msg  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msg.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef MSG_H
26 
27 #define MSG_H
28 
37 #include <sofia-sip/msg_types.h>
38 #include <sofia-sip/su_alloc.h>
39 
40 SOFIA_BEGIN_DECLS
41 
42 SOFIAPUBFUN msg_t *msg_create(msg_mclass_t const *mc, int flags);
43 
46 
48 
50 SOFIAPUBFUN msg_t *msg_dup(msg_t const *);
51 
52 SOFIAPUBFUN msg_t *msg_make(msg_mclass_t const *mc, int flags,
53  void const *data, ssize_t len);
55  msg_t *msg, msg_pub_t *pub, int flags,
56  size_t *return_len);
57 
58 SOFIAPUBFUN void msg_set_parent(msg_t *kid, msg_t *dad);
59 
62 
63 SOFIAPUBFUN msg_pub_t *msg_public(msg_t const *msg, void *tag);
65 SOFIAPUBFUN msg_mclass_t const *msg_mclass(msg_t const *msg);
66 
67 SOFIAPUBFUN int msg_extract(msg_t *msg);
68 SOFIAPUBFUN unsigned msg_extract_errors(msg_t const *msg);
69 SOFIAPUBFUN int msg_is_complete(msg_t const *msg);
70 SOFIAPUBFUN int msg_has_error(msg_t const *msg);
72 
74 SOFIAPUBFUN int msg_prepare(msg_t *msg);
76 SOFIAPUBFUN int msg_is_prepared(msg_t const *msg);
77 
78 SOFIAPUBFUN usize_t msg_size(msg_t const *msg);
79 SOFIAPUBFUN usize_t msg_maxsize(msg_t *msg, usize_t maxsize);
80 
82 #define msg_home(h) ((su_home_t*)(h))
83 
90 };
91 
92 SOFIAPUBFUN int msg_is_streaming(msg_t const *msg);
94 
95 SOFIAPUBFUN unsigned msg_mark_as_complete(msg_t *msg, unsigned mask);
96 
97 SOFIAPUBFUN unsigned msg_get_flags(msg_t const *msg, unsigned mask);
98 SOFIAPUBFUN unsigned msg_set_flags(msg_t *msg, unsigned mask);
99 SOFIAPUBFUN unsigned msg_zap_flags(msg_t *msg, unsigned mask);
100 
104  MSG_FLG_COMPACT = (1<<0),
106  MSG_FLG_CANONIC = (1<<1),
111 
115  MSG_FLG_MAILBOX = (1<<4),
116 
119 
123 
125  MSG_FLG_THRDSAFE = (1<<15),
126 
127  MSG_FLG_USERMASK = (1<<16) - 1
128 };
129 
133  MSG_FLG_HEADERS = (1<<16),
135  MSG_FLG_BODY = (1<<17),
137  MSG_FLG_CHUNKS = (1<<18),
139  MSG_FLG_TRAILERS = (1<<19),
141  MSG_FLG_FRAGS = (1<<20),
143  MSG_FLG_COMPLETE = (1<<24),
144 
146  MSG_FLG_ERROR = (1<<25),
148  MSG_FLG_TOOLARGE = (1<<26),
150  MSG_FLG_TRUNC = (1<<27),
152  MSG_FLG_TIMEOUT = (1<<28),
153 
154  MSG_FLG_PARSERMASK = ((-1) ^ ((1<<16) - 1))
155 };
156 
157 #define MSG_DO_COMPACT MSG_FLG_COMPACT
158 #define MSG_DO_CANONIC MSG_FLG_CANONIC
159 #define MSG_DO_EXTRACT_COPY MSG_FLG_EXTRACT_COPY
160 
162 #define MSG_FLAGS(f, v) (((f) & (v)) == v)
163 
164 #define MSG_IS_COMPACT(f) MSG_FLAGS((f), MSG_FLG_COMPACT)
165 #define MSG_IS_CANONIC(f) MSG_FLAGS((f), MSG_FLG_CANONIC)
166 #define MSG_IS_EXTRACT_COPY(f) MSG_FLAGS((f), MSG_FLG_EXTRACT_COPY)
167 #define MSG_IS_COMMA_LISTS(f) MSG_FLAGS((f), MSG_FLG_COMMA_LISTS)
168 #define MSG_IS_MAILBOX(f) MSG_FLAGS((f), MSG_FLG_MAILBOX)
169 
170 #define MSG_HAS_COMPLETE(f) MSG_FLAGS((f), MSG_FLG_COMPLETE)
171 #define MSG_HAS_ERROR(f) MSG_FLAGS((f), MSG_FLG_ERROR)
172 
173 #define MSG_IS_COMPLETE(mo) (((mo)->msg_flags & MSG_FLG_COMPLETE) != 0)
174 
175 SOFIA_END_DECLS
176 
177 #endif /* MSG_H */

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