Group PJSIP_MSG_HDR

group PJSIP_MSG_HDR

Declarations for various SIP header fields.

Defines

PJSIP_DECL_HDR_MEMBER(hdr)

Generic fields for all SIP headers are declared using this macro, to make sure that all headers will have exactly the same layout in their start of the storage. This behaves like C++ inheritance actually.

PJSIP_GENERIC_ARRAY_MAX_COUNT

Maximum elements in the header array.

PJSIP_MAX_ACCEPT_COUNT

Maximum fields in Accept header.

PJSIP_EXPIRES_NOT_SPECIFIED

Expires not specified.

pjsip_accept_encoding_hdr_create

Create Accept-Encoding header.

pjsip_accept_lang_hdr_create

Create Accept-Language header.

pjsip_alert_info_hdr_create

Create Alert-Info header.

pjsip_auth_info_hdr_create

Create Authentication-Info header.

pjsip_call_info_hdr_create

Create Call-Info header.

pjsip_content_disposition_hdr_create

Create Content-Disposition header.

pjsip_content_encoding_hdr_create

Create Content-Encoding header.

pjsip_content_lang_hdr_create

Create Content-Language header.

pjsip_date_hdr_create

Create Date header.

pjsip_err_info_hdr_create

Create Error-Info header.

pjsip_in_reply_to_hdr_create

Create In-Reply-To header.

pjsip_mime_version_hdr_create

Create MIME-Version header.

pjsip_organization_hdr_create

Create Organization header.

pjsip_priority_hdr_create

Create Priority header.

pjsip_reply_to_hdr_create

Create Reply-To header.

pjsip_server_hdr_create

Create Server header.

pjsip_subject_hdr_create

Create Subject header.

pjsip_timestamp_hdr_create

Create Timestamp header.

pjsip_user_agent_hdr_create

Create User-Agent header.

Typedefs

typedef pjsip_generic_array_hdr pjsip_accept_hdr

Accept header.

typedef pjsip_generic_array_hdr pjsip_allow_hdr

Allow header.

typedef pjsip_generic_int_hdr pjsip_expires_hdr

Expires header.

typedef pjsip_fromto_hdr pjsip_from_hdr

Alias for From header.

typedef pjsip_fromto_hdr pjsip_to_hdr

Alias for To header.

typedef pjsip_generic_int_hdr pjsip_max_fwd_hdr

Max-Forwards header.

typedef pjsip_generic_int_hdr pjsip_min_expires_hdr

Min-Expires header.

typedef pjsip_routing_hdr pjsip_rr_hdr

Alias for Record-Route header.

typedef pjsip_routing_hdr pjsip_route_hdr

Alias for Route header.

typedef pjsip_generic_array_hdr pjsip_require_hdr

Require header.

typedef pjsip_generic_array_hdr pjsip_supported_hdr

Supported header.

typedef pjsip_generic_array_hdr pjsip_unsupported_hdr

Unsupported header.

typedef pjsip_generic_string_hdr pjsip_warning_hdr

SIP Warning header. In this version, Warning header is just a typedef for generic string header.

typedef pjsip_generic_string_hdr pjsip_accept_encoding_hdr

Accept-Encoding header.

typedef pjsip_generic_string_hdr pjsip_accept_lang_hdr

Accept-Language header.

typedef pjsip_generic_string_hdr pjsip_alert_info_hdr

Alert-Info header.

typedef pjsip_generic_string_hdr pjsip_auth_info_hdr

Authentication-Info header.

typedef pjsip_generic_string_hdr pjsip_call_info_hdr

Call-Info header.

typedef pjsip_generic_string_hdr pjsip_content_disposition_hdr

Content-Disposition header.

typedef pjsip_generic_string_hdr pjsip_content_encoding_hdr

Content-Encoding header.

typedef pjsip_generic_string_hdr pjsip_content_lang_hdr

Content-Language header.

typedef pjsip_generic_string_hdr pjsip_date_hdr

Date header.

typedef pjsip_generic_string_hdr pjsip_err_info_hdr

Error-Info header.

typedef pjsip_generic_string_hdr pjsip_in_reply_to_hdr

In-Reply-To header.

typedef pjsip_generic_string_hdr pjsip_mime_version_hdr

MIME-Version header.

typedef pjsip_generic_string_hdr pjsip_organization_hdr

Organization header.

typedef pjsip_generic_string_hdr pjsip_priority_hdr

Priority header.

typedef pjsip_generic_string_hdr pjsip_proxy_require_hdr

Proxy-Require header.

typedef pjsip_generic_string_hdr pjsip_reply_to_hdr

Reply-To header.

typedef pjsip_generic_string_hdr pjsip_server_hdr

Server header.

typedef pjsip_generic_string_hdr pjsip_subject_hdr

Subject header.

typedef pjsip_generic_string_hdr pjsip_timestamp_hdr

Timestamp header.

typedef pjsip_generic_string_hdr pjsip_user_agent_hdr

User-Agent header.

Enums

enum pjsip_hdr_e

Header types, as defined by RFC3261.

Values:

enumerator PJSIP_H_ACCEPT
enumerator PJSIP_H_ACCEPT_ENCODING_UNIMP
enumerator PJSIP_H_ACCEPT_LANGUAGE_UNIMP
enumerator PJSIP_H_ALERT_INFO_UNIMP
enumerator PJSIP_H_ALLOW
enumerator PJSIP_H_AUTHENTICATION_INFO_UNIMP
enumerator PJSIP_H_AUTHORIZATION
enumerator PJSIP_H_CALL_ID
enumerator PJSIP_H_CALL_INFO_UNIMP
enumerator PJSIP_H_CONTACT
enumerator PJSIP_H_CONTENT_DISPOSITION_UNIMP
enumerator PJSIP_H_CONTENT_ENCODING_UNIMP
enumerator PJSIP_H_CONTENT_LANGUAGE_UNIMP
enumerator PJSIP_H_CONTENT_LENGTH
enumerator PJSIP_H_CONTENT_TYPE
enumerator PJSIP_H_CSEQ
enumerator PJSIP_H_DATE_UNIMP
enumerator PJSIP_H_ERROR_INFO_UNIMP
enumerator PJSIP_H_EXPIRES
enumerator PJSIP_H_FROM
enumerator PJSIP_H_IN_REPLY_TO_UNIMP
enumerator PJSIP_H_MAX_FORWARDS
enumerator PJSIP_H_MIME_VERSION_UNIMP
enumerator PJSIP_H_MIN_EXPIRES
enumerator PJSIP_H_ORGANIZATION_UNIMP
enumerator PJSIP_H_PRIORITY_UNIMP
enumerator PJSIP_H_PROXY_AUTHENTICATE
enumerator PJSIP_H_PROXY_AUTHORIZATION
enumerator PJSIP_H_PROXY_REQUIRE_UNIMP
enumerator PJSIP_H_RECORD_ROUTE
enumerator PJSIP_H_REPLY_TO_UNIMP
enumerator PJSIP_H_REQUIRE
enumerator PJSIP_H_RETRY_AFTER
enumerator PJSIP_H_ROUTE
enumerator PJSIP_H_SERVER_UNIMP
enumerator PJSIP_H_SUBJECT_UNIMP
enumerator PJSIP_H_SUPPORTED
enumerator PJSIP_H_TIMESTAMP_UNIMP
enumerator PJSIP_H_TO
enumerator PJSIP_H_UNSUPPORTED
enumerator PJSIP_H_USER_AGENT_UNIMP
enumerator PJSIP_H_VIA
enumerator PJSIP_H_WARNING_UNIMP
enumerator PJSIP_H_WWW_AUTHENTICATE
enumerator PJSIP_H_OTHER

Functions

pjsip_authorization_hdr *pjsip_authorization_hdr_create(pj_pool_t *pool)

Create SIP Authorization header.

Parameters:

pool – Pool where memory will be allocated from.

Returns:

SIP Authorization header.

pjsip_proxy_authorization_hdr *pjsip_proxy_authorization_hdr_create(pj_pool_t *pool)

Create SIP Proxy-Authorization header.

Parameters:

pool – Pool where memory will be allocated from.

Returns:

SIP Proxy-Authorization header.

pjsip_www_authenticate_hdr *pjsip_www_authenticate_hdr_create(pj_pool_t *pool)

Create SIP WWW-Authenticate header.

Parameters:

pool – Pool where memory will be allocated from.

Returns:

SIP WWW-Authenticate header.

pjsip_proxy_authenticate_hdr *pjsip_proxy_authenticate_hdr_create(pj_pool_t *pool)

Create SIP Proxy-Authenticate header.

Parameters:

pool – Pool where memory will be allocated from.

Returns:

SIP Proxy-Authenticate header.

void *pjsip_hdr_clone(pj_pool_t *pool, const void *hdr)

This generic function will clone any header, by calling “clone” function in header’s virtual function table.

Parameters:
  • pool – The pool to allocate memory from.

  • hdr – The header to clone.

Returns:

A new instance copied from the original header.

void *pjsip_hdr_shallow_clone(pj_pool_t *pool, const void *hdr)

This generic function will clone any header, by calling “shallow_clone” function in header’s virtual function table.

Parameters:
  • pool – The pool to allocate memory from.

  • hdr – The header to clone.

Returns:

A new instance copied from the original header.

int pjsip_hdr_print_on(void *hdr, char *buf, pj_size_t len)

This generic function will print any header, by calling “print” function in header’s virtual function table.

Parameters:
  • hdr – The header to print.

  • buf – The buffer.

  • len – The size of the buffer.

Returns:

The size copied to buffer, or -1 if there’s not enough space.

void *pjsip_hdr_find(const void *hdr_list, pjsip_hdr_e type, const void *start)

Find a header in a header list by the header type.

Parameters:
  • hdr_list – The “head” of the header list.

  • type – The header type to find.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns:

The header field, or NULL if no header with the specified type is found.

void *pjsip_hdr_find_by_name(const void *hdr_list, const pj_str_t *name, const void *start)

Find a header in a header list by its name.

Parameters:
  • hdr_list – The “head” of the header list.

  • name – The header name to find.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns:

The header field, or NULL if no header with the specified type is found.

void *pjsip_hdr_find_by_names(const void *hdr_list, const pj_str_t *name, const pj_str_t *sname, const void *start)

Find a header in a header list by its name and short name version.

Parameters:
  • hdr_list – The “head” of the header list.

  • name – The header name to find.

  • sname – The short name version of the header name.

  • start – The first header field where the search should begin. If NULL is specified, then the search will begin from the first header, otherwise the search will begin at the specified header.

Returns:

The header field, or NULL if no header with the specified type is found.

pjsip_generic_string_hdr *pjsip_generic_string_hdr_create(pj_pool_t *pool, const pj_str_t *hname, const pj_str_t *hvalue)

Create a new instance of generic header. A generic header can have an arbitrary header name.

Parameters:
  • pool – The pool.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string.

  • hvalue – Optional string to be assigned as the value.

Returns:

The header, or THROW exception.

pjsip_generic_string_hdr *pjsip_generic_string_hdr_init(pj_pool_t *pool, void *mem, const pj_str_t *hname, const pj_str_t *hvalue)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string later.

  • hvalue – Optional string to be assigned as the value.

Returns:

The header instance, which points to the same memory location as the mem argument.

void pjsip_generic_string_hdr_init2(pjsip_generic_string_hdr *h, pj_str_t *hname, pj_str_t *hvalue)

Construct a generic string header without allocating memory from the pool. This function is useful to create a temporary header which life-time is very short (for example, creating the header in the stack to be passed as argument to a function which will copy the header).

Parameters:
  • h – The header to be initialized.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string.

  • hvalue – Optional string to be assigned as the value.

pjsip_generic_int_hdr *pjsip_generic_int_hdr_create(pj_pool_t *pool, const pj_str_t *hname, unsigned hvalue)

Create a new instance of generic header. A generic header can have an arbitrary header name.

Parameters:
  • pool – The pool.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string.

  • hvalue – The value to be assigned to the header.

Returns:

The header, or THROW exception.

pjsip_generic_int_hdr *pjsip_generic_int_hdr_init(pj_pool_t *pool, void *mem, const pj_str_t *hname, unsigned value)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string later.

  • value – Value to be assigned to the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_generic_array_hdr *pjsip_generic_array_hdr_create(pj_pool_t *pool, const pj_str_t *hname)

Create generic array header.

Parameters:
  • pool – Pool to allocate memory from.

  • hname – Header name.

Returns:

New generic array header.

pjsip_generic_array_hdr *pjsip_generic_array_hdr_init(pj_pool_t *pool, void *mem, const pj_str_t *hname)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • hname – The header name to be assigned to the header, or NULL to assign the header name with some string later.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_accept_hdr *pjsip_accept_hdr_create(pj_pool_t *pool)

Create new Accept header instance.

Parameters:

pool – The pool.

Returns:

New Accept header instance.

pjsip_accept_hdr *pjsip_accept_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_allow_hdr *pjsip_allow_hdr_create(pj_pool_t *pool)

Create new Allow header instance.

Parameters:

pool – The pool.

Returns:

New Allow header instance.

pjsip_allow_hdr *pjsip_allow_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_cid_hdr *pjsip_cid_hdr_create(pj_pool_t *pool)

Create new Call-ID header.

Parameters:

pool – The pool.

Returns:

new Call-ID header.

pjsip_cid_hdr *pjsip_cid_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_clen_hdr *pjsip_clen_hdr_create(pj_pool_t *pool)

Create new Content-Length header.

Parameters:

pool – the pool.

Returns:

A new Content-Length header instance.

pjsip_clen_hdr *pjsip_clen_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_cseq_hdr *pjsip_cseq_hdr_create(pj_pool_t *pool)

Create new CSeq header.

Parameters:

pool – The pool.

Returns:

A new CSeq header instance.

pjsip_cseq_hdr *pjsip_cseq_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_contact_hdr *pjsip_contact_hdr_create(pj_pool_t *pool)

Create a new Contact header.

Parameters:

pool – The pool.

Returns:

A new instance of Contact header.

pjsip_contact_hdr *pjsip_contact_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_ctype_hdr *pjsip_ctype_hdr_create(pj_pool_t *pool)

Create a nwe Content Type header.

Parameters:

pool – The pool.

Returns:

A new Content-Type header.

pjsip_ctype_hdr *pjsip_ctype_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_expires_hdr *pjsip_expires_hdr_create(pj_pool_t *pool, unsigned value)

Create a new Expires header.

Parameters:
  • pool – The pool.

  • value – The expiration value.

Returns:

A new Expires header.

pjsip_expires_hdr *pjsip_expires_hdr_init(pj_pool_t *pool, void *mem, unsigned value)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • value – The expiration value.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_from_hdr *pjsip_from_hdr_create(pj_pool_t *pool)

Create a From header.

Parameters:

pool – The pool.

Returns:

New instance of From header.

pjsip_from_hdr *pjsip_from_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_to_hdr *pjsip_to_hdr_create(pj_pool_t *pool)

Create a To header.

Parameters:

pool – The pool.

Returns:

New instance of To header.

pjsip_to_hdr *pjsip_to_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_from_hdr *pjsip_fromto_hdr_set_from(pjsip_fromto_hdr *hdr)

Convert the header to a From header.

Parameters:

hdr – The generic from/to header.

Returns:

“From” header.

pjsip_to_hdr *pjsip_fromto_hdr_set_to(pjsip_fromto_hdr *hdr)

Convert the header to a To header.

Parameters:

hdr – The generic from/to header.

Returns:

“To” header.

pjsip_max_fwd_hdr *pjsip_max_fwd_hdr_create(pj_pool_t *pool, unsigned value)

Create new Max-Forwards header instance.

Parameters:
  • pool – The pool.

  • value – The Max-Forwards value.

Returns:

New Max-Forwards header instance.

pjsip_max_fwd_hdr *pjsip_max_fwd_hdr_init(pj_pool_t *pool, void *mem, unsigned value)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • value – The Max-Forwards value.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_min_expires_hdr *pjsip_min_expires_hdr_create(pj_pool_t *pool, unsigned value)

Create new Min-Expires header instance.

Parameters:
  • pool – The pool.

  • value – The Min-Expires value.

Returns:

New Min-Expires header instance.

pjsip_min_expires_hdr *pjsip_min_expires_hdr_init(pj_pool_t *pool, void *mem, unsigned value)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • value – The Min-Expires value.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_rr_hdr *pjsip_rr_hdr_create(pj_pool_t *pool)

Create new Record-Route header from the pool.

Parameters:

pool – The pool.

Returns:

A new instance of Record-Route header.

pjsip_rr_hdr *pjsip_rr_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_route_hdr *pjsip_route_hdr_create(pj_pool_t *pool)

Create new Route header from the pool.

Parameters:

pool – The pool.

Returns:

A new instance of “Route” header.

pjsip_route_hdr *pjsip_route_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_rr_hdr *pjsip_routing_hdr_set_rr(pjsip_routing_hdr *r)

Convert generic routing header to Record-Route header.

Parameters:

r – The generic routing header, or a “Routing” header.

Returns:

Record-Route header.

pjsip_route_hdr *pjsip_routing_hdr_set_route(pjsip_routing_hdr *r)

Convert generic routing header to “Route” header.

Parameters:

r – The generic routing header, or a “Record-Route” header.

Returns:

“Route” header.

pjsip_require_hdr *pjsip_require_hdr_create(pj_pool_t *pool)

Create new Require header instance.

Parameters:

pool – The pool.

Returns:

New Require header instance.

pjsip_require_hdr *pjsip_require_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure. This function should only be called when application uses its own memory allocation to allocate memory block for the specified header (e.g. in C++, when the header is allocated with “new” operator). For normal applications, they should use pjsip_xxx_hdr_create() instead, which allocates memory and initialize it in one go.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_retry_after_hdr *pjsip_retry_after_hdr_create(pj_pool_t *pool, int value)

Create new Retry-After header instance.

Parameters:
  • pool – The pool.

  • value – The Retry-After value.

Returns:

New Retry-After header instance.

pjsip_retry_after_hdr *pjsip_retry_after_hdr_init(pj_pool_t *pool, void *mem, int value)

Initialize a preallocated memory with the header structure.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

  • value – The Retry-After value.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_supported_hdr *pjsip_supported_hdr_create(pj_pool_t *pool)

Create new Supported header instance.

Parameters:

pool – The pool.

Returns:

New Supported header instance.

pjsip_supported_hdr *pjsip_supported_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_unsupported_hdr *pjsip_unsupported_hdr_create(pj_pool_t *pool)

Create new Unsupported header instance.

Parameters:

pool – The pool.

Returns:

New Unsupported header instance.

pjsip_unsupported_hdr *pjsip_unsupported_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_via_hdr *pjsip_via_hdr_create(pj_pool_t *pool)

Create a new Via header.

Parameters:

pool – The pool.

Returns:

A new “Via” header instance.

pjsip_via_hdr *pjsip_via_hdr_init(pj_pool_t *pool, void *mem)

Initialize a preallocated memory with the header structure.

Parameters:
  • pool – Pool for additional memory allocation if required.

  • mem – Pre-allocated memory to be initialized as the header.

Returns:

The header instance, which points to the same memory location as the mem argument.

pjsip_warning_hdr *pjsip_warning_hdr_create(pj_pool_t *pool, int code, const pj_str_t *host, const pj_str_t *text)

Create a warning header with the specified contents.

Parameters:
  • pool – Pool to allocate memory from.

  • code – Warning code, 300-399.

  • host – The host portion of the Warning header.

  • text – The warning text, which MUST not be quoted with double quote.

Returns:

The Warning header field.

pjsip_warning_hdr *pjsip_warning_hdr_create_from_status(pj_pool_t *pool, const pj_str_t *host, pj_status_t status)

Create a warning header and initialize the contents from the error message for the specified status code. The warning code will be set to 399.

Parameters:
  • pool – Pool to allocate memory from.

  • host – The host portion of the Warning header.

  • status – The error status code, which error text will be put in as the Warning text.

Returns:

The Warning header field.

struct pjsip_common_credential
#include <sip_auth_msg.h>

Common credential structure represents common credential fields present in Authorization/Proxy-Authorization header.

Public Members

pj_str_t realm

Credential’s realm.

pjsip_param other_param

Other parameters.

struct pjsip_digest_credential
#include <sip_auth_msg.h>

This structure describe credential used in Authorization and Proxy-Authorization header for digest authentication scheme.

Public Members

pj_str_t realm

Realm of the credential

pjsip_param other_param

Other parameters.

pj_str_t username

Username parameter.

pj_str_t nonce

Nonce parameter.

pj_str_t uri

URI parameter.

pj_str_t response

Response digest.

pj_str_t algorithm

Algorithm.

pj_str_t cnonce

Cnonce.

pj_str_t opaque

Opaque value.

pj_str_t qop

Quality of protection.

pj_str_t nc

Nonce count.

struct pjsip_pgp_credential
#include <sip_auth_msg.h>

This structure describe credential used in Authorization and Proxy-Authorization header for PGP authentication scheme.

Public Members

pj_str_t realm

Realm.

pjsip_param other_param

Other parameters.

pj_str_t version

Version parameter.

pj_str_t signature

Signature parameter.

pj_str_t signed_by

Signed by parameter.

pj_str_t nonce

Nonce parameter.

struct pjsip_oauth_credential
#include <sip_auth_msg.h>

This structure describe credential used in Authorization and Proxy-Authorization header for OAuth authentication scheme.

Public Members

pj_str_t realm

Realm of the credential

pjsip_param other_param

Other parameters.

pj_str_t username

Username parameter.

pj_str_t token

Token parameter.

struct pjsip_authorization_hdr
#include <sip_auth_msg.h>

This structure describes SIP Authorization header (and also SIP Proxy-Authorization header).

SIP Proxy-Authorization header shares the same structure as SIP Authorization header.

Public Functions

PJSIP_DECL_HDR_MEMBER(struct pjsip_authorization_hdr)

Standard header fiends.

Public Members

pj_str_t scheme

Authorization scheme.

pjsip_common_credential common

Common fields.

pjsip_digest_credential digest

Digest credentials.

pjsip_pgp_credential pgp

PGP credentials.

pjsip_oauth_credential oauth

OAuth credentials.

union pjsip_authorization_hdr::[anonymous] credential

Type of credentials, depending on the scheme.

struct pjsip_common_challenge
#include <sip_auth_msg.h>

This structure describes common fields in authentication challenge headers (WWW-Authenticate and Proxy-Authenticate).

Public Members

pj_str_t realm

Realm for the challenge.

pjsip_param other_param

Other parameters.

struct pjsip_digest_challenge
#include <sip_auth_msg.h>

This structure describes authentication challenge used in Proxy-Authenticate or WWW-Authenticate for digest authentication scheme.

Public Members

pj_str_t realm

Realm for the challenge.

pjsip_param other_param

Other parameters.

pj_str_t domain

Domain.

pj_str_t nonce

Nonce challenge.

pj_str_t opaque

Opaque value.

int stale

Stale parameter.

pj_str_t algorithm

Algorithm parameter.

pj_str_t qop

Quality of protection.

struct pjsip_pgp_challenge
#include <sip_auth_msg.h>

This structure describes authentication challenge used in Proxy-Authenticate or WWW-Authenticate for PGP authentication scheme.

Public Members

pj_str_t realm

Realm for the challenge.

pjsip_param other_param

Other parameters.

pj_str_t version

PGP version.

pj_str_t micalgorithm

micalgorithm parameter.

pj_str_t pubalgorithm

pubalgorithm parameter.

pj_str_t nonce

Nonce challenge.

struct pjsip_www_authenticate_hdr
#include <sip_auth_msg.h>

This structure describe SIP WWW-Authenticate header (Proxy-Authenticate header also uses the same structure).

WWW-Authenticate header.

Proxy-Authenticate header.

Public Functions

PJSIP_DECL_HDR_MEMBER(struct pjsip_www_authenticate_hdr)

Standard header fields.

Public Members

pj_str_t scheme

Authentication scheme

pjsip_common_challenge common

Common fields.

pjsip_digest_challenge digest

Digest challenge.

pjsip_pgp_challenge pgp

PGP challenge.

union pjsip_www_authenticate_hdr::[anonymous] challenge

This union contains structures that are only relevant depending on the value of the scheme being used.

struct pjsip_hdr_vptr
#include <sip_msg.h>

This structure provides the pointer to basic functions that are needed for generic header operations. All header fields will have pointer to this structure, so that they can be manipulated uniformly.

Public Members

void *(*clone)(pj_pool_t *pool, const void *hdr)

Function to clone the header.

Param pool:

Memory pool to allocate the new header.

Param hdr:

Header to clone.

Return:

A new instance of the header.

void *(*shallow_clone)(pj_pool_t *pool, const void *hdr)

Pointer to function to shallow clone the header. Shallow cloning will just make a memory copy of the original header, thus all pointers in original header will be kept intact. Because the function does not need to perform deep copy, the operation should be faster, but the application must make sure that the original header is still valid throughout the lifetime of new header.

Param pool:

Memory pool to allocate the new header.

Param hdr:

The header to clone.

int (*print_on)(void *hdr, char *buf, pj_size_t len)

Pointer to function to print the header to the specified buffer. Returns the length of string written, or -1 if the remaining buffer is not enough to hold the header.

Param hdr:

The header to print.

Param buf:

The buffer.

Param len:

The size of the buffer.

Return:

The size copied to buffer, or -1 if there’s not enough space.

struct pjsip_hdr
#include <sip_msg.h>

Generic SIP header structure, for generic manipulation for headers in the message. All header fields can be typecasted to this type.

Forward declaration for header field (sip_msg.h).

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

struct pjsip_generic_string_hdr
#include <sip_msg.h>

Generic SIP header, which contains hname and a string hvalue. Note that this header is not supposed to be used as ‘base’ class for headers.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_generic_string_hdr)

Standard header field. List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_str_t hvalue

hvalue

struct pjsip_generic_int_hdr
#include <sip_msg.h>

Generic SIP header, which contains hname and an integer ivalue.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_generic_int_hdr)

Standard header field. List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_uint32_t ivalue

ivalue

struct pjsip_generic_array_hdr
#include <sip_msg.h>

Generic array of string header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_generic_array_hdr)

Standard header fields. List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

unsigned count

Number of tags/elements.

pj_str_t values[32]

Tags/elements.

struct pjsip_cid_hdr
#include <sip_msg.h>

Call-ID header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_cid_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_str_t id

Call-ID string.

struct pjsip_clen_hdr
#include <sip_msg.h>

Content-Length header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_clen_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

int len

Content length.

struct pjsip_cseq_hdr
#include <sip_msg.h>

CSeq header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_cseq_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_int32_t cseq

CSeq number.

pjsip_method method

CSeq method.

struct pjsip_contact_hdr
#include <sip_msg.h>

Contact header. In this library, contact header only contains single URI. If a message has multiple URI in the Contact header, the URI will be put in separate Contact headers.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_contact_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

int star

The contact contains only a ‘*’ character

pjsip_uri *uri

URI in the contact.

int q1000

The “q” value times 1000 (to avoid float)

pj_uint32_t expires

Expires parameter, otherwise PJSIP_EXPIRES_NOT_SPECIFIED if not present.

pjsip_param other_param

Other parameters, concatenated in a single string.

struct pjsip_ctype_hdr
#include <sip_msg.h>

Content-Type.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_ctype_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pjsip_media_type media

Media type.

struct pjsip_fromto_hdr
#include <sip_msg.h>

To or From header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_fromto_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pjsip_uri *uri

URI in From/To header.

pj_str_t tag

Header “tag” parameter.

pjsip_param other_param

Other params, concatenated as a single string.

struct pjsip_routing_hdr
#include <sip_msg.h>

Record-Route and Route headers.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_routing_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table. Generic header fields.

pjsip_name_addr name_addr

The URL in the Route/Record-Route header.

pjsip_param other_param

Other parameter.

struct pjsip_retry_after_hdr
#include <sip_msg.h>

Retry-After header.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_retry_after_hdr)

Standard header field. List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_int32_t ivalue

Retry-After value

pjsip_param param

Optional parameters

pj_str_t comment

Optional comments.

struct pjsip_via_hdr
#include <sip_msg.h>

SIP Via header. In this implementation, Via header can only have one element in each header. If a message arrives with multiple elements in a single Via, then they will be split up into multiple Via headers.

Public Functions

PJ_DECL_LIST_MEMBER(struct pjsip_via_hdr)

List members.

Public Members

pjsip_hdr_e type

Header type

pj_str_t name

Header name.

pj_str_t sname

Header short name version.

pjsip_hdr_vptr *vptr

Virtual function table.

pj_str_t transport

Transport type.

pjsip_host_port sent_by

Host and optional port

int ttl_param

TTL parameter, or -1 if it’s not specified.

int rport_param

“rport” parameter, 0 to specify without port number, -1 means doesn’t exist.

pj_str_t maddr_param

“maddr” parameter.

pj_str_t recvd_param

“received” parameter.

pj_str_t branch_param

“branch” parameter.

pjsip_param other_param

Other parameters, concatenated as single string.

pj_str_t comment

Comment.