File: smsgtypes.h

package info (click to toggle)
libosip 0.9.7-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,852 kB
  • ctags: 1,812
  • sloc: ansic: 20,266; sh: 9,218; makefile: 215
file content (414 lines) | stat: -rw-r--r-- 8,929 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
/*
  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
  Copyright (C) 2001,2002,2003  Aymeric MOIZARD jack@atosc.org
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _SMSGTYPES_H_
#define _SMSGTYPES_H_

#include <osip/list.h>
#include <osip/urls.h>


/**
 * @file smsgtypes.h
 * @brief oSIP type definitions
 */

/**
 * @defgroup oSIP_TYPES oSIP type definitions
 * @ingroup oSIP
 * @{
 */


#ifdef __cplusplus
extern "C"
{
#endif

#ifndef SIP_MESSAGE_MAX_LENGTH
/**
 * You can re-define your own maximum length for SIP message.
 * <BR>The default value is 20000 characters. (which is much more that the MTU!)
 * <BR>BUG: If you try to build a message string (by calling msg_2char), with
 * a higher length, your application will crash. Anybody building a commercial
 * application should fix that behavior (and hopefully send the code back to me!)
 */
#define SIP_MESSAGE_MAX_LENGTH 4000
#endif

#ifndef BODY_MESSAGE_MAX_SIZE
/**
 * You can define the maximum authorised length for a body inside a SIP message.
 */
#define BODY_MESSAGE_MAX_SIZE  500
#endif

/**
 * Structure for startline (1st line of SIP message either REQUEST and RESPONSE).
 * @defvar startline_t
 */
  typedef struct startline_t startline_t;

  struct startline_t
  {
    /* msgevttype_t method; */
    char *sipmethod;
    char *sipversion;

    /* req */
    url_t *rquri;

    /* resp */
    char *statuscode;
    char *reasonphrase;

  };

/**
 * Structure for 'unknown' headers.
 * NOTE: 'unknown' header' are used in oSIP for all header that are not
 * defined by oSIP in the sip_t structure. This means that all 'unknown'
 * header has to be handled with the API related to this structure.
 * @defvar startline_t
 */
  typedef struct header_t header_t;

  struct header_t
  {
    char *hname;
    char *hvalue;
  };

/**
 * Structure for CSeq headers.
 * @defvar cseq_t
 */
  typedef struct cseq_t cseq_t;

  struct cseq_t
  {
    char *method;
    char *number;
  };

/**
 * Structure for Via headers.
 * @defvar via_t
 */
  typedef struct via_t via_t;

  struct via_t
  {
    char *version;
    char *protocol;
    char *host;
    char *port;
    char *comment;
    list_t *via_params;
  };

/**
 * Structure for generic parameter headers.
 * Generic parameter are used in a lot of headers. (To, From, Route,
 * Record-Route...) All those headers use a common API but this is
 * hidden by MACROs that you can be found in smsg.h.
 * @defvar cseq_t
 */
  typedef url_param_t generic_param_t;

/**
 * Structure for From headers.
 * @defvar from_t
 */
  typedef struct from_t from_t;

  struct from_t
  {
    char *displayname;
    url_t *url;			/* could contain various urischeme_t ? only in the future */
    list_t *gen_params;
  };

/**
 * Structure for To headers.
 * @defvar to_t
 */
  typedef from_t to_t;
/**
 * Structure for Contact headers.
 * @defvar contact_t
 */
  typedef from_t contact_t;
/**
 * Structure for Record-Route headers.
 * @defvar record_route_t
 */
  typedef from_t record_route_t;
/**
 * Structure for Route headers.
 * @defvar route_t
 */
  typedef from_t route_t;

/**
 * Structure for Call-Id headers.
 * @defvar call_id_t
 */
  typedef struct call_id_t call_id_t;

  struct call_id_t
  {
    char *number;
    char *host;
  };

/**
 * Structure for Content-Length headers.
 * @defvar content_length_t
 */
  typedef struct content_length_t content_length_t;

  struct content_length_t
  {
    char *value;
  };

/**
 * Structure for Language-Tag headers. - NOT IMPLEMENTED -
 * @defvar language_tag_t
 */
  typedef struct language_tag_t language_tag_t;

  struct language_tag_t
  {
    list_t *tags;
  };

/**
 * Structure for Allow headers.
 * @defvar allow_t
 */
  typedef content_length_t allow_t;
/**
 * Structure for Content-Encoding headers.
 * @defvar content_encoding_t
 */
  typedef content_length_t content_encoding_t;
/**
 * Structure for Mime-Version headers.
 * @defvar mime_version_t
 */
  typedef content_length_t mime_version_t;

/* typedef url_param_t content_type_param_t; */

/**
 * Structure for Content-Type headers.
 * @defvar content_type_t
 */
  typedef struct content_type_t content_type_t;

  struct content_type_t
  {
    char *type;
    char *subtype;
    list_t *gen_params;
  };

/**
 * Structure for accept headers.
 * @defvar accept_t
 */
  typedef content_type_t accept_t;

/**
 * Structure for Accept-Encoding headers.
 * @defvar accept_encoding_t
 */
  typedef struct accept_encoding_t accept_encoding_t;

  struct accept_encoding_t
  {
    char *element;
    list_t *gen_params;
  };

/**
 * Structure for Accept-Language headers.
 * @defvar accept_language_t
 */
  typedef accept_encoding_t accept_language_t;

/**
 * Structure for Call-Info headers.
 * @defvar call_info_t
 */
  typedef struct call_info_t call_info_t;

  struct call_info_t
  {
    char *element;
    list_t *gen_params;
  };

/**
 * Structure for Alert-Info headers.
 * @defvar alert_info_t
 */
  typedef call_info_t alert_info_t;
/**
 * Structure for Error-Info headers.
 * @defvar error_info_t
 */
  typedef call_info_t error_info_t;

/**
 * Structure for Content-Disposition headers.
 * @defvar content_disposition_t
 */
  typedef call_info_t content_disposition_t;
/**
 * Structure for encryption headers. - NOT IMPLEMENTED -
 * @defvar encryption_t
 */
  typedef call_info_t encryption_t;

/**
 * Structure for WWW-Authenticate headers.
 * @defvar www_authenticate_t
 */
  typedef struct www_authenticate_t www_authenticate_t;

  struct www_authenticate_t
  {
    char *auth_type;		/* ( "Basic" | "Digest" )      */
    char *realm;		/* mandatory ( quoted-string ) */
    char *domain;		/* optional  <"> 1#URI <">     */
    char *nonce;		/* mandatory */
    char *opaque;		/* optional  */
    char *stale;		/* optional  ( "true" | "false" ) */
    char *algorithm;		/* optional  ( "MD5"  | token   ) */
    char *qop_options;		/* optional  */
    char *auth_param;		/* optional  */
  };

/**
 * Structure for Proxy-Authenticate headers.
 * @defvar proxy_authenticate_t
 */
  typedef www_authenticate_t proxy_authenticate_t;

/**
 * Structure for Authorization headers.
 * @defvar authorization_t
 */
  typedef struct authorization_t authorization_t;

  struct authorization_t
  {
    char *auth_type;		/* ( "Basic" | "Digest" )      */
    char *username;
    char *realm;		/* mandatory ( quoted-string ) */
    char *nonce;
    char *uri;
    char *response;
    char *digest;		/* DO NOT USE IT IN AUTHORIZATION_T HEADER?? */
    char *algorithm;		/* optionnal, default is "md5" */
    char *cnonce;		/* optionnal */
    char *opaque;		/* optionnal */
    char *message_qop;		/* optionnal */
    char *nonce_count;		/* optionnal */
    char *auth_param;		/* optionnal */
  };

/**
 * Structure for Proxy-Authorization headers.
 * @defvar proxy_authorization_t
 */
  typedef authorization_t proxy_authorization_t;

/**
 * Structure for Body - LIGHT SUPPORT FOR MIME FORMAT: TO BE TESTED-.
 * @defvar body_t
 */
  typedef struct body_t body_t;

  struct body_t
  {
    char *body;
    list_t *headers;
    content_type_t *content_type;
    /*  content_length_t   *content_length; */
  };

/**
 * Structure for SIP Message (REQUEST and RESPONSE).
 * @defvar sip_t
 */
  typedef struct sip_t sip_t;

  struct sip_t
  {
    startline_t *strtline;

    list_t *accepts;
    list_t *accept_encodings;
    list_t *accept_languages;
    list_t *alert_infos;
    list_t *allows;
    list_t *authorizations;
    call_id_t *call_id;
    list_t *call_infos;
    list_t *contacts;
    list_t *content_dispositions;
    list_t *content_encodings;
    content_length_t *contentlength;
    content_type_t *content_type;
    cseq_t *cseq;
    list_t *error_infos;
    from_t *from;
    mime_version_t *mime_version;
    list_t *proxy_authenticates;
    list_t *proxy_authorizations;
    list_t *record_routes;
    list_t *routes;
    to_t *to;
    list_t *vias;
    list_t *www_authenticates;

    list_t *headers;

    list_t *bodies;

    /*
       1: structure and buffer "message" are identical.
       2: buffer "message" is not up to date with the structure info (call msg_2char to update it).
     */
    int message_property;
    char *message;
  };


#ifdef __cplusplus
}
#endif

/** @} */

#endif