1 /* $Id$ */
2 /*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 #ifndef __PJSIP_SIP_MSG_H__
21 #define __PJSIP_SIP_MSG_H__
22
23 /**
24 * @file pjsip/sip_msg.h
25 * @brief SIP Message Structure.
26 */
27
28 #include <pjsip/sip_types.h>
29 #include <pjsip/sip_uri.h>
30 #include <pj/list.h>
31
32 PJ_BEGIN_DECL
33
34 /**
35 * @defgroup PJSIP_MSG Messaging Elements
36 * @ingroup PJSIP_CORE
37 * @brief Various SIP message elements such as methods, headers, URIs, etc.
38 * @{
39 */
40
41 /* **************************************************************************/
42 /**
43 * @defgroup PJSIP_MSG_METHOD Methods
44 * @brief Method names and manipulation.
45 * @ingroup PJSIP_MSG
46 * @{
47 */
48
49 /**
50 * This enumeration declares SIP methods as described by RFC3261. Additional
51 * methods do exist, and they are described by corresponding RFCs for the SIP
52 * extentensions. Since they won't alter the characteristic of the processing
53 * of the message, they don't need to be explicitly mentioned here.
54 */
55 typedef enum pjsip_method_e
56 {
57 PJSIP_INVITE_METHOD, /**< INVITE method, for establishing dialogs. */
58 PJSIP_CANCEL_METHOD, /**< CANCEL method, for cancelling request. */
59 PJSIP_ACK_METHOD, /**< ACK method. */
60 PJSIP_BYE_METHOD, /**< BYE method, for terminating dialog. */
61 PJSIP_REGISTER_METHOD, /**< REGISTER method. */
62 PJSIP_OPTIONS_METHOD, /**< OPTIONS method. */
63
64 PJSIP_OTHER_METHOD /**< Other method. */
65
66 } pjsip_method_e;
67
68
69
70 /**
71 * This structure represents a SIP method.
72 * Application must always use either #pjsip_method_init or #pjsip_method_set
73 * to make sure that method name is initialized correctly. This way, the name
74 * member will always contain a valid method string regardless whether the ID
75 * is recognized or not.
76 */
77 struct pjsip_method
78 {
79 pjsip_method_e id; /**< Method ID, from \a pjsip_method_e. */
80 pj_str_t name; /**< Method name, which will always contain the
81 method string. */
82 };
83
84
85 /*
86 * For convenience, standard method structures are defined in the library.
87 */
88 /** INVITE method constant. @see pjsip_get_invite_method() */
89 PJ_DECL_DATA(const pjsip_method) pjsip_invite_method;
90
91 /** CANCEL method constant. @see pjsip_get_cancel_method() */
92 PJ_DECL_DATA(const pjsip_method) pjsip_cancel_method;
93
94 /** ACK method constant. @see pjsip_get_ack_method() */
95 PJ_DECL_DATA(const pjsip_method) pjsip_ack_method;
96
97 /** BYE method constant. @see pjsip_get_bye_method() */
98 PJ_DECL_DATA(const pjsip_method) pjsip_bye_method;
99
100 /** REGISTER method constant. @see pjsip_get_register_method() */
101 PJ_DECL_DATA(const pjsip_method) pjsip_register_method;
102
103 /** OPTIONS method constant. @see pjsip_get_options_method() */
104 PJ_DECL_DATA(const pjsip_method) pjsip_options_method;
105
106 /*
107 * Accessor functions for standard SIP methods.
108 */
109 /** Get INVITE method constant. */
110 PJ_DECL(const pjsip_method*) pjsip_get_invite_method(void);
111 /** Get CANCEL method constant. */
112 PJ_DECL(const pjsip_method*) pjsip_get_cancel_method(void);
113 /** Get ACK method constant. */
114 PJ_DECL(const pjsip_method*) pjsip_get_ack_method(void);
115 /** Get BYE method constant. */
116 PJ_DECL(const pjsip_method*) pjsip_get_bye_method(void);
117 /** Get REGISTER method constant.*/
118 PJ_DECL(const pjsip_method*) pjsip_get_register_method(void);
119 /** Get OPTIONS method constant. */
120 PJ_DECL(const pjsip_method*) pjsip_get_options_method(void);
121
122
123 /*
124 * Accessor functions
125 */
126
127 /**
128 * Initialize the method structure from a string.
129 * This function will check whether the method is a known method then set
130 * both the id and name accordingly.
131 *
132 * @param m The method to initialize.
133 * @param pool Pool where memory allocation will be allocated from, if required.
134 * @param str The method string.
135 */
136 PJ_DECL(void) pjsip_method_init( pjsip_method *m,
137 pj_pool_t *pool,
138 const pj_str_t *str);
139
140 /**
141 * Initialize the method structure from a string, without cloning the string.
142 * See #pjsip_method_init.
143 *
144 * @param m The method structure to be initialized.
145 * @param str The method string.
146 */
147 PJ_DECL(void) pjsip_method_init_np( pjsip_method *m,
148 pj_str_t *str);
149
150 /**
151 * Set the method with the predefined method ID.
152 * This function will also set the name member of the structure to the correct
153 * string according to the method.
154 *
155 * @param m The method structure.
156 * @param id The method ID.
157 */
158 PJ_DECL(void) pjsip_method_set( pjsip_method *m, pjsip_method_e id );
159
160
161 /**
162 * Copy one method structure to another. If the method is of the known methods,
163 * then memory allocation is not required.
164 *
165 * @param pool Pool to allocate memory from, if required.
166 * @param method The destination method to copy to.
167 * @param rhs The source method to copy from.
168 */
169 PJ_DECL(void) pjsip_method_copy( pj_pool_t *pool,
170 pjsip_method *method,
171 const pjsip_method *rhs );
172
173 /**
174 * Compare one method with another, and conveniently determine whether the
175 * first method is equal, less than, or greater than the second method.
176 *
177 * @param m1 The first method.
178 * @param m2 The second method.
179 *
180 * @return Zero if equal, otherwise will return -1 if less or +1 if greater.
181 */
182 PJ_DECL(int) pjsip_method_cmp( const pjsip_method *m1, const pjsip_method *m2);
183
184 /**
185 * @}
186 */
187
188 /* **************************************************************************/
189 /**
190 * @defgroup PJSIP_MSG_HDR Header Fields
191 * @brief Declarations for various SIP header fields.
192 * @ingroup PJSIP_MSG
193 * @{
194 */
195
196 /**
197 * Header types, as defined by RFC3261.
198 */
199 typedef enum pjsip_hdr_e
200 {
201 /*
202 * These are the headers documented in RFC3261. Headers not documented
203 * there must have type PJSIP_H_OTHER, and the header type itself is
204 * recorded in the header name string.
205 *
206 * DO NOT CHANGE THE VALUE/ORDER OF THE HEADER IDs!!!.
207 */
208 PJSIP_H_ACCEPT,
209 PJSIP_H_ACCEPT_ENCODING_UNIMP, /* N/A, use pjsip_generic_string_hdr */
210 PJSIP_H_ACCEPT_LANGUAGE_UNIMP, /* N/A, use pjsip_generic_string_hdr */
211 PJSIP_H_ALERT_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
212 PJSIP_H_ALLOW,
213 PJSIP_H_AUTHENTICATION_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
214 PJSIP_H_AUTHORIZATION,
215 PJSIP_H_CALL_ID,
216 PJSIP_H_CALL_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
217 PJSIP_H_CONTACT,
218 PJSIP_H_CONTENT_DISPOSITION_UNIMP, /* N/A, use pjsip_generic_string_hdr */
219 PJSIP_H_CONTENT_ENCODING_UNIMP, /* N/A, use pjsip_generic_string_hdr */
220 PJSIP_H_CONTENT_LANGUAGE_UNIMP, /* N/A, use pjsip_generic_string_hdr */
221 PJSIP_H_CONTENT_LENGTH,
222 PJSIP_H_CONTENT_TYPE,
223 PJSIP_H_CSEQ,
224 PJSIP_H_DATE_UNIMP, /* N/A, use pjsip_generic_string_hdr */
225 PJSIP_H_ERROR_INFO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
226 PJSIP_H_EXPIRES,
227 PJSIP_H_FROM,
228 PJSIP_H_IN_REPLY_TO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
229 PJSIP_H_MAX_FORWARDS,
230 PJSIP_H_MIME_VERSION_UNIMP, /* N/A, use pjsip_generic_string_hdr */
231 PJSIP_H_MIN_EXPIRES,
232 PJSIP_H_ORGANIZATION_UNIMP, /* N/A, use pjsip_generic_string_hdr */
233 PJSIP_H_PRIORITY_UNIMP, /* N/A, use pjsip_generic_string_hdr */
234 PJSIP_H_PROXY_AUTHENTICATE,
235 PJSIP_H_PROXY_AUTHORIZATION,
236 PJSIP_H_PROXY_REQUIRE_UNIMP, /* N/A, use pjsip_generic_string_hdr */
237 PJSIP_H_RECORD_ROUTE,
238 PJSIP_H_REPLY_TO_UNIMP, /* N/A, use pjsip_generic_string_hdr */
239 PJSIP_H_REQUIRE,
240 PJSIP_H_RETRY_AFTER,
241 PJSIP_H_ROUTE,
242 PJSIP_H_SERVER_UNIMP, /* N/A, use pjsip_generic_string_hdr */
243 PJSIP_H_SUBJECT_UNIMP, /* N/A, use pjsip_generic_string_hdr */
244 PJSIP_H_SUPPORTED,
245 PJSIP_H_TIMESTAMP_UNIMP, /* N/A, use pjsip_generic_string_hdr */
246 PJSIP_H_TO,
247 PJSIP_H_UNSUPPORTED,
248 PJSIP_H_USER_AGENT_UNIMP, /* N/A, use pjsip_generic_string_hdr */
249 PJSIP_H_VIA,
250 PJSIP_H_WARNING_UNIMP, /* N/A, use pjsip_generic_string_hdr */
251 PJSIP_H_WWW_AUTHENTICATE,
252
253 PJSIP_H_OTHER
254
255 } pjsip_hdr_e;
256
257 /**
258 * This structure provides the pointer to basic functions that are needed
259 * for generic header operations. All header fields will have pointer to
260 * this structure, so that they can be manipulated uniformly.
261 */
262 typedef struct pjsip_hdr_vptr
263 {
264 /**
265 * Function to clone the header.
266 *
267 * @param pool Memory pool to allocate the new header.
268 * @param hdr Header to clone.
269 *
270 * @return A new instance of the header.
271 */
272 void *(*clone)(pj_pool_t *pool, const void *hdr);
273
274 /**
275 * Pointer to function to shallow clone the header.
276 * Shallow cloning will just make a memory copy of the original header,
277 * thus all pointers in original header will be kept intact. Because the
278 * function does not need to perform deep copy, the operation should be
279 * faster, but the application must make sure that the original header
280 * is still valid throughout the lifetime of new header.
281 *
282 * @param pool Memory pool to allocate the new header.
283 * @param hdr The header to clone.
284 */
285 void *(*shallow_clone)(pj_pool_t *pool, const void *hdr);
286
287 /** Pointer to function to print the header to the specified buffer.
288 * Returns the length of string written, or -1 if the remaining buffer
289 * is not enough to hold the header.
290 *
291 * @param hdr The header to print.
292 * @param buf The buffer.
293 * @param len The size of the buffer.
294 *
295 * @return The size copied to buffer, or -1 if there's not enough space.
296 */
297 int (*print_on)(void *hdr, char *buf, pj_size_t len);
298
299 } pjsip_hdr_vptr;
300
301
302 /**
303 * Generic fields for all SIP headers are declared using this macro, to make
304 * sure that all headers will have exactly the same layout in their start of
305 * the storage. This behaves like C++ inheritance actually.
306 */
307 #define PJSIP_DECL_HDR_MEMBER(hdr) \
308 /** List members. */ \
309 PJ_DECL_LIST_MEMBER(hdr); \
310 /** Header type */ \
311 pjsip_hdr_e type; \
312 /** Header name. */ \
313 pj_str_t name; \
314 /** Header short name version. */ \
315 pj_str_t sname; \
316 /** Virtual function table. */ \
317 pjsip_hdr_vptr *vptr
318
319
320 /**
321 * Generic SIP header structure, for generic manipulation for headers in the
322 * message. All header fields can be typecasted to this type.
323 */
324 struct pjsip_hdr
325 {
326 PJSIP_DECL_HDR_MEMBER(struct pjsip_hdr);
327 };
328
329
330 /**
331 * This generic function will clone any header, by calling "clone" function
332 * in header's virtual function table.
333 *
334 * @param pool The pool to allocate memory from.
335 * @param hdr The header to clone.
336 *
337 * @return A new instance copied from the original header.
338 */
339 PJ_DECL(void*) pjsip_hdr_clone( pj_pool_t *pool, const void *hdr );
340
341
342 /**
343 * This generic function will clone any header, by calling "shallow_clone"
344 * function in header's virtual function table.
345 *
346 * @param pool The pool to allocate memory from.
347 * @param hdr The header to clone.
348 *
349 * @return A new instance copied from the original header.
350 */
351 PJ_DECL(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr );
352
353 /**
354 * This generic function will print any header, by calling "print"
355 * function in header's virtual function table.
356 *
357 * @param hdr The header to print.
358 * @param buf The buffer.
359 * @param len The size of the buffer.
360 *
361 * @return The size copied to buffer, or -1 if there's not enough space.
362 */
363 PJ_DECL(int) pjsip_hdr_print_on( void *hdr, char *buf, pj_size_t len);
364
365 /**
366 * @}
367 */
368
369 /* **************************************************************************/
370 /**
371 * @defgroup PJSIP_MSG_LINE Request and Status Line.
372 * @brief Request and status line structures and manipulation.
373 * @ingroup PJSIP_MSG
374 * @{
375 */
376
377 /**
378 * This structure describes SIP request line.
379 */
380 typedef struct pjsip_request_line
381 {
382 pjsip_method method; /**< Method for this request line. */
383 pjsip_uri *uri; /**< URI for this request line. */
384 } pjsip_request_line;
385
386
387 /**
388 * This structure describes SIP status line.
389 */
390 typedef struct pjsip_status_line
391 {
392 int code; /**< Status code. */
393 pj_str_t reason; /**< Reason string. */
394 } pjsip_status_line;
395
396
397 /**
398 * This enumeration lists standard SIP status codes according to RFC 3261.
399 * In addition, it also declares new status class 7xx for errors generated
400 * by the stack. This status class however should not get transmitted on the
401 * wire.
402 */
403 typedef enum pjsip_status_code
404 {
405 PJSIP_SC_NULL = 0,
406
407 PJSIP_SC_TRYING = 100,
408 PJSIP_SC_RINGING = 180,
409 PJSIP_SC_CALL_BEING_FORWARDED = 181,
410 PJSIP_SC_QUEUED = 182,
411 PJSIP_SC_PROGRESS = 183,
412 PJSIP_SC_EARLY_DIALOG_TERMINATED = 199,
413
414 PJSIP_SC_OK = 200,
415 PJSIP_SC_ACCEPTED = 202,
416 PJSIP_SC_NO_NOTIFICATION = 204,
417
418 PJSIP_SC_MULTIPLE_CHOICES = 300,
419 PJSIP_SC_MOVED_PERMANENTLY = 301,
420 PJSIP_SC_MOVED_TEMPORARILY = 302,
421 PJSIP_SC_USE_PROXY = 305,
422 PJSIP_SC_ALTERNATIVE_SERVICE = 380,
423
424 PJSIP_SC_BAD_REQUEST = 400,
425 PJSIP_SC_UNAUTHORIZED = 401,
426 PJSIP_SC_PAYMENT_REQUIRED = 402,
427 PJSIP_SC_FORBIDDEN = 403,
428 PJSIP_SC_NOT_FOUND = 404,
429 PJSIP_SC_METHOD_NOT_ALLOWED = 405,
430 PJSIP_SC_NOT_ACCEPTABLE = 406,
431 PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED = 407,
432 PJSIP_SC_REQUEST_TIMEOUT = 408,
433 PJSIP_SC_CONFLICT = 409,
434 PJSIP_SC_GONE = 410,
435 PJSIP_SC_LENGTH_REQUIRED = 411,
436 PJSIP_SC_CONDITIONAL_REQUEST_FAILED = 412,
437 PJSIP_SC_REQUEST_ENTITY_TOO_LARGE = 413,
438 PJSIP_SC_REQUEST_URI_TOO_LONG = 414,
439 PJSIP_SC_UNSUPPORTED_MEDIA_TYPE = 415,
440 PJSIP_SC_UNSUPPORTED_URI_SCHEME = 416,
441 PJSIP_SC_UNKNOWN_RESOURCE_PRIORITY = 417,
442 PJSIP_SC_BAD_EXTENSION = 420,
443 PJSIP_SC_EXTENSION_REQUIRED = 421,
444 PJSIP_SC_SESSION_TIMER_TOO_SMALL = 422,
445 PJSIP_SC_INTERVAL_TOO_BRIEF = 423,
446 PJSIP_SC_BAD_LOCATION_INFORMATION = 424,
447 PJSIP_SC_USE_IDENTITY_HEADER = 428,
448 PJSIP_SC_PROVIDE_REFERRER_HEADER = 429,
449 PJSIP_SC_FLOW_FAILED = 430,
450 PJSIP_SC_ANONIMITY_DISALLOWED = 433,
451 PJSIP_SC_BAD_IDENTITY_INFO = 436,
452 PJSIP_SC_UNSUPPORTED_CERTIFICATE = 437,
453 PJSIP_SC_INVALID_IDENTITY_HEADER = 438,
454 PJSIP_SC_FIRST_HOP_LACKS_OUTBOUND_SUPPORT = 439,
455 PJSIP_SC_MAX_BREADTH_EXCEEDED = 440,
456 PJSIP_SC_BAD_INFO_PACKAGE = 469,
457 PJSIP_SC_CONSENT_NEEDED = 470,
458 PJSIP_SC_TEMPORARILY_UNAVAILABLE = 480,
459 PJSIP_SC_CALL_TSX_DOES_NOT_EXIST = 481,
460 PJSIP_SC_LOOP_DETECTED = 482,
461 PJSIP_SC_TOO_MANY_HOPS = 483,
462 PJSIP_SC_ADDRESS_INCOMPLETE = 484,
463 PJSIP_AC_AMBIGUOUS = 485,
464 PJSIP_SC_BUSY_HERE = 486,
465 PJSIP_SC_REQUEST_TERMINATED = 487,
466 PJSIP_SC_NOT_ACCEPTABLE_HERE = 488,
467 PJSIP_SC_BAD_EVENT = 489,
468 PJSIP_SC_REQUEST_UPDATED = 490,
469 PJSIP_SC_REQUEST_PENDING = 491,
470 PJSIP_SC_UNDECIPHERABLE = 493,
471 PJSIP_SC_SECURITY_AGREEMENT_NEEDED = 494,
472
473 PJSIP_SC_INTERNAL_SERVER_ERROR = 500,
474 PJSIP_SC_NOT_IMPLEMENTED = 501,
475 PJSIP_SC_BAD_GATEWAY = 502,
476 PJSIP_SC_SERVICE_UNAVAILABLE = 503,
477 PJSIP_SC_SERVER_TIMEOUT = 504,
478 PJSIP_SC_VERSION_NOT_SUPPORTED = 505,
479 PJSIP_SC_MESSAGE_TOO_LARGE = 513,
480 PJSIP_SC_PUSH_NOTIFICATION_SERVICE_NOT_SUPPORTED = 555,
481 PJSIP_SC_PRECONDITION_FAILURE = 580,
482
483 PJSIP_SC_BUSY_EVERYWHERE = 600,
484 PJSIP_SC_DECLINE = 603,
485 PJSIP_SC_DOES_NOT_EXIST_ANYWHERE = 604,
486 PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE = 606,
487 PJSIP_SC_UNWANTED = 607,
488 PJSIP_SC_REJECTED = 608,
489
490 PJSIP_SC_TSX_TIMEOUT = PJSIP_SC_REQUEST_TIMEOUT,
491 /*PJSIP_SC_TSX_RESOLVE_ERROR = 702,*/
492 PJSIP_SC_TSX_TRANSPORT_ERROR = PJSIP_SC_SERVICE_UNAVAILABLE,
493
494 /* This is not an actual status code, but rather a constant
495 * to force GCC to use 32bit to represent this enum, since
496 * we have a code in PJSUA-LIB that assigns an integer
497 * to this enum (see pjsua_acc_get_info() function).
498 */
499 PJSIP_SC__force_32bit = 0x7FFFFFFF
500
501 } pjsip_status_code;
502
503 /**
504 * Get the default status text for the status code.
505 *
506 * @param status_code SIP Status Code
507 *
508 * @return textual message for the status code.
509 */
510 PJ_DECL(const pj_str_t*) pjsip_get_status_text(int status_code);
511
512 /**
513 * This macro returns non-zero (TRUE) if the specified status_code is
514 * in the same class as the code_class.
515 *
516 * @param status_code The status code.
517 * @param code_class The status code in the class (for example 100, 200).
518 */
519 #define PJSIP_IS_STATUS_IN_CLASS(status_code, code_class) \
520 (status_code/100 == code_class/100)
521
522 /**
523 * @}
524 */
525
526 /* **************************************************************************/
527 /**
528 * @addtogroup PJSIP_MSG_MEDIA Media/MIME Type
529 * @brief Media/MIME type declaration and manipulations.
530 * @ingroup PJSIP_MSG
531 * @{
532 */
533
534 /**
535 * This structure describes SIP media type, as used for example in
536 * Accept and Content-Type header..
537 */
538 typedef struct pjsip_media_type
539 {
540 pj_str_t type; /**< Media type. */
541 pj_str_t subtype; /**< Media subtype. */
542 pjsip_param param; /**< Media type parameters */
543 } pjsip_media_type;
544
545
546 /**
547 * Initialize the media type with the specified type and subtype string.
548 *
549 * @param mt The media type.
550 * @param type Optionally specify the media type.
551 * @param subtype Optionally specify the media subtype.
552 */
553 PJ_DECL(void) pjsip_media_type_init(pjsip_media_type *mt,
554 pj_str_t *type,
555 pj_str_t *subtype);
556
557 /**
558 * Initialize the media type with the specified type and subtype string.
559 *
560 * @param mt The media type.
561 * @param type Optionally specify the media type.
562 * @param subtype Optionally specify the media subtype.
563 */
564 PJ_DECL(void) pjsip_media_type_init2(pjsip_media_type *mt,
565 char *type,
566 char *subtype);
567
568 /**
569 * Compare two media types.
570 *
571 * @param mt1 The first media type.
572 * @param mt2 The second media type.
573 * @param cmp_param Specify how to compare the media type parameters:
574 * - 0: do not compare parameters
575 * - 1: compare parameters but ignore parameters that
576 * only appear in one of the media type.
577 * - 2: compare the parameters.
578 *
579 * @return Zero if both media types are equal, -1 if mt1 < mt2,
580 * 1 if mt1 > mt2.
581 */
582 PJ_DECL(int) pjsip_media_type_cmp(const pjsip_media_type *mt1,
583 const pjsip_media_type *mt2,
584 int cmp_param);
585
586 /**
587 * Copy SIP media type to another.
588 *
589 * @param pool Pool to duplicate strings.
590 * @param dst Destination structure.
591 * @param src Source structure.
592 */
593 PJ_DECL(void) pjsip_media_type_cp(pj_pool_t *pool,
594 pjsip_media_type *dst,
595 const pjsip_media_type *src);
596
597 /**
598 * Print media type to the specified buffer.
599 *
600 * @param buf Destination buffer.
601 * @param len Length of the buffer.
602 * @param mt The media type to be printed.
603 *
604 * @return The number of characters printed to the buffer, or -1
605 * if there's not enough space in the buffer.
606 */
607 PJ_DECL(int) pjsip_media_type_print(char *buf, unsigned len,
608 const pjsip_media_type *mt);
609
610 /**
611 * @}
612 */
613
614 /* **************************************************************************/
615 /**
616 * @addtogroup PJSIP_MSG_BODY Message Body
617 * @brief SIP message body structures and manipulation.
618 * @ingroup PJSIP_MSG
619 * @{
620 */
621
622 /**
623 * Generic abstraction to message body.
624 * When an incoming message is parsed (pjsip_parse_msg()), the parser fills in
625 * all members with the appropriate value. The 'data' and 'len' member will
626 * describe portion of incoming packet which denotes the message body.
627 * When application needs to attach message body to outgoing SIP message, it
628 * must fill in all members of this structure.
629 */
630 struct pjsip_msg_body
631 {
632 /** MIME content type.
633 * For incoming messages, the parser will fill in this member with the
634 * content type found in Content-Type header.
635 *
636 * For outgoing messages, application may fill in this member with
637 * appropriate value, because the stack will generate Content-Type header
638 * based on the value specified here.
639 *
640 * If the content_type is empty, no Content-Type AND Content-Length header
641 * will be added to the message. The stack assumes that application adds
642 * these headers themselves.
643 */
644 pjsip_media_type content_type;
645
646 /** Pointer to buffer which holds the message body data.
647 * For incoming messages, the parser will fill in this member with the
648 * pointer to the body string.
649 *
650 * When sending outgoing message, this member doesn't need to point to the
651 * actual message body string. It can be assigned with arbitrary pointer,
652 * because the value will only need to be understood by the print_body()
653 * function. The stack itself will not try to interpret this value, but
654 * instead will always call the print_body() whenever it needs to get the
655 * actual body string.
656 */
657 void *data;
658
659 /** The length of the data.
660 * For incoming messages, the parser will fill in this member with the
661 * actual length of message body.
662 *
663 * When sending outgoing message, again just like the "data" member, the
664 * "len" member doesn't need to point to the actual length of the body
665 * string.
666 */
667 unsigned len;
668
669 /** Pointer to function to print this message body.
670 * Application must set a proper function here when sending outgoing
671 * message.
672 *
673 * @param msg_body This structure itself.
674 * @param buf The buffer.
675 * @param size The buffer size.
676 *
677 * @return The length of the string printed, or -1 if there is
678 * not enough space in the buffer to print the whole
679 * message body.
680 */
681 int (*print_body)(struct pjsip_msg_body *msg_body,
682 char *buf, pj_size_t size);
683
684 /** Clone the data part only of this message body. Note that this only
685 * duplicates the data part of the body instead of the whole message
686 * body. If application wants to duplicate the entire message body
687 * structure, it must call #pjsip_msg_body_clone().
688 *
689 * @param pool Pool used to clone the data.
690 * @param data The data inside message body, to be cloned.
691 * @param len The length of the data.
692 *
693 * @return New data duplicated from the original data.
694 */
695 void* (*clone_data)(pj_pool_t *pool, const void *data, unsigned len);
696
697 };
698
699 /**
700 * General purpose function to textual data in a SIP body. Attach this function
701 * in a SIP message body only if the data in pjsip_msg_body is a textual
702 * message ready to be embedded in a SIP message. If the data in the message
703 * body is not a textual body, then application must supply a custom function
704 * to print that body.
705 *
706 * @param msg_body The message body.
707 * @param buf Buffer to copy the message body to.
708 * @param size The size of the buffer.
709 *
710 * @return The length copied to the buffer, or -1.
711 */
712 PJ_DECL(int) pjsip_print_text_body( pjsip_msg_body *msg_body,
713 char *buf, pj_size_t size);
714
715 /**
716 * General purpose function to clone textual data in a SIP body. Attach this
717 * function as "clone_data" member of the SIP body only if the data type
718 * is a text (i.e. C string, not pj_str_t), and the length indicates the
719 * length of the text.
720 *
721 * @param pool Pool used to clone the data.
722 * @param data Textual data.
723 * @param len The length of the string.
724 *
725 * @return New text duplicated from the original text.
726 */
727 PJ_DECL(void*) pjsip_clone_text_data( pj_pool_t *pool, const void *data,
728 unsigned len);
729
730
731 /**
732 * Clone the message body in src_body to the dst_body. This will duplicate
733 * the contents of the message body using the \a clone_data member of the
734 * source message body.
735 *
736 * @param pool Pool to use to duplicate the message body.
737 * @param dst_body Destination message body.
738 * @param src_body Source message body to duplicate.
739 *
740 * @return PJ_SUCCESS on success.
741 */
742 PJ_DECL(pj_status_t) pjsip_msg_body_copy( pj_pool_t *pool,
743 pjsip_msg_body *dst_body,
744 const pjsip_msg_body *src_body );
745
746
747 /**
748 * Create cloned message body. This will duplicate the contents of the message
749 * body using the \a clone_data member of the source message body.
750 *
751 * @param pool Pool to use to duplicate the message body.
752 * @param body Source message body to duplicate.
753 *
754 * @return The cloned message body on successfull.
755 */
756 PJ_DECL(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool,
757 const pjsip_msg_body *body );
758
759
760 /**
761 * Create a text message body. Use this function to create message body when
762 * the content is a simple text. For non-text message body (e.g.
763 * pjmedia_sdp_session or pj_xml_node), application must construct the message
764 * manually.
765 *
766 * @param pool Pool to allocate message body and its contents.
767 * @param type MIME type (e.g. "text").
768 * @param subtype MIME subtype (e.g. "plain").
769 * @param text The text content to be put in the message body.
770 *
771 * @return A new message body with the specified Content-Type and
772 * text.
773 */
774 PJ_DECL(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool,
775 const pj_str_t *type,
776 const pj_str_t *subtype,
777 const pj_str_t *text );
778
779 /**
780 * @}
781 */
782
783 /* **************************************************************************/
784 /**
785 * @defgroup PJSIP_MSG_MSG Message Structure
786 * @brief SIP message (request and response) structure and operations.
787 * @ingroup PJSIP_MSG
788 * @{
789 */
790
791 /**
792 * Message type (request or response).
793 */
794 typedef enum pjsip_msg_type_e
795 {
796 PJSIP_REQUEST_MSG, /**< Indicates request message. */
797 PJSIP_RESPONSE_MSG /**< Indicates response message. */
798 } pjsip_msg_type_e;
799
800
801 /**
802 * This structure describes a SIP message.
803 */
804 struct pjsip_msg
805 {
806 /** Message type (ie request or response). */
807 pjsip_msg_type_e type;
808
809 /** The first line of the message can be either request line for request
810 * messages, or status line for response messages. It is represented here
811 * as a union.
812 */
813 union
814 {
815 /** Request Line. */
816 struct pjsip_request_line req;
817
818 /** Status Line. */
819 struct pjsip_status_line status;
820 } line;
821
822 /** List of message headers. */
823 pjsip_hdr hdr;
824
825 /** Pointer to message body, or NULL if no message body is attached to
826 * this mesage.
827 */
828 pjsip_msg_body *body;
829 };
830
831
832 /**
833 * Create new request or response message.
834 *
835 * @param pool The pool.
836 * @param type Message type.
837 * @return New message, or THROW exception if failed.
838 */
839 PJ_DECL(pjsip_msg*) pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type);
840
841
842 /**
843 * Perform a deep clone of a SIP message.
844 *
845 * @param pool The pool for creating the new message.
846 * @param msg The message to be duplicated.
847 *
848 * @return New message, which is duplicated from the original
849 * message.
850 */
851 PJ_DECL(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *msg);
852
853
854 /**
855 * Find a header in the message by the header type.
856 *
857 * @param msg The message.
858 * @param type The header type to find.
859 * @param start The first header field where the search should begin.
860 * If NULL is specified, then the search will begin from the
861 * first header, otherwise the search will begin at the
862 * specified header.
863 *
864 * @return The header field, or NULL if no header with the specified
865 * type is found.
866 */
867 PJ_DECL(void*) pjsip_msg_find_hdr( const pjsip_msg *msg,
868 pjsip_hdr_e type, const void *start);
869
870 /**
871 * Find a header in the message by its name.
872 *
873 * @param msg The message.
874 * @param name The header name to find.
875 * @param start The first header field where the search should begin.
876 * If NULL is specified, then the search will begin from the
877 * first header, otherwise the search will begin at the
878 * specified header.
879 *
880 * @return The header field, or NULL if no header with the specified
881 * type is found.
882 */
883 PJ_DECL(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
884 const pj_str_t *name,
885 const void *start);
886
887 /**
888 * Find a header in the message by its name and short name version.
889 *
890 * @param msg The message.
891 * @param name The header name to find.
892 * @param sname The short name version of the header name.
893 * @param start The first header field where the search should begin.
894 * If NULL is specified, then the search will begin from the
895 * first header, otherwise the search will begin at the
896 * specified header.
897 *
898 * @return The header field, or NULL if no header with the specified
899 * type is found.
900 */
901 PJ_DECL(void*) pjsip_msg_find_hdr_by_names(const pjsip_msg *msg,
902 const pj_str_t *name,
903 const pj_str_t *sname,
904 const void *start);
905
906 /**
907 * Find and remove a header in the message.
908 *
909 * @param msg The message.
910 * @param hdr The header type to find.
911 * @param start The first header field where the search should begin,
912 * or NULL to search from the first header in the message.
913 *
914 * @return The header field, or NULL if not found.
915 */
916 PJ_DECL(void*) pjsip_msg_find_remove_hdr( pjsip_msg *msg,
917 pjsip_hdr_e hdr, void *start);
918
919 /**
920 * Add a header to the message, putting it last in the header list.
921 *
922 * @param msg The message.
923 * @param hdr The header to add.
924 *
925 * @bug Once the header is put in a list (or message), it can not be put in
926 * other list (or message). Otherwise Real Bad Thing will happen.
927 */
pjsip_msg_add_hdr(pjsip_msg * msg,pjsip_hdr * hdr)928 PJ_INLINE(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
929 {
930 pj_list_insert_before(&msg->hdr, hdr);
931 }
932
933 /**
934 * Add header field to the message, putting it in the front of the header list.
935 *
936 * @param msg The message.
937 * @param hdr The header to add.
938 *
939 * @bug Once the header is put in a list (or message), it can not be put in
940 * other list (or message). Otherwise Real Bad Thing will happen.
941 */
pjsip_msg_insert_first_hdr(pjsip_msg * msg,pjsip_hdr * hdr)942 PJ_INLINE(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
943 {
944 pj_list_insert_after(&msg->hdr, hdr);
945 }
946
947 /**
948 * Print the message to the specified buffer.
949 *
950 * @param msg The message to print.
951 * @param buf The buffer
952 * @param size The size of the buffer.
953 *
954 * @return The length of the printed characters (in bytes), or NEGATIVE
955 * value if the message is too large for the specified buffer.
956 */
957 PJ_DECL(pj_ssize_t) pjsip_msg_print(const pjsip_msg *msg,
958 char *buf, pj_size_t size);
959
960
961 /*
962 * Some usefull macros to find common headers.
963 */
964
965
966 /**
967 * Find Call-ID header.
968 *
969 * @param msg The message.
970 * @return Call-ID header instance.
971 */
972 #define PJSIP_MSG_CID_HDR(msg) \
973 ((pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL))
974
975 /**
976 * Find CSeq header.
977 *
978 * @param msg The message.
979 * @return CSeq header instance.
980 */
981 #define PJSIP_MSG_CSEQ_HDR(msg) \
982 ((pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))
983
984 /**
985 * Find From header.
986 *
987 * @param msg The message.
988 * @return From header instance.
989 */
990 #define PJSIP_MSG_FROM_HDR(msg) \
991 ((pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL))
992
993 /**
994 * Find To header.
995 *
996 * @param msg The message.
997 * @return To header instance.
998 */
999 #define PJSIP_MSG_TO_HDR(msg) \
1000 ((pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL))
1001
1002
1003 /**
1004 * @}
1005 */
1006
1007 /* **************************************************************************/
1008 /**
1009 * @addtogroup PJSIP_MSG_HDR
1010 * @{
1011 */
1012
1013 /**
1014 * Generic SIP header, which contains hname and a string hvalue.
1015 * Note that this header is not supposed to be used as 'base' class for headers.
1016 */
1017 typedef struct pjsip_generic_string_hdr
1018 {
1019 /** Standard header field. */
1020 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr);
1021 /** hvalue */
1022 pj_str_t hvalue;
1023 } pjsip_generic_string_hdr;
1024
1025
1026 /**
1027 * Create a new instance of generic header. A generic header can have an
1028 * arbitrary header name.
1029 *
1030 * @param pool The pool.
1031 * @param hname The header name to be assigned to the header, or NULL to
1032 * assign the header name with some string.
1033 * @param hvalue Optional string to be assigned as the value.
1034 *
1035 * @return The header, or THROW exception.
1036 */
1037 PJ_DECL(pjsip_generic_string_hdr*)
1038 pjsip_generic_string_hdr_create( pj_pool_t *pool,
1039 const pj_str_t *hname,
1040 const pj_str_t *hvalue);
1041
1042
1043 /**
1044 * Initialize a preallocated memory with the header structure. This function
1045 * should only be called when application uses its own memory allocation to
1046 * allocate memory block for the specified header (e.g. in C++, when the
1047 * header is allocated with "new" operator).
1048 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1049 * which allocates memory and initialize it in one go.
1050 *
1051 * @param pool Pool for additional memory allocation if required.
1052 * @param mem Pre-allocated memory to be initialized as the header.
1053 * @param hname The header name to be assigned to the header, or NULL to
1054 * assign the header name with some string later.
1055 * @param hvalue Optional string to be assigned as the value.
1056 *
1057 * @return The header instance, which points to the same memory
1058 * location as the mem argument.
1059 */
1060 PJ_DECL(pjsip_generic_string_hdr*)
1061 pjsip_generic_string_hdr_init( pj_pool_t *pool,
1062 void *mem,
1063 const pj_str_t *hname,
1064 const pj_str_t *hvalue);
1065
1066
1067 /**
1068 * Construct a generic string header without allocating memory from the pool.
1069 * This function is useful to create a temporary header which life-time is
1070 * very short (for example, creating the header in the stack to be passed
1071 * as argument to a function which will copy the header).
1072 *
1073 * @param h The header to be initialized.
1074 * @param hname The header name to be assigned to the header, or NULL to
1075 * assign the header name with some string.
1076 * @param hvalue Optional string to be assigned as the value.
1077 *
1078 * @return The header, or THROW exception.
1079 */
1080 PJ_DECL(void) pjsip_generic_string_hdr_init2(pjsip_generic_string_hdr *h,
1081 pj_str_t *hname,
1082 pj_str_t *hvalue);
1083
1084
1085 /* **************************************************************************/
1086
1087 /**
1088 * Generic SIP header, which contains hname and an integer ivalue.
1089 */
1090 typedef struct pjsip_generic_int_hdr
1091 {
1092 /** Standard header field. */
1093 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_int_hdr);
1094 /** ivalue */
1095 pj_uint32_t ivalue;
1096 } pjsip_generic_int_hdr;
1097
1098
1099 /**
1100 * Create a new instance of generic header. A generic header can have an
1101 * arbitrary header name.
1102 *
1103 * @param pool The pool.
1104 * @param hname The header name to be assigned to the header, or NULL to
1105 * assign the header name with some string.
1106 * @param hvalue The value to be assigned to the header.
1107 *
1108 * @return The header, or THROW exception.
1109 */
1110 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
1111 const pj_str_t *hname,
1112 unsigned hvalue );
1113
1114
1115 /**
1116 * Initialize a preallocated memory with the header structure. This function
1117 * should only be called when application uses its own memory allocation to
1118 * allocate memory block for the specified header (e.g. in C++, when the
1119 * header is allocated with "new" operator).
1120 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1121 * which allocates memory and initialize it in one go.
1122 *
1123 * @param pool Pool for additional memory allocation if required.
1124 * @param mem Pre-allocated memory to be initialized as the header.
1125 * @param hname The header name to be assigned to the header, or NULL to
1126 * assign the header name with some string later.
1127 * @param value Value to be assigned to the header.
1128 *
1129 * @return The header instance, which points to the same memory
1130 * location as the mem argument.
1131 */
1132 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool,
1133 void *mem,
1134 const pj_str_t *hname,
1135 unsigned value );
1136
1137 /* **************************************************************************/
1138
1139 /** Maximum elements in the header array. */
1140 #define PJSIP_GENERIC_ARRAY_MAX_COUNT 32
1141
1142 /**
1143 * Generic array of string header.
1144 */
1145 typedef struct pjsip_generic_array_hdr
1146 {
1147 /** Standard header fields. */
1148 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_array_hdr);
1149
1150 /** Number of tags/elements. */
1151 unsigned count;
1152
1153 /** Tags/elements. */
1154 pj_str_t values[PJSIP_GENERIC_ARRAY_MAX_COUNT];
1155
1156 } pjsip_generic_array_hdr;
1157
1158 /**
1159 * Create generic array header.
1160 *
1161 * @param pool Pool to allocate memory from.
1162 * @param hname Header name.
1163 *
1164 * @return New generic array header.
1165 */
1166 PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create(pj_pool_t *pool,
1167 const pj_str_t *hname);
1168
1169 /**
1170 * Initialize a preallocated memory with the header structure. This function
1171 * should only be called when application uses its own memory allocation to
1172 * allocate memory block for the specified header (e.g. in C++, when the
1173 * header is allocated with "new" operator).
1174 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1175 * which allocates memory and initialize it in one go.
1176 *
1177 * @param pool Pool for additional memory allocation if required.
1178 * @param mem Pre-allocated memory to be initialized as the header.
1179 * @param hname The header name to be assigned to the header, or NULL to
1180 * assign the header name with some string later.
1181 *
1182 * @return The header instance, which points to the same memory
1183 * location as the mem argument.
1184 */
1185 PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init(pj_pool_t *pool,
1186 void *mem,
1187 const pj_str_t *hname);
1188
1189
1190 /* **************************************************************************/
1191
1192 /** Accept header. */
1193 typedef pjsip_generic_array_hdr pjsip_accept_hdr;
1194
1195 /** Maximum fields in Accept header. */
1196 #define PJSIP_MAX_ACCEPT_COUNT PJSIP_GENERIC_ARRAY_MAX_COUNT
1197
1198 /**
1199 * Create new Accept header instance.
1200 *
1201 * @param pool The pool.
1202 *
1203 * @return New Accept header instance.
1204 */
1205 PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool);
1206
1207 /**
1208 * Initialize a preallocated memory with the header structure. This function
1209 * should only be called when application uses its own memory allocation to
1210 * allocate memory block for the specified header (e.g. in C++, when the
1211 * header is allocated with "new" operator).
1212 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1213 * which allocates memory and initialize it in one go.
1214 *
1215 * @param pool Pool for additional memory allocation if required.
1216 * @param mem Pre-allocated memory to be initialized as the header.
1217 *
1218 * @return The header instance, which points to the same memory
1219 * location as the mem argument.
1220 */
1221 PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool,
1222 void *mem );
1223
1224
1225 /* **************************************************************************/
1226
1227 /**
1228 * Allow header.
1229 */
1230 typedef pjsip_generic_array_hdr pjsip_allow_hdr;
1231
1232 /**
1233 * Create new Allow header instance.
1234 *
1235 * @param pool The pool.
1236 *
1237 * @return New Allow header instance.
1238 */
1239 PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool);
1240
1241
1242
1243 /**
1244 * Initialize a preallocated memory with the header structure. This function
1245 * should only be called when application uses its own memory allocation to
1246 * allocate memory block for the specified header (e.g. in C++, when the
1247 * header is allocated with "new" operator).
1248 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1249 * which allocates memory and initialize it in one go.
1250 *
1251 * @param pool Pool for additional memory allocation if required.
1252 * @param mem Pre-allocated memory to be initialized as the header.
1253 *
1254 * @return The header instance, which points to the same memory
1255 * location as the mem argument.
1256 */
1257 PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool,
1258 void *mem );
1259
1260 /* **************************************************************************/
1261
1262 /**
1263 * Call-ID header.
1264 */
1265 typedef struct pjsip_cid_hdr
1266 {
1267 PJSIP_DECL_HDR_MEMBER(struct pjsip_cid_hdr);
1268 pj_str_t id; /**< Call-ID string. */
1269 } pjsip_cid_hdr;
1270
1271
1272 /**
1273 * Create new Call-ID header.
1274 *
1275 * @param pool The pool.
1276 *
1277 * @return new Call-ID header.
1278 */
1279 PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_create( pj_pool_t *pool );
1280
1281
1282 /**
1283 * Initialize a preallocated memory with the header structure. This function
1284 * should only be called when application uses its own memory allocation to
1285 * allocate memory block for the specified header (e.g. in C++, when the
1286 * header is allocated with "new" operator).
1287 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1288 * which allocates memory and initialize it in one go.
1289 *
1290 * @param pool Pool for additional memory allocation if required.
1291 * @param mem Pre-allocated memory to be initialized as the header.
1292 *
1293 * @return The header instance, which points to the same memory
1294 * location as the mem argument.
1295 */
1296 PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool,
1297 void *mem );
1298
1299
1300
1301 /* **************************************************************************/
1302 /**
1303 * Content-Length header.
1304 */
1305 typedef struct pjsip_clen_hdr
1306 {
1307 PJSIP_DECL_HDR_MEMBER(struct pjsip_clen_hdr);
1308 int len; /**< Content length. */
1309 } pjsip_clen_hdr;
1310
1311 /**
1312 * Create new Content-Length header.
1313 *
1314 * @param pool the pool.
1315 * @return A new Content-Length header instance.
1316 */
1317 PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool );
1318
1319 /**
1320 * Initialize a preallocated memory with the header structure. This function
1321 * should only be called when application uses its own memory allocation to
1322 * allocate memory block for the specified header (e.g. in C++, when the
1323 * header is allocated with "new" operator).
1324 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1325 * which allocates memory and initialize it in one go.
1326 *
1327 * @param pool Pool for additional memory allocation if required.
1328 * @param mem Pre-allocated memory to be initialized as the header.
1329 *
1330 * @return The header instance, which points to the same memory
1331 * location as the mem argument.
1332 */
1333 PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool,
1334 void *mem );
1335
1336
1337 /* **************************************************************************/
1338 /**
1339 * CSeq header.
1340 */
1341 typedef struct pjsip_cseq_hdr
1342 {
1343 PJSIP_DECL_HDR_MEMBER(struct pjsip_cseq_hdr);
1344 pj_int32_t cseq; /**< CSeq number. */
1345 pjsip_method method; /**< CSeq method. */
1346 } pjsip_cseq_hdr;
1347
1348
1349 /** Create new CSeq header.
1350 *
1351 * @param pool The pool.
1352 * @return A new CSeq header instance.
1353 */
1354 PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool );
1355
1356 /**
1357 * Initialize a preallocated memory with the header structure. This function
1358 * should only be called when application uses its own memory allocation to
1359 * allocate memory block for the specified header (e.g. in C++, when the
1360 * header is allocated with "new" operator).
1361 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1362 * which allocates memory and initialize it in one go.
1363 *
1364 * @param pool Pool for additional memory allocation if required.
1365 * @param mem Pre-allocated memory to be initialized as the header.
1366 *
1367 * @return The header instance, which points to the same memory
1368 * location as the mem argument.
1369 */
1370 PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool,
1371 void *mem );
1372
1373 /* **************************************************************************/
1374
1375 /** Expires not specified. */
1376 #define PJSIP_EXPIRES_NOT_SPECIFIED ((pj_uint32_t)0xFFFFFFFFUL)
1377
1378 /**
1379 * Contact header.
1380 * In this library, contact header only contains single URI. If a message has
1381 * multiple URI in the Contact header, the URI will be put in separate Contact
1382 * headers.
1383 */
1384 typedef struct pjsip_contact_hdr
1385 {
1386 PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr);
1387 int star; /**< The contact contains only a '*'
1388 character */
1389 pjsip_uri *uri; /**< URI in the contact. */
1390 int q1000; /**< The "q" value times 1000
1391 (to avoid float) */
1392 pj_uint32_t expires; /**< Expires parameter, otherwise
1393 PJSIP_EXPIRES_NOT_SPECIFIED
1394 if not present. */
1395 pjsip_param other_param; /**< Other parameters, concatenated in
1396 a single string. */
1397 } pjsip_contact_hdr;
1398
1399
1400 /**
1401 * Create a new Contact header.
1402 *
1403 * @param pool The pool.
1404 * @return A new instance of Contact header.
1405 */
1406 PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool );
1407
1408 /**
1409 * Initialize a preallocated memory with the header structure. This function
1410 * should only be called when application uses its own memory allocation to
1411 * allocate memory block for the specified header (e.g. in C++, when the
1412 * header is allocated with "new" operator).
1413 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1414 * which allocates memory and initialize it in one go.
1415 *
1416 * @param pool Pool for additional memory allocation if required.
1417 * @param mem Pre-allocated memory to be initialized as the header.
1418 *
1419 * @return The header instance, which points to the same memory
1420 * location as the mem argument.
1421 */
1422 PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool,
1423 void *mem );
1424
1425
1426 /* **************************************************************************/
1427 /**
1428 * Content-Type.
1429 */
1430 typedef struct pjsip_ctype_hdr
1431 {
1432 PJSIP_DECL_HDR_MEMBER(struct pjsip_ctype_hdr);
1433 pjsip_media_type media; /**< Media type. */
1434 } pjsip_ctype_hdr;
1435
1436
1437 /**
1438 * Create a nwe Content Type header.
1439 *
1440 * @param pool The pool.
1441 * @return A new Content-Type header.
1442 */
1443 PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_create( pj_pool_t *pool );
1444
1445 /**
1446 * Initialize a preallocated memory with the header structure. This function
1447 * should only be called when application uses its own memory allocation to
1448 * allocate memory block for the specified header (e.g. in C++, when the
1449 * header is allocated with "new" operator).
1450 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1451 * which allocates memory and initialize it in one go.
1452 *
1453 * @param pool Pool for additional memory allocation if required.
1454 * @param mem Pre-allocated memory to be initialized as the header.
1455 *
1456 * @return The header instance, which points to the same memory
1457 * location as the mem argument.
1458 */
1459 PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool,
1460 void *mem );
1461
1462 /* **************************************************************************/
1463 /** Expires header. */
1464 typedef pjsip_generic_int_hdr pjsip_expires_hdr;
1465
1466 /**
1467 * Create a new Expires header.
1468 *
1469 * @param pool The pool.
1470 * @param value The expiration value.
1471 *
1472 * @return A new Expires header.
1473 */
1474 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
1475 unsigned value);
1476
1477 /**
1478 * Initialize a preallocated memory with the header structure. This function
1479 * should only be called when application uses its own memory allocation to
1480 * allocate memory block for the specified header (e.g. in C++, when the
1481 * header is allocated with "new" operator).
1482 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1483 * which allocates memory and initialize it in one go.
1484 *
1485 * @param pool Pool for additional memory allocation if required.
1486 * @param mem Pre-allocated memory to be initialized as the header.
1487 * @param value The expiration value.
1488 *
1489 * @return The header instance, which points to the same memory
1490 * location as the mem argument.
1491 */
1492 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
1493 void *mem,
1494 unsigned value );
1495
1496
1497
1498 /* **************************************************************************/
1499 /**
1500 * To or From header.
1501 */
1502 typedef struct pjsip_fromto_hdr
1503 {
1504 PJSIP_DECL_HDR_MEMBER(struct pjsip_fromto_hdr);
1505 pjsip_uri *uri; /**< URI in From/To header. */
1506 pj_str_t tag; /**< Header "tag" parameter. */
1507 pjsip_param other_param; /**< Other params, concatenated as a single string. */
1508 } pjsip_fromto_hdr;
1509
1510 /** Alias for From header. */
1511 typedef pjsip_fromto_hdr pjsip_from_hdr;
1512
1513 /** Alias for To header. */
1514 typedef pjsip_fromto_hdr pjsip_to_hdr;
1515
1516 /**
1517 * Create a From header.
1518 *
1519 * @param pool The pool.
1520 * @return New instance of From header.
1521 */
1522 PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool );
1523
1524 /**
1525 * Initialize a preallocated memory with the header structure. This function
1526 * should only be called when application uses its own memory allocation to
1527 * allocate memory block for the specified header (e.g. in C++, when the
1528 * header is allocated with "new" operator).
1529 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1530 * which allocates memory and initialize it in one go.
1531 *
1532 * @param pool Pool for additional memory allocation if required.
1533 * @param mem Pre-allocated memory to be initialized as the header.
1534 *
1535 * @return The header instance, which points to the same memory
1536 * location as the mem argument.
1537 */
1538 PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool,
1539 void *mem );
1540
1541 /**
1542 * Create a To header.
1543 *
1544 * @param pool The pool.
1545 * @return New instance of To header.
1546 */
1547 PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_create( pj_pool_t *pool );
1548
1549 /**
1550 * Initialize a preallocated memory with the header structure. This function
1551 * should only be called when application uses its own memory allocation to
1552 * allocate memory block for the specified header (e.g. in C++, when the
1553 * header is allocated with "new" operator).
1554 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1555 * which allocates memory and initialize it in one go.
1556 *
1557 * @param pool Pool for additional memory allocation if required.
1558 * @param mem Pre-allocated memory to be initialized as the header.
1559 *
1560 * @return The header instance, which points to the same memory
1561 * location as the mem argument.
1562 */
1563 PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool,
1564 void *mem );
1565
1566 /**
1567 * Convert the header to a From header.
1568 *
1569 * @param hdr The generic from/to header.
1570 * @return "From" header.
1571 */
1572 PJ_DECL(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr );
1573
1574 /**
1575 * Convert the header to a To header.
1576 *
1577 * @param hdr The generic from/to header.
1578 * @return "To" header.
1579 */
1580 PJ_DECL(pjsip_to_hdr*) pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr );
1581
1582
1583 /* **************************************************************************/
1584 /**
1585 * Max-Forwards header.
1586 */
1587 typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr;
1588
1589 /**
1590 * Create new Max-Forwards header instance.
1591 *
1592 * @param pool The pool.
1593 * @param value The Max-Forwards value.
1594 *
1595 * @return New Max-Forwards header instance.
1596 */
1597 PJ_DECL(pjsip_max_fwd_hdr*)
1598 pjsip_max_fwd_hdr_create(pj_pool_t *pool, unsigned value);
1599
1600
1601 /**
1602 * Initialize a preallocated memory with the header structure. This function
1603 * should only be called when application uses its own memory allocation to
1604 * allocate memory block for the specified header (e.g. in C++, when the
1605 * header is allocated with "new" operator).
1606 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1607 * which allocates memory and initialize it in one go.
1608 *
1609 * @param pool Pool for additional memory allocation if required.
1610 * @param mem Pre-allocated memory to be initialized as the header.
1611 * @param value The Max-Forwards value.
1612 *
1613 * @return The header instance, which points to the same memory
1614 * location as the mem argument.
1615 */
1616 PJ_DECL(pjsip_max_fwd_hdr*)
1617 pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, unsigned value );
1618
1619
1620 /* **************************************************************************/
1621 /**
1622 * Min-Expires header.
1623 */
1624 typedef pjsip_generic_int_hdr pjsip_min_expires_hdr;
1625
1626 /**
1627 * Create new Min-Expires header instance.
1628 *
1629 * @param pool The pool.
1630 * @param value The Min-Expires value.
1631 *
1632 * @return New Min-Expires header instance.
1633 */
1634 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
1635 unsigned value);
1636
1637
1638 /**
1639 * Initialize a preallocated memory with the header structure. This function
1640 * should only be called when application uses its own memory allocation to
1641 * allocate memory block for the specified header (e.g. in C++, when the
1642 * header is allocated with "new" operator).
1643 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1644 * which allocates memory and initialize it in one go.
1645 *
1646 * @param pool Pool for additional memory allocation if required.
1647 * @param mem Pre-allocated memory to be initialized as the header.
1648 * @param value The Min-Expires value.
1649 *
1650 * @return The header instance, which points to the same memory
1651 * location as the mem argument.
1652 */
1653 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
1654 void *mem,
1655 unsigned value );
1656
1657
1658 /* **************************************************************************/
1659 /**
1660 * Record-Route and Route headers.
1661 */
1662 typedef struct pjsip_routing_hdr
1663 {
1664 PJSIP_DECL_HDR_MEMBER(struct pjsip_routing_hdr); /**< Generic header fields. */
1665 pjsip_name_addr name_addr; /**< The URL in the Route/Record-Route header. */
1666 pjsip_param other_param; /**< Other parameter. */
1667 } pjsip_routing_hdr;
1668
1669 /** Alias for Record-Route header. */
1670 typedef pjsip_routing_hdr pjsip_rr_hdr;
1671
1672 /** Alias for Route header. */
1673 typedef pjsip_routing_hdr pjsip_route_hdr;
1674
1675
1676 /**
1677 * Create new Record-Route header from the pool.
1678 *
1679 * @param pool The pool.
1680 * @return A new instance of Record-Route header.
1681 */
1682 PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool );
1683
1684 /**
1685 * Initialize a preallocated memory with the header structure. This function
1686 * should only be called when application uses its own memory allocation to
1687 * allocate memory block for the specified header (e.g. in C++, when the
1688 * header is allocated with "new" operator).
1689 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1690 * which allocates memory and initialize it in one go.
1691 *
1692 * @param pool Pool for additional memory allocation if required.
1693 * @param mem Pre-allocated memory to be initialized as the header.
1694 *
1695 * @return The header instance, which points to the same memory
1696 * location as the mem argument.
1697 */
1698 PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool,
1699 void *mem );
1700
1701 /**
1702 * Create new Route header from the pool.
1703 *
1704 * @param pool The pool.
1705 * @return A new instance of "Route" header.
1706 */
1707 PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_create( pj_pool_t *pool );
1708
1709 /**
1710 * Initialize a preallocated memory with the header structure. This function
1711 * should only be called when application uses its own memory allocation to
1712 * allocate memory block for the specified header (e.g. in C++, when the
1713 * header is allocated with "new" operator).
1714 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1715 * which allocates memory and initialize it in one go.
1716 *
1717 * @param pool Pool for additional memory allocation if required.
1718 * @param mem Pre-allocated memory to be initialized as the header.
1719 *
1720 * @return The header instance, which points to the same memory
1721 * location as the mem argument.
1722 */
1723 PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool,
1724 void *mem );
1725
1726 /**
1727 * Convert generic routing header to Record-Route header.
1728 *
1729 * @param r The generic routing header, or a "Routing" header.
1730 * @return Record-Route header.
1731 */
1732 PJ_DECL(pjsip_rr_hdr*) pjsip_routing_hdr_set_rr( pjsip_routing_hdr *r );
1733
1734 /**
1735 * Convert generic routing header to "Route" header.
1736 *
1737 * @param r The generic routing header, or a "Record-Route" header.
1738 * @return "Route" header.
1739 */
1740 PJ_DECL(pjsip_route_hdr*) pjsip_routing_hdr_set_route( pjsip_routing_hdr *r );
1741
1742 /* **************************************************************************/
1743 /**
1744 * Require header.
1745 */
1746 typedef pjsip_generic_array_hdr pjsip_require_hdr;
1747
1748 /**
1749 * Create new Require header instance.
1750 *
1751 * @param pool The pool.
1752 *
1753 * @return New Require header instance.
1754 */
1755 PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool);
1756
1757 /**
1758 * Initialize a preallocated memory with the header structure. This function
1759 * should only be called when application uses its own memory allocation to
1760 * allocate memory block for the specified header (e.g. in C++, when the
1761 * header is allocated with "new" operator).
1762 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1763 * which allocates memory and initialize it in one go.
1764 *
1765 * @param pool Pool for additional memory allocation if required.
1766 * @param mem Pre-allocated memory to be initialized as the header.
1767 *
1768 * @return The header instance, which points to the same memory
1769 * location as the mem argument.
1770 */
1771 PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool,
1772 void *mem );
1773
1774
1775 /* **************************************************************************/
1776 /**
1777 * Retry-After header.
1778 */
1779 typedef struct pjsip_retry_after_hdr
1780 {
1781 /** Standard header field. */
1782 PJSIP_DECL_HDR_MEMBER(struct pjsip_retry_after_hdr);
1783 pj_int32_t ivalue; /**< Retry-After value */
1784 pjsip_param param; /**< Optional parameters */
1785 pj_str_t comment; /**< Optional comments. */
1786 } pjsip_retry_after_hdr;
1787
1788
1789 /**
1790 * Create new Retry-After header instance.
1791 *
1792 * @param pool The pool.
1793 * @param value The Retry-After value.
1794 *
1795 * @return New Retry-After header instance.
1796 */
1797 PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool,
1798 int value);
1799
1800 /**
1801 * Initialize a preallocated memory with the header structure.
1802 *
1803 * @param pool Pool for additional memory allocation if required.
1804 * @param mem Pre-allocated memory to be initialized as the header.
1805 * @param value The Retry-After value.
1806 *
1807 * @return The header instance, which points to the same memory
1808 * location as the mem argument.
1809 */
1810 PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool,
1811 void *mem,
1812 int value );
1813
1814
1815 /* **************************************************************************/
1816 /**
1817 * Supported header.
1818 */
1819 typedef pjsip_generic_array_hdr pjsip_supported_hdr;
1820
1821 /**
1822 * Create new Supported header instance.
1823 *
1824 * @param pool The pool.
1825 *
1826 * @return New Supported header instance.
1827 */
1828 PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool);
1829
1830 /**
1831 * Initialize a preallocated memory with the header structure.
1832 *
1833 * @param pool Pool for additional memory allocation if required.
1834 * @param mem Pre-allocated memory to be initialized as the header.
1835 *
1836 * @return The header instance, which points to the same memory
1837 * location as the mem argument.
1838 */
1839 PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool,
1840 void *mem );
1841
1842 /* **************************************************************************/
1843 /**
1844 * Unsupported header.
1845 */
1846 typedef pjsip_generic_array_hdr pjsip_unsupported_hdr;
1847
1848 /**
1849 * Create new Unsupported header instance.
1850 *
1851 * @param pool The pool.
1852 *
1853 * @return New Unsupported header instance.
1854 */
1855 PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool);
1856
1857 /**
1858 * Initialize a preallocated memory with the header structure.
1859 *
1860 * @param pool Pool for additional memory allocation if required.
1861 * @param mem Pre-allocated memory to be initialized as the header.
1862 *
1863 * @return The header instance, which points to the same memory
1864 * location as the mem argument.
1865 */
1866 PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool,
1867 void *mem );
1868
1869 /* **************************************************************************/
1870 /**
1871 * SIP Via header.
1872 * In this implementation, Via header can only have one element in each header.
1873 * If a message arrives with multiple elements in a single Via, then they will
1874 * be split up into multiple Via headers.
1875 */
1876 typedef struct pjsip_via_hdr
1877 {
1878 PJSIP_DECL_HDR_MEMBER(struct pjsip_via_hdr);
1879 pj_str_t transport; /**< Transport type. */
1880 pjsip_host_port sent_by; /**< Host and optional port */
1881 int ttl_param; /**< TTL parameter, or -1 if it's not specified. */
1882 int rport_param; /**< "rport" parameter, 0 to specify without
1883 port number, -1 means doesn't exist. */
1884 pj_str_t maddr_param; /**< "maddr" parameter. */
1885 pj_str_t recvd_param; /**< "received" parameter. */
1886 pj_str_t branch_param; /**< "branch" parameter. */
1887 pjsip_param other_param; /**< Other parameters, concatenated as single string. */
1888 pj_str_t comment; /**< Comment. */
1889 } pjsip_via_hdr;
1890
1891 /**
1892 * Create a new Via header.
1893 *
1894 * @param pool The pool.
1895 * @return A new "Via" header instance.
1896 */
1897 PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool );
1898
1899 /**
1900 * Initialize a preallocated memory with the header structure.
1901 *
1902 * @param pool Pool for additional memory allocation if required.
1903 * @param mem Pre-allocated memory to be initialized as the header.
1904 *
1905 * @return The header instance, which points to the same memory
1906 * location as the mem argument.
1907 */
1908 PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool,
1909 void *mem );
1910
1911 /* **************************************************************************/
1912 /**
1913 * SIP Warning header.
1914 * In this version, Warning header is just a typedef for generic string
1915 * header.
1916 */
1917 typedef pjsip_generic_string_hdr pjsip_warning_hdr;
1918
1919 /**
1920 * Create a warning header with the specified contents.
1921 *
1922 * @param pool Pool to allocate memory from.
1923 * @param code Warning code, 300-399.
1924 * @param host The host portion of the Warning header.
1925 * @param text The warning text, which MUST not be quoted with
1926 * double quote.
1927 *
1928 * @return The Warning header field.
1929 */
1930 PJ_DECL(pjsip_warning_hdr*) pjsip_warning_hdr_create( pj_pool_t *pool,
1931 int code,
1932 const pj_str_t *host,
1933 const pj_str_t *text);
1934
1935 /**
1936 * Create a warning header and initialize the contents from the error
1937 * message for the specified status code. The warning code will be
1938 * set to 399.
1939 *
1940 * @param pool Pool to allocate memory from.
1941 * @param host The host portion of the Warning header.
1942 * @param status The error status code, which error text will be
1943 * put in as the Warning text.
1944 *
1945 * @return The Warning header field.
1946 */
1947 PJ_DECL(pjsip_warning_hdr*)
1948 pjsip_warning_hdr_create_from_status( pj_pool_t *pool,
1949 const pj_str_t *host,
1950 pj_status_t status);
1951
1952 /* **************************************************************************/
1953 /** Accept-Encoding header. */
1954 typedef pjsip_generic_string_hdr pjsip_accept_encoding_hdr;
1955
1956 /** Create Accept-Encoding header. */
1957 #define pjsip_accept_encoding_hdr_create pjsip_generic_string_hdr_create
1958
1959 /** Accept-Language header. */
1960 typedef pjsip_generic_string_hdr pjsip_accept_lang_hdr;
1961
1962 /** Create Accept-Language header. */
1963 #define pjsip_accept_lang_hdr_create pjsip_generic_string_hdr_create
1964
1965 /** Alert-Info header. */
1966 typedef pjsip_generic_string_hdr pjsip_alert_info_hdr;
1967
1968 /** Create Alert-Info header. */
1969 #define pjsip_alert_info_hdr_create pjsip_generic_string_hdr_create
1970
1971 /** Authentication-Info header. */
1972 typedef pjsip_generic_string_hdr pjsip_auth_info_hdr;
1973
1974 /** Create Authentication-Info header. */
1975 #define pjsip_auth_info_hdr_create pjsip_generic_string_hdr_create
1976
1977 /** Call-Info header. */
1978 typedef pjsip_generic_string_hdr pjsip_call_info_hdr;
1979
1980 /** Create Call-Info header. */
1981 #define pjsip_call_info_hdr_create pjsip_generic_string_hdr_create
1982
1983 /** Content-Disposition header. */
1984 typedef pjsip_generic_string_hdr pjsip_content_disposition_hdr;
1985
1986 /** Create Content-Disposition header. */
1987 #define pjsip_content_disposition_hdr_create pjsip_generic_string_hdr_create
1988
1989 /** Content-Encoding header. */
1990 typedef pjsip_generic_string_hdr pjsip_content_encoding_hdr;
1991
1992 /** Create Content-Encoding header. */
1993 #define pjsip_content_encoding_hdr_create pjsip_generic_string_hdr_create
1994
1995 /** Content-Language header. */
1996 typedef pjsip_generic_string_hdr pjsip_content_lang_hdr;
1997
1998 /** Create Content-Language header. */
1999 #define pjsip_content_lang_hdr_create pjsip_generic_string_hdr_create
2000
2001 /** Date header. */
2002 typedef pjsip_generic_string_hdr pjsip_date_hdr;
2003
2004 /** Create Date header. */
2005 #define pjsip_date_hdr_create pjsip_generic_string_hdr_create
2006
2007 /** Error-Info header. */
2008 typedef pjsip_generic_string_hdr pjsip_err_info_hdr;
2009
2010 /** Create Error-Info header. */
2011 #define pjsip_err_info_hdr_create pjsip_generic_string_hdr_create
2012
2013 /** In-Reply-To header. */
2014 typedef pjsip_generic_string_hdr pjsip_in_reply_to_hdr;
2015
2016 /** Create In-Reply-To header. */
2017 #define pjsip_in_reply_to_hdr_create pjsip_generic_string_hdr_create
2018
2019 /** MIME-Version header. */
2020 typedef pjsip_generic_string_hdr pjsip_mime_version_hdr;
2021
2022 /** Create MIME-Version header. */
2023 #define pjsip_mime_version_hdr_create pjsip_generic_string_hdr_create
2024
2025 /** Organization header. */
2026 typedef pjsip_generic_string_hdr pjsip_organization_hdr;
2027
2028 /** Create Organization header. */
2029 #define pjsip_organization_hdr_create pjsip_genric_string_hdr_create
2030
2031 /** Priority header. */
2032 typedef pjsip_generic_string_hdr pjsip_priority_hdr;
2033
2034 /** Create Priority header. */
2035 #define pjsip_priority_hdr_create pjsip_generic_string_hdr_create
2036
2037 /** Proxy-Require header. */
2038 typedef pjsip_generic_string_hdr pjsip_proxy_require_hdr;
2039
2040 /** Reply-To header. */
2041 typedef pjsip_generic_string_hdr pjsip_reply_to_hdr;
2042
2043 /** Create Reply-To header. */
2044 #define pjsip_reply_to_hdr_create pjsip_generic_string_hdr_create
2045
2046 /** Server header. */
2047 typedef pjsip_generic_string_hdr pjsip_server_hdr;
2048
2049 /** Create Server header. */
2050 #define pjsip_server_hdr_create pjsip_generic_string_hdr_create
2051
2052 /** Subject header. */
2053 typedef pjsip_generic_string_hdr pjsip_subject_hdr;
2054
2055 /** Create Subject header. */
2056 #define pjsip_subject_hdr_create pjsip_generic_string_hdr_create
2057
2058 /** Timestamp header. */
2059 typedef pjsip_generic_string_hdr pjsip_timestamp_hdr;
2060
2061 /** Create Timestamp header. */
2062 #define pjsip_timestamp_hdr_create pjsip_generic_string_hdr_create
2063
2064 /** User-Agent header. */
2065 typedef pjsip_generic_string_hdr pjsip_user_agent_hdr;
2066
2067 /** Create User-Agent header. */
2068 #define pjsip_user_agent_hdr_create pjsip_generic_string_hdr_create
2069
2070
2071 /**
2072 * @}
2073 */
2074
2075 /**
2076 * @} PJSIP_MSG
2077 */
2078
2079
2080 PJ_END_DECL
2081
2082 #endif /* __PJSIP_SIP_MSG_H__ */
2083
2084