📄 sip_extra.h
字号:
#if SU_HAVE_INLINEsu_inlinesip_p_asserted_identity_t *sip_p_asserted_identity_dup(su_home_t *home, sip_p_asserted_identity_t const *hdr){ return (sip_p_asserted_identity_t *) msg_header_dup_as(home, sip_p_asserted_identity_class, (msg_header_t const *)hdr);}#endif/**Copy a list of @ref sip_p_asserted_identity "P-Asserted-Identity header" header structures #sip_p_asserted_identity_t. * * The function sip_p_asserted_identity_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 * * p_asserted_identity = sip_p_asserted_identity_copy(home, sip->sip_p_asserted_identity); * * @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_p_asserted_identity_t *sip_p_asserted_identity_copy(su_home_t *home, sip_p_asserted_identity_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_p_asserted_identity_t *sip_p_asserted_identity_copy(su_home_t *home, sip_p_asserted_identity_t const *hdr) { return (sip_p_asserted_identity_t *) msg_header_copy_as(home, sip_p_asserted_identity_class, (msg_header_t const *)hdr); }#endif/**Make a @ref sip_p_asserted_identity "P-Asserted-Identity header" structure #sip_p_asserted_identity_t. * * The function sip_p_asserted_identity_make() makes a new * #sip_p_asserted_identity_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_p_asserted_identity_t header structure, or NULL upon an * error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline #endifsip_p_asserted_identity_t *sip_p_asserted_identity_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_p_asserted_identity_t *sip_p_asserted_identity_make(su_home_t *home, char const *s){ return (sip_p_asserted_identity_t *)sip_header_make(home, sip_p_asserted_identity_class, s);}#endif/**Make a @ref sip_p_asserted_identity "P-Asserted-Identity header" from formatting result. * * Make a new #sip_p_asserted_identity_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_p_asserted_identity_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_p_asserted_identity_t *sip_p_asserted_identity_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));#if SU_HAVE_INLINEsu_inline sip_p_asserted_identity_t *sip_p_asserted_identity_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_p_asserted_identity_class, fmt, ap); va_end(ap); return (sip_p_asserted_identity_t *)h;}#endif/** @} *//**@ingroup sip_p_asserted_identity * * Tag list item for pointer to a @ref sip_p_asserted_identity "P-Asserted-Identity header" * structure #sip_p_asserted_identity_t. * * The SIPTAG_P_ASSERTED_IDENTITY() macro is used to include a tag item with a * pointer to a #sip_p_asserted_identity_t structure in a tag list. * * @param x pointer to a #sip_p_asserted_identity_t structure, or NULL. * * The corresponding tag taking reference parameter is * SIPTAG_P_ASSERTED_IDENTITY_REF(). * * @since New in @NEW_1_12_7. * * @HIDE */#define SIPTAG_P_ASSERTED_IDENTITY(x) siptag_p_asserted_identity, siptag_p_asserted_identity_v(x)SOFIAPUBVAR tag_typedef_t siptag_p_asserted_identity;/**@ingroup sip_p_asserted_identity * Tag list item for reference to a * @ref sip_p_asserted_identity "P-Asserted-Identity header" pointer. */#define SIPTAG_P_ASSERTED_IDENTITY_REF(x) siptag_p_asserted_identity_ref, siptag_p_asserted_identity_vr(&(x))SOFIAPUBVAR tag_typedef_t siptag_p_asserted_identity_ref;/**@ingroup sip_p_asserted_identity * * Tag list item for string with @ref sip_p_asserted_identity "P-Asserted-Identity header" value. * * The SIPTAG_P_ASSERTED_IDENTITY_STR() macro is used to include a tag item with a * string containing value of a #sip_p_asserted_identity_t header in a tag list. * * @param s pointer to a string containing * @ref sip_p_asserted_identity "P-Asserted-Identity header" value, or NULL. * * The string in SIPTAG_P_ASSERTED_IDENTITY_STR() can be converted to a * #sip_p_asserted_identity_t header structure by giving the string @a s has * second argument to function sip_p_asserted_identity_make(). * * The corresponding tag taking reference parameter is * SIPTAG_P_ASSERTED_IDENTITY_STR_REF(). * * @since New in @NEW_1_12_7. * * @HIDE */#define SIPTAG_P_ASSERTED_IDENTITY_STR(s) siptag_p_asserted_identity_str, tag_str_v(s)SOFIAPUBVAR tag_typedef_t siptag_p_asserted_identity_str;/**@ingroup sip_p_asserted_identity * Tag list item for reference to a * @ref sip_p_asserted_identity "P-Asserted-Identity header" string. */#define SIPTAG_P_ASSERTED_IDENTITY_STR_REF(x) siptag_p_asserted_identity_str_ref, tag_str_vr(&(x))SOFIAPUBVAR tag_typedef_t siptag_p_asserted_identity_str_ref;#if SU_INLINE_TAG_CASTsu_inline tag_value_tsiptag_p_asserted_identity_v(sip_p_asserted_identity_t const *v){ return (tag_value_t)v; }su_inline tag_value_tsiptag_p_asserted_identity_vr(sip_p_asserted_identity_t const **vp){ return (tag_value_t)vp; }#else#define siptag_p_asserted_identity_v(v) (tag_value_t)(v)#define siptag_p_asserted_identity_vr(vp) (tag_value_t)(vp)#endif/** Defined as 1 if the @ref sip_p_preferred_identity "P-Preferred-Identity header" is supported */#define SIP_HAVE_P_PREFERRED_IDENTITY 1enum { /**@ingroup sip_p_preferred_identity @internal * * Hash of @ref sip_p_preferred_identity "P-Preferred-Identity header". * * @since New in @NEW_1_12_7. */ sip_p_preferred_identity_hash = 44591 };/**Header class for @ref sip_p_preferred_identity "P-Preferred-Identity header". * * The header class sip_p_preferred_identity_class defines how a SIP * @ref sip_p_preferred_identity "P-Preferred-Identity header" is parsed and printed. * It also contains methods used by SIP parser and other functions to * manipulate the #sip_p_preferred_identity_t header structure. * * @ingroup sip_p_preferred_identity * * @since New in @NEW_1_12_7. */SIP_DLL extern msg_hclass_t sip_p_preferred_identity_class[];/**@addtogroup sip_p_preferred_identity * @{ *//** Parse a SIP @ref sip_p_preferred_identity "P-Preferred-Identity header". @internal */SOFIAPUBFUN issize_t sip_p_preferred_identity_d(su_home_t *, msg_header_t *, char *s, isize_t slen);/** Print a SIP @ref sip_p_preferred_identity "P-Preferred-Identity header". @internal */SOFIAPUBFUN issize_t sip_p_preferred_identity_e(char b[], isize_t bsiz, msg_header_t const *h, int flags);/**Access a SIP @ref sip_p_preferred_identity "P-Preferred-Identity header" * structure #sip_p_preferred_identity_t from #sip_t. * * @since New in @NEW_1_12_7. */#define sip_p_preferred_identity(sip) \ ((sip_p_preferred_identity_t *)msg_header_access((msg_pub_t*)(sip), sip_p_preferred_identity_class))/**Initializer for structure #sip_p_preferred_identity_t. * * A static #sip_p_preferred_identity_t structure for * @ref sip_p_preferred_identity "P-Preferred-Identity header" must be initialized with * the SIP_P_PREFERRED_IDENTITY_INIT() macro. * For instance, * @code * * sip_p_preferred_identity_t sip_p_preferred_identity = SIP_P_PREFERRED_IDENTITY_INIT; * * @endcode * @HI * * @since New in @NEW_1_12_7. */#define SIP_P_PREFERRED_IDENTITY_INIT() SIP_HDR_INIT(p_preferred_identity)/**Initialize a structure #sip_p_preferred_identity_t. * * An #sip_p_preferred_identity_t structure for * @ref sip_p_preferred_identity "P-Preferred-Identity header" can be initialized with the * sip_p_preferred_identity_init() function/macro. For instance, * @code * * sip_p_preferred_identity_t sip_p_preferred_identity; * * sip_p_preferred_identity_init(&sip_p_preferred_identity); * * @endcode * @HI * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline sip_p_preferred_identity_t *sip_p_preferred_identity_init(sip_p_preferred_identity_t x[1]){ return SIP_HEADER_INIT(x, sip_p_preferred_identity_class, sizeof(sip_p_preferred_identity_t));}#else#define sip_p_preferred_identity_init(x) \ SIP_HEADER_INIT(x, sip_p_preferred_identity_class, sizeof(sip_p_preferred_identity_t))#endif/**Test if header object is instance of #sip_p_preferred_identity_t. * * Check if the header class is an instance of * @ref sip_p_preferred_identity "P-Preferred-Identity 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 p_preferred_identity * @retval 0 (false) otherwise * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline int sip_is_p_preferred_identity(sip_header_t const *header){ return header && header->sh_class->hc_hash == sip_p_preferred_identity_hash;}#elseint sip_is_p_preferred_identity(sip_header_t const *header);#endif#define sip_p_preferred_identity_p(h) sip_is_p_preferred_identity((h))/**Duplicate a list of @ref sip_p_preferred_identity "P-Preferred-Identity header" header structures #sip_p_preferred_identity_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 * * p_preferred_identity = sip_p_preferred_identity_dup(home, sip->sip_p_preferred_identity); * * @endcode * * @return * A pointer to the * newly duplicated #sip_p_preferred_identity_t header structure, or NULL * upon an error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline#endifsip_p_preferred_identity_t *sip_p_preferred_identity_dup(su_home_t *home, sip_p_preferred_identity_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_p_preferred_identity_t *sip_p_preferred_identity_dup(su_home_t *home, sip_p_preferred_identity_t const *hdr){ return (sip_p_preferred_identity_t *) msg_header_dup_as(home, sip_p_preferred_identity_class, (msg_header_t const *)hdr);}#endif/**Copy a list of @ref sip_p_preferred_identity "P-Preferred-Identity header" header structures #sip_p_preferred_identity_t. * * The function sip_p_preferred_identity_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 * * p_preferred_identity = sip_p_preferred_identity_copy(home, sip->sip_p_preferred_identity); * * @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_p_preferred_identity_t *sip_p_preferred_identity_copy(su_home_t *home, sip_p_preferred_identity_t const *hdr) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inlinesip_p_preferred_identity_t *sip_p_preferred_identity_copy(su_home_t *home, sip_p_preferred_identity_t const *hdr) { return (sip_p_preferred_identity_t *) msg_header_copy_as(home, sip_p_preferred_identity_class, (msg_header_t const *)hdr); }#endif/**Make a @ref sip_p_preferred_identity "P-Preferred-Identity header" structure #sip_p_preferred_identity_t. * * The function sip_p_preferred_identity_make() makes a new * #sip_p_preferred_identity_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_p_preferred_identity_t header structure, or NULL upon an * error. * * @since New in @NEW_1_12_7. */#if SU_HAVE_INLINEsu_inline #endifsip_p_preferred_identity_t *sip_p_preferred_identity_make(su_home_t *home, char const *s) __attribute__((__malloc__));#if SU_HAVE_INLINEsu_inline sip_p_preferred_identity_t *sip_p_preferred_identity_make(su
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -