📄 sip_extra.c
字号:
* @endcode * * The parsed Suppress-Body-If-Match header is stored in * #sip_suppress_body_if_match_t structure. * * @sa @RFC3265, draft-niemi-sip-subnot-etags-01.txt * * @EXP_1_12_5. * In order to use @b Suppress-Body-If-Match header, * initialize the SIP parser with, e.g., * sip_update_default_mclass(sip_extend_mclass(NULL)). * * @note * The #sip_t structure does not contain a @a * sip_suppress_body_if_match field, but sip_suppress_body_if_match() * function should be used for accessing the @b Suppress-Body-If-Match * header structure. *//**@ingroup sip_suppress_body_if_match * @typedef struct sip_suppress_body_if_match_s sip_suppress_body_if_match_t; * * The structure #sip_suppress_body_if_match_t contains representation of a * SIP @SuppressBodyIfMatch header. * * The #sip_suppress_body_if_match_t is defined as follows: * @code * typedef struct sip_suppress_body_if_match_s * { * sip_common_t sbim_common[1]; // Common fragment info * sip_error_t *sbim_next; // Dummy link to next header * char const *sbim_tag; // entity-tag * } sip_suppress_body_if_match_t; * @endcode */#define sip_suppress_body_if_match_dup_xtra msg_generic_dup_xtra#define sip_suppress_body_if_match_dup_one msg_generic_dup_one#define sip_suppress_body_if_match_update NULLmsg_hclass_t sip_suppress_body_if_match_class[] =SIP_HEADER_CLASS(suppress_body_if_match, "Suppress-Body-If-Match", "", sbim_common, single, suppress_body_if_match);issize_t sip_suppress_body_if_match_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen){ sip_suppress_body_if_match_t *sbim = (void *)h; return msg_token_d(&s, &sbim->sbim_tag);}issize_t sip_suppress_body_if_match_e(char b[], isize_t bsiz, sip_header_t const *h, int f){ return sip_etag_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_suppress_notify_if_match Suppress-Notify-If-Match Header * * The @b Suppress-Notify-If-Match header is used to suppress * superfluous NOTIFY transactions. Its syntax is defined in * draft-niemi-sip-subnot-etags-01 as follows: * * @code * Suppress-Notify-If-Match = "Suppress-Notify-If-Match" HCOLON entity-tag * entity-tag = token * @endcode * * The parsed Suppress-Notify-If-Match header is stored in * #sip_suppress_notify_if_match_t structure. * * @sa @RFC3265, draft-niemi-sip-subnot-etag-01 * * @EXP_1_12_5. * In order to use @b Suppress-Notify-If-Match header, * initialize the SIP parser with, e.g., * sip_update_default_mclass(sip_extend_mclass(NULL)). * * @note * The #sip_t struct does not contain @a sip_suppress_notify_if_match field, * but sip_suppress_notify_if_match() function should be used for accessing * the @b Suppress-Notify-If-Match header structure. *//**@ingroup sip_suppress_notify_if_match * @typedef struct sip_suppress_notify_if_match_s \ * sip_suppress_notify_if_match_t; * * The structure #sip_suppress_notify_if_match_t contains representation of a * SIP @SuppressNotifyIfMatch header. * * The #sip_suppress_notify_if_match_t is defined as follows: * @code * typedef struct sip_suppress_notify_if_match_s * { * sip_common_t snim_common[1]; // Common fragment info * sip_error_t *snim_next; // Dummy link to next header * char const *snim_tag; // entity-tag * } sip_suppress_notify_if_match_t; * @endcode */#define sip_suppress_notify_if_match_dup_xtra msg_generic_dup_xtra#define sip_suppress_notify_if_match_dup_one msg_generic_dup_one#define sip_suppress_notify_if_match_update NULLmsg_hclass_t sip_suppress_notify_if_match_class[] =SIP_HEADER_CLASS(suppress_notify_if_match, "Suppress-Notify-If-Match", "", snim_common, single, suppress_notify_if_match);issize_t sip_suppress_notify_if_match_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen){ sip_suppress_notify_if_match_t *snim = (void *)h; return msg_token_d(&s, &snim->snim_tag);}issize_t sip_suppress_notify_if_match_e(char b[], isize_t bsiz, sip_header_t const *h, int f){ return msg_generic_e(b, bsiz, h, f);}#endif#if SIP_HAVE_REMOTE_PARTY_ID/**@SIP_HEADER sip_remote_party_id Remote-Party-ID Header * * The syntax of the Remote-Party-ID header is described as follows: * @code * Remote-Party-ID = "Remote-Party-ID" HCOLON rpid *(COMMA rpid) * * rpid = [display-name] LAQUOT addr-spec RAQUOT * *(SEMI rpi-token) * * rpi-token = rpi-screen / rpi-pty-type / * rpi-id-type / rpi-privacy / other-rpi-token * * rpi-screen = "screen" EQUAL ("no" / "yes") * * rpi-pty-type = "party" EQUAL ("calling" / "called" / token) * * rpi-id-type = "id-type" EQUAL ("subscriber" / "user" / * "term" / token) * * rpi-privacy = "privacy" EQUAL * ( rpi-priv-element * / (LDQUOT rpi-priv-element * *(COMMA rpi-priv-element) RDQUOT) ) * * rpi-priv-element = ("full" / "name" / "uri" / "off" / token) * ["-" ( "network" / token )] * * other-rpi-token = ["-"] token [EQUAL (token / quoted-string)] * * @endcode * * @sa sip_update_default_mclass(), draft-ietf-sip-privacy-04.txt, @RFC3325 * * @NEW_1_12_7. In order to use @b Remote-Party-ID header, * initialize the SIP parser before calling nta_agent_create() or * nua_create() with, e.g., * sip_update_default_mclass(sip_extend_mclass(NULL)). * * @note * The #sip_t structure does not contain @a sip_remote_party_id field, but * sip_remote_party_id() function should be used for accessing the @b * Remote-Party-ID header structure. *//**@ingroup sip_remote_party_id * @typedef typedef struct sip_remote_party_id_s sip_remote_party_id_t; * * The structure #sip_remote_party_id_t contains representation of SIP * @RemotePartyID header. * * The #sip_remote_party_id_t is defined as follows: * @code * typedef struct sip_remote_party_id_s { * sip_common_t rpid_common[1]; // Common fragment info * sip_remote_party_id_t *rpid_next; // Link to next * char const *rpid_display; // Display name * url_t rpid_url[1]; // URL * sip_param_t const *rpid_params; // Parameters * // Shortcuts to screen, party, id-type and privacy parameters * char const *rpid_screen, *rpid_party, *rpid_id_type, *rpid_privacy; * } sip_remote_party_id_t; * @endcode */extern msg_xtra_f sip_remote_party_id_dup_xtra;extern msg_dup_f sip_remote_party_id_dup_one;static msg_update_f sip_remote_party_id_update;msg_hclass_t sip_remote_party_id_class[] =SIP_HEADER_CLASS(remote_party_id, "Remote-Party-ID", "", rpid_params, append, remote_party_id);issize_t sip_remote_party_id_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen){ sip_remote_party_id_t *rpid = (sip_remote_party_id_t *)h; while (*s == ',') /* Ignore empty entries (comma-whitespace) */ *s = '\0', s += span_lws(s + 1) + 1; if (sip_name_addr_d(home, &s, &rpid->rpid_display, rpid->rpid_url, &rpid->rpid_params, NULL) == -1) return -1; return msg_parse_next_field(home, h, s, slen);}issize_t sip_remote_party_id_e(char b[], isize_t bsiz, sip_header_t const *h, int f){ sip_remote_party_id_t const *rpid = (sip_remote_party_id_t *)h; return sip_name_addr_e(b, bsiz, f, rpid->rpid_display, 1, rpid->rpid_url, rpid->rpid_params, NULL);}/** Calculate size of extra data required for duplicating one * sip_remote_party_id_t header. */isize_t sip_remote_party_id_dup_xtra(sip_header_t const *h, isize_t offset){ sip_remote_party_id_t const *rpid = (sip_remote_party_id_t *)h; return sip_name_addr_xtra(rpid->rpid_display, rpid->rpid_url, rpid->rpid_params, offset);}/** Duplicate one sip_remote_party_id_t object */char *sip_remote_party_id_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, isize_t xtra){ sip_remote_party_id_t *rpid = (sip_remote_party_id_t *)dst; sip_remote_party_id_t const *o = (sip_remote_party_id_t const *)src; return sip_name_addr_dup(&rpid->rpid_display, o->rpid_display, rpid->rpid_url, o->rpid_url, &rpid->rpid_params, o->rpid_params, b, xtra);}static int sip_remote_party_id_update(msg_common_t *h, char const *name, isize_t namelen, char const *value){ sip_remote_party_id_t *rpid = (sip_remote_party_id_t *)h; if (name == NULL) { rpid->rpid_screen = NULL; rpid->rpid_party = NULL; rpid->rpid_id_type = NULL; rpid->rpid_privacy = NULL; }#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s))) else if (MATCH(screen)) rpid->rpid_screen = value; else if (MATCH(party)) rpid->rpid_party = value; else if (MATCH(id-type)) rpid->rpid_id_type = value; else if (MATCH(privacy)) rpid->rpid_privacy = value;#undef MATCH return 0;}#endif#if SIP_HAVE_P_ASSERTED_IDENTITY/**@SIP_HEADER sip_p_asserted_identity P-Asserted-Identity Header * * The P-Asserted-Identity header is used used among trusted SIP entities * (typically intermediaries) to carry the identity of the user sending a * SIP message as it was verified by authentication. It is "defined" in * @RFC3325 section 9.1 as follows: * * @code * PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value * *(COMMA PAssertedID-value) * PAssertedID-value = name-addr / addr-spec * @endcode * * @sa @RFC3325, @PPreferredIdentity * * @NEW_1_12_7. In order to use @b P-Asserted-Identity header, * initialize the SIP parser before calling nta_agent_create() or * nua_create() with, e.g., * sip_update_default_mclass(sip_extend_mclass(NULL)). * * @note * The #sip_t structure does not contain @a sip_p_asserted_identity field, * but sip_p_asserted_identity() function should be used for accessing the * @b P-Asserted-Identity header structure. *//**@ingroup sip_p_asserted_identity * @typedef typedef struct sip_p_asserted_identity_s sip_p_asserted_identity_t; * * The structure #sip_p_asserted_identity_t contains representation of SIP * @PAssertedIdentity header. * * The #sip_p_asserted_identity_t is defined as follows: * @code * typedef struct sip_p_asserted_identity_s { * sip_common_t paid_common[1]; // Common fragment info * sip_p_asserted_identity_t *paid_next; // Link to next * char const *paid_display; // Display name * url_t paid_url[1]; // URL * } sip_p_asserted_identity_t; * @endcode */static msg_xtra_f sip_p_asserted_identity_dup_xtra;static msg_dup_f sip_p_asserted_identity_dup_one;#define sip_p_asserted_identity_update NULLmsg_hclass_t sip_p_asserted_identity_class[] =SIP_HEADER_CLASS(p_asserted_identity, "P-Asserted-Identity", "", paid_common, append, p_asserted_identity);issize_t sip_p_asserted_identity_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen){ sip_p_asserted_identity_t *paid = (sip_p_asserted_identity_t *)h; while (*s == ',') /* Ignore empty entries (comma-whitespace) */ *s = '\0', s += span_lws(s + 1) + 1; if (sip_name_addr_d(home, &s, &paid->paid_display, paid->paid_url, NULL, NULL) == -1) return -1; return msg_parse_next_field(home, h, s, slen);}issize_t sip_p_asserted_identity_e(char b[], isize_t bsiz, sip_header_t const *h, int f){ sip_p_asserted_identity_t const *paid = (sip_p_asserted_identity_t *)h; return sip_name_addr_e(b, bsiz, f, paid->paid_display, MSG_IS_CANONIC(f), paid->paid_url, NULL, NULL);}isize_t sip_p_asserted_identity_dup_xtra(sip_header_t const *h, isize_t offset){ sip_p_asserted_identity_t const *paid = (sip_p_asserted_identity_t *)h; return sip_name_addr_xtra(paid->paid_display, paid->paid_url, NULL, offset);}/** Duplicate one sip_p_asserted_identity_t object */char *sip_p_asserted_identity_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, isize_t xtra){ sip_p_asserted_identity_t *paid = (sip_p_asserted_identity_t *)dst; sip_p_asserted_identity_t const *o = (sip_p_asserted_identity_t *)src; return sip_name_addr_dup(&paid->paid_display, o->paid_display, paid->paid_url, o->paid_url, NULL, NULL, b, xtra);}#endif#if SIP_HAVE_P_PREFERRED_IDENTITY/**@SIP_HEADER sip_p_preferred_identity P-Preferred-Identity Header * * The P-Preferred-Identity header is used used among trusted SIP entities * (typically intermediaries) to carry the identity of the user sending a * SIP message as it was verified by authentication. It is "defined" in * @RFC3325 section 9.1 as follows: * * @code * PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value * *(COMMA PPreferredID-value) * PPreferredID-value = name-addr / addr-spec * @endcode * * @sa @RFC3325, @PAssertedIdentity * * @NEW_1_12_7. In order to use @b P-Preferred-Identity header, * initialize the SIP parser before calling nta_agent_create() or * nua_create() with, e.g., * sip_update_default_mclass(sip_extend_mclass(NULL)). * * @note * The #sip_t structure does not contain @a sip_p_preferred_identity field, * but sip_p_preferred_identity() function should be used for accessing the * @b P-Preferred-Identity header structure. *//**@ingroup sip_p_preferred_identity * @typedef typedef struct sip_p_preferred_identity_s sip_p_preferred_identity_t; * * The structure #sip_p_preferred_identity_t contains representation of SIP * @PPreferredIdentity header. * * The #sip_p_preferred_identity_t is defined as follows: * @code * typedef struct sip_p_preferred_identity_s { * sip_common_t ppid_common[1]; // Common fragment info * sip_p_preferred_identity_t *ppid_next; // Link to next * char const *ppid_display; // Display name * url_t ppid_url[1]; // URL * } sip_p_preferred_identity_t; * @endcode */msg_hclass_t sip_p_preferred_identity_class[] =SIP_HEADER_CLASS(p_preferred_identity, "P-Preferred-Identity", "", ppid_common, append, p_asserted_identity);issize_t sip_p_preferred_identity_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen){ return sip_p_asserted_identity_d(home, h, s, slen);}issize_t sip_p_preferred_identity_e(char b[], isize_t bsiz, sip_header_t const *h, int f){ return sip_p_asserted_identity_e(b, bsiz, h, f);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -