📄 sip_protos.h
字号:
/**Duplicate (deep copy) @c sip_from_t. * * The function sip_from_dup() duplicates a header * structure @a hdr. If the header structure @a hdr * contains a reference (@c hdr->x_next) to a list of * headers, all the headers in the list are duplicated, too. * * @param home memory home used to allocate new structure * @param hdr header structure to be duplicated * * When duplicating, all parameter lists and non-constant * strings attached to the header are copied, too. The * function uses given memory @a home to allocate all the * memory areas used to copy the header. * * @par Example * @code * * from = sip_from_dup(home, sip->sip_from); * * @endcode * * @return * The function sip_from_dup() returns a pointer to the * newly duplicated sip_from_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_from_t *sip_from_dup(su_home_t *home, sip_from_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_from_t *sip_from_dup(su_home_t *home, sip_from_t const *hdr){ return (sip_from_t *) msg_header_dup_as(home, sip_from_class, (msg_header_t const *)hdr);}#endif/**Copy a sip_from_t header structure. * * The function sip_from_copy() copies a header structure @a * hdr. If the header structure @a hdr contains a reference (@c * hdr->h_next) to a list of headers, all the headers in that * list are copied, too. The function uses given memory @a home * to allocate all the memory areas used to copy the header * structure @a hdr. * * @param home memory home used to allocate new structure * @param hdr pointer to the header structure to be copied * * When copying, only the header structure and parameter lists attached to * it are duplicated. The new header structure retains all the references to * the strings within the old @a hdr header, including the encoding of the * old header, if present. * * @par Example * @code * * from = sip_from_copy(home, sip->sip_from); * * @endcode * * @return * The function sip_from_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_from_t *sip_from_copy(su_home_t *home, sip_from_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_from_t *sip_from_copy(su_home_t *home, sip_from_t const *hdr) { return (sip_from_t *) msg_header_copy_as(home, sip_from_class, (msg_header_t const *)hdr); }#endif/**Make a header structure sip_from_t. * * The function sip_from_make() makes a new * sip_from_t header structure. It allocates a new * header structure, and decodes the string @a s as the * value of the structure. * * @param home memory home used to allocate new header structure. * @param s string to be decoded as value of the new header structure * * @note This function is usually implemented as a macro calling * sip_header_make(). * * @return * The function sip_from_make() returns a pointer to * newly maked sip_from_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline #endifsip_from_t *sip_from_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_from_t *sip_from_make(su_home_t *home, char const *s){ return (sip_from_t *)sip_header_make(home, sip_from_class, s);}#endif/**Make a From header from formatting result. * * The function sip_from_format() makes a new * From header object using formatting result as its * value. The function first prints the arguments according to * the format @a fmt specified. Then it allocates a new header * structure, and uses the formatting result as the header * value. * * @param home memory home used to allocate new header structure. * @param fmt string used as a printf()-style format * @param ... argument list for format * * @note This function is usually implemented as a macro calling * msg_header_format(). * * @return * The function sip_from_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifsip_from_t *sip_from_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_from_t *sip_from_format(su_home_t *home, char const *fmt, ...){ sip_header_t *h; va_list ap; va_start(ap, fmt); h = sip_header_vformat(home, sip_from_class, fmt, ap); va_end(ap); return (sip_from_t *)h;}#endif/** @} *//**@addtogroup sip_to * @{ *//** Parse a To header. @internal */int sip_to_d(su_home_t *home, msg_header_t *h, char *s, int slen);/** Print a To header. @internal */int sip_to_e(char b[], int bsiz, msg_header_t const *h, int flags);/**Access a sip_to_t from sip_t. * */#define sip_to(sip) \ ((sip_to_t *)msg_header_access((msg_pub_t*)(sip), sip_to_class))/**Initializer for structure sip_to_t. * * A static sip_to_t structure must be initialized. * The SIP_TO_INIT() macro provides initialization value. * For instance, * @code * * sip_to_t sip_to = SIP_TO_INIT; * * @endcode * @HI */#define SIP_TO_INIT() SIP_HDR_INIT(to)/**Initialize a structure sip_to_t. * * An sip_to_t structure can be initialized with the * sip_to_init() function/macro. For instance, * @code * * sip_to_t sip_to; * * sip_to_init(&sip_to); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline sip_to_t *sip_to_init(sip_to_t x[1]){ return SIP_HEADER_INIT(x, sip_to_class, sizeof(sip_to_t));}#else#define sip_to_init(x) \ SIP_HEADER_INIT(x, sip_to_class, sizeof(sip_to_t))#endif/**Test if header object is instance of sip_to_t. * * The function sip_is_to() returns true (nonzero) if * the header class is an instance of To header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function sip_is_to() returns true (nonzero) if * the header object is an instance of header to and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int sip_is_to(sip_header_t const *header){ return header && header->sh_class->hc_hash == sip_to_hash;}#elseint sip_is_to(sip_header_t const *header);#endif#define sip_to_p(h) sip_is_to((h))/**Duplicate (deep copy) @c sip_to_t. * * The function sip_to_dup() duplicates a header * structure @a hdr. If the header structure @a hdr * contains a reference (@c hdr->x_next) to a list of * headers, all the headers in the list are duplicated, too. * * @param home memory home used to allocate new structure * @param hdr header structure to be duplicated * * When duplicating, all parameter lists and non-constant * strings attached to the header are copied, too. The * function uses given memory @a home to allocate all the * memory areas used to copy the header. * * @par Example * @code * * to = sip_to_dup(home, sip->sip_to); * * @endcode * * @return * The function sip_to_dup() returns a pointer to the * newly duplicated sip_to_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_to_t *sip_to_dup(su_home_t *home, sip_to_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_to_t *sip_to_dup(su_home_t *home, sip_to_t const *hdr){ return (sip_to_t *) msg_header_dup_as(home, sip_to_class, (msg_header_t const *)hdr);}#endif/**Copy a sip_to_t header structure. * * The function sip_to_copy() copies a header structure @a * hdr. If the header structure @a hdr contains a reference (@c * hdr->h_next) to a list of headers, all the headers in that * list are copied, too. The function uses given memory @a home * to allocate all the memory areas used to copy the header * structure @a hdr. * * @param home memory home used to allocate new structure * @param hdr pointer to the header structure to be copied * * When copying, only the header structure and parameter lists attached to * it are duplicated. The new header structure retains all the references to * the strings within the old @a hdr header, including the encoding of the * old header, if present. * * @par Example * @code * * to = sip_to_copy(home, sip->sip_to); * * @endcode * * @return * The function sip_to_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_to_t *sip_to_copy(su_home_t *home, sip_to_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_to_t *sip_to_copy(su_home_t *home, sip_to_t const *hdr) { return (sip_to_t *) msg_header_copy_as(home, sip_to_class, (msg_header_t const *)hdr); }#endif/**Make a header structure sip_to_t. * * The function sip_to_make() makes a new * sip_to_t header structure. It allocates a new * header structure, and decodes the string @a s as the * value of the structure. * * @param home memory home used to allocate new header structure. * @param s string to be decoded as value of the new header structure * * @note This function is usually implemented as a macro calling * sip_header_make(). * * @return * The function sip_to_make() returns a pointer to * newly maked sip_to_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline #endifsip_to_t *sip_to_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_to_t *sip_to_make(su_home_t *home, char const *s){ return (sip_to_t *)sip_header_make(home, sip_to_class, s);}#endif/**Make a To header from formatting result. * * The function sip_to_format() makes a new * To header object using formatting result as its * value. The function first prints the arguments according to * the format @a fmt specified. Then it allocates a new header * structure, and uses the formatting result as the header * value. * * @param home memory home used to allocate new header structure. * @param fmt string used as a printf()-style format * @param ... argument list for format * * @note This function is usually implemented as a macro calling * msg_header_format(). * * @return * The function sip_to_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifsip_to_t *sip_to_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_to_t *sip_to_format(su_home_t *home, char const *fmt, ...){ sip_header_t *h; va_list ap; va_start(ap, fmt); h = sip_header_vformat(home, sip_to_class, fmt, ap); va_end(ap); return (sip_to_t *)h;}#endif/** @} *//**@addtogroup sip_call_id * @{ *//** Parse a Call-ID header. @internal */int sip_call_id_d(su_home_t *home, msg_header_t *h, char *s, int slen);/** Print a Call-ID header. @internal */int sip_call_id_e(char b[], int bsiz, msg_header_t const *h, int flags);/**Access a sip_call_id_t from sip_t. * */#define sip_call_id(sip) \ ((sip_call_id_t *)msg_header_access((msg_pub_t*)(sip), sip_call_id_class))/**Initializer for structure sip_call_id_t. * * A static sip_call_id_t structure must be initialized. * The SIP_CALL_ID_INIT() macro provides initialization value. * For instance, * @code * * sip_call_id_t sip_call_id = SIP_CALL_ID_INIT; * * @endcode * @HI */#define SIP_CALL_ID_INIT() SIP_HDR_INIT(call_id)/**Initialize a structure sip_call_id_t. * * An sip_call_id_t structure can be initialized with the * sip_call_id_init() function/macro. For instance, * @code * * sip_call_id_t sip_call_id; * * sip_call_id_init(&sip_call_id); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline sip_call_id_t *sip_call_id_init(sip_call_id_t x[1]){ return SIP_HEADER_INIT(x, sip_call_id_class, sizeof(sip_call_id_t));}#else#define sip_call_id_init(x) \ SIP_HEADER_INIT(x, sip_call_id_class, sizeof(sip_call_id_t))#endif/**Test if header object is instance of sip_call_id_t. * * The function sip_is_call_id() returns true (nonzero) if * the header class is an instance of Call-ID header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function sip_is_call_id() returns true (nonzero) if * the header object is an instance of header call_id and * false (zero) otherwise
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -