msg 1.12.11devel
/tmp/buildd/sofia-sip-1.12.11+20110422/libsofia-sip-ua/msg/sofia-sip/msg.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef MSG_H
00026 
00027 #define MSG_H
00028 
00037 #include <sofia-sip/msg_types.h>
00038 #include <sofia-sip/su_alloc.h>
00039 
00040 SOFIA_BEGIN_DECLS
00041 
00042 SOFIAPUBFUN msg_t *msg_create(msg_mclass_t const *mc, int flags);
00043 
00044 SOFIAPUBFUN msg_t *msg_ref(msg_t *);
00045 SOFIAPUBFUN void msg_unref(msg_t *);
00046 
00047 SOFIAPUBFUN void msg_destroy(msg_t *);
00048 
00049 SOFIAPUBFUN msg_t *msg_copy(msg_t *);
00050 SOFIAPUBFUN msg_t *msg_dup(msg_t const *);
00051 
00052 SOFIAPUBFUN msg_t *msg_make(msg_mclass_t const *mc, int flags,
00053                             void const *data, ssize_t len);
00054 SOFIAPUBFUN char *msg_as_string(su_home_t *home,
00055                                 msg_t *msg, msg_pub_t *pub, int flags,
00056                                 size_t *return_len);
00057 
00058 SOFIAPUBFUN void msg_set_parent(msg_t *kid, msg_t *dad);
00059 
00060 SOFIAPUBFUN msg_t *msg_ref_create(msg_t *);
00061 SOFIAPUBFUN void msg_ref_destroy(msg_t *);
00062 
00063 SOFIAPUBFUN msg_pub_t *msg_public(msg_t const *msg, void *tag);
00064 SOFIAPUBFUN msg_pub_t *msg_object(msg_t const *msg);
00065 SOFIAPUBFUN msg_mclass_t const *msg_mclass(msg_t const *msg);
00066 
00067 SOFIAPUBFUN int msg_extract(msg_t *msg);
00068 SOFIAPUBFUN unsigned msg_extract_errors(msg_t const *msg);
00069 SOFIAPUBFUN int msg_is_complete(msg_t const *msg);
00070 SOFIAPUBFUN int msg_has_error(msg_t const *msg);
00071 SOFIAPUBFUN msg_header_t **msg_chain_head(msg_t const *msg);
00072 
00073 SOFIAPUBFUN int msg_serialize(msg_t *msg, msg_pub_t *mo);
00074 SOFIAPUBFUN int msg_prepare(msg_t *msg);
00075 SOFIAPUBFUN void msg_unprepare(msg_t *msg);
00076 SOFIAPUBFUN int msg_is_prepared(msg_t const *msg);
00077 
00078 SOFIAPUBFUN usize_t msg_size(msg_t const *msg);
00079 SOFIAPUBFUN usize_t msg_maxsize(msg_t *msg, usize_t maxsize);
00080 
00082 #define msg_home(h) ((su_home_t*)(h))
00083 
00085 enum msg_streaming_status {
00087   msg_stop_streaming = 0,
00089   msg_start_streaming = 1
00090 };
00091 
00092 SOFIAPUBFUN int msg_is_streaming(msg_t const *msg);
00093 SOFIAPUBFUN void msg_set_streaming(msg_t *msg, enum msg_streaming_status what);
00094 
00095 SOFIAPUBFUN unsigned msg_mark_as_complete(msg_t *msg, unsigned mask);
00096 
00097 SOFIAPUBFUN unsigned msg_get_flags(msg_t const *msg, unsigned mask);
00098 SOFIAPUBFUN unsigned msg_set_flags(msg_t *msg, unsigned mask);
00099 SOFIAPUBFUN unsigned msg_zap_flags(msg_t *msg, unsigned mask);
00100 
00102 enum msg_flg_user {
00104   MSG_FLG_COMPACT = (1<<0),
00106   MSG_FLG_CANONIC = (1<<1),
00108   MSG_FLG_EXTRACT_COPY = (1<<2),
00110   MSG_FLG_COMMA_LISTS = (1<<3),
00111 
00115   MSG_FLG_MAILBOX = (1<<4),
00116 
00118   MSG_FLG_CHUNKING = (1<<5),
00119 
00122   MSG_FLG_STREAMING = (1<<6),
00123 
00125   MSG_FLG_THRDSAFE = (1<<15),
00126 
00127   MSG_FLG_USERMASK = (1<<16) - 1
00128 };
00129 
00131 enum  msg_flg_parser {
00133   MSG_FLG_HEADERS = (1<<16),
00135   MSG_FLG_BODY = (1<<17),
00137   MSG_FLG_CHUNKS = (1<<18),
00139   MSG_FLG_TRAILERS = (1<<19),
00141   MSG_FLG_FRAGS = (1<<20),
00143   MSG_FLG_COMPLETE = (1<<24),
00144 
00146   MSG_FLG_ERROR = (1<<25),
00148   MSG_FLG_TOOLARGE = (1<<26),
00150   MSG_FLG_TRUNC = (1<<27),
00152   MSG_FLG_TIMEOUT = (1<<28),
00153 
00154   MSG_FLG_PARSERMASK = ((-1) ^ ((1<<16) - 1))
00155 };
00156 
00157 #define MSG_DO_COMPACT      MSG_FLG_COMPACT
00158 #define MSG_DO_CANONIC      MSG_FLG_CANONIC
00159 #define MSG_DO_EXTRACT_COPY MSG_FLG_EXTRACT_COPY
00160 
00162 #define MSG_FLAGS(f, v) (((f) & (v)) == v)
00163 
00164 #define MSG_IS_COMPACT(f)      MSG_FLAGS((f), MSG_FLG_COMPACT)
00165 #define MSG_IS_CANONIC(f)      MSG_FLAGS((f), MSG_FLG_CANONIC)
00166 #define MSG_IS_EXTRACT_COPY(f) MSG_FLAGS((f), MSG_FLG_EXTRACT_COPY)
00167 #define MSG_IS_COMMA_LISTS(f)  MSG_FLAGS((f), MSG_FLG_COMMA_LISTS)
00168 #define MSG_IS_MAILBOX(f)      MSG_FLAGS((f), MSG_FLG_MAILBOX)
00169 
00170 #define MSG_HAS_COMPLETE(f)    MSG_FLAGS((f), MSG_FLG_COMPLETE)
00171 #define MSG_HAS_ERROR(f)       MSG_FLAGS((f), MSG_FLG_ERROR)
00172 
00173 #define MSG_IS_COMPLETE(mo) (((mo)->msg_flags & MSG_FLG_COMPLETE) != 0)
00174 
00175 SOFIA_END_DECLS
00176 
00177 #endif /* MSG_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.