⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msg_mime.c

📁 sip协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
 * @endcode */msg_hclass_t msg_accept_charset_class[1] = MSG_HEADER_CLASS(msg_, accept_charset, "Accept-Charset", "",		  aa_params, apndlist, msg_accept_any, msg_accept_any);int msg_accept_charset_d(su_home_t *home, msg_header_t *h, char *s, int slen){  return msg_accept_any_d(home, h, s, slen);}int msg_accept_charset_e(char b[], int bsiz, msg_header_t const *h, int f){  assert(msg_is_accept_charset(h));  return msg_accept_any_e(b, bsiz, h, f);}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_accept_encoding Accept-Encoding Header * * The Accept-Encoding header is similar to Accept, but restricts the * content-codings that are acceptable in the response.  Its syntax is * defined in [H14.3, S20.2] as follows: * * @code *    Accept-Encoding  = "Accept-Encoding" ":" *                       1#( codings [ ";" "q" "=" qvalue ] ) *    codings          = ( content-coding | "*" ) *    content-coding   = token * @endcode * *//**@ingroup msg_accept_encoding * @typedef typedef struct msg_accept_encoding_s msg_accept_encoding_t; * * The structure msg_accept_encoding_t contains representation of @b * Accept-Encoding header. * * The msg_accept_encoding_t is defined as follows: * @code * typedef struct { *   msg_common_t        aa_common[1]; // Common fragment info *   msg_accept_any_t   *aa_next;      // Pointer to next Accept-Encoding *   char const         *aa_value;     // Content-coding *   msg_param_t const  *aa_params;    // Parameter list *   char const         *aa_q;	       // Q-value * } msg_accept_encoding_t; * @endcode */msg_hclass_t msg_accept_encoding_class[1] = MSG_HEADER_CLASS(msg_, accept_encoding, "Accept-Encoding", "",		  aa_params, apndlist, msg_accept_any, msg_accept_any);int msg_accept_encoding_d(su_home_t *home, msg_header_t *h, char *s, int slen){  return msg_accept_any_d(home, h, s, slen);}int msg_accept_encoding_e(char b[], int bsiz, msg_header_t const *h, int f){  return msg_accept_any_e(b, bsiz, h, f);}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_accept_language Accept-Language Header * * The Accept-Language header allows the client to indicate to the server in * which language it would prefer to receive reason phrases, session * descriptions or status responses carried as message bodies. Its syntax is * defined in [H14.4, S20.3] as follows: * * @code *    Accept-Language = "Accept-Language" ":" *                      1#( language-range [ ";" "q" "=" qvalue ] ) * *    language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) * @endcode * *//**@ingroup msg_accept_language * @typedef typedef struct msg_accept_language_s msg_accept_language_t; * * The structure msg_accept_language_t contains representation of @b * Accept-Language header. * * The msg_accept_language_t is defined as follows: * @code * typedef struct { *   msg_common_t        aa_common[1]; // Common fragment info *   msg_accept_any_t   *aa_next;      // Pointer to next Accept-Encoding *   char const         *aa_value;     // Language-range *   msg_param_t const  *aa_params;    // Parameter list *   char const         *aa_q;	       // Q-value * } msg_accept_language_t; * @endcode */msg_hclass_t msg_accept_language_class[1] = MSG_HEADER_CLASS(msg_, accept_language, "Accept-Language", "",		  aa_params, apndlist, msg_accept_any, msg_accept_any);int msg_accept_language_d(su_home_t *home, msg_header_t *h, char *s, int slen){  return msg_accept_any_d(home, h, s, slen);}int msg_accept_language_e(char b[], int bsiz, msg_header_t const *h, int f){  assert(msg_is_accept_language(h));  return msg_accept_any_e(b, bsiz, h, f);}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_content_disposition Content-Disposition Header * * The Content-Disposition header field describes how the message body or, * in the case of multipart messages, a message body part is to be * interpreted by the UAC or UAS.  Its syntax is defined in [S20.11] * as follows: * * @code *    Content-Disposition   =  "Content-Disposition" ":" *                             disposition-type *( ";" disposition-param ) *    disposition-type      =  "render" | "session" | "icon" | "alert" *                         |   disp-extension-token *    disposition-param     =  "handling" "=" *                             ( "optional" | "required" | other-handling ) *                         |   generic-param *    other-handling        =  token *    disp-extension-token  =  token * @endcode * * The Content-Disposition header was extended by * draft-lennox-sip-reg-payload-01.txt section 3.1 as follows: * * @code *    Content-Disposition      =  "Content-Disposition" ":" *                                disposition-type *( ";" disposition-param ) *    disposition-type        /=  "script" | "sip-cgi" | token *    disposition-param       /=  action-param *                             /  modification-date-param *    action-param             =  "action" "=" action-value *    action-value             =  "store" | "remove" | token *    modification-date-param  =  "modification-date" "=" quoted-date-time *    quoted-date-time         =  <"> SIP-date <"> * @endcode *//**@ingroup msg_content_disposition * @typedef struct msg_content_disposition_s msg_content_disposition_t;  * * The structure msg_content_disposition_t contains representation of an @b * Content-Disposition header. * * The msg_content_disposition_t is defined as follows: * @code * typedef struct msg_content_disposition_s * { *   msg_common_t       cd_common[1];  // Common fragment info *   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 * } msg_content_disposition_t; * @endcode */msg_hclass_t msg_content_disposition_class[] =MSG_HEADER_CLASS(msg_, content_disposition, "Content-Disposition", "",		 cd_params, single, msg_content_disposition,		 msg_content_disposition);int msg_content_disposition_d(su_home_t *home, msg_header_t *h, char *s, int slen){  msg_content_disposition_t *cd = (msg_content_disposition_t *)h;  if (msg_token_d(&s, &cd->cd_type) < 0 ||      (*s == ';' && msg_params_d(home, &s, &cd->cd_params) < 0))      return -1;  if (cd->cd_params)    msg_header_update_params(cd->cd_common, 0);  return 0;}int msg_content_disposition_e(char b[], int bsiz, msg_header_t const *h, int f){  char *b0 = b, *end = b + bsiz;  msg_content_disposition_t const *cd = (msg_content_disposition_t *)h;  assert(msg_is_content_disposition(h));  MSG_STRING_E(b, end, cd->cd_type);  MSG_PARAMS_E(b, end, cd->cd_params, f);  MSG_TERM_E(b, end);  return b - b0;}int msg_content_disposition_dup_xtra(msg_header_t const *h, int offset){  int rv = offset;  msg_content_disposition_t const *cd = (msg_content_disposition_t *)h;  MSG_PARAMS_SIZE(rv, cd->cd_params);  rv += MSG_STRING_SIZE(cd->cd_type);  return rv;}/** Duplicate one msg_content_disposition_t object */char *msg_content_disposition_dup_one(msg_header_t *dst,				     msg_header_t const *src,				     char *b, int xtra){  msg_content_disposition_t *cd = (msg_content_disposition_t *)dst;  msg_content_disposition_t const *o = (msg_content_disposition_t *)src;  char *end = b + xtra;  b = msg_params_dup(&cd->cd_params, o->cd_params, b, xtra);  MSG_STRING_DUP(b, cd->cd_type, o->cd_type);  assert(b <= end);  return b;}/** Update Content-Disposition parameters */int msg_content_disposition_update(msg_common_t *h,				   char const *name, int namelen,				   char const *value){  msg_content_disposition_t *cd = (msg_content_disposition_t *)h;  if (name == NULL) {    cd->cd_handling = NULL, cd->cd_required = 0, cd->cd_optional = 0;  }  else if (namelen == strlen("handling") &&	   strncasecmp(name, "handling", namelen) == 0) {    cd->cd_handling = value;    cd->cd_required = strcasecmp(value, "required") == 0;    cd->cd_optional = strcasecmp(value, "optional") == 0;  }  return 0;}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_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 [H14.11] * and [S20.12] as follows: * * @code *    Content-Encoding = ( "Content-Encoding" / "e" ) ":" 1#content-coding *    content-coding   = token * @endcode *//**@ingroup msg_content_encoding * @typedef struct msg_list_s msg_content_encoding_t;  * * The structure msg_content_encoding_t contains representation of an @b * Content-Encoding header. * * The msg_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 * } msg_content_encoding_t; * @endcode */msg_hclass_t msg_content_encoding_class[] =  MSG_HEADER_CLASS_LIST(content_encoding, "Content-Encoding", "e", list);int msg_content_encoding_d(su_home_t *home, msg_header_t *h, char *s, int slen){  msg_content_encoding_t *e = (msg_content_encoding_t *)h;  return msg_commalist_d(home, &s, &e->k_items, msg_token_scan);}int msg_content_encoding_e(char b[], int bsiz, msg_header_t const *h, int f){  assert(msg_is_content_encoding(h));  return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_content_language Content-Language Header * * The Content-Language header describes the natural language(s) of the * intended audience for the enclosed message body. Note that this might not * be equivalent to all the languages used within the message-body. Its * syntax is defined in [H14.12, S20.13] as follows: * * @code *    Content-Language  = "Content-Language" ":" 1#language-tag * @endcode * or * @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 msg_content_language * @typedef typedef struct msg_content_language_s msg_content_language_t; * * The structure msg_content_language_t contains representation of @b * Content-Language header. * * The msg_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 * } msg_content_language_t; * @endcode */msg_hclass_t msg_content_language_class[] =MSG_HEADER_CLASS_LIST(content_language, "Content-Language", "", list);int msg_content_language_d(su_home_t *home, msg_header_t *h, char *s, int slen){  msg_content_language_t *k = (msg_content_language_t *)h;  return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);}int msg_content_language_e(char b[], int bsiz, msg_header_t const *h, int f){  assert(msg_is_content_language(h));  return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_content_length Content-Length Header * * The Content-Length header indicates the size of the message-body in * decimal number of octets.  Its syntax is defined in [S10.18] as * follows: * * @code *    Content-Length  =  ( "Content-Length" / "l" ) HCOLON 1*DIGIT * @endcode * *//**@ingroup msg_content_length * @typedef typedef struct msg_content_length_s msg_content_length_t; * * The structure msg_content_length_t contains representation of a * Content-Length header. * * The msg_content_length_t is defined as follows: * @code * typedef struct msg_content_length_s { *   msg_common_t   l_common[1];        // Common fragment info *   msg_error_t   *l_next;             // Link to next (dummy) *   unsigned long  l_length;           // Numeric value * } msg_content_length_t; * @endcode */#define msg_content_length_d msg_numeric_d#define msg_content_length_e msg_numeric_emsg_hclass_t msg_content_length_class[] =MSG_HEADER_CLASS(msg_, content_length, "Content-Length", "l",		 l_common, single_critical, msg_default, msg_generic);/**@ingroup msg_content_length *燙reate a @b Content-Length header object. * * The function msg_content_length_create() creates a Content-Length * header object with the value @a n.  The memory for the header is * allocated from the memory home @a home. * * @param home  memory home * @param n     payload size in bytes * * @return * The function msg_content_length_create() returns a pointer to newly * created @b Content-Length header object when successful or NULL upon * an error. */msg_content_length_t *msg_content_length_create(su_home_t *home, uint32_t n){  msg_content_length_t *l = (msg_content_length_t *)    msg_header_alloc(home, msg_content_length_class, 0);  if (l)    l->l_length = n;  return l;}/* ====================================================================== *//**@ingroup msg_mime * @defgroup msg_content_md5 Content-MD5 Header * * The Content-MD5 header is an MD5 digest of the entity-body for the * purpose of providing an end-to-end message integrity check (MIC) of the * message-body. Its syntax is defined in [@RFC1864, H14.15] as follows: * * @code *      Content-MD5   = "Content-MD5" ":" md5-digest *      md5-digest   = <base64 of 128 bit MD5 digest as per @RFC1864> * @endcode *//**@ingroup msg_content_md5 * @typedef struct msg_generic_s msg_content_md5_t;  * * The structure msg_content_md5_t contains representation of an @b * Content-MD5 header.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -