msg  1.12.11devel
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 */
msg_separator_s::sep_data
char sep_data[4]
NUL-terminated separator.
Definition: msg_types.h:210
msg_unknown_s::un_next
msg_unknown_t * un_next
Link to next unknown header.
Definition: msg_types.h:193
msg_kind_single
@ msg_kind_single
Only one header is allowed.
Definition: msg_types.h:251
msg_hclass_s::hc_name
const char * hc_name
Full name.
Definition: msg_types.h:287
msg_auth_info_s
Authentication-Info header.
Definition: msg_types.h:183
msg_auth_s::au_next
msg_auth_t * au_next
Link to next header.
Definition: msg_types.h:174
msg_common_s::h_len
usize_t h_len
Fragment length (including CRLF)
Definition: msg_types.h:116
msg_auth_s::au_common
msg_common_t au_common[1]
Common fragment info.
Definition: msg_types.h:173
msg_auth_info_s::ai_next
msg_error_t * ai_next
Dummy link to next.
Definition: msg_types.h:186
msg_hclass_s::hc_dxtra
msg_xtra_f * hc_dxtra
Calculate extra size for dup.
Definition: msg_types.h:284
msg_list_s::k_next
msg_list_t * k_next
Link to next header.
Definition: msg_types.h:163
msg_unknown_s::un_value
const char * un_value
Header field value.
Definition: msg_types.h:195
msg_common_s::h_prev
msg_header_t ** h_prev
Pointer to preceeding fragment.
Definition: msg_types.h:113
msg_auth_s
Authentication header.
Definition: msg_types.h:172
msg_pub_t
MSG_PUB_T msg_pub_t
Public protocol-specific message structure for accessing the message.
Definition: msg_types.h:81
msg_payload_s
Message payload.
Definition: msg_types.h:214
msg_hclass_s::hc_parse
msg_parse_f * hc_parse
Parse header.
Definition: msg_types.h:282
su_types.h
msg_header_u
Any header.
Definition: msg_types.h:222
msg_list_s::k_items
msg_param_t * k_items
List of items.
Definition: msg_types.h:164
msg_hclass_s::hc_print
msg_print_f * hc_print
Print header.
Definition: msg_types.h:283
msg_header_u::sh_common
msg_common_t sh_common[1]
Common fragment info.
Definition: msg_types.h:223
msg_kind_append
@ msg_kind_append
New header is appended.
Definition: msg_types.h:252
msg_numeric_s::x_value
unsigned long x_value
Numeric header value.
Definition: msg_types.h:143
msg_list_s
List header.
Definition: msg_types.h:161
msg_hclass_s::hc_update
msg_update_f * hc_update
Update parameter(s)
Definition: msg_types.h:286
msg_hclass_s::hc_params
unsigned char hc_params
Offset of parameter list.
Definition: msg_types.h:291
msg_auth_info_s::ai_params
const msg_param_t * ai_params
List of ainfo.
Definition: msg_types.h:187
msg_generic_s
Generic header.
Definition: msg_types.h:151
msg_payload_s::pl_data
char * pl_data
Data - may contain NUL.
Definition: msg_types.h:217
msg_kind_list
@ msg_kind_list
A token list header, new header is combined with old one.
Definition: msg_types.h:253
msg_numeric_s
Numeric header.
Definition: msg_types.h:140
msg_auth_s::au_params
const msg_param_t * au_params
Comma-separated parameters.
Definition: msg_types.h:176
msg_numeric_s::x_common
msg_common_t x_common[1]
Common fragment info.
Definition: msg_types.h:141
msg_hclass_s::hc_hash
int hc_hash
Header name hash or ID.
Definition: msg_types.h:281
msg_payload_s::pl_common
msg_common_t pl_common[1]
Common fragment info.
Definition: msg_types.h:215
msg_common_s::h_data
const void * h_data
Fragment data.
Definition: msg_types.h:115
msg_kind_prepend
@ msg_kind_prepend
New header is prepended.
Definition: msg_types.h:256
msg_separator_s
Separator.
Definition: msg_types.h:207
msg_separator_s::sep_common
msg_common_t sep_common[1]
Common fragment info.
Definition: msg_types.h:208
msg_href_s
Header reference.
Definition: msg_mclass.h:62
msg_hclass_s::hc_short
char hc_short[2]
Short name, if any.
Definition: msg_types.h:289
msg_hclass_s
Factory object for a header.
Definition: msg_types.h:278
msg_separator_s::sep_next
msg_error_t * sep_next
Dummy link to next header.
Definition: msg_types.h:209
msg_mclass_s
Factory object for protocol messages.
Definition: msg_mclass.h:96
msg_auth_s::au_scheme
const char * au_scheme
Auth-scheme like Basic or Digest.
Definition: msg_types.h:175
msg_payload_s::pl_len
usize_t pl_len
Length of message payload.
Definition: msg_types.h:218
msg_generic_s::g_common
msg_common_t g_common[1]
Common fragment info.
Definition: msg_types.h:152
msg_time_t
unsigned long msg_time_t
Time in seconds since epoch (1900-Jan-01 00:00:00).
Definition: msg_types.h:59
msg_kind_apndlist
@ msg_kind_apndlist
A complex list header.
Definition: msg_types.h:255
msg_hclass_s::hc_dup_one
msg_dup_f * hc_dup_one
Duplicate one header.
Definition: msg_types.h:285
msg_auth_info_s::ai_common
msg_common_t ai_common[1]
Common fragment info.
Definition: msg_types.h:185
msg_header_t
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition: msg_types.h:87
msg_s
Message object.
Definition: msg_internal.h:59
msg_pub_s
Message object, common view.
Definition: msg_types.h:121
msg_payload_s::pl_next
msg_payload_t * pl_next
Next payload chunk.
Definition: msg_types.h:216
msg_generic_s::g_next
msg_generic_t * g_next
Link to next header.
Definition: msg_types.h:153
msg_hclass_t
struct msg_hclass_s const msg_hclass_t
Header class.
Definition: msg_types.h:48
msg_numeric_s::x_next
msg_numeric_t * x_next
Link to next header.
Definition: msg_types.h:142
msg_hclass_s::hc_kind
unsigned hc_kind
Kind of header (msg_header_kind_t): single, append, list, apndlist, prepend.
Definition: msg_types.h:292
msg_list_s::k_common
msg_common_t k_common[1]
Common fragment info.
Definition: msg_types.h:162
msg_error_s::er_next
msg_error_t * er_next
Link to next header.
Definition: msg_types.h:201
msg_hclass_s::hc_size
unsigned char hc_size
Size of header structure.
Definition: msg_types.h:290
msg_error_s::er_common
msg_common_t er_common[1]
Common fragment info.
Definition: msg_types.h:200
msg_unknown_s::un_common
msg_common_t un_common[1]
Common fragment info.
Definition: msg_types.h:192
msg_error_s::er_name
const char * er_name
Name of bad header (if any).
Definition: msg_types.h:202
msg_unknown_s::un_name
const char * un_name
Header name.
Definition: msg_types.h:194
msg_common_s::h_succ
msg_header_t * h_succ
Pointer to succeeding fragment.
Definition: msg_types.h:112
msg_generic_s::g_string
const char * g_string
Header value.
Definition: msg_types.h:154
msg_header_kind_t
msg_header_kind_t
Define how to handle existing headers when a new header is added to a message.
Definition: msg_types.h:250
su_home_s
msg_hclass_s::hc_critical
unsigned hc_critical
True if header is critical.
Definition: msg_types.h:294
msg_hclass_s::hc_len
short hc_len
Length of hc_name.
Definition: msg_types.h:288
msg_pub_s::msg_common
msg_common_t msg_common[1]
Recursive.
Definition: msg_types.h:122
msg_common_s::h_class
msg_hclass_t * h_class
Header class.
Definition: msg_types.h:114
msg_common_s
Common part of the header objects (or message fragments).
Definition: msg_types.h:111
msg_unknown_s
Unknown header.
Definition: msg_types.h:191
msg_error_s
Erroneus header.
Definition: msg_types.h:199

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