📄 http_protos.h
字号:
h = http_header_vformat(home, http_accept_ranges_class, fmt, ap); va_end(ap); return (http_accept_ranges_t *)h;}su_inlinehttp_accept_ranges_t *http_accept_ranges_dup(su_home_t *home, http_accept_ranges_t const *o) { return (http_accept_ranges_t *) msg_header_dup_as(home, http_accept_ranges_class, (msg_header_t const *)o);}su_inlinehttp_accept_ranges_t *http_accept_ranges_copy(su_home_t *home, http_accept_ranges_t const *o) { return (http_accept_ranges_t *) msg_header_copy_as(home, http_accept_ranges_class, (msg_header_t const *)o); }su_inline http_accept_ranges_t *http_accept_ranges_make(su_home_t *home, char const *s){ return (http_accept_ranges_t *)http_header_make(home, http_accept_ranges_class, s);}#endif#endif /* !define HTTP_HCLASSES_ONLY *//** @} *//* Declare internal prototypes for Allow header *//**@addtogroup http_allow*/ /** @{ */enum { /** Hash of Allow header. @internal*/ http_allow_hash = 44519 };/**Header class for HTTP Allow header. * * The header class http_allow_class defines how a HTTP * Allow header is parsed and printed. It also * contains methods used by HTTP parser and other functions * to manipulate the http_allow_t header structure. * */HTTP_DLL extern msg_hclass_t http_allow_class[];#ifndef HTTP_HCLASSES_ONLY/** Decode (parse) a Allow header. @internal */msg_parse_f http_allow_d;/** Encode (print) a Allow header. @internal */msg_print_f http_allow_e;/**Initializer for structure http_allow_t. * * A static http_allow_t structure must be initialized * with the HTTP_ALLOW_INIT() macro. For instance, * @code * * http_allow_t http_allow = HTTP_ALLOW_INIT; * * @endcode * @HI */#define HTTP_ALLOW_INIT() HTTP_HDR_INIT(allow)/**Initialize a structure http_allow_t. * * An http_allow_t structure can be initialized with the * http_allow_init() function/macro. For instance, * @code * * http_allow_t http_allow; * * http_allow_init(&http_allow); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_allow_t *http_allow_init(http_allow_t x[1]){ return HTTP_HEADER_INIT(x, http_allow_class, sizeof(http_allow_t));}#else#define http_allow_init(x) \ HTTP_HEADER_INIT(x, http_allow_class, sizeof(http_allow_t))#endif/**Test if header object is instance of http_allow_t. * * The function http_is_allow() returns true (nonzero) if * the header class is an instance of Allow header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function http_is_xallow() returns true (nonzero) if * the header object is an instance of header allow and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_allow(http_header_t const *header){ return header && header->sh_class->hc_hash == http_allow_hash;}#else#define http_is_allow(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_allow_hash)#endif/**Duplicate (deep copy) @c http_allow_t. * * The function http_allow_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 * * allow = http_allow_dup(home, http->http_allow); * * @endcode * * @return * The function http_allow_dup() returns a pointer to the * newly duplicated http_allow_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_allow_t *http_allow_dup(su_home_t *home, http_allow_t const *hdr) __attribute__((__malloc__));/**Copy a http_allow_t header structure. * * The function http_allow_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 * * allow = http_allow_copy(home, http->http_allow); * * @endcode * * @return * The function http_allow_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_allow_t *http_allow_copy(su_home_t *home, http_allow_t const *hdr) __attribute__((__malloc__));/**Make a header structure http_allow_t. * * The function http_allow_make() makes a new * http_allow_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_allow_make() returns a pointer to * newly maked http_allow_t header structure, or NULL upon * an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_allow_t *http_allow_make(su_home_t *home, char const *s) __attribute__((__malloc__));/**Make a Allow header from formatting result. * * The function http_allow_format() makes a new * Allow 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_allow_format() returns a pointer to newly * makes header structure, or NULL upon an error. * * @HIDE */#if SU_HAVE_INLINEsu_inline#endifhttp_allow_t *http_allow_format(su_home_t *home, char const *fmt, ...) __attribute__((__malloc__, __format__ (printf, 2, 3)));/* Inlined functions */#if SU_HAVE_INLINEsu_inlinehttp_allow_t *http_allow_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_allow_class, fmt, ap); va_end(ap); return (http_allow_t *)h;}su_inlinehttp_allow_t *http_allow_dup(su_home_t *home, http_allow_t const *o) { return (http_allow_t *) msg_header_dup_as(home, http_allow_class, (msg_header_t const *)o);}su_inlinehttp_allow_t *http_allow_copy(su_home_t *home, http_allow_t const *o) { return (http_allow_t *) msg_header_copy_as(home, http_allow_class, (msg_header_t const *)o); }su_inline http_allow_t *http_allow_make(su_home_t *home, char const *s){ return (http_allow_t *)http_header_make(home, http_allow_class, s);}#endif#endif /* !define HTTP_HCLASSES_ONLY *//** @} *//* Declare internal prototypes for Authentication-Info header *//**@addtogroup http_authentication_info*/ /** @{ */enum { /** Hash of Authentication-Info header. @internal*/ http_authentication_info_hash = 20849 };/**Header class for HTTP Authentication-Info header. * * The header class http_authentication_info_class defines how a HTTP * Authentication-Info header is parsed and printed. It also * contains methods used by HTTP parser and other functions * to manipulate the http_authentication_info_t header structure. * */HTTP_DLL extern msg_hclass_t http_authentication_info_class[];#ifndef HTTP_HCLASSES_ONLY/** Decode (parse) a Authentication-Info header. @internal */msg_parse_f http_authentication_info_d;/** Encode (print) a Authentication-Info header. @internal */msg_print_f http_authentication_info_e;/**Initializer for structure http_authentication_info_t. * * A static http_authentication_info_t structure must be initialized * with the HTTP_AUTHENTICATION_INFO_INIT() macro. For instance, * @code * * http_authentication_info_t http_authentication_info = HTTP_AUTHENTICATION_INFO_INIT; * * @endcode * @HI */#define HTTP_AUTHENTICATION_INFO_INIT() HTTP_HDR_INIT(authentication_info)/**Initialize a structure http_authentication_info_t. * * An http_authentication_info_t structure can be initialized with the * http_authentication_info_init() function/macro. For instance, * @code * * http_authentication_info_t http_authentication_info; * * http_authentication_info_init(&http_authentication_info); * * @endcode * @HI */#if SU_HAVE_INLINEsu_inline http_authentication_info_t *http_authentication_info_init(http_authentication_info_t x[1]){ return HTTP_HEADER_INIT(x, http_authentication_info_class, sizeof(http_authentication_info_t));}#else#define http_authentication_info_init(x) \ HTTP_HEADER_INIT(x, http_authentication_info_class, sizeof(http_authentication_info_t))#endif/**Test if header object is instance of http_authentication_info_t. * * The function http_is_authentication_info() returns true (nonzero) if * the header class is an instance of Authentication-Info header * object and false (zero) otherwise. * * @param header pointer to the header structure to be tested * * @return * The function http_is_xauthentication_info() returns true (nonzero) if * the header object is an instance of header authentication_info and * false (zero) otherwise. */#if SU_HAVE_INLINEsu_inline int http_is_authentication_info(http_header_t const *header){ return header && header->sh_class->hc_hash == http_authentication_info_hash;}#else#define http_is_authentication_info(h) \ ((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_authentication_info_hash)#endif/**Duplicate (deep copy) @c http_authentication_info_t. * * The function http_authentication_info_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 * * authentication_info = http_authentication_info_dup(home, http->http_authentication_info); * * @endcode * * @return * The function http_authentication_info_dup() returns a pointer to the * newly duplicated http_authentication_info_t header structure, or NULL * upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_authentication_info_t *http_authentication_info_dup(su_home_t *home, http_authentication_info_t const *hdr) __attribute__((__malloc__));/**Copy a http_authentication_info_t header structure. * * The function http_authentication_info_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 * * authentication_info = http_authentication_info_copy(home, http->http_authentication_info); * * @endcode * * @return * The function http_authentication_info_copy() returns a pointer to * newly copied header structure, or NULL upon an error. */#if SU_HAVE_INLINEsu_inline#endifhttp_authentication_info_t *http_authentication_info_copy(su_home_t *home, http_authentication_info_t const *hdr) __attribute__((__malloc__));/**Make a header structure http_authentication_info_t. * * The function http_aut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -