📄 sip_mime.c
字号:
* msg_error_t *cd_next; // Link to next (dummy) * char const *cd_type; // Disposition type * msg_param_t const *cd_params; // List of parameters * msg_param_t cd_handling; // Value of @b handling parameter * unsigned cd_required:1; // True if handling=required * unsigned cd_optional:1; // True if handling=optional * } sip_content_disposition_t; * @endcode */static msg_xtra_f sip_content_disposition_dup_xtra;static msg_dup_f sip_content_disposition_dup_one;#define sip_content_disposition_update msg_content_disposition_updatemsg_hclass_t sip_content_disposition_class[] = SIP_HEADER_CLASS(content_disposition, "Content-Disposition", "", cd_params, single, content_disposition);int sip_content_disposition_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return msg_content_disposition_d(home, h, s, slen);}int sip_content_disposition_e(char b[], int bsiz, sip_header_t const *h, int f){ return msg_content_disposition_e(b, bsiz, h, f);}staticint sip_content_disposition_dup_xtra(sip_header_t const *h, int offset){ return msg_content_disposition_dup_xtra(h, offset);}/** Duplicate one sip_content_disposition_t object */ staticchar *sip_content_disposition_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, int xtra){ return msg_content_disposition_dup_one(dst, src, b, xtra);}/* ====================================================================== *//**@SIP_HEADER sip_content_encoding Content-Encoding Header * * The Content-Encoding header indicates what additional content codings * have been applied to the entity-body. Its syntax is defined in [S20.12] * as follows: * * @code * Content-Encoding = ( "Content-Encoding" / "e" ) HCOLON * content-coding *(COMMA content-coding) * content-coding = token * @endcode *//**@ingroup sip_content_encoding * @typedef struct msg_list_s sip_content_encoding_t; * * The structure sip_content_encoding_t contains representation of an @b * Content-Encoding header. * * The sip_content_encoding_t is defined as follows: * @code * typedef struct msg_list_s * { * msg_common_t k_common[1]; // Common fragment info * msg_list_t *k_next; // Link to next header * msg_param_t *k_items; // List of items * } sip_content_encoding_t; * @endcode */msg_hclass_t sip_content_encoding_class[] = SIP_HEADER_CLASS_LIST(content_encoding, "Content-Encoding", "e", list);int sip_content_encoding_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return msg_list_d(home, h, s, slen);}int sip_content_encoding_e(char b[], int bsiz, sip_header_t const *h, int f){ return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_content_language Content-Language Header * * The Content-Language header [H14.12] describes the natural language(s) of * the intended audience for the enclosed entity. Note that this might not * be equivalent to all the languages used within the entity-body. Its * syntax is defined in @RFC3261 as follows: * * @code * Content-Language = "Content-Language" HCOLON * language-tag *(COMMA language-tag) * language-tag = primary-tag *( "-" subtag ) * primary-tag = 1*8ALPHA * subtag = 1*8ALPHA * @endcode *//**@ingroup sip_content_language * @typedef typedef struct msg_content_language_s sip_content_language_t; * * The structure sip_content_language_t contains representation of @b * Content-Language header. * * The sip_content_language_t is defined as follows: * @code * typedef struct { * msg_common_t k_common[1]; // Common fragment info * msg_content_language_t *k_next; // (Content-Encoding header) * msg_param_t *k_items; // List of languages * } sip_content_language_t; * @endcode */msg_hclass_t sip_content_language_class[] = SIP_HEADER_CLASS_LIST(content_language, "Content-Language", "", list);int sip_content_language_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return msg_list_d(home, h, s, slen);}int sip_content_language_e(char b[], int bsiz, sip_header_t const *h, int f){ return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_content_type Content-Type Header * * The Content-Type header indicates the media type of the message-body sent * to the recipient. Its syntax is defined in [H3.7, S] as * follows: * * @code * Content-Type = ( "Content-Type" / "c" ) HCOLON media-type * media-type = m-type SLASH m-subtype *(SEMI m-parameter) * m-type = discrete-type / composite-type * discrete-type = "text" / "image" / "audio" / "video" * / "application" / extension-token * composite-type = "message" / "multipart" / extension-token * extension-token = ietf-token / x-token * ietf-token = token * x-token = "x-" token * m-subtype = extension-token / iana-token * iana-token = token * m-parameter = m-attribute EQUAL m-value * m-attribute = token * m-value = token / quoted-string * @endcode *//**@ingroup sip_content_type * @typedef typedef struct sip_content_type_s sip_content_type_t; * * The structure #sip_content_type_t contains representation of SIP @b * Content-Type header. * * The #sip_content_type_t is defined as follows: * @code * typedef struct sip_content_type_s { * sip_common_t c_common[1]; // Common fragment info * sip_unknown_t *c_next; // Dummy link to next * char const *c_type; // Pointer to type/subtype * char const *c_subtype; // Points after first slash in type * msg_param_t const *c_params; // List of parameters * } sip_content_type_t; * @endcode * * The whitespace in the @a c_type is always removed when parsing. */static msg_xtra_f sip_content_type_dup_xtra;static msg_dup_f sip_content_type_dup_one;#define sip_content_type_update NULLmsg_hclass_t sip_content_type_class[] = SIP_HEADER_CLASS(content_type, "Content-Type", "c", c_params, single, content_type);int sip_content_type_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_content_type_t *c; assert(h); c = h->sh_content_type; /* "Content-type:" type/subtyp *(; parameter))) */ if (/* Parse protocol */ sip_version_d(&s, &c->c_type) == -1 || /* compacts token / token */ (c->c_subtype = strchr(c->c_type, '/')) == NULL || (*s == ';' && msg_params_d(home, &s, &c->c_params) == -1) || (*s != '\0')) return -1; c->c_subtype++; return 0;}int sip_content_type_e(char b[], int bsiz, sip_header_t const *h, int flags){ char *b0 = b, *end = b + bsiz; sip_content_type_t const *c = h->sh_content_type; MSG_STRING_E(b, end, c->c_type); MSG_PARAMS_E(b, end, c->c_params, flags); MSG_TERM_E(b, end); return b - b0;}staticint sip_content_type_dup_xtra(sip_header_t const *h, int offset){ int rv = offset; sip_content_type_t const *c = h->sh_content_type; MSG_PARAMS_SIZE(rv, c->c_params); rv += MSG_STRING_SIZE(c->c_type); return rv;}/** Duplicate one sip_content_type_t object */ staticchar *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src, char *b, int xtra){ sip_content_type_t *c = dst->sh_content_type; sip_content_type_t const *o = src->sh_content_type; char *end = b + xtra; b = msg_params_dup(&c->c_params, o->c_params, b, xtra); MSG_STRING_DUP(b, c->c_type, o->c_type); c->c_subtype = strchr(c->c_type, '/'); c->c_subtype++; assert(b <= end); return b;}/* ====================================================================== *//**@SIP_HEADER sip_mime_version MIME-Version Header * * MIME-Version header indicates what version of the MIME protocol was used * to construct the message. Its syntax is defined in [H19.4.1, S10.28] * as follows: * * @code * MIME-Version = "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT * @endcode *//**@ingroup sip_mime_version * @typedef struct msg_generic_s sip_mime_version_t; * * The structure sip_mime_version_t contains representation of an @b * MIME-Version header. * * The sip_mime_version_t is defined as follows: * @code * typedef struct msg_generic_s * { * msg_common_t g_common[1]; // Common fragment info * msg_generic_t *g_next; // Link to next header * char const *g_string; // Header value * } sip_mime_version_t; * @endcode */msg_hclass_t sip_mime_version_class[] = SIP_HEADER_CLASS_G(mime_version, "MIME-Version", "", single);int sip_mime_version_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return sip_generic_d(home, h, s, slen);}int sip_mime_version_e(char b[], int bsiz, sip_header_t const *h, int f){ return sip_generic_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_warning Warning Header * * The Warning response-header field is used to carry additional information * about the status of a response. Its syntax is defined in [S20.43] as * follows: * * @code * Warning = "Warning" HCOLON warning-value *(COMMA warning-value) * warning-value = warn-code SP warn-agent SP warn-text * warn-code = 3DIGIT * warn-agent = hostport / pseudonym * ; the name or pseudonym of the server adding * ; the Warning header, for use in debugging * warn-text = quoted-string * pseudonym = token * @endcode *//**@ingroup sip_warning * @typedef struct msg_warning_s sip_warning_t; * * The structure sip_warning_t contains representation of an @b * Warning header. * * The sip_warning_t is defined as follows: * @code * typedef struct msg_warning_s * { * msg_common_t w_common[1]; // Common fragment info * msg_warning_t *w_next; // Link to next Warning header * unsigned w_code; // Warning code * char const *w_host; // Hostname or pseudonym * char const *w_port; // Port number * char const *w_text; // Warning text * } sip_warning_t; * @endcode */#define sip_warning_dup_xtra msg_warning_dup_xtra#define sip_warning_dup_one msg_warning_dup_one#define sip_warning_update NULLmsg_hclass_t sip_warning_class[] = SIP_HEADER_CLASS(warning, "Warning", "", w_common, append, warning);int sip_warning_d(su_home_t *home, sip_header_t *h, char *s, int slen){ return msg_warning_d(home, h, s, slen);}int sip_warning_e(char b[], int bsiz, sip_header_t const *h, int f){ return msg_warning_e(b, bsiz, h, f);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -