📄 sip_extra.h
字号:
{ return (tag_value_t)vp; }#else#define siptag_alert_info_v(v) (tag_value_t)(v)#define siptag_alert_info_vr(vp) (tag_value_t)(vp)#endif/** Defined as 1 if the @ref sip_reply_to "Reply-To header" is supported */#define SIP_HAVE_REPLY_TO 1enum { /**@ingroup sip_reply_to @internal * * Hash of @ref sip_reply_to "Reply-To header". * * @since New in @NEW_1_12_7. */ sip_reply_to_hash = 38016 };/**Header class for @ref sip_reply_to "Reply-To header". * * The header class sip_reply_to_class defines how a SIP * @ref sip_reply_to "Reply-To header" is parsed and printed. * It also contains methods used by SIP parser and other functions to * manipulate the #sip_reply_to_t header structure. * * @ingroup sip_reply_to * * @since New in @NEW_1_12_7. */SIP_DLL extern msg_hclass_t sip_reply_to_class[];/**@addtogroup sip_reply_to * @{ *//** Parse a SIP @ref sip_reply_to "Reply-To header". @internal */SOFIAPUBFUN issize_t sip_reply_to_d(su_home_t *, msg_header_t *, char *s, isize_t slen);/** Print a SIP @ref sip_reply_to "Reply-To header". @internal */SOFIAPUBFUN issize_t sip_reply_to_e(char b[], isize_t bsiz, msg_header_t const *h, int flags);/**Access a SIP @ref sip_reply_to "Reply-To header" * structure #sip_reply_to_t from #sip_t. * * @since New in @NEW_1_12_7. */#define sip_reply_to(sip) \ ((sip_reply_to_t *)msg_header_access((msg_pub_t*)(sip), sip_reply_to_class))/**Initializer for structure #sip_reply_to_t. * * A static #sip_reply_to_t structure for * @ref sip_reply_to "Reply-To header" must be initialized with * the SIP_REPLY_TO_INIT() macro. * For instance, * @code * * sip_reply_to_t sip_reply_to = SIP_REPLY_TO_INIT; * * @endcode * @HI * * @since New in @NEW_1_12_7. */#define SIP_REPLY_TO_INIT() SIP_HDR_INIT(reply_to)/**Initialize a structure #sip_reply_to_t. * * An #sip_reply_to_t structure for * @ref sip_reply_to "Reply-To header" can be initialized with the * sip_reply_to_init() function/macro. For instance, * @code * * sip_reply_to_t sip_reply_to; * * sip_reply_to_init(&sip_reply_to); * * @endcode * @HI * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline sip_reply_to_t *sip_reply_to_init(sip_reply_to_t x[1]){ return SIP_HEADER_INIT(x, sip_reply_to_class, sizeof(sip_reply_to_t));}#else#define sip_reply_to_init(x) \ SIP_HEADER_INIT(x, sip_reply_to_class, sizeof(sip_reply_to_t))#endif/**Test if header object is instance of #sip_reply_to_t. * * Check if the header class is an instance of * @ref sip_reply_to "Reply-To header" object and return true (nonzero), * otherwise return false (zero). * * @param header pointer to the header structure to be tested * * @retval 1 (true) if the @a header is an instance of header reply_to * @retval 0 (false) otherwise * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline int sip_is_reply_to(sip_header_t const *header){ return header && header->sh_class->hc_hash == sip_reply_to_hash;}#elseint sip_is_reply_to(sip_header_t const *header);#endif#define sip_reply_to_p(h) sip_is_reply_to((h))/**Duplicate a list of @ref sip_reply_to "Reply-To header" header structures #sip_reply_to_t. * * Duplicate 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 * * reply_to = sip_reply_to_dup(home, sip->sip_reply_to); * * @endcode * * @return * A pointer to the * newly duplicated #sip_reply_to_t header structure, or NULL * upon an error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline#endifsip_reply_to_t *sip_reply_to_dup(su_home_t *home, sip_reply_to_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_reply_to_t *sip_reply_to_dup(su_home_t *home, sip_reply_to_t const *hdr){ return (sip_reply_to_t *) msg_header_dup_as(home, sip_reply_to_class, (msg_header_t const *)hdr);}#endif/**Copy a list of @ref sip_reply_to "Reply-To header" header structures #sip_reply_to_t. * * The function sip_reply_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 list of 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 * * reply_to = sip_reply_to_copy(home, sip->sip_reply_to); * * @endcode * * @return * A pointer to newly copied header structure, or NULL upon an error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline#endifsip_reply_to_t *sip_reply_to_copy(su_home_t *home, sip_reply_to_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_reply_to_t *sip_reply_to_copy(su_home_t *home, sip_reply_to_t const *hdr) { return (sip_reply_to_t *) msg_header_copy_as(home, sip_reply_to_class, (msg_header_t const *)hdr); }#endif/**Make a @ref sip_reply_to "Reply-To header" structure #sip_reply_to_t. * * The function sip_reply_to_make() makes a new * #sip_reply_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 * * @return * A pointer to newly maked #sip_reply_to_t header structure, or NULL upon an * error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline #endifsip_reply_to_t *sip_reply_to_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_reply_to_t *sip_reply_to_make(su_home_t *home, char const *s){ return (sip_reply_to_t *)sip_header_make(home, sip_reply_to_class, s);}#endif/**Make a @ref sip_reply_to "Reply-To header" from formatting result. * * Make a new #sip_reply_to_t 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 parses the * formatting result to the structure #sip_reply_to_t. * * @param home memory home used to allocate new header structure. * @param fmt string used as a printf()-style format * @param ... argument list for format * * @return * A pointer to newly * makes header structure, or NULL upon an error. * * @HIDE * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline#endifsip_reply_to_t *sip_reply_to_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_reply_to_t *sip_reply_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_reply_to_class, fmt, ap); va_end(ap); return (sip_reply_to_t *)h;}#endif/** @} *//**@ingroup sip_reply_to * * Tag list item for pointer to a @ref sip_reply_to "Reply-To header" * structure #sip_reply_to_t. * * The SIPTAG_REPLY_TO() macro is used to include a tag item with a * pointer to a #sip_reply_to_t structure in a tag list. * * @param x pointer to a #sip_reply_to_t structure, or NULL. * * The corresponding tag taking reference parameter is * SIPTAG_REPLY_TO_REF(). * * @since New in @NEW_1_12_7. * * @HIDE */#define SIPTAG_REPLY_TO(x) siptag_reply_to, siptag_reply_to_v(x)SOFIAPUBVAR tag_typedef_t siptag_reply_to;/**@ingroup sip_reply_to * Tag list item for reference to a * @ref sip_reply_to "Reply-To header" pointer. */#define SIPTAG_REPLY_TO_REF(x) siptag_reply_to_ref, siptag_reply_to_vr(&(x))SOFIAPUBVAR tag_typedef_t siptag_reply_to_ref;/**@ingroup sip_reply_to * * Tag list item for string with @ref sip_reply_to "Reply-To header" value. * * The SIPTAG_REPLY_TO_STR() macro is used to include a tag item with a * string containing value of a #sip_reply_to_t header in a tag list. * * @param s pointer to a string containing * @ref sip_reply_to "Reply-To header" value, or NULL. * * The string in SIPTAG_REPLY_TO_STR() can be converted to a * #sip_reply_to_t header structure by giving the string @a s has * second argument to function sip_reply_to_make(). * * The corresponding tag taking reference parameter is * SIPTAG_REPLY_TO_STR_REF(). * * @since New in @NEW_1_12_7. * * @HIDE */#define SIPTAG_REPLY_TO_STR(s) siptag_reply_to_str, tag_str_v(s)SOFIAPUBVAR tag_typedef_t siptag_reply_to_str;/**@ingroup sip_reply_to * Tag list item for reference to a * @ref sip_reply_to "Reply-To header" string. */#define SIPTAG_REPLY_TO_STR_REF(x) siptag_reply_to_str_ref, tag_str_vr(&(x))SOFIAPUBVAR tag_typedef_t siptag_reply_to_str_ref;#if SU_INLINE_TAG_CASTsu_inline tag_value_tsiptag_reply_to_v(sip_reply_to_t const *v){ return (tag_value_t)v; }su_inline tag_value_tsiptag_reply_to_vr(sip_reply_to_t const **vp){ return (tag_value_t)vp; }#else#define siptag_reply_to_v(v) (tag_value_t)(v)#define siptag_reply_to_vr(vp) (tag_value_t)(vp)#endif/** Defined as 1 if the @ref sip_remote_party_id "Remote-Party-ID header" is supported */#define SIP_HAVE_REMOTE_PARTY_ID 1enum { /**@ingroup sip_remote_party_id @internal * * Hash of @ref sip_remote_party_id "Remote-Party-ID header". * * @since New in @NEW_1_12_7. */ sip_remote_party_id_hash = 59907 };/**Header class for @ref sip_remote_party_id "Remote-Party-ID header". * * The header class sip_remote_party_id_class defines how a SIP * @ref sip_remote_party_id "Remote-Party-ID header" is parsed and printed. * It also contains methods used by SIP parser and other functions to * manipulate the #sip_remote_party_id_t header structure. * * @ingroup sip_remote_party_id * * @since New in @NEW_1_12_7. */SIP_DLL extern msg_hclass_t sip_remote_party_id_class[];/**@addtogroup sip_remote_party_id * @{ *//** Parse a SIP @ref sip_remote_party_id "Remote-Party-ID header". @internal */SOFIAPUBFUN issize_t sip_remote_party_id_d(su_home_t *, msg_header_t *, char *s, isize_t slen);/** Print a SIP @ref sip_remote_party_id "Remote-Party-ID header". @internal */SOFIAPUBFUN issize_t sip_remote_party_id_e(char b[], isize_t bsiz, msg_header_t const *h, int flags);/**Access a SIP @ref sip_remote_party_id "Remote-Party-ID header" * structure #sip_remote_party_id_t from #sip_t. * * @since New in @NEW_1_12_7. */#define sip_remote_party_id(sip) \ ((sip_remote_party_id_t *)msg_header_access((msg_pub_t*)(sip), sip_remote_party_id_class))/**Initializer for structure #sip_remote_party_id_t. * * A static #sip_remote_party_id_t structure for * @ref sip_remote_party_id "Remote-Party-ID header" must be initialized with * the SIP_REMOTE_PARTY_ID_INIT() macro. * For instance, * @code * * sip_remote_party_id_t sip_remote_party_id = SIP_REMOTE_PARTY_ID_INIT; * * @endcode * @HI * * @since New in @NEW_1_12_7. */#define SIP_REMOTE_PARTY_ID_INIT() SIP_HDR_INIT(remote_party_id)/**Initialize a structure #sip_remote_party_id_t. * * An #sip_remote_party_id_t structure for * @ref sip_remote_party_id "Remote-Party-ID header" can be initialized with the * sip_remote_party_id_init() function/macro. For instance, * @code *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -