📄 sip_extra.c
字号:
* product = token [SLASH product-version] * product-version = token * @endcode */msg_hclass_t sip_server_class[] = SIP_HEADER_CLASS_G(server, "Server", "", single);int sip_server_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return sip_generic_d(home, h, s, slen);}int sip_server_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_server_p(h)); return sip_generic_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_subject Subject Header * * The Subject header provides a summary or indicates the nature of the * request. Its syntax is defined in [S10.40] as follows: * * @code * Subject = ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM] * @endcode * */msg_hclass_t sip_subject_class[] = SIP_HEADER_CLASS_G(subject, "Subject", "s", single);int sip_subject_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return sip_generic_d(home, h, s, slen);}int sip_subject_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_subject_p(h)); return sip_generic_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_timestamp Timestamp Header * * The Timestamp header describes when the client sent the request to the * server, and it is used by the client to adjust its retransmission * intervals. Its syntax is defined in [S10.42] as follows: * * @code * Timestamp = "Timestamp" HCOLON 1*(DIGIT) * [ "." *(DIGIT) ] [ LWS delay ] * delay = *(DIGIT) [ "." *(DIGIT) ] * @endcode * */static int sip_timestamp_dup_xtra(sip_header_t const *h, int offset);static char *sip_timestamp_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, int xtra);#define sip_timestamp_update NULLmsg_hclass_t sip_timestamp_class[] = SIP_HEADER_CLASS(timestamp, "Timestamp", "", ts_common, single, timestamp);int sip_timestamp_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_timestamp_t *ts = (sip_timestamp_t*)h; ts->ts_stamp = s; skip_digit(&s); if (s == ts->ts_stamp) return -1; if (*s == '.') { s++; skip_digit(&s); } if (IS_LWS(*s)) { *s++ = '\0'; skip_lws(&s); ts->ts_delay = s; skip_digit(&s); if (*s == '.') { s++; skip_digit(&s); } } if (!*s || IS_LWS(*s)) *s++ = '\0'; else return -1; return 0;}int sip_timestamp_e(char b[], int bsiz, sip_header_t const *h, int f){ sip_timestamp_t const *ts = h->sh_timestamp; char *end = b + bsiz, *b0 = b; assert(sip_timestamp_p(h)); MSG_STRING_E(b, end, ts->ts_stamp); if (ts->ts_delay) { MSG_CHAR_E(b, end, ' '); MSG_STRING_E(b, end, ts->ts_delay); } MSG_TERM_E(b, end); return b - b0;}int sip_timestamp_dup_xtra(sip_header_t const *h, int offset){ int rv = offset; sip_timestamp_t const *ts = h->sh_timestamp; rv += MSG_STRING_SIZE(ts->ts_stamp); rv += MSG_STRING_SIZE(ts->ts_delay); return rv;}char *sip_timestamp_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, int xtra){ sip_timestamp_t *ts = dst->sh_timestamp; sip_timestamp_t const *o = src->sh_timestamp; char *end = b + xtra; MSG_STRING_DUP(b, ts->ts_stamp, o->ts_stamp); MSG_STRING_DUP(b, ts->ts_delay, o->ts_delay); assert(b <= end); return b;}/* ====================================================================== *//**@SIP_HEADER sip_user_agent User-Agent Header * * The User-Agent header contains information about the client user agent * originating the request. Its syntax is defined in [H14.43, S10.45] as * follows: * * @code * User-Agent = "User-Agent" HCOLON server-val *(LWS server-val) * server-val = product / comment * product = token [SLASH product-version] * product-version = token * @endcode * */msg_hclass_t sip_user_agent_class[] = SIP_HEADER_CLASS_G(user_agent, "User-Agent", "", single);int sip_user_agent_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return sip_generic_d(home, h, s, slen);}int sip_user_agent_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_user_agent_p(h)); return sip_generic_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_etag SIP-ETag Header * * The @b SIP-ETag header field identifies the published event state. Its * syntax is defined in @RFC3903 as follows: * * @code * SIP-ETag = "SIP-ETag" HCOLON entity-tag * entity-tag = token * @endcode */msg_hclass_t sip_etag_class[] = SIP_HEADER_CLASS_G(etag, "SIP-ETag", "", single);int sip_etag_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_etag_t *etag = (sip_etag_t *)h; return msg_token_d(&s, &etag->g_value);}int sip_etag_e(char b[], int bsiz, sip_header_t const *h, int f){ return msg_generic_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_if_match SIP-If-Match Header * * The @b SIP-If-Match header field identifies the specific entity of event * state that the request is refreshing, modifying or removing. Its syntax * is defined in @RFC3903 as follows: * * @code * SIP-If-Match = "SIP-If-Match" HCOLON entity-tag * entity-tag = token * @endcode */msg_hclass_t sip_if_match_class[] = SIP_HEADER_CLASS_G(if_match, "SIP-If-Match", "", single);int sip_if_match_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return sip_etag_d(home, h, s, slen);}int sip_if_match_e(char b[], int bsiz, sip_header_t const *h, int f){ return sip_etag_e(b, bsiz, h, f);}/* ====================================================================== */int sip_info_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_call_info_t *ci = h->sh_call_info; char *end = s + slen; assert(h); while (*s == ',') s++, skip_lws(&s); if (sip_name_addr_d(home, &s, NULL, ci->ci_url, &ci->ci_params, NULL) < 0) return -1; if (*s && *s != ',') return -1; while (*s == ',') *s++ = '\0', skip_lws(&s); /* Skip comma and following whitespace */ if (*s == 0) return 0; if (!(h = sip_header_alloc(home, h->sh_class, 0))) return -1; return sip_info_d(home, h, s, end - s);}int sip_info_dup_xtra(sip_header_t const *h, int offset){ int rv = offset; sip_call_info_t const *ci = h->sh_call_info; MSG_PARAMS_SIZE(rv, ci->ci_params); rv += url_xtra(ci->ci_url); return rv;}char *sip_info_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, int xtra){ sip_call_info_t *ci = dst->sh_call_info; sip_call_info_t const *o = src->sh_call_info; char *end = b + xtra; b = msg_params_dup(&ci->ci_params, o->ci_params, b, xtra); URL_DUP(b, end, ci->ci_url, o->ci_url); assert(b <= end); return b;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -