📄 sip_protos.h
字号:
* 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 * * max_forwards = sip_max_forwards_dup(home, sip->sip_max_forwards); * * @endcode * * @return * The function sip_max_forwards_dup() returns a pointer to the * newly duplicated sip_max_forwards_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_max_forwards_t *sip_max_forwards_dup(su_home_t *home, sip_max_forwards_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_max_forwards_t *sip_max_forwards_dup(su_home_t *home, sip_max_forwards_t const *hdr){ return (sip_max_forwards_t *) msg_header_dup_as(home, sip_max_forwards_class, (msg_header_t const *)hdr);}#endif/**Copy a sip_max_forwards_t header structure. * * The function sip_max_forwards_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 * * max_forwards = sip_max_forwards_copy(home, sip->sip_max_forwards); * * @endcode * * @return * The function sip_max_forwards_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_max_forwards_t *sip_max_forwards_copy(su_home_t *home, sip_max_forwards_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_max_forwards_t *sip_max_forwards_copy(su_home_t *home, sip_max_forwards_t const *hdr) { return (sip_max_forwards_t *) msg_header_copy_as(home, sip_max_forwards_class, (msg_header_t const *)hdr); }#endif/**Make a header structure sip_max_forwards_t. * * The function sip_max_forwards_make() makes a new * sip_max_forwards_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_max_forwards_make() returns a pointer to * newly maked sip_max_forwards_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline #endifsip_max_forwards_t *sip_max_forwards_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_max_forwards_t *sip_max_forwards_make(su_home_t *home, char const *s){ return (sip_max_forwards_t *)sip_header_make(home, sip_max_forwards_class, s);}#endif/**Make a Max-Forwards header from formatting result. * * The function sip_max_forwards_format() makes a new * Max-Forwards 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_max_forwards_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifsip_max_forwards_t *sip_max_forwards_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_max_forwards_t *sip_max_forwards_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_max_forwards_class, fmt, ap); va_end(ap); return (sip_max_forwards_t *)h;}#endif/** @} *//**@addtogroup sip_proxy_require * @{ *//** Parse a Proxy-Require header. @internal */int sip_proxy_require_d(su_home_t *home, msg_header_t *h, char *s, int slen);/** Print a Proxy-Require header. @internal */int sip_proxy_require_e(char b[], int bsiz, msg_header_t const *h, int flags);/**Access a sip_proxy_require_t from sip_t. * */#define sip_proxy_require(sip) \ ((sip_proxy_require_t *)msg_header_access((msg_pub_t*)(sip), sip_proxy_require_class))/**Initializer for structure sip_proxy_require_t. * * A static sip_proxy_require_t structure must be initialized. * The SIP_PROXY_REQUIRE_INIT() macro provides initialization value. * For instance, * @code * * sip_proxy_require_t sip_proxy_require = SIP_PROXY_REQUIRE_INIT; * * @endcode * @HI */#define SIP_PROXY_REQUIRE_INIT() SIP_HDR_INIT(proxy_require)/**Initialize a structure sip_proxy_require_t. * * An sip_proxy_require_t structure can be initialized with the * sip_proxy_require_init() function/macro. For instance, * @code * * sip_proxy_require_t sip_proxy_require; * * sip_proxy_require_init(&sip_proxy_require); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline sip_proxy_require_t *sip_proxy_require_init(sip_proxy_require_t x[1]){ return SIP_HEADER_INIT(x, sip_proxy_require_class, sizeof(sip_proxy_require_t));}#else#define sip_proxy_require_init(x) \ SIP_HEADER_INIT(x, sip_proxy_require_class, sizeof(sip_proxy_require_t))#endif/**Test if header object is instance of sip_proxy_require_t. * * The function sip_is_proxy_require() returns true (nonzero) if * the header class is an instance of Proxy-Require header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function sip_is_proxy_require() returns true (nonzero) if * the header object is an instance of header proxy_require and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int sip_is_proxy_require(sip_header_t const *header){ return header && header->sh_class->hc_hash == sip_proxy_require_hash;}#elseint sip_is_proxy_require(sip_header_t const *header);#endif#define sip_proxy_require_p(h) sip_is_proxy_require((h))/**Duplicate (deep copy) @c sip_proxy_require_t. * * The function sip_proxy_require_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 * * proxy_require = sip_proxy_require_dup(home, sip->sip_proxy_require); * * @endcode * * @return * The function sip_proxy_require_dup() returns a pointer to the * newly duplicated sip_proxy_require_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_proxy_require_t *sip_proxy_require_dup(su_home_t *home, sip_proxy_require_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_proxy_require_t *sip_proxy_require_dup(su_home_t *home, sip_proxy_require_t const *hdr){ return (sip_proxy_require_t *) msg_header_dup_as(home, sip_proxy_require_class, (msg_header_t const *)hdr);}#endif/**Copy a sip_proxy_require_t header structure. * * The function sip_proxy_require_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 * * proxy_require = sip_proxy_require_copy(home, sip->sip_proxy_require); * * @endcode * * @return * The function sip_proxy_require_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifsip_proxy_require_t *sip_proxy_require_copy(su_home_t *home, sip_proxy_require_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_proxy_require_t *sip_proxy_require_copy(su_home_t *home, sip_proxy_require_t const *hdr) { return (sip_proxy_require_t *) msg_header_copy_as(home, sip_proxy_require_class, (msg_header_t const *)hdr); }#endif/**Make a header structure sip_proxy_require_t. * * The function sip_proxy_require_make() makes a new * sip_proxy_require_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_proxy_require_make() returns a pointer to * newly maked sip_proxy_require_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline #endifsip_proxy_require_t *sip_proxy_require_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_proxy_require_t *sip_proxy_require_make(su_home_t *home, char const *s){ return (sip_proxy_require_t *)sip_header_make(home, sip_proxy_require_class, s);}#endif/**Make a Proxy-Require header from formatting result. * * The function sip_proxy_require_format() makes a new * Proxy-Require 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_proxy_require_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifsip_proxy_require_t *sip_proxy_require_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_proxy_require_t *sip_proxy_require_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_proxy_require_class, fmt, ap); va_end(ap); return (sip_proxy_require_t *)h;}#endif/** @} *//**@addtogroup sip_from * @{ *//** Parse a From header. @internal */int sip_from_d(su_home_t *home, msg_header_t *h, char *s, int slen);/** Print a From header. @internal */int sip_from_e(char b[], int bsiz, msg_header_t const *h, int flags);/**Access a sip_from_t from sip_t. * */#define sip_from(sip) \ ((sip_from_t *)msg_header_access((msg_pub_t*)(sip), sip_from_class))/**Initializer for structure sip_from_t. * * A static sip_from_t structure must be initialized. * The SIP_FROM_INIT() macro provides initialization value. * For instance, * @code * * sip_from_t sip_from = SIP_FROM_INIT; * * @endcode * @HI */#define SIP_FROM_INIT() SIP_HDR_INIT(from)/**Initialize a structure sip_from_t. * * An sip_from_t structure can be initialized with the * sip_from_init() function/macro. For instance, * @code * * sip_from_t sip_from; * * sip_from_init(&sip_from); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline sip_from_t *sip_from_init(sip_from_t x[1]){ return SIP_HEADER_INIT(x, sip_from_class, sizeof(sip_from_t));}#else#define sip_from_init(x) \ SIP_HEADER_INIT(x, sip_from_class, sizeof(sip_from_t))#endif/**Test if header object is instance of sip_from_t. * * The function sip_is_from() returns true (nonzero) if * the header class is an instance of From header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function sip_is_from() returns true (nonzero) if * the header object is an instance of header from and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int sip_is_from(sip_header_t const *header){ return header && header->sh_class->hc_hash == sip_from_hash;}#elseint sip_is_from(sip_header_t const *header);#endif#define sip_from_p(h) sip_is_from((h))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -