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

📄 http_protos.h

📁 Internet Phone, Chat, Conferencing
💻 H
📖 第 1 页 / 共 5 页
字号:
/**Initializer for structure http_accept_language_t. *  * A static http_accept_language_t structure must be initialized * with the HTTP_ACCEPT_LANGUAGE_INIT() macro. For instance, * @code  *  *  http_accept_language_t http_accept_language = HTTP_ACCEPT_LANGUAGE_INIT; *  * @endcode * @HI */#define HTTP_ACCEPT_LANGUAGE_INIT() HTTP_HDR_INIT(accept_language)/**Initialize a structure http_accept_language_t. *  * An http_accept_language_t structure can be initialized with the * http_accept_language_init() function/macro. For instance, * @code *  *  http_accept_language_t http_accept_language; *  *  http_accept_language_init(&http_accept_language); *  * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_accept_language_t *http_accept_language_init(http_accept_language_t x[1]){  return HTTP_HEADER_INIT(x, http_accept_language_class, sizeof(http_accept_language_t));}#else#define http_accept_language_init(x) \  HTTP_HEADER_INIT(x, http_accept_language_class, sizeof(http_accept_language_t))#endif/**Test if header object is instance of http_accept_language_t. *  * The function http_is_accept_language() returns true (nonzero) if * the header class is an instance of Accept-Language header * object and false (zero) otherwise. *  * @param header pointer to the header structure to be tested *  * @return * The function http_is_xaccept_language() returns true (nonzero) if * the header object is an instance of header accept_language and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_accept_language(http_header_t const *header){  return header && header->sh_class->hc_hash == http_accept_language_hash;}#else#define http_is_accept_language(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_accept_language_hash)#endif/**Duplicate (deep copy) @c http_accept_language_t. *  * The function http_accept_language_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 *  *   accept_language = http_accept_language_dup(home, http->http_accept_language); *  * @endcode *  * @return * The function http_accept_language_dup() returns a pointer to the * newly duplicated http_accept_language_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_language_t *http_accept_language_dup(su_home_t *home, 				   http_accept_language_t const *hdr)     __attribute__((__malloc__));/**Copy a http_accept_language_t header structure. *  * The function http_accept_language_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 *  *   accept_language = http_accept_language_copy(home, http->http_accept_language); *  * @endcode *  * @return * The function http_accept_language_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_language_t *http_accept_language_copy(su_home_t *home, 				    http_accept_language_t const *hdr)     __attribute__((__malloc__));/**Make a header structure http_accept_language_t. *  * The function http_accept_language_make() makes a new * http_accept_language_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_accept_language_make() returns a pointer to * newly maked http_accept_language_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_language_t *http_accept_language_make(su_home_t *home, char const *s)     __attribute__((__malloc__));/**Make a Accept-Language header from formatting result. *  * The function http_accept_language_format() makes a new * Accept-Language header 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_accept_language_format() returns a pointer to newly * makes header structure, or NULL upon an error. *  * @HIDE */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_language_t *http_accept_language_format(su_home_t *home, char const *fmt, ...)     __attribute__((__malloc__, __format__ (printf, 2, 3)));/* Inlined functions */#if SU_HAVE_INLINEsu_inlinehttp_accept_language_t *http_accept_language_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_accept_language_class, fmt, ap);  va_end(ap);   return (http_accept_language_t *)h;}su_inlinehttp_accept_language_t *http_accept_language_dup(su_home_t *home, http_accept_language_t const *o) {   return (http_accept_language_t *)    msg_header_dup_as(home, http_accept_language_class, (msg_header_t const *)o);}su_inlinehttp_accept_language_t *http_accept_language_copy(su_home_t *home, http_accept_language_t const *o) {   return (http_accept_language_t *)    msg_header_copy_as(home, http_accept_language_class, (msg_header_t const *)o); }su_inline http_accept_language_t *http_accept_language_make(su_home_t *home, char const *s){  return (http_accept_language_t *)http_header_make(home, http_accept_language_class, s);}#endif#endif /* !define HTTP_HCLASSES_ONLY *//** @} *//* Declare internal prototypes for Accept-Ranges header *//**@addtogroup http_accept_ranges*/ /** @{ */enum {   /** Hash of Accept-Ranges header. @internal*/  http_accept_ranges_hash = 59733 };/**Header class for HTTP Accept-Ranges header. *  * The header class http_accept_ranges_class defines how a HTTP * Accept-Ranges header is parsed and printed.  It also * contains methods used by HTTP parser and other functions * to manipulate the http_accept_ranges_t header structure. *  */HTTP_DLL extern msg_hclass_t http_accept_ranges_class[];#ifndef HTTP_HCLASSES_ONLY/** Decode (parse) a Accept-Ranges header. @internal */msg_parse_f http_accept_ranges_d;/** Encode (print) a Accept-Ranges header. @internal */msg_print_f http_accept_ranges_e;/**Initializer for structure http_accept_ranges_t. *  * A static http_accept_ranges_t structure must be initialized * with the HTTP_ACCEPT_RANGES_INIT() macro. For instance, * @code  *  *  http_accept_ranges_t http_accept_ranges = HTTP_ACCEPT_RANGES_INIT; *  * @endcode * @HI */#define HTTP_ACCEPT_RANGES_INIT() HTTP_HDR_INIT(accept_ranges)/**Initialize a structure http_accept_ranges_t. *  * An http_accept_ranges_t structure can be initialized with the * http_accept_ranges_init() function/macro. For instance, * @code *  *  http_accept_ranges_t http_accept_ranges; *  *  http_accept_ranges_init(&http_accept_ranges); *  * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_accept_ranges_t *http_accept_ranges_init(http_accept_ranges_t x[1]){  return HTTP_HEADER_INIT(x, http_accept_ranges_class, sizeof(http_accept_ranges_t));}#else#define http_accept_ranges_init(x) \  HTTP_HEADER_INIT(x, http_accept_ranges_class, sizeof(http_accept_ranges_t))#endif/**Test if header object is instance of http_accept_ranges_t. *  * The function http_is_accept_ranges() returns true (nonzero) if * the header class is an instance of Accept-Ranges header * object and false (zero) otherwise. *  * @param header pointer to the header structure to be tested *  * @return * The function http_is_xaccept_ranges() returns true (nonzero) if * the header object is an instance of header accept_ranges and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_accept_ranges(http_header_t const *header){  return header && header->sh_class->hc_hash == http_accept_ranges_hash;}#else#define http_is_accept_ranges(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_accept_ranges_hash)#endif/**Duplicate (deep copy) @c http_accept_ranges_t. *  * The function http_accept_ranges_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 *  *   accept_ranges = http_accept_ranges_dup(home, http->http_accept_ranges); *  * @endcode *  * @return * The function http_accept_ranges_dup() returns a pointer to the * newly duplicated http_accept_ranges_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_ranges_t *http_accept_ranges_dup(su_home_t *home, 				   http_accept_ranges_t const *hdr)     __attribute__((__malloc__));/**Copy a http_accept_ranges_t header structure. *  * The function http_accept_ranges_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 *  *   accept_ranges = http_accept_ranges_copy(home, http->http_accept_ranges); *  * @endcode *  * @return * The function http_accept_ranges_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_ranges_t *http_accept_ranges_copy(su_home_t *home, 				    http_accept_ranges_t const *hdr)     __attribute__((__malloc__));/**Make a header structure http_accept_ranges_t. *  * The function http_accept_ranges_make() makes a new * http_accept_ranges_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_accept_ranges_make() returns a pointer to * newly maked http_accept_ranges_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_ranges_t *http_accept_ranges_make(su_home_t *home, char const *s)     __attribute__((__malloc__));/**Make a Accept-Ranges header from formatting result. *  * The function http_accept_ranges_format() makes a new * Accept-Ranges header 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_accept_ranges_format() returns a pointer to newly * makes header structure, or NULL upon an error. *  * @HIDE */#if SU_HAVE_INLINEsu_inline#endifhttp_accept_ranges_t *http_accept_ranges_format(su_home_t *home, char const *fmt, ...)     __attribute__((__malloc__, __format__ (printf, 2, 3)));/* Inlined functions */#if SU_HAVE_INLINEsu_inlinehttp_accept_ranges_t *http_accept_ranges_format(su_home_t *home, char const *fmt, ...){  http_header_t *h;  va_list ap;    va_start(ap, fmt);

⌨️ 快捷键说明

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