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

📄 http_protos.h

📁 一个支持众多rfc的开源sip协议栈
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * 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 * */#ifndef HTTP_PROTOS_H/** Defined when <sofia-sip/http_protos.h> has been included. */#define HTTP_PROTOS_H/**@file sofia-sip/http_protos.h  * * Macros for each HTTP header. * * This file is automatically generated from <http.h> by msg_parser.awk. *  * @author Pekka Pessi <Pekka.Pessi@nokia.com> */#include <sofia-sip/su_config.h>#ifndef HTTP_HEADER_H#include <sofia-sip/http_header.h>#endif#ifndef HTTP_HCLASSES_H#include <sofia-sip/http_hclasses.h>#endif#define http_header_make(h, c, s) \  ((http_header_t *)msg_header_make((h), (c), (s)))#define http_header_vformat(h, c, f, a) \  ((http_header_t *)msg_header_vformat((h), (c), (f), (a)))SOFIA_BEGIN_DECLS/* Declare internal prototypes for request line *//**@addtogroup http_request*/ /** @{ */enum {   /** Hash of request line. @internal*/  http_request_hash = -1 };/**Header class for HTTP request line. *  * The header class http_request_class defines how a HTTP * request line is parsed and printed.  It also * contains methods used by HTTP parser and other functions * to manipulate the http_request_t header structure. *  */SOFIAPUBVAR msg_hclass_t http_request_class[];#ifndef HTTP_HCLASSES_ONLY/** Decode (parse) a request line. @internal */SOFIAPUBFUN msg_parse_f http_request_d;/** Encode (print) a request line. @internal */SOFIAPUBFUN msg_print_f http_request_e;/**Initializer for structure http_request_t. *  * A static http_request_t structure must be initialized * with the HTTP_REQUEST_INIT() macro. For instance, * @code  *  *  http_request_t http_request = HTTP_REQUEST_INIT; *  * @endcode * @HI */#define HTTP_REQUEST_INIT() HTTP_HDR_INIT(request)/**Initialize a structure http_request_t. *  * An http_request_t structure can be initialized with the * http_request_init() function/macro. For instance, * @code *  *  http_request_t http_request; *  *  http_request_init(&http_request); *  * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_request_t *http_request_init(http_request_t x[1]){  return HTTP_HEADER_INIT(x, http_request_class, sizeof(http_request_t));}#else#define http_request_init(x) \  HTTP_HEADER_INIT(x, http_request_class, sizeof(http_request_t))#endif/**Test if header object is instance of http_request_t. *  * The function http_is_request() returns true (nonzero) if * the header class is an instance of request line * object and false (zero) otherwise. *  * @param header pointer to the header structure to be tested *  * @return * The function http_is_xrequest() returns true (nonzero) if * the header object is an instance of header request and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_request(http_header_t const *header){  return header && header->sh_class->hc_hash == http_request_hash;}#else#define http_is_request(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_request_hash)#endif/**Duplicate (deep copy) @c http_request_t. *  * The function http_request_dup() duplicates a header * structure @a hdr.  If the header structure @a hdr * contains a reference (@c hdr->x_next) to a list of * headers, all the headers in the list are duplicated, too. *  * @param home  memory home used to allocate new structure * @param hdr   header structure to be duplicated *  * When duplicating, all parameter lists and non-constant * strings attached to the header are copied, too.  The * function uses given memory @a home to allocate all the * memory areas used to copy the header. *  * @par Example * @code *  *   request = http_request_dup(home, http->http_request); *  * @endcode *  * @return * The function http_request_dup() returns a pointer to the * newly duplicated http_request_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_request_t *http_request_dup(su_home_t *home, 				   http_request_t const *hdr)     __attribute__((__malloc__));/**Copy a http_request_t header structure. *  * The function http_request_copy() copies a header structure @a * hdr.  If the header structure @a hdr contains a reference (@c * hdr->h_next) to a list of headers, all the headers in that * list are copied, too. The function uses given memory @a home * to allocate all the memory areas used to copy the header * structure @a hdr. *  * @param home    memory home used to allocate new structure * @param hdr     pointer to the header structure to be duplicated *  * When copying, only the header structure and parameter lists * attached to it are duplicated.  The new header structure * retains all the references to the strings within the old @a * header, including the encoding of the old header, if present. *  * @par Example * @code *  *   request = http_request_copy(home, http->http_request); *  * @endcode *  * @return * The function http_request_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_request_t *http_request_copy(su_home_t *home, 				    http_request_t const *hdr)     __attribute__((__malloc__));/**Make a header structure http_request_t. *  * The function http_request_make() makes a new * http_request_t header structure.  It allocates a new * header structure, and decodes the string @a s as the * value of the structure. *  * @param home memory home used to allocate new header structure. * @param s    string to be decoded as value of the new header structure *  * @note This function is usually implemented as a macro calling * http_header_make(). *  * @return * The function http_request_make() returns a pointer to * newly maked http_request_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_request_t *http_request_make(su_home_t *home, char const *s)     __attribute__((__malloc__));/**Make a request line from formatting result. *  * The function http_request_format() makes a new * request line object using formatting result as its * value.  The function first prints the arguments according to * the format @a fmt specified.  Then it allocates a new header * structure, and uses the formatting result as the header * value. *  * @param home   memory home used to allocate new header structure. * @param fmt    string used as a printf()-style format * @param ...    argument list for format *  * @note This function is usually implemented as a macro calling * msg_header_format(). *  * @return * The function http_request_format() returns a pointer to newly * makes header structure, or NULL upon an error. *  * @HIDE */#if SU_HAVE_INLINEsu_inline#endifhttp_request_t *http_request_format(su_home_t *home, char const *fmt, ...)     __attribute__((__malloc__, __format__ (printf, 2, 3)));/* Inlined functions */#if SU_HAVE_INLINEsu_inlinehttp_request_t *http_request_format(su_home_t *home, char const *fmt, ...){  http_header_t *h;  va_list ap;    va_start(ap, fmt);  h = http_header_vformat(home, http_request_class, fmt, ap);  va_end(ap);   return (http_request_t *)h;}su_inlinehttp_request_t *http_request_dup(su_home_t *home, http_request_t const *o) {   return (http_request_t *)    msg_header_dup_as(home, http_request_class, (msg_header_t const *)o);}su_inlinehttp_request_t *http_request_copy(su_home_t *home, http_request_t const *o) {   return (http_request_t *)    msg_header_copy_as(home, http_request_class, (msg_header_t const *)o); }su_inline http_request_t *http_request_make(su_home_t *home, char const *s){  return (http_request_t *)http_header_make(home, http_request_class, s);}#endif#endif /* !define HTTP_HCLASSES_ONLY *//** @} *//* Declare internal prototypes for status line *//**@addtogroup http_status*/ /** @{ */enum {   /** Hash of status line. @internal*/  http_status_hash = -2 };/**Header class for HTTP status line. *  * The header class http_status_class defines how a HTTP * status line is parsed and printed.  It also * contains methods used by HTTP parser and other functions * to manipulate the http_status_t header structure. *  */SOFIAPUBVAR msg_hclass_t http_status_class[];#ifndef HTTP_HCLASSES_ONLY/** Decode (parse) a status line. @internal */SOFIAPUBFUN msg_parse_f http_status_d;/** Encode (print) a status line. @internal */SOFIAPUBFUN msg_print_f http_status_e;/**Initializer for structure http_status_t. *  * A static http_status_t structure must be initialized * with the HTTP_STATUS_INIT() macro. For instance, * @code  *  *  http_status_t http_status = HTTP_STATUS_INIT; *  * @endcode * @HI */#define HTTP_STATUS_INIT() HTTP_HDR_INIT(status)/**Initialize a structure http_status_t. *  * An http_status_t structure can be initialized with the * http_status_init() function/macro. For instance, * @code *  *  http_status_t http_status; *  *  http_status_init(&http_status); *  * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_status_t *http_status_init(http_status_t x[1]){  return HTTP_HEADER_INIT(x, http_status_class, sizeof(http_status_t));}#else#define http_status_init(x) \  HTTP_HEADER_INIT(x, http_status_class, sizeof(http_status_t))#endif/**Test if header object is instance of http_status_t. *  * The function http_is_status() returns true (nonzero) if * the header class is an instance of status line * object and false (zero) otherwise. *  * @param header pointer to the header structure to be tested *  * @return * The function http_is_xstatus() returns true (nonzero) if * the header object is an instance of header status and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_status(http_header_t const *header){  return header && header->sh_class->hc_hash == http_status_hash;}#else#define http_is_status(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_status_hash)#endif/**Duplicate (deep copy) @c http_status_t. *  * The function http_status_dup() duplicates a header * structure @a hdr.  If the header structure @a hdr * contains a reference (@c hdr->x_next) to a list of * headers, all the headers in the list are duplicated, too. *  * @param home  memory home used to allocate new structure * @param hdr   header structure to be duplicated *  * When duplicating, all parameter lists and non-constant * strings attached to the header are copied, too.  The * function uses given memory @a home to allocate all the * memory areas used to copy the header. *  * @par Example * @code *  *   status = http_status_dup(home, http->http_status); *  * @endcode *  * @return * The function http_status_dup() returns a pointer to the * newly duplicated http_status_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_status_t *http_status_dup(su_home_t *home, 				   http_status_t const *hdr)     __attribute__((__malloc__));/**Copy a http_status_t header structure. *  * The function http_status_copy() copies a header structure @a * hdr.  If the header structure @a hdr contains a reference (@c * hdr->h_next) to a list of headers, all the headers in that * list are copied, too. The function uses given memory @a home * to allocate all the memory areas used to copy the header * structure @a hdr. *  * @param home    memory home used to allocate new structure * @param hdr     pointer to the header structure to be duplicated *  * When copying, only the header structure and parameter lists * attached to it are duplicated.  The new header structure * retains all the references to the strings within the old @a * header, including the encoding of the old header, if present. *  * @par Example

⌨️ 快捷键说明

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