📄 sip_feature.c
字号:
/* * This file is part of the Sofia-SIP package * * Copyright (C) 2005 Nokia Corporation. * * Contact: Pekka Pessi <pekka.pessi@nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * *//**@CFILE sip_feature.c * * @brief Feature-related SIP header handling * * @author Pekka Pessi <Pekka.Pessi@nokia.com>. * * @date Created: Tue Jun 13 02:57:51 2000 ppessi */#include "config.h"/* Avoid casting sip_t to msg_pub_t and sip_header_t to msg_header_t */#define MSG_PUB_T struct sip_s#define MSG_HDR_T union sip_header_u#include "sofia-sip/sip_parser.h"#include <stddef.h>#include <stdlib.h>#include <string.h>#include <assert.h>/* ====================================================================== *//**@SIP_HEADER sip_allow Allow Header * * The Allow header lists the set of methods supported by the user agent * generating the message. Its syntax is defined in [S10.10] as * follows: * * @code * Allow = "Allow" HCOLON [Method *(COMMA Method)] * @endcode * *//**@ingroup sip_allow * @typedef struct msg_list_s sip_allow_t; * * The structure sip_allow_t contains representation of an @b Allow header. * * The sip_allow_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_allow_t; * @endcode */msg_hclass_t sip_allow_class[] = SIP_HEADER_CLASS_LIST(allow, "Allow", "", list);int sip_allow_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_allow_t *k = (sip_allow_t *)h; return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);}int sip_allow_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_is_allow(h)); return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_proxy_require Proxy-Require Header * * The Proxy-Require header is used to indicate proxy-sensitive features * that @b MUST be supported by the proxy. Its syntax is defined in [S10.33] * as follows: * * @code * Proxy-Require = "Proxy-Require" HCOLON option-tag *(COMMA option-tag) * @endcode * *//**@ingroup sip_proxy_require * @typedef struct msg_list_s sip_proxy_require_t; * * The structure sip_proxy_require_t contains representation of an @b * Proxy-Require header. * * The sip_proxy_require_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_proxy_require_t; * @endcode */msg_hclass_t sip_proxy_require_class[] = SIP_HEADER_CLASS_LIST(proxy_require, "Proxy-Require", "", list);int sip_proxy_require_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_proxy_require_t *k = (sip_proxy_require_t *)h; return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);}int sip_proxy_require_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_is_proxy_require(h)); return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_require Require Header * * The Require header is used by clients to tell user agent servers about * options that the client expects the server to support in order to * properly process the request. Its syntax is defined in [S10.35] * as follows: * * @code * Require = "Require" HCOLON option-tag *(COMMA option-tag) * @endcode * *//**@ingroup sip_require * @typedef struct msg_list_s sip_require_t; * * The structure sip_require_t contains representation of an @b * Require header. * * The sip_require_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_require_t; * @endcode */msg_hclass_t sip_require_class[] = SIP_HEADER_CLASS_LIST(require, "Require", "", list);int sip_require_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_require_t *k = (sip_require_t *)h; return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);}int sip_require_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_is_require(h)); return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_supported Supported Header * * The Supported header enumerates all the capabilities of the client or * server. Its syntax is defined in [S10.41] as follows: * * @code * Supported = ( "Supported" / "k" ) HCOLON * [option-tag *(COMMA option-tag)] * @endcode * *//**@ingroup sip_supported * @typedef struct msg_list_s sip_supported_t; * * The structure sip_supported_t contains representation of an @b * Supported header. * * The sip_supported_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_supported_t; * @endcode */msg_hclass_t sip_supported_class[] = SIP_HEADER_CLASS_LIST(supported, "Supported", "k", list);int sip_supported_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_supported_t *k = (sip_supported_t *)h; return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);}int sip_supported_e(char b[], int bsiz, sip_header_t const *h, int f){ assert(sip_is_supported(h)); return msg_list_e(b, bsiz, h, f);}/* ====================================================================== *//**@SIP_HEADER sip_unsupported Unsupported Header * * The Unsupported header lists the features not supported by the server. * Its syntax is defined in [S20.40] as follows: * * @code * Unsupported = "Unsupported" HCOLON [option-tag *(COMMA option-tag)] * @endcode * *//**@ingroup sip_unsupported * @typedef struct msg_list_s sip_unsupported_t; * * The structure sip_unsupported_t contains representation of an @b * Unsupported header. * * The sip_unsupported_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_unsupported_t; * @endcode */msg_hclass_t sip_unsupported_class[] = SIP_HEADER_CLASS_LIST(unsupported, "Unsupported", "", list);int sip_unsupported_d(su_home_t *home, sip_header_t *h, char *s, int slen){ sip_unsupported_t *k = (sip_unsupported_t *)h; return msg_commalist_d(home, &s, &k->k_items, msg_token_scan);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -