msg  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msg_types.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_TYPES_H
26 
27 #define MSG_TYPES_H
28 
38 #ifndef SU_TYPES_H
39 #include <sofia-sip/su_types.h>
40 #endif
41 
42 SOFIA_BEGIN_DECLS
43 
45 typedef struct msg_mclass_s msg_mclass_t;
46 
48 typedef struct msg_hclass_s const msg_hclass_t;
49 
51 typedef struct msg_href_s msg_href_t;
52 
54 typedef struct msg_s msg_t;
55 
56 #ifndef MSG_TIME_T_DEFINED
57 #define MSG_TIME_T_DEFINED
58 
59 typedef unsigned long msg_time_t;
60 #endif
61 
62 #ifndef MSG_TIME_MAX
63 
64 #define MSG_TIME_MAX ((msg_time_t)ULONG_MAX)
65 #endif
66 
67 #ifndef MSG_PUB_T
68 #ifdef MSG_OBJ_T
69 #define MSG_PUB_T MSG_OBJ_T
70 #else
71 #define MSG_PUB_T struct msg_pub_s
72 #endif
73 #endif
74 
81 typedef MSG_PUB_T msg_pub_t;
82 
83 #ifndef MSG_HDR_T
84 #define MSG_HDR_T union msg_header_u
85 #endif
86 
87 typedef MSG_HDR_T msg_header_t;
88 
89 typedef struct msg_common_s msg_common_t;
90 
94 typedef struct msg_error_s msg_error_t;
95 
96 typedef msg_common_t msg_frg_t;
97 
98 typedef char const *msg_param_t;
99 typedef struct msg_numeric_s msg_numeric_t;
100 typedef struct msg_generic_s msg_generic_t;
101 typedef struct msg_list_s msg_list_t;
102 typedef struct msg_auth_s msg_auth_t;
103 typedef struct msg_auth_info_s msg_auth_info_t;
104 
105 #define MSG_HEADER_N 16377
106 
111 struct msg_common_s {
115  void const *h_data;
116  usize_t h_len;
117 };
118 
119 
121 struct msg_pub_s {
123  msg_pub_t *msg_next;
124  void *msg_user;
125  unsigned msg_size;
126  unsigned msg_flags;
127  msg_error_t *msg_error;
128  msg_header_t *msg_request;
129  msg_header_t *msg_status;
130  msg_header_t *msg_headers[MSG_HEADER_N];
131 };
132 
133 #define msg_ident msg_common->h_class
134 
143  unsigned long x_value;
144 };
145 
154  char const *g_string;
155 };
156 
161 struct msg_list_s {
164  msg_param_t *k_items;
165 };
166 
172 struct msg_auth_s {
175  char const *au_scheme;
176  msg_param_t const *au_params;
177 };
178 
184 {
187  msg_param_t const *ai_params;
188 };
189 
194  char const *un_name;
195  char const *un_value;
196 };
197 
199 struct msg_error_s {
202  char const *er_name;
203 };
204 
205 
210  char sep_data[4];
211 };
212 
217  char *pl_data;
218  usize_t pl_len;
219 };
220 
224  struct {
225  msg_common_t shn_common;
226  msg_header_t *shn_next;
227  } sh_header_next[1];
228 #define sh_next sh_header_next->shn_next
229 #define sh_class sh_common->h_class
230 #define sh_succ sh_common->h_succ
231 #define sh_prev sh_common->h_prev
232 #define sh_data sh_common->h_data
233 #define sh_len sh_common->h_len
234 
235  msg_generic_t sh_generic[1];
236  msg_numeric_t sh_numeric[1];
237  msg_list_t sh_list[1];
238  msg_auth_t sh_auth[1];
239  msg_separator_t sh_separator[1];
240  msg_payload_t sh_payload[1];
241  msg_unknown_t sh_unknown[1];
242  msg_error_t sh_error[1];
243 };
244 
245 /* ====================================================================== */
246 
250 typedef enum {
258 
259 struct su_home_s;
260 
261 typedef issize_t msg_parse_f(struct su_home_s *, msg_header_t *, char *, isize_t);
262 typedef issize_t msg_print_f(char buf[], isize_t bufsiz,
263  msg_header_t const *, int flags);
264 typedef char *msg_dup_f(msg_header_t *dst, msg_header_t const *src,
265  char *buf, isize_t bufsiz);
266 typedef isize_t msg_xtra_f(msg_header_t const *h, isize_t offset);
267 
268 typedef int msg_update_f(msg_common_t *, char const *name, isize_t namelen,
269  char const *value);
270 
279 {
280  /* XXX size of header class missing. Someone has saved bits in wrong place. */
281  int hc_hash;
282  msg_parse_f *hc_parse;
283  msg_print_f *hc_print;
284  msg_xtra_f *hc_dxtra;
285  msg_dup_f *hc_dup_one;
286  msg_update_f *hc_update;
287  char const *hc_name;
288  short hc_len;
289  char hc_short[2];
290  unsigned char hc_size;
291  unsigned char hc_params;
292  unsigned hc_kind:3;
294  unsigned hc_critical:1;
295  unsigned /*pad*/:0;
296 };
297 
298 #define HC_LEN_MAX SHRT_MAX
299 
300 SOFIA_END_DECLS
301 
302 #endif /* !defined MSG_TYPES_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.