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 
00039 SOFIA_BEGIN_DECLS
00040 
00041 SOFIAPUBFUN msg_t *msg_create(msg_mclass_t const *mc, int flags);
00042 SOFIAPUBFUN void msg_destroy(msg_t *);
00043 
00044 SOFIAPUBFUN msg_t *msg_copy(msg_t *);
00045 SOFIAPUBFUN msg_t *msg_dup(msg_t const *);
00046 
00047 SOFIAPUBFUN void msg_set_parent(msg_t *kid, msg_t *dad);
00048 
00049 SOFIAPUBFUN msg_t *msg_ref_create(msg_t *);
00050 SOFIAPUBFUN void msg_ref_destroy(msg_t *);
00051      
00052 SOFIAPUBFUN msg_pub_t *msg_public(msg_t const *msg, void *tag);
00053 SOFIAPUBFUN msg_pub_t *msg_object(msg_t const *msg);
00054 SOFIAPUBFUN msg_mclass_t const *msg_mclass(msg_t const *msg);
00055 
00056 SOFIAPUBFUN int msg_extract(msg_t *msg);
00057 SOFIAPUBFUN unsigned msg_extract_errors(msg_t const *msg);
00058 SOFIAPUBFUN int msg_is_complete(msg_t const *msg);
00059 SOFIAPUBFUN int msg_has_error(msg_t const *msg);
00060 SOFIAPUBFUN msg_header_t **msg_chain_head(msg_t const *msg);
00061 
00062 SOFIAPUBFUN int msg_serialize(msg_t *msg, msg_pub_t *mo);
00063 SOFIAPUBFUN int msg_prepare(msg_t *msg);
00064 SOFIAPUBFUN void msg_unprepare(msg_t *msg);
00065 SOFIAPUBFUN int msg_is_prepared(msg_t const *msg);
00066 
00067 SOFIAPUBFUN unsigned msg_size(msg_t const *msg);
00068 SOFIAPUBFUN unsigned msg_maxsize(msg_t *msg, unsigned maxsize);
00069 
00070 #define msg_home(h) ((su_home_t*)(h))
00071 
00072 enum msg_streaming_status {
00074   msg_stop_streaming = 0,
00076   msg_start_streaming = 1
00077 };
00078 
00079 SOFIAPUBFUN int msg_is_streaming(msg_t const *msg);
00080 SOFIAPUBFUN void msg_set_streaming(msg_t *msg, enum msg_streaming_status what);
00081 
00082 SOFIAPUBFUN unsigned msg_mark_as_complete(msg_t *msg, unsigned mask);
00083 
00084 SOFIAPUBFUN unsigned msg_get_flags(msg_t const *msg, unsigned mask);
00085 SOFIAPUBFUN unsigned msg_set_flags(msg_t *msg, unsigned mask);
00086 SOFIAPUBFUN unsigned msg_zap_flags(msg_t *msg, unsigned mask);
00087 
00089 enum msg_flg_user {
00091   MSG_FLG_COMPACT = (1<<0),
00093   MSG_FLG_CANONIC = (1<<1),
00095   MSG_FLG_EXTRACT_COPY = (1<<2),
00097   MSG_FLG_COMMA_LISTS = (1<<3), 
00098 
00102   MSG_FLG_MAILBOX = (1<<4),
00103 
00105   MSG_FLG_CHUNKING = (1<<5),
00106 
00109   MSG_FLG_STREAMING = (1<<6),
00110 
00112   MSG_FLG_THRDSAFE = (1<<15),
00113 
00114   MSG_FLG_USERMASK = (1<<16) - 1
00115 };
00116 
00118 enum  msg_flg_parser {
00120   MSG_FLG_HEADERS = (1<<16),
00122   MSG_FLG_BODY = (1<<17),
00124   MSG_FLG_CHUNKS = (1<<18),
00126   MSG_FLG_TRAILERS = (1<<19),
00128   MSG_FLG_FRAGS = (1<<20),
00130   MSG_FLG_COMPLETE = (1<<24),
00131 
00133   MSG_FLG_ERROR = (1<<25),
00135   MSG_FLG_TOOLARGE = (1<<26),
00137   MSG_FLG_TRUNC = (1<<27),
00139   MSG_FLG_TIMEOUT = (1<<28),
00140 
00141   MSG_FLG_PARSERMASK = ((-1) ^ ((1<<16) - 1))
00142 };
00143 
00144 #define MSG_DO_COMPACT      MSG_FLG_COMPACT
00145 #define MSG_DO_CANONIC      MSG_FLG_CANONIC
00146 #define MSG_DO_EXTRACT_COPY MSG_FLG_EXTRACT_COPY
00147 
00149 #define MSG_FLAGS(f, v) (((f) & (v)) == v)
00150 
00151 #define MSG_IS_COMPACT(f)      MSG_FLAGS((f), MSG_FLG_COMPACT)
00152 #define MSG_IS_CANONIC(f)      MSG_FLAGS((f), MSG_FLG_CANONIC)
00153 #define MSG_IS_EXTRACT_COPY(f) MSG_FLAGS((f), MSG_FLG_EXTRACT_COPY)
00154 #define MSG_IS_COMMA_LISTS(f)  MSG_FLAGS((f), MSG_FLG_COMMA_LISTS)
00155 #define MSG_IS_MAILBOX(f)      MSG_FLAGS((f), MSG_FLG_MAILBOX)
00156 
00157 #define MSG_HAS_COMPLETE(f)    MSG_FLAGS((f), MSG_FLG_COMPLETE)
00158 #define MSG_HAS_ERROR(f)       MSG_FLAGS((f), MSG_FLG_ERROR)
00159 
00160 #define MSG_IS_COMPLETE(mo) (((mo)->msg_flags & MSG_FLG_COMPLETE) != 0)
00161 
00162 SOFIA_END_DECLS
00163 
00164 #endif /* MSG_H */

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