📄 http.h
字号:
/* * 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_H /** Defined when http.h has been included. */#define HTTP_H/**@file http.h * * HTTP message, methods, headers. * * @sa <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> * * @author Pekka Pessi <Pekka.Pessi@nokia.com>. * * @date Created : Thu Jun 8 19:28:55 2000 ppessi */#ifndef MSG_H#include <sofia-sip/msg.h>#endif#ifndef URL_H#include <sofia-sip/url.h>#endif#ifndef MSG_MIME_H#include <sofia-sip/msg_mime.h>#endifSOFIA_BEGIN_DECLS/* ---------------------------------------------------------------------- * 1) Constants */#define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE)#define HTTP_DEFAULT_PORT (80)#define HTTP_DEFAULT_SERV "80"/** HTTP protocol identifier */#define HTTP_PROTOCOL_TAG ((void *)0x48545450) /* 'HTTP' *//** HTTP parser flags */enum { HTTP_FLG_NO_BODY = (1 << 15)};/** IDs for well-known HTTP methods. */typedef enum { http_method_invalid = -1, /**< Invalid method name */ http_method_unknown = 0, /**< Unknown method, use @c method_name */ http_method_get, /**< GET */ http_method_post, /**< POST */ http_method_head, /**< HEAD */ http_method_options, /**< OPTIONS */ http_method_put, /**< PUT */ http_method_delete, /**< DELETE */ http_method_trace, /**< TRACE */ http_method_connect, /**< CONNECT */} http_method_t;#define HTTP_METHOD(s) http_method_unknown, #s#define HTTP_NO_METHOD http_method_unknown, NULL#define HTTP_METHOD_GET http_method_get, "GET"#define HTTP_METHOD_POST http_method_post, "POST"#define HTTP_METHOD_HEAD http_method_head, "HEAD"#define HTTP_METHOD_OPTIONS http_method_options, "OPTIONS"#define HTTP_METHOD_PUT http_method_put, "PUT"#define HTTP_METHOD_DELETE http_method_delete, "DELETE"#define HTTP_METHOD_TRACE http_method_trace, "TRACE"#define HTTP_METHOD_CONNECT http_method_connect, "CONNECT"/* ---------------------------------------------------------------------- * 2) Type declarations *//** HTTP message object. */typedef struct http_s http_t;/** Any HTTP header - union of all possible HTTP headers. */typedef union http_header_u http_header_t;typedef struct http_request_s http_request_t;typedef struct http_status_s http_status_t;typedef msg_accept_t http_accept_t;typedef msg_accept_charset_t http_accept_charset_t;typedef msg_accept_encoding_t http_accept_encoding_t;typedef msg_accept_language_t http_accept_language_t;typedef msg_list_t http_accept_ranges_t;typedef msg_numeric_t http_age_t;typedef msg_list_t http_allow_t;typedef struct http_authentication_info_s http_authentication_info_t;typedef msg_auth_t http_authorization_t;typedef msg_list_t http_cache_control_t;typedef msg_list_t http_connection_t;typedef msg_content_encoding_t http_content_encoding_t;typedef msg_content_language_t http_content_language_t;typedef msg_content_length_t http_content_length_t;typedef msg_content_location_t http_content_location_t;typedef msg_generic_t http_content_md5_t;typedef struct http_content_range_s http_content_range_t;typedef msg_content_type_t http_content_type_t;typedef struct http_date_s http_date_t;typedef msg_generic_t http_etag_t;typedef msg_generic_t http_expect_t;typedef http_date_t http_expires_t;typedef msg_generic_t http_from_t;typedef struct http_host_s http_host_t;typedef msg_list_t http_if_match_t;typedef http_date_t http_if_modified_since_t;typedef msg_list_t http_if_none_match_t;typedef struct http_if_range_s http_if_range_t;typedef http_date_t http_if_unmodified_since_t;typedef http_date_t http_last_modified_t;typedef struct http_location_s http_location_t;typedef struct http_max_forwards_s http_max_forwards_t;typedef msg_generic_t http_mime_version_t;typedef msg_list_t http_pragma_t;typedef msg_auth_t http_proxy_authenticate_t;typedef msg_auth_t http_proxy_authorization_t;typedef struct http_range_s http_range_t;typedef struct http_location_s http_referer_t;typedef struct http_retry_after_s http_retry_after_t;typedef msg_generic_t http_server_t;typedef struct http_te_s http_te_t;typedef msg_list_t http_trailer_t;typedef msg_list_t http_transfer_encoding_t;typedef msg_list_t http_upgrade_t;typedef msg_generic_t http_user_agent_t;typedef msg_list_t http_vary_t;typedef struct http_via_s http_via_t;typedef msg_warning_t http_warning_t;typedef msg_auth_t http_www_authenticate_t;typedef msg_list_t http_proxy_connection_t;typedef struct http_set_cookie_s http_set_cookie_t;typedef struct http_cookie_s http_cookie_t;/** Erroneous header. */typedef msg_error_t http_error_t;/** Unknown header. */typedef msg_generic_t http_unknown_t;/** Separator line between headers and message contents */ typedef msg_separator_t http_separator_t;/** Entity-body */ typedef msg_payload_t http_payload_t;/** Time in seconds since 01-Jan-1900. */typedef unsigned long http_time_t;/** Range offset. */typedef unsigned long http_off_t;/* ---------------------------------------------------------------------- * 3) Structure definitions *//** HTTP request line */struct http_request_s { msg_common_t rq_common[1]; http_error_t *rq_next; http_method_t rq_method; /** Method enum. */ char const *rq_method_name; /** Method name. */ url_t rq_url[1]; /** URL. */ char const *rq_version; /** Protocol version. */};/** HTTP status line */struct http_status_s { msg_common_t st_common[1]; http_error_t *st_next; char const *st_version; int st_status; char const *st_phrase;};/**@ingroup http_authentication_info * @brief Structure for @b Authentication-Info header. */struct http_authentication_info_s{ msg_common_t ai_common[1]; /**< Common fragment info */ msg_error_t *ai_next; /**< Dummy link to next */ msg_param_t const *ai_params; /**< List of authentication info */};/** Content-Range */struct http_content_range_s { msg_common_t cr_common[1]; http_error_t *cr_next; http_off_t cr_first; /**< First-byte-pos */ http_off_t cr_last; /**< Last-byte-pos */ http_off_t cr_length; /**< Instance-length */};/** Date, Expires, If-Modified-Since, If-Unmodified-Since, Last-Modified */struct http_date_s { msg_common_t d_common[1]; http_error_t *d_next; http_time_t d_time; /**< Seconds since Jan 1, 1900 */};/** Host */struct http_host_s { msg_common_t h_common[1]; http_error_t *h_next; char const *h_host; char const *h_port;};/** If-Range */struct http_if_range_s { msg_common_t ifr_common[1]; http_error_t *ifr_next; char const *ifr_tag; /**< Tag */ http_time_t ifr_time; /**< Timestamp */};/** Location, Referer */struct http_location_s { msg_common_t loc_common[1];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -