blob: 40fae8bc721cc795aa84df5735154839e67e4316 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001/* $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
32PJ_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 */
55typedef 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 */
77struct 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() */
89PJ_DECL_DATA(const pjsip_method) pjsip_invite_method;
90
91/** CANCEL method constant. @see pjsip_get_cancel_method() */
92PJ_DECL_DATA(const pjsip_method) pjsip_cancel_method;
93
94/** ACK method constant. @see pjsip_get_ack_method() */
95PJ_DECL_DATA(const pjsip_method) pjsip_ack_method;
96
97/** BYE method constant. @see pjsip_get_bye_method() */
98PJ_DECL_DATA(const pjsip_method) pjsip_bye_method;
99
100/** REGISTER method constant. @see pjsip_get_register_method() */
101PJ_DECL_DATA(const pjsip_method) pjsip_register_method;
102
103/** OPTIONS method constant. @see pjsip_get_options_method() */
104PJ_DECL_DATA(const pjsip_method) pjsip_options_method;
105
106/*
107 * Accessor functions for standard SIP methods.
108 */
109/** Get INVITE method constant. */
110PJ_DECL(const pjsip_method*) pjsip_get_invite_method(void);
111/** Get CANCEL method constant. */
112PJ_DECL(const pjsip_method*) pjsip_get_cancel_method(void);
113/** Get ACK method constant. */
114PJ_DECL(const pjsip_method*) pjsip_get_ack_method(void);
115/** Get BYE method constant. */
116PJ_DECL(const pjsip_method*) pjsip_get_bye_method(void);
117/** Get REGISTER method constant.*/
118PJ_DECL(const pjsip_method*) pjsip_get_register_method(void);
119/** Get OPTIONS method constant. */
120PJ_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 */
136PJ_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 */
147PJ_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 */
158PJ_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 */
169PJ_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 */
182PJ_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 */
199typedef 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 */
262typedef 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 */
324struct 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 */
339PJ_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 */
351PJ_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 */
363PJ_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 */
380typedef 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 */
390typedef 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 */
403typedef enum pjsip_status_code
404{
405 PJSIP_SC_TRYING = 100,
406 PJSIP_SC_RINGING = 180,
407 PJSIP_SC_CALL_BEING_FORWARDED = 181,
408 PJSIP_SC_QUEUED = 182,
409 PJSIP_SC_PROGRESS = 183,
410
411 PJSIP_SC_OK = 200,
412 PJSIP_SC_ACCEPTED = 202,
413
414 PJSIP_SC_MULTIPLE_CHOICES = 300,
415 PJSIP_SC_MOVED_PERMANENTLY = 301,
416 PJSIP_SC_MOVED_TEMPORARILY = 302,
417 PJSIP_SC_USE_PROXY = 305,
418 PJSIP_SC_ALTERNATIVE_SERVICE = 380,
419
420 PJSIP_SC_BAD_REQUEST = 400,
421 PJSIP_SC_UNAUTHORIZED = 401,
422 PJSIP_SC_PAYMENT_REQUIRED = 402,
423 PJSIP_SC_FORBIDDEN = 403,
424 PJSIP_SC_NOT_FOUND = 404,
425 PJSIP_SC_METHOD_NOT_ALLOWED = 405,
426 PJSIP_SC_NOT_ACCEPTABLE = 406,
427 PJSIP_SC_PROXY_AUTHENTICATION_REQUIRED = 407,
428 PJSIP_SC_REQUEST_TIMEOUT = 408,
429 PJSIP_SC_GONE = 410,
430 PJSIP_SC_REQUEST_ENTITY_TOO_LARGE = 413,
431 PJSIP_SC_REQUEST_URI_TOO_LONG = 414,
432 PJSIP_SC_UNSUPPORTED_MEDIA_TYPE = 415,
433 PJSIP_SC_UNSUPPORTED_URI_SCHEME = 416,
434 PJSIP_SC_BAD_EXTENSION = 420,
435 PJSIP_SC_EXTENSION_REQUIRED = 421,
436 PJSIP_SC_SESSION_TIMER_TOO_SMALL = 422,
437 PJSIP_SC_INTERVAL_TOO_BRIEF = 423,
438 PJSIP_SC_TEMPORARILY_UNAVAILABLE = 480,
439 PJSIP_SC_CALL_TSX_DOES_NOT_EXIST = 481,
440 PJSIP_SC_LOOP_DETECTED = 482,
441 PJSIP_SC_TOO_MANY_HOPS = 483,
442 PJSIP_SC_ADDRESS_INCOMPLETE = 484,
443 PJSIP_AC_AMBIGUOUS = 485,
444 PJSIP_SC_BUSY_HERE = 486,
445 PJSIP_SC_REQUEST_TERMINATED = 487,
446 PJSIP_SC_NOT_ACCEPTABLE_HERE = 488,
447 PJSIP_SC_BAD_EVENT = 489,
448 PJSIP_SC_REQUEST_UPDATED = 490,
449 PJSIP_SC_REQUEST_PENDING = 491,
450 PJSIP_SC_UNDECIPHERABLE = 493,
451
452 PJSIP_SC_INTERNAL_SERVER_ERROR = 500,
453 PJSIP_SC_NOT_IMPLEMENTED = 501,
454 PJSIP_SC_BAD_GATEWAY = 502,
455 PJSIP_SC_SERVICE_UNAVAILABLE = 503,
456 PJSIP_SC_SERVER_TIMEOUT = 504,
457 PJSIP_SC_VERSION_NOT_SUPPORTED = 505,
458 PJSIP_SC_MESSAGE_TOO_LARGE = 513,
459 PJSIP_SC_PRECONDITION_FAILURE = 580,
460
461 PJSIP_SC_BUSY_EVERYWHERE = 600,
462 PJSIP_SC_DECLINE = 603,
463 PJSIP_SC_DOES_NOT_EXIST_ANYWHERE = 604,
464 PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE = 606,
465
466 PJSIP_SC_TSX_TIMEOUT = PJSIP_SC_REQUEST_TIMEOUT,
467 /*PJSIP_SC_TSX_RESOLVE_ERROR = 702,*/
468 PJSIP_SC_TSX_TRANSPORT_ERROR = PJSIP_SC_SERVICE_UNAVAILABLE,
469
470 /* This is not an actual status code, but rather a constant
471 * to force GCC to use 32bit to represent this enum, since
472 * we have a code in PJSUA-LIB that assigns an integer
473 * to this enum (see pjsua_acc_get_info() function).
474 */
475 PJSIP_SC__force_32bit = 0x7FFFFFFF
476
477} pjsip_status_code;
478
479/**
480 * Get the default status text for the status code.
481 *
482 * @param status_code SIP Status Code
483 *
484 * @return textual message for the status code.
485 */
486PJ_DECL(const pj_str_t*) pjsip_get_status_text(int status_code);
487
488/**
489 * This macro returns non-zero (TRUE) if the specified status_code is
490 * in the same class as the code_class.
491 *
492 * @param status_code The status code.
493 * @param code_class The status code in the class (for example 100, 200).
494 */
495#define PJSIP_IS_STATUS_IN_CLASS(status_code, code_class) \
496 (status_code/100 == code_class/100)
497
498/**
499 * @}
500 */
501
502/* **************************************************************************/
503/**
504 * @addtogroup PJSIP_MSG_MEDIA Media/MIME Type
505 * @brief Media/MIME type declaration and manipulations.
506 * @ingroup PJSIP_MSG
507 * @{
508 */
509
510/**
511 * This structure describes SIP media type, as used for example in
512 * Accept and Content-Type header..
513 */
514typedef struct pjsip_media_type
515{
516 pj_str_t type; /**< Media type. */
517 pj_str_t subtype; /**< Media subtype. */
518 pjsip_param param; /**< Media type parameters */
519} pjsip_media_type;
520
521
522/**
523 * Initialize the media type with the specified type and subtype string.
524 *
525 * @param mt The media type.
526 * @param type Optionally specify the media type.
527 * @param subtype Optionally specify the media subtype.
528 */
529PJ_DECL(void) pjsip_media_type_init(pjsip_media_type *mt,
530 pj_str_t *type,
531 pj_str_t *subtype);
532
533/**
534 * Initialize the media type with the specified type and subtype string.
535 *
536 * @param mt The media type.
537 * @param type Optionally specify the media type.
538 * @param subtype Optionally specify the media subtype.
539 */
540PJ_DECL(void) pjsip_media_type_init2(pjsip_media_type *mt,
541 char *type,
542 char *subtype);
543
544/**
545 * Compare two media types.
546 *
547 * @param mt1 The first media type.
548 * @param mt2 The second media type.
549 * @param cmp_param Specify how to compare the media type parameters:
550 * - 0: do not compare parameters
551 * - 1: compare parameters but ignore parameters that
552 * only appear in one of the media type.
553 * - 2: compare the parameters.
554 *
555 * @return Zero if both media types are equal, -1 if mt1 < mt2,
556 * 1 if mt1 > mt2.
557 */
558PJ_DECL(int) pjsip_media_type_cmp(const pjsip_media_type *mt1,
559 const pjsip_media_type *mt2,
560 int cmp_param);
561
562/**
563 * Copy SIP media type to another.
564 *
565 * @param pool Pool to duplicate strings.
566 * @param dst Destination structure.
567 * @param src Source structure.
568 */
569PJ_DECL(void) pjsip_media_type_cp(pj_pool_t *pool,
570 pjsip_media_type *dst,
571 const pjsip_media_type *src);
572
573/**
574 * Print media type to the specified buffer.
575 *
576 * @param buf Destination buffer.
577 * @param len Length of the buffer.
578 * @param mt The media type to be printed.
579 *
580 * @return The number of characters printed to the buffer, or -1
581 * if there's not enough space in the buffer.
582 */
583PJ_DECL(int) pjsip_media_type_print(char *buf, unsigned len,
584 const pjsip_media_type *mt);
585
586/**
587 * @}
588 */
589
590/* **************************************************************************/
591/**
592 * @addtogroup PJSIP_MSG_BODY Message Body
593 * @brief SIP message body structures and manipulation.
594 * @ingroup PJSIP_MSG
595 * @{
596 */
597
598/**
599 * Generic abstraction to message body.
600 * When an incoming message is parsed (pjsip_parse_msg()), the parser fills in
601 * all members with the appropriate value. The 'data' and 'len' member will
602 * describe portion of incoming packet which denotes the message body.
603 * When application needs to attach message body to outgoing SIP message, it
604 * must fill in all members of this structure.
605 */
606struct pjsip_msg_body
607{
608 /** MIME content type.
609 * For incoming messages, the parser will fill in this member with the
610 * content type found in Content-Type header.
611 *
612 * For outgoing messages, application may fill in this member with
613 * appropriate value, because the stack will generate Content-Type header
614 * based on the value specified here.
615 *
616 * If the content_type is empty, no Content-Type AND Content-Length header
617 * will be added to the message. The stack assumes that application adds
618 * these headers themselves.
619 */
620 pjsip_media_type content_type;
621
622 /** Pointer to buffer which holds the message body data.
623 * For incoming messages, the parser will fill in this member with the
624 * pointer to the body string.
625 *
626 * When sending outgoing message, this member doesn't need to point to the
627 * actual message body string. It can be assigned with arbitrary pointer,
628 * because the value will only need to be understood by the print_body()
629 * function. The stack itself will not try to interpret this value, but
630 * instead will always call the print_body() whenever it needs to get the
631 * actual body string.
632 */
633 void *data;
634
635 /** The length of the data.
636 * For incoming messages, the parser will fill in this member with the
637 * actual length of message body.
638 *
639 * When sending outgoing message, again just like the "data" member, the
640 * "len" member doesn't need to point to the actual length of the body
641 * string.
642 */
643 unsigned len;
644
645 /** Pointer to function to print this message body.
646 * Application must set a proper function here when sending outgoing
647 * message.
648 *
649 * @param msg_body This structure itself.
650 * @param buf The buffer.
651 * @param size The buffer size.
652 *
653 * @return The length of the string printed, or -1 if there is
654 * not enough space in the buffer to print the whole
655 * message body.
656 */
657 int (*print_body)(struct pjsip_msg_body *msg_body,
658 char *buf, pj_size_t size);
659
660 /** Clone the data part only of this message body. Note that this only
661 * duplicates the data part of the body instead of the whole message
662 * body. If application wants to duplicate the entire message body
663 * structure, it must call #pjsip_msg_body_clone().
664 *
665 * @param pool Pool used to clone the data.
666 * @param data The data inside message body, to be cloned.
667 * @param len The length of the data.
668 *
669 * @return New data duplicated from the original data.
670 */
671 void* (*clone_data)(pj_pool_t *pool, const void *data, unsigned len);
672
673};
674
675/**
676 * General purpose function to textual data in a SIP body. Attach this function
677 * in a SIP message body only if the data in pjsip_msg_body is a textual
678 * message ready to be embedded in a SIP message. If the data in the message
679 * body is not a textual body, then application must supply a custom function
680 * to print that body.
681 *
682 * @param msg_body The message body.
683 * @param buf Buffer to copy the message body to.
684 * @param size The size of the buffer.
685 *
686 * @return The length copied to the buffer, or -1.
687 */
688PJ_DECL(int) pjsip_print_text_body( pjsip_msg_body *msg_body,
689 char *buf, pj_size_t size);
690
691/**
692 * General purpose function to clone textual data in a SIP body. Attach this
693 * function as "clone_data" member of the SIP body only if the data type
694 * is a text (i.e. C string, not pj_str_t), and the length indicates the
695 * length of the text.
696 *
697 * @param pool Pool used to clone the data.
698 * @param data Textual data.
699 * @param len The length of the string.
700 *
701 * @return New text duplicated from the original text.
702 */
703PJ_DECL(void*) pjsip_clone_text_data( pj_pool_t *pool, const void *data,
704 unsigned len);
705
706
707/**
708 * Clone the message body in src_body to the dst_body. This will duplicate
709 * the contents of the message body using the \a clone_data member of the
710 * source message body.
711 *
712 * @param pool Pool to use to duplicate the message body.
713 * @param dst_body Destination message body.
714 * @param src_body Source message body to duplicate.
715 *
716 * @return PJ_SUCCESS on success.
717 */
718PJ_DECL(pj_status_t) pjsip_msg_body_copy( pj_pool_t *pool,
719 pjsip_msg_body *dst_body,
720 const pjsip_msg_body *src_body );
721
722
723/**
724 * Create cloned message body. This will duplicate the contents of the message
725 * body using the \a clone_data member of the source message body.
726 *
727 * @param pool Pool to use to duplicate the message body.
728 * @param body Source message body to duplicate.
729 *
730 * @return The cloned message body on successfull.
731 */
732PJ_DECL(pjsip_msg_body*) pjsip_msg_body_clone( pj_pool_t *pool,
733 const pjsip_msg_body *body );
734
735
736/**
737 * Create a text message body. Use this function to create message body when
738 * the content is a simple text. For non-text message body (e.g.
739 * pjmedia_sdp_session or pj_xml_node), application must construct the message
740 * manually.
741 *
742 * @param pool Pool to allocate message body and its contents.
743 * @param type MIME type (e.g. "text").
744 * @param subtype MIME subtype (e.g. "plain").
745 * @param text The text content to be put in the message body.
746 *
747 * @return A new message body with the specified Content-Type and
748 * text.
749 */
750PJ_DECL(pjsip_msg_body*) pjsip_msg_body_create( pj_pool_t *pool,
751 const pj_str_t *type,
752 const pj_str_t *subtype,
753 const pj_str_t *text );
754
755/**
756 * @}
757 */
758
759/* **************************************************************************/
760/**
761 * @defgroup PJSIP_MSG_MSG Message Structure
762 * @brief SIP message (request and response) structure and operations.
763 * @ingroup PJSIP_MSG
764 * @{
765 */
766
767/**
768 * Message type (request or response).
769 */
770typedef enum pjsip_msg_type_e
771{
772 PJSIP_REQUEST_MSG, /**< Indicates request message. */
773 PJSIP_RESPONSE_MSG /**< Indicates response message. */
774} pjsip_msg_type_e;
775
776
777/**
778 * This structure describes a SIP message.
779 */
780struct pjsip_msg
781{
782 /** Message type (ie request or response). */
783 pjsip_msg_type_e type;
784
785 /** The first line of the message can be either request line for request
786 * messages, or status line for response messages. It is represented here
787 * as a union.
788 */
789 union
790 {
791 /** Request Line. */
792 struct pjsip_request_line req;
793
794 /** Status Line. */
795 struct pjsip_status_line status;
796 } line;
797
798 /** List of message headers. */
799 pjsip_hdr hdr;
800
801 /** Pointer to message body, or NULL if no message body is attached to
802 * this mesage.
803 */
804 pjsip_msg_body *body;
805};
806
807
808/**
809 * Create new request or response message.
810 *
811 * @param pool The pool.
812 * @param type Message type.
813 * @return New message, or THROW exception if failed.
814 */
815PJ_DECL(pjsip_msg*) pjsip_msg_create( pj_pool_t *pool, pjsip_msg_type_e type);
816
817
818/**
819 * Perform a deep clone of a SIP message.
820 *
821 * @param pool The pool for creating the new message.
822 * @param msg The message to be duplicated.
823 *
824 * @return New message, which is duplicated from the original
825 * message.
826 */
827PJ_DECL(pjsip_msg*) pjsip_msg_clone( pj_pool_t *pool, const pjsip_msg *msg);
828
829
830/**
831 * Find a header in the message by the header type.
832 *
833 * @param msg The message.
834 * @param type The header type to find.
835 * @param start The first header field where the search should begin.
836 * If NULL is specified, then the search will begin from the
837 * first header, otherwise the search will begin at the
838 * specified header.
839 *
840 * @return The header field, or NULL if no header with the specified
841 * type is found.
842 */
843PJ_DECL(void*) pjsip_msg_find_hdr( const pjsip_msg *msg,
844 pjsip_hdr_e type, const void *start);
845
846/**
847 * Find a header in the message by its name.
848 *
849 * @param msg The message.
850 * @param name The header name to find.
851 * @param start The first header field where the search should begin.
852 * If NULL is specified, then the search will begin from the
853 * first header, otherwise the search will begin at the
854 * specified header.
855 *
856 * @return The header field, or NULL if no header with the specified
857 * type is found.
858 */
859PJ_DECL(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
860 const pj_str_t *name,
861 const void *start);
862
863/**
864 * Find a header in the message by its name and short name version.
865 *
866 * @param msg The message.
867 * @param name The header name to find.
868 * @param sname The short name version of the header name.
869 * @param start The first header field where the search should begin.
870 * If NULL is specified, then the search will begin from the
871 * first header, otherwise the search will begin at the
872 * specified header.
873 *
874 * @return The header field, or NULL if no header with the specified
875 * type is found.
876 */
877PJ_DECL(void*) pjsip_msg_find_hdr_by_names(const pjsip_msg *msg,
878 const pj_str_t *name,
879 const pj_str_t *sname,
880 const void *start);
881
882/**
883 * Find and remove a header in the message.
884 *
885 * @param msg The message.
886 * @param hdr The header type to find.
887 * @param start The first header field where the search should begin,
888 * or NULL to search from the first header in the message.
889 *
890 * @return The header field, or NULL if not found.
891 */
892PJ_DECL(void*) pjsip_msg_find_remove_hdr( pjsip_msg *msg,
893 pjsip_hdr_e hdr, void *start);
894
895/**
896 * Add a header to the message, putting it last in the header list.
897 *
898 * @param msg The message.
899 * @param hdr The header to add.
900 *
901 * @bug Once the header is put in a list (or message), it can not be put in
902 * other list (or message). Otherwise Real Bad Thing will happen.
903 */
904PJ_INLINE(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
905{
906 pj_list_insert_before(&msg->hdr, hdr);
907}
908
909/**
910 * Add header field to the message, putting it in the front of the header list.
911 *
912 * @param msg The message.
913 * @param hdr The header to add.
914 *
915 * @bug Once the header is put in a list (or message), it can not be put in
916 * other list (or message). Otherwise Real Bad Thing will happen.
917 */
918PJ_INLINE(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr )
919{
920 pj_list_insert_after(&msg->hdr, hdr);
921}
922
923/**
924 * Print the message to the specified buffer.
925 *
926 * @param msg The message to print.
927 * @param buf The buffer
928 * @param size The size of the buffer.
929 *
930 * @return The length of the printed characters (in bytes), or NEGATIVE
931 * value if the message is too large for the specified buffer.
932 */
933PJ_DECL(pj_ssize_t) pjsip_msg_print(const pjsip_msg *msg,
934 char *buf, pj_size_t size);
935
936
937/*
938 * Some usefull macros to find common headers.
939 */
940
941
942/**
943 * Find Call-ID header.
944 *
945 * @param msg The message.
946 * @return Call-ID header instance.
947 */
948#define PJSIP_MSG_CID_HDR(msg) \
949 ((pjsip_cid_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CALL_ID, NULL))
950
951/**
952 * Find CSeq header.
953 *
954 * @param msg The message.
955 * @return CSeq header instance.
956 */
957#define PJSIP_MSG_CSEQ_HDR(msg) \
958 ((pjsip_cseq_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL))
959
960/**
961 * Find From header.
962 *
963 * @param msg The message.
964 * @return From header instance.
965 */
966#define PJSIP_MSG_FROM_HDR(msg) \
967 ((pjsip_from_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL))
968
969/**
970 * Find To header.
971 *
972 * @param msg The message.
973 * @return To header instance.
974 */
975#define PJSIP_MSG_TO_HDR(msg) \
976 ((pjsip_to_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL))
977
978
979/**
980 * @}
981 */
982
983/* **************************************************************************/
984/**
985 * @addtogroup PJSIP_MSG_HDR
986 * @{
987 */
988
989/**
990 * Generic SIP header, which contains hname and a string hvalue.
991 * Note that this header is not supposed to be used as 'base' class for headers.
992 */
993typedef struct pjsip_generic_string_hdr
994{
995 /** Standard header field. */
996 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_string_hdr);
997 /** hvalue */
998 pj_str_t hvalue;
999} pjsip_generic_string_hdr;
1000
1001
1002/**
1003 * Create a new instance of generic header. A generic header can have an
1004 * arbitrary header name.
1005 *
1006 * @param pool The pool.
1007 * @param hname The header name to be assigned to the header, or NULL to
1008 * assign the header name with some string.
1009 * @param hvalue Optional string to be assigned as the value.
1010 *
1011 * @return The header, or THROW exception.
1012 */
1013PJ_DECL(pjsip_generic_string_hdr*)
1014pjsip_generic_string_hdr_create( pj_pool_t *pool,
1015 const pj_str_t *hname,
1016 const pj_str_t *hvalue);
1017
1018
1019/**
1020 * Initialize a preallocated memory with the header structure. This function
1021 * should only be called when application uses its own memory allocation to
1022 * allocate memory block for the specified header (e.g. in C++, when the
1023 * header is allocated with "new" operator).
1024 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1025 * which allocates memory and initialize it in one go.
1026 *
1027 * @param pool Pool for additional memory allocation if required.
1028 * @param mem Pre-allocated memory to be initialized as the header.
1029 * @param hname The header name to be assigned to the header, or NULL to
1030 * assign the header name with some string later.
1031 * @param hvalue Optional string to be assigned as the value.
1032 *
1033 * @return The header instance, which points to the same memory
1034 * location as the mem argument.
1035 */
1036PJ_DECL(pjsip_generic_string_hdr*)
1037pjsip_generic_string_hdr_init( pj_pool_t *pool,
1038 void *mem,
1039 const pj_str_t *hname,
1040 const pj_str_t *hvalue);
1041
1042
1043/**
1044 * Construct a generic string header without allocating memory from the pool.
1045 * This function is useful to create a temporary header which life-time is
1046 * very short (for example, creating the header in the stack to be passed
1047 * as argument to a function which will copy the header).
1048 *
1049 * @param h The header to be initialized.
1050 * @param hname The header name to be assigned to the header, or NULL to
1051 * assign the header name with some string.
1052 * @param hvalue Optional string to be assigned as the value.
1053 *
1054 * @return The header, or THROW exception.
1055 */
1056PJ_DECL(void) pjsip_generic_string_hdr_init2(pjsip_generic_string_hdr *h,
1057 pj_str_t *hname,
1058 pj_str_t *hvalue);
1059
1060
1061/* **************************************************************************/
1062
1063/**
1064 * Generic SIP header, which contains hname and a string hvalue.
1065 */
1066typedef struct pjsip_generic_int_hdr
1067{
1068 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_int_hdr); /**< Standard header field. */
1069 pj_int32_t ivalue; /**< ivalue */
1070} pjsip_generic_int_hdr;
1071
1072
1073/**
1074 * Create a new instance of generic header. A generic header can have an
1075 * arbitrary header name.
1076 *
1077 * @param pool The pool.
1078 * @param hname The header name to be assigned to the header, or NULL to
1079 * assign the header name with some string.
1080 * @param hvalue The value to be assigned to the header.
1081 *
1082 * @return The header, or THROW exception.
1083 */
1084PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
1085 const pj_str_t *hname,
1086 int hvalue );
1087
1088
1089/**
1090 * Initialize a preallocated memory with the header structure. This function
1091 * should only be called when application uses its own memory allocation to
1092 * allocate memory block for the specified header (e.g. in C++, when the
1093 * header is allocated with "new" operator).
1094 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1095 * which allocates memory and initialize it in one go.
1096 *
1097 * @param pool Pool for additional memory allocation if required.
1098 * @param mem Pre-allocated memory to be initialized as the header.
1099 * @param hname The header name to be assigned to the header, or NULL to
1100 * assign the header name with some string later.
1101 * @param value Value to be assigned to the header.
1102 *
1103 * @return The header instance, which points to the same memory
1104 * location as the mem argument.
1105 */
1106PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_init( pj_pool_t *pool,
1107 void *mem,
1108 const pj_str_t *hname,
1109 int value );
1110
1111/* **************************************************************************/
1112
1113/** Maximum elements in the header array. */
1114#define PJSIP_GENERIC_ARRAY_MAX_COUNT 32
1115
1116/**
1117 * Generic array of string header.
1118 */
1119typedef struct pjsip_generic_array_hdr
1120{
1121 /** Standard header fields. */
1122 PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_array_hdr);
1123
1124 /** Number of tags/elements. */
1125 unsigned count;
1126
1127 /** Tags/elements. */
1128 pj_str_t values[PJSIP_GENERIC_ARRAY_MAX_COUNT];
1129
1130} pjsip_generic_array_hdr;
1131
1132/**
1133 * Create generic array header.
1134 *
1135 * @param pool Pool to allocate memory from.
1136 * @param hname Header name.
1137 *
1138 * @return New generic array header.
1139 */
1140PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_create(pj_pool_t *pool,
1141 const pj_str_t *hname);
1142
1143/**
1144 * Initialize a preallocated memory with the header structure. This function
1145 * should only be called when application uses its own memory allocation to
1146 * allocate memory block for the specified header (e.g. in C++, when the
1147 * header is allocated with "new" operator).
1148 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1149 * which allocates memory and initialize it in one go.
1150 *
1151 * @param pool Pool for additional memory allocation if required.
1152 * @param mem Pre-allocated memory to be initialized as the header.
1153 * @param hname The header name to be assigned to the header, or NULL to
1154 * assign the header name with some string later.
1155 *
1156 * @return The header instance, which points to the same memory
1157 * location as the mem argument.
1158 */
1159PJ_DECL(pjsip_generic_array_hdr*) pjsip_generic_array_hdr_init(pj_pool_t *pool,
1160 void *mem,
1161 const pj_str_t *hname);
1162
1163
1164/* **************************************************************************/
1165
1166/** Accept header. */
1167typedef pjsip_generic_array_hdr pjsip_accept_hdr;
1168
1169/** Maximum fields in Accept header. */
1170#define PJSIP_MAX_ACCEPT_COUNT PJSIP_GENERIC_ARRAY_MAX_COUNT
1171
1172/**
1173 * Create new Accept header instance.
1174 *
1175 * @param pool The pool.
1176 *
1177 * @return New Accept header instance.
1178 */
1179PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_create(pj_pool_t *pool);
1180
1181/**
1182 * Initialize a preallocated memory with the header structure. This function
1183 * should only be called when application uses its own memory allocation to
1184 * allocate memory block for the specified header (e.g. in C++, when the
1185 * header is allocated with "new" operator).
1186 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1187 * which allocates memory and initialize it in one go.
1188 *
1189 * @param pool Pool for additional memory allocation if required.
1190 * @param mem Pre-allocated memory to be initialized as the header.
1191 *
1192 * @return The header instance, which points to the same memory
1193 * location as the mem argument.
1194 */
1195PJ_DECL(pjsip_accept_hdr*) pjsip_accept_hdr_init( pj_pool_t *pool,
1196 void *mem );
1197
1198
1199/* **************************************************************************/
1200
1201/**
1202 * Allow header.
1203 */
1204typedef pjsip_generic_array_hdr pjsip_allow_hdr;
1205
1206/**
1207 * Create new Allow header instance.
1208 *
1209 * @param pool The pool.
1210 *
1211 * @return New Allow header instance.
1212 */
1213PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_create(pj_pool_t *pool);
1214
1215
1216
1217/**
1218 * Initialize a preallocated memory with the header structure. This function
1219 * should only be called when application uses its own memory allocation to
1220 * allocate memory block for the specified header (e.g. in C++, when the
1221 * header is allocated with "new" operator).
1222 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1223 * which allocates memory and initialize it in one go.
1224 *
1225 * @param pool Pool for additional memory allocation if required.
1226 * @param mem Pre-allocated memory to be initialized as the header.
1227 *
1228 * @return The header instance, which points to the same memory
1229 * location as the mem argument.
1230 */
1231PJ_DECL(pjsip_allow_hdr*) pjsip_allow_hdr_init( pj_pool_t *pool,
1232 void *mem );
1233
1234/* **************************************************************************/
1235
1236/**
1237 * Call-ID header.
1238 */
1239typedef struct pjsip_cid_hdr
1240{
1241 PJSIP_DECL_HDR_MEMBER(struct pjsip_cid_hdr);
1242 pj_str_t id; /**< Call-ID string. */
1243} pjsip_cid_hdr;
1244
1245
1246/**
1247 * Create new Call-ID header.
1248 *
1249 * @param pool The pool.
1250 *
1251 * @return new Call-ID header.
1252 */
1253PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_create( pj_pool_t *pool );
1254
1255
1256/**
1257 * Initialize a preallocated memory with the header structure. This function
1258 * should only be called when application uses its own memory allocation to
1259 * allocate memory block for the specified header (e.g. in C++, when the
1260 * header is allocated with "new" operator).
1261 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1262 * which allocates memory and initialize it in one go.
1263 *
1264 * @param pool Pool for additional memory allocation if required.
1265 * @param mem Pre-allocated memory to be initialized as the header.
1266 *
1267 * @return The header instance, which points to the same memory
1268 * location as the mem argument.
1269 */
1270PJ_DECL(pjsip_cid_hdr*) pjsip_cid_hdr_init( pj_pool_t *pool,
1271 void *mem );
1272
1273
1274
1275/* **************************************************************************/
1276/**
1277 * Content-Length header.
1278 */
1279typedef struct pjsip_clen_hdr
1280{
1281 PJSIP_DECL_HDR_MEMBER(struct pjsip_clen_hdr);
1282 int len; /**< Content length. */
1283} pjsip_clen_hdr;
1284
1285/**
1286 * Create new Content-Length header.
1287 *
1288 * @param pool the pool.
1289 * @return A new Content-Length header instance.
1290 */
1291PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_create( pj_pool_t *pool );
1292
1293/**
1294 * Initialize a preallocated memory with the header structure. This function
1295 * should only be called when application uses its own memory allocation to
1296 * allocate memory block for the specified header (e.g. in C++, when the
1297 * header is allocated with "new" operator).
1298 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1299 * which allocates memory and initialize it in one go.
1300 *
1301 * @param pool Pool for additional memory allocation if required.
1302 * @param mem Pre-allocated memory to be initialized as the header.
1303 *
1304 * @return The header instance, which points to the same memory
1305 * location as the mem argument.
1306 */
1307PJ_DECL(pjsip_clen_hdr*) pjsip_clen_hdr_init( pj_pool_t *pool,
1308 void *mem );
1309
1310
1311/* **************************************************************************/
1312/**
1313 * CSeq header.
1314 */
1315typedef struct pjsip_cseq_hdr
1316{
1317 PJSIP_DECL_HDR_MEMBER(struct pjsip_cseq_hdr);
1318 pj_int32_t cseq; /**< CSeq number. */
1319 pjsip_method method; /**< CSeq method. */
1320} pjsip_cseq_hdr;
1321
1322
1323/** Create new CSeq header.
1324 *
1325 * @param pool The pool.
1326 * @return A new CSeq header instance.
1327 */
1328PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_create( pj_pool_t *pool );
1329
1330/**
1331 * Initialize a preallocated memory with the header structure. This function
1332 * should only be called when application uses its own memory allocation to
1333 * allocate memory block for the specified header (e.g. in C++, when the
1334 * header is allocated with "new" operator).
1335 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1336 * which allocates memory and initialize it in one go.
1337 *
1338 * @param pool Pool for additional memory allocation if required.
1339 * @param mem Pre-allocated memory to be initialized as the header.
1340 *
1341 * @return The header instance, which points to the same memory
1342 * location as the mem argument.
1343 */
1344PJ_DECL(pjsip_cseq_hdr*) pjsip_cseq_hdr_init( pj_pool_t *pool,
1345 void *mem );
1346
1347/* **************************************************************************/
1348/**
1349 * Contact header.
1350 * In this library, contact header only contains single URI. If a message has
1351 * multiple URI in the Contact header, the URI will be put in separate Contact
1352 * headers.
1353 */
1354typedef struct pjsip_contact_hdr
1355{
1356 PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr);
1357 int star; /**< The contact contains only a '*' character */
1358 pjsip_uri *uri; /**< URI in the contact. */
1359 int q1000; /**< The "q" value times 1000 (to avoid float) */
1360 pj_int32_t expires; /**< Expires parameter, otherwise -1 if not present. */
1361 pjsip_param other_param; /**< Other parameters, concatenated in a single string. */
1362} pjsip_contact_hdr;
1363
1364
1365/**
1366 * Create a new Contact header.
1367 *
1368 * @param pool The pool.
1369 * @return A new instance of Contact header.
1370 */
1371PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_create( pj_pool_t *pool );
1372
1373/**
1374 * Initialize a preallocated memory with the header structure. This function
1375 * should only be called when application uses its own memory allocation to
1376 * allocate memory block for the specified header (e.g. in C++, when the
1377 * header is allocated with "new" operator).
1378 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1379 * which allocates memory and initialize it in one go.
1380 *
1381 * @param pool Pool for additional memory allocation if required.
1382 * @param mem Pre-allocated memory to be initialized as the header.
1383 *
1384 * @return The header instance, which points to the same memory
1385 * location as the mem argument.
1386 */
1387PJ_DECL(pjsip_contact_hdr*) pjsip_contact_hdr_init( pj_pool_t *pool,
1388 void *mem );
1389
1390
1391/* **************************************************************************/
1392/**
1393 * Content-Type.
1394 */
1395typedef struct pjsip_ctype_hdr
1396{
1397 PJSIP_DECL_HDR_MEMBER(struct pjsip_ctype_hdr);
1398 pjsip_media_type media; /**< Media type. */
1399} pjsip_ctype_hdr;
1400
1401
1402/**
1403 * Create a nwe Content Type header.
1404 *
1405 * @param pool The pool.
1406 * @return A new Content-Type header.
1407 */
1408PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_create( pj_pool_t *pool );
1409
1410/**
1411 * Initialize a preallocated memory with the header structure. This function
1412 * should only be called when application uses its own memory allocation to
1413 * allocate memory block for the specified header (e.g. in C++, when the
1414 * header is allocated with "new" operator).
1415 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1416 * which allocates memory and initialize it in one go.
1417 *
1418 * @param pool Pool for additional memory allocation if required.
1419 * @param mem Pre-allocated memory to be initialized as the header.
1420 *
1421 * @return The header instance, which points to the same memory
1422 * location as the mem argument.
1423 */
1424PJ_DECL(pjsip_ctype_hdr*) pjsip_ctype_hdr_init( pj_pool_t *pool,
1425 void *mem );
1426
1427/* **************************************************************************/
1428/** Expires header. */
1429typedef pjsip_generic_int_hdr pjsip_expires_hdr;
1430
1431/**
1432 * Create a new Expires header.
1433 *
1434 * @param pool The pool.
1435 * @param value The expiration value.
1436 *
1437 * @return A new Expires header.
1438 */
1439PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
1440 int value);
1441
1442/**
1443 * Initialize a preallocated memory with the header structure. This function
1444 * should only be called when application uses its own memory allocation to
1445 * allocate memory block for the specified header (e.g. in C++, when the
1446 * header is allocated with "new" operator).
1447 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1448 * which allocates memory and initialize it in one go.
1449 *
1450 * @param pool Pool for additional memory allocation if required.
1451 * @param mem Pre-allocated memory to be initialized as the header.
1452 * @param value The expiration value.
1453 *
1454 * @return The header instance, which points to the same memory
1455 * location as the mem argument.
1456 */
1457PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
1458 void *mem,
1459 int value );
1460
1461
1462
1463/* **************************************************************************/
1464/**
1465 * To or From header.
1466 */
1467typedef struct pjsip_fromto_hdr
1468{
1469 PJSIP_DECL_HDR_MEMBER(struct pjsip_fromto_hdr);
1470 pjsip_uri *uri; /**< URI in From/To header. */
1471 pj_str_t tag; /**< Header "tag" parameter. */
1472 pjsip_param other_param; /**< Other params, concatenated as a single string. */
1473} pjsip_fromto_hdr;
1474
1475/** Alias for From header. */
1476typedef pjsip_fromto_hdr pjsip_from_hdr;
1477
1478/** Alias for To header. */
1479typedef pjsip_fromto_hdr pjsip_to_hdr;
1480
1481/**
1482 * Create a From header.
1483 *
1484 * @param pool The pool.
1485 * @return New instance of From header.
1486 */
1487PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_create( pj_pool_t *pool );
1488
1489/**
1490 * Initialize a preallocated memory with the header structure. This function
1491 * should only be called when application uses its own memory allocation to
1492 * allocate memory block for the specified header (e.g. in C++, when the
1493 * header is allocated with "new" operator).
1494 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1495 * which allocates memory and initialize it in one go.
1496 *
1497 * @param pool Pool for additional memory allocation if required.
1498 * @param mem Pre-allocated memory to be initialized as the header.
1499 *
1500 * @return The header instance, which points to the same memory
1501 * location as the mem argument.
1502 */
1503PJ_DECL(pjsip_from_hdr*) pjsip_from_hdr_init( pj_pool_t *pool,
1504 void *mem );
1505
1506/**
1507 * Create a To header.
1508 *
1509 * @param pool The pool.
1510 * @return New instance of To header.
1511 */
1512PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_create( pj_pool_t *pool );
1513
1514/**
1515 * Initialize a preallocated memory with the header structure. This function
1516 * should only be called when application uses its own memory allocation to
1517 * allocate memory block for the specified header (e.g. in C++, when the
1518 * header is allocated with "new" operator).
1519 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1520 * which allocates memory and initialize it in one go.
1521 *
1522 * @param pool Pool for additional memory allocation if required.
1523 * @param mem Pre-allocated memory to be initialized as the header.
1524 *
1525 * @return The header instance, which points to the same memory
1526 * location as the mem argument.
1527 */
1528PJ_DECL(pjsip_to_hdr*) pjsip_to_hdr_init( pj_pool_t *pool,
1529 void *mem );
1530
1531/**
1532 * Convert the header to a From header.
1533 *
1534 * @param hdr The generic from/to header.
1535 * @return "From" header.
1536 */
1537PJ_DECL(pjsip_from_hdr*) pjsip_fromto_hdr_set_from( pjsip_fromto_hdr *hdr );
1538
1539/**
1540 * Convert the header to a To header.
1541 *
1542 * @param hdr The generic from/to header.
1543 * @return "To" header.
1544 */
1545PJ_DECL(pjsip_to_hdr*) pjsip_fromto_hdr_set_to( pjsip_fromto_hdr *hdr );
1546
1547
1548/* **************************************************************************/
1549/**
1550 * Max-Forwards header.
1551 */
1552typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr;
1553
1554/**
1555 * Create new Max-Forwards header instance.
1556 *
1557 * @param pool The pool.
1558 * @param value The Max-Forwards value.
1559 *
1560 * @return New Max-Forwards header instance.
1561 */
1562PJ_DECL(pjsip_max_fwd_hdr*)
1563pjsip_max_fwd_hdr_create(pj_pool_t *pool, int value);
1564
1565
1566/**
1567 * Initialize a preallocated memory with the header structure. This function
1568 * should only be called when application uses its own memory allocation to
1569 * allocate memory block for the specified header (e.g. in C++, when the
1570 * header is allocated with "new" operator).
1571 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1572 * which allocates memory and initialize it in one go.
1573 *
1574 * @param pool Pool for additional memory allocation if required.
1575 * @param mem Pre-allocated memory to be initialized as the header.
1576 * @param value The Max-Forwards value.
1577 *
1578 * @return The header instance, which points to the same memory
1579 * location as the mem argument.
1580 */
1581PJ_DECL(pjsip_max_fwd_hdr*)
1582pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value );
1583
1584
1585/* **************************************************************************/
1586/**
1587 * Min-Expires header.
1588 */
1589typedef pjsip_generic_int_hdr pjsip_min_expires_hdr;
1590
1591/**
1592 * Create new Min-Expires header instance.
1593 *
1594 * @param pool The pool.
1595 * @param value The Min-Expires value.
1596 *
1597 * @return New Min-Expires header instance.
1598 */
1599PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
1600 int value);
1601
1602
1603/**
1604 * Initialize a preallocated memory with the header structure. This function
1605 * should only be called when application uses its own memory allocation to
1606 * allocate memory block for the specified header (e.g. in C++, when the
1607 * header is allocated with "new" operator).
1608 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1609 * which allocates memory and initialize it in one go.
1610 *
1611 * @param pool Pool for additional memory allocation if required.
1612 * @param mem Pre-allocated memory to be initialized as the header.
1613 * @param value The Min-Expires value.
1614 *
1615 * @return The header instance, which points to the same memory
1616 * location as the mem argument.
1617 */
1618PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
1619 void *mem,
1620 int value );
1621
1622
1623/* **************************************************************************/
1624/**
1625 * Record-Route and Route headers.
1626 */
1627typedef struct pjsip_routing_hdr
1628{
1629 PJSIP_DECL_HDR_MEMBER(struct pjsip_routing_hdr); /**< Generic header fields. */
1630 pjsip_name_addr name_addr; /**< The URL in the Route/Record-Route header. */
1631 pjsip_param other_param; /**< Other parameter. */
1632} pjsip_routing_hdr;
1633
1634/** Alias for Record-Route header. */
1635typedef pjsip_routing_hdr pjsip_rr_hdr;
1636
1637/** Alias for Route header. */
1638typedef pjsip_routing_hdr pjsip_route_hdr;
1639
1640
1641/**
1642 * Create new Record-Route header from the pool.
1643 *
1644 * @param pool The pool.
1645 * @return A new instance of Record-Route header.
1646 */
1647PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_create( pj_pool_t *pool );
1648
1649/**
1650 * Initialize a preallocated memory with the header structure. This function
1651 * should only be called when application uses its own memory allocation to
1652 * allocate memory block for the specified header (e.g. in C++, when the
1653 * header is allocated with "new" operator).
1654 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1655 * which allocates memory and initialize it in one go.
1656 *
1657 * @param pool Pool for additional memory allocation if required.
1658 * @param mem Pre-allocated memory to be initialized as the header.
1659 *
1660 * @return The header instance, which points to the same memory
1661 * location as the mem argument.
1662 */
1663PJ_DECL(pjsip_rr_hdr*) pjsip_rr_hdr_init( pj_pool_t *pool,
1664 void *mem );
1665
1666/**
1667 * Create new Route header from the pool.
1668 *
1669 * @param pool The pool.
1670 * @return A new instance of "Route" header.
1671 */
1672PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_create( pj_pool_t *pool );
1673
1674/**
1675 * Initialize a preallocated memory with the header structure. This function
1676 * should only be called when application uses its own memory allocation to
1677 * allocate memory block for the specified header (e.g. in C++, when the
1678 * header is allocated with "new" operator).
1679 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1680 * which allocates memory and initialize it in one go.
1681 *
1682 * @param pool Pool for additional memory allocation if required.
1683 * @param mem Pre-allocated memory to be initialized as the header.
1684 *
1685 * @return The header instance, which points to the same memory
1686 * location as the mem argument.
1687 */
1688PJ_DECL(pjsip_route_hdr*) pjsip_route_hdr_init( pj_pool_t *pool,
1689 void *mem );
1690
1691/**
1692 * Convert generic routing header to Record-Route header.
1693 *
1694 * @param r The generic routing header, or a "Routing" header.
1695 * @return Record-Route header.
1696 */
1697PJ_DECL(pjsip_rr_hdr*) pjsip_routing_hdr_set_rr( pjsip_routing_hdr *r );
1698
1699/**
1700 * Convert generic routing header to "Route" header.
1701 *
1702 * @param r The generic routing header, or a "Record-Route" header.
1703 * @return "Route" header.
1704 */
1705PJ_DECL(pjsip_route_hdr*) pjsip_routing_hdr_set_route( pjsip_routing_hdr *r );
1706
1707/* **************************************************************************/
1708/**
1709 * Require header.
1710 */
1711typedef pjsip_generic_array_hdr pjsip_require_hdr;
1712
1713/**
1714 * Create new Require header instance.
1715 *
1716 * @param pool The pool.
1717 *
1718 * @return New Require header instance.
1719 */
1720PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_create(pj_pool_t *pool);
1721
1722/**
1723 * Initialize a preallocated memory with the header structure. This function
1724 * should only be called when application uses its own memory allocation to
1725 * allocate memory block for the specified header (e.g. in C++, when the
1726 * header is allocated with "new" operator).
1727 * For normal applications, they should use pjsip_xxx_hdr_create() instead,
1728 * which allocates memory and initialize it in one go.
1729 *
1730 * @param pool Pool for additional memory allocation if required.
1731 * @param mem Pre-allocated memory to be initialized as the header.
1732 *
1733 * @return The header instance, which points to the same memory
1734 * location as the mem argument.
1735 */
1736PJ_DECL(pjsip_require_hdr*) pjsip_require_hdr_init( pj_pool_t *pool,
1737 void *mem );
1738
1739
1740/* **************************************************************************/
1741/**
1742 * Retry-After header.
1743 */
1744typedef struct pjsip_retry_after_hdr
1745{
1746 /** Standard header field. */
1747 PJSIP_DECL_HDR_MEMBER(struct pjsip_retry_after_hdr);
1748 pj_int32_t ivalue; /**< Retry-After value */
1749 pjsip_param param; /**< Optional parameters */
1750 pj_str_t comment; /**< Optional comments. */
1751} pjsip_retry_after_hdr;
1752
1753
1754/**
1755 * Create new Retry-After header instance.
1756 *
1757 * @param pool The pool.
1758 * @param value The Retry-After value.
1759 *
1760 * @return New Retry-After header instance.
1761 */
1762PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_create(pj_pool_t *pool,
1763 int value);
1764
1765/**
1766 * Initialize a preallocated memory with the header structure.
1767 *
1768 * @param pool Pool for additional memory allocation if required.
1769 * @param mem Pre-allocated memory to be initialized as the header.
1770 * @param value The Retry-After value.
1771 *
1772 * @return The header instance, which points to the same memory
1773 * location as the mem argument.
1774 */
1775PJ_DECL(pjsip_retry_after_hdr*) pjsip_retry_after_hdr_init( pj_pool_t *pool,
1776 void *mem,
1777 int value );
1778
1779
1780/* **************************************************************************/
1781/**
1782 * Supported header.
1783 */
1784typedef pjsip_generic_array_hdr pjsip_supported_hdr;
1785
1786/**
1787 * Create new Supported header instance.
1788 *
1789 * @param pool The pool.
1790 *
1791 * @return New Supported header instance.
1792 */
1793PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_create(pj_pool_t *pool);
1794
1795/**
1796 * Initialize a preallocated memory with the header structure.
1797 *
1798 * @param pool Pool for additional memory allocation if required.
1799 * @param mem Pre-allocated memory to be initialized as the header.
1800 *
1801 * @return The header instance, which points to the same memory
1802 * location as the mem argument.
1803 */
1804PJ_DECL(pjsip_supported_hdr*) pjsip_supported_hdr_init( pj_pool_t *pool,
1805 void *mem );
1806
1807/* **************************************************************************/
1808/**
1809 * Unsupported header.
1810 */
1811typedef pjsip_generic_array_hdr pjsip_unsupported_hdr;
1812
1813/**
1814 * Create new Unsupported header instance.
1815 *
1816 * @param pool The pool.
1817 *
1818 * @return New Unsupported header instance.
1819 */
1820PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_create(pj_pool_t *pool);
1821
1822/**
1823 * Initialize a preallocated memory with the header structure.
1824 *
1825 * @param pool Pool for additional memory allocation if required.
1826 * @param mem Pre-allocated memory to be initialized as the header.
1827 *
1828 * @return The header instance, which points to the same memory
1829 * location as the mem argument.
1830 */
1831PJ_DECL(pjsip_unsupported_hdr*) pjsip_unsupported_hdr_init( pj_pool_t *pool,
1832 void *mem );
1833
1834/* **************************************************************************/
1835/**
1836 * SIP Via header.
1837 * In this implementation, Via header can only have one element in each header.
1838 * If a message arrives with multiple elements in a single Via, then they will
1839 * be split up into multiple Via headers.
1840 */
1841typedef struct pjsip_via_hdr
1842{
1843 PJSIP_DECL_HDR_MEMBER(struct pjsip_via_hdr);
1844 pj_str_t transport; /**< Transport type. */
1845 pjsip_host_port sent_by; /**< Host and optional port */
1846 int ttl_param; /**< TTL parameter, or -1 if it's not specified. */
1847 int rport_param; /**< "rport" parameter, 0 to specify without
1848 port number, -1 means doesn't exist. */
1849 pj_str_t maddr_param; /**< "maddr" parameter. */
1850 pj_str_t recvd_param; /**< "received" parameter. */
1851 pj_str_t branch_param; /**< "branch" parameter. */
1852 pjsip_param other_param; /**< Other parameters, concatenated as single string. */
1853 pj_str_t comment; /**< Comment. */
1854} pjsip_via_hdr;
1855
1856/**
1857 * Create a new Via header.
1858 *
1859 * @param pool The pool.
1860 * @return A new "Via" header instance.
1861 */
1862PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_create( pj_pool_t *pool );
1863
1864/**
1865 * Initialize a preallocated memory with the header structure.
1866 *
1867 * @param pool Pool for additional memory allocation if required.
1868 * @param mem Pre-allocated memory to be initialized as the header.
1869 *
1870 * @return The header instance, which points to the same memory
1871 * location as the mem argument.
1872 */
1873PJ_DECL(pjsip_via_hdr*) pjsip_via_hdr_init( pj_pool_t *pool,
1874 void *mem );
1875
1876/* **************************************************************************/
1877/**
1878 * SIP Warning header.
1879 * In this version, Warning header is just a typedef for generic string
1880 * header.
1881 */
1882typedef pjsip_generic_string_hdr pjsip_warning_hdr;
1883
1884/**
1885 * Create a warning header with the specified contents.
1886 *
1887 * @param pool Pool to allocate memory from.
1888 * @param code Warning code, 300-399.
1889 * @param host The host portion of the Warning header.
1890 * @param text The warning text, which MUST not be quoted with
1891 * double quote.
1892 *
1893 * @return The Warning header field.
1894 */
1895PJ_DECL(pjsip_warning_hdr*) pjsip_warning_hdr_create( pj_pool_t *pool,
1896 int code,
1897 const pj_str_t *host,
1898 const pj_str_t *text);
1899
1900/**
1901 * Create a warning header and initialize the contents from the error
1902 * message for the specified status code. The warning code will be
1903 * set to 399.
1904 *
1905 * @param pool Pool to allocate memory from.
1906 * @param host The host portion of the Warning header.
1907 * @param status The error status code, which error text will be
1908 * put in as the Warning text.
1909 *
1910 * @return The Warning header field.
1911 */
1912PJ_DECL(pjsip_warning_hdr*)
1913pjsip_warning_hdr_create_from_status( pj_pool_t *pool,
1914 const pj_str_t *host,
1915 pj_status_t status);
1916
1917/* **************************************************************************/
1918/** Accept-Encoding header. */
1919typedef pjsip_generic_string_hdr pjsip_accept_encoding_hdr;
1920
1921/** Create Accept-Encoding header. */
1922#define pjsip_accept_encoding_hdr_create pjsip_generic_string_hdr_create
1923
1924/** Accept-Language header. */
1925typedef pjsip_generic_string_hdr pjsip_accept_lang_hdr;
1926
1927/** Create Accept-Language header. */
1928#define pjsip_accept_lang_hdr_create pjsip_generic_string_hdr_create
1929
1930/** Alert-Info header. */
1931typedef pjsip_generic_string_hdr pjsip_alert_info_hdr;
1932
1933/** Create Alert-Info header. */
1934#define pjsip_alert_info_hdr_create pjsip_generic_string_hdr_create
1935
1936/** Authentication-Info header. */
1937typedef pjsip_generic_string_hdr pjsip_auth_info_hdr;
1938
1939/** Create Authentication-Info header. */
1940#define pjsip_auth_info_hdr_create pjsip_generic_string_hdr_create
1941
1942/** Call-Info header. */
1943typedef pjsip_generic_string_hdr pjsip_call_info_hdr;
1944
1945/** Create Call-Info header. */
1946#define pjsip_call_info_hdr_create pjsip_generic_string_hdr_create
1947
1948/** Content-Disposition header. */
1949typedef pjsip_generic_string_hdr pjsip_content_disposition_hdr;
1950
1951/** Create Content-Disposition header. */
1952#define pjsip_content_disposition_hdr_create pjsip_generic_string_hdr_create
1953
1954/** Content-Encoding header. */
1955typedef pjsip_generic_string_hdr pjsip_content_encoding_hdr;
1956
1957/** Create Content-Encoding header. */
1958#define pjsip_content_encoding_hdr_create pjsip_generic_string_hdr_create
1959
1960/** Content-Language header. */
1961typedef pjsip_generic_string_hdr pjsip_content_lang_hdr;
1962
1963/** Create Content-Language header. */
1964#define pjsip_content_lang_hdr_create pjsip_generic_string_hdr_create
1965
1966/** Date header. */
1967typedef pjsip_generic_string_hdr pjsip_date_hdr;
1968
1969/** Create Date header. */
1970#define pjsip_date_hdr_create pjsip_generic_string_hdr_create
1971
1972/** Error-Info header. */
1973typedef pjsip_generic_string_hdr pjsip_err_info_hdr;
1974
1975/** Create Error-Info header. */
1976#define pjsip_err_info_hdr_create pjsip_generic_string_hdr_create
1977
1978/** In-Reply-To header. */
1979typedef pjsip_generic_string_hdr pjsip_in_reply_to_hdr;
1980
1981/** Create In-Reply-To header. */
1982#define pjsip_in_reply_to_hdr_create pjsip_generic_string_hdr_create
1983
1984/** MIME-Version header. */
1985typedef pjsip_generic_string_hdr pjsip_mime_version_hdr;
1986
1987/** Create MIME-Version header. */
1988#define pjsip_mime_version_hdr_create pjsip_generic_string_hdr_create
1989
1990/** Organization header. */
1991typedef pjsip_generic_string_hdr pjsip_organization_hdr;
1992
1993/** Create Organization header. */
1994#define pjsip_organization_hdr_create pjsip_genric_string_hdr_create
1995
1996/** Priority header. */
1997typedef pjsip_generic_string_hdr pjsip_priority_hdr;
1998
1999/** Create Priority header. */
2000#define pjsip_priority_hdr_create pjsip_generic_string_hdr_create
2001
2002/** Proxy-Require header. */
2003typedef pjsip_generic_string_hdr pjsip_proxy_require_hdr;
2004
2005/** Reply-To header. */
2006typedef pjsip_generic_string_hdr pjsip_reply_to_hdr;
2007
2008/** Create Reply-To header. */
2009#define pjsip_reply_to_hdr_create pjsip_generic_string_hdr_create
2010
2011/** Server header. */
2012typedef pjsip_generic_string_hdr pjsip_server_hdr;
2013
2014/** Create Server header. */
2015#define pjsip_server_hdr_create pjsip_generic_string_hdr_create
2016
2017/** Subject header. */
2018typedef pjsip_generic_string_hdr pjsip_subject_hdr;
2019
2020/** Create Subject header. */
2021#define pjsip_subject_hdr_create pjsip_generic_string_hdr_create
2022
2023/** Timestamp header. */
2024typedef pjsip_generic_string_hdr pjsip_timestamp_hdr;
2025
2026/** Create Timestamp header. */
2027#define pjsip_timestamp_hdr_create pjsip_generic_string_hdr_create
2028
2029/** User-Agent header. */
2030typedef pjsip_generic_string_hdr pjsip_user_agent_hdr;
2031
2032/** Create User-Agent header. */
2033#define pjsip_user_agent_hdr_create pjsip_generic_string_hdr_create
2034
2035
2036/**
2037 * @}
2038 */
2039
2040/**
2041 * @} PJSIP_MSG
2042 */
2043
2044
2045PJ_END_DECL
2046
2047#endif /* __PJSIP_SIP_MSG_H__ */
2048