mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 06:48:33 +00:00
add sofia-sip 1.12.4 (plus some patches through 12/21/2006) to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3774 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
0cdfa4fe13
commit
2ecac238f3
719 files changed
+311340
-2
No files matched your search
@@ -0,0 +1,482 @@
|
||||
/*
|
||||
* 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 <sofia-sip/http.h> has been included. */
|
||||
#define HTTP_H
|
||||
|
||||
/**@file sofia-sip/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>
|
||||
#endif
|
||||
|
||||
SOFIA_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 msg_auth_info_t 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.
|
||||
*
|
||||
* @deprecated Use struct msg_auth_info_s instead.
|
||||
*/
|
||||
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];
|
||||
http_error_t *loc_next;
|
||||
url_t loc_url[1];
|
||||
};
|
||||
|
||||
/** Max-Forwards */
|
||||
struct http_max_forwards_s {
|
||||
msg_common_t mf_common[1];
|
||||
http_error_t *mf_next;
|
||||
unsigned long mf_count;
|
||||
};
|
||||
|
||||
/** Range */
|
||||
struct http_range_s
|
||||
{
|
||||
msg_common_t rng_common[1];
|
||||
http_error_t *rng_next;
|
||||
char const *rng_unit;
|
||||
char const **rng_specs;
|
||||
};
|
||||
|
||||
/** Retry-After. */
|
||||
struct http_retry_after_s {
|
||||
msg_common_t ra_common[1]; /**< Common fragment info */
|
||||
http_error_t *ra_next; /**< Link to next (dummy) */
|
||||
http_time_t ra_date; /**< When to retry */
|
||||
http_time_t ra_delta; /**< Seconds to before retry */
|
||||
};
|
||||
|
||||
/** TE */
|
||||
struct http_te_s {
|
||||
msg_common_t te_common[1]; /**< Common fragment info */
|
||||
http_te_t *te_next; /**< Link to next t-coding */
|
||||
char const *te_extension; /**< Transfer-Extension */
|
||||
msg_param_t const *te_params; /**< List of parameters */
|
||||
char const *te_q; /**< Q-value */
|
||||
};
|
||||
|
||||
/** Via */
|
||||
struct http_via_s {
|
||||
msg_common_t v_common[1];
|
||||
http_via_t *v_next;
|
||||
char const *v_version;
|
||||
char const *v_host;
|
||||
char const *v_port;
|
||||
char const *v_comment;
|
||||
};
|
||||
|
||||
/** Cookie */
|
||||
struct http_cookie_s {
|
||||
msg_common_t c_common[1];
|
||||
http_cookie_t *c_next;
|
||||
msg_param_t const *c_params;
|
||||
char const *c_version;
|
||||
char const *c_name;
|
||||
char const *c_domain;
|
||||
char const *c_path;
|
||||
};
|
||||
|
||||
/** Set-Cookie */
|
||||
struct http_set_cookie_s {
|
||||
msg_common_t sc_common[1];
|
||||
http_set_cookie_t *sc_next;
|
||||
msg_param_t const *sc_params;
|
||||
char const *sc_name;
|
||||
char const *sc_version;
|
||||
char const *sc_domain;
|
||||
char const *sc_path;
|
||||
char const *sc_comment;
|
||||
char const *sc_max_age;
|
||||
unsigned sc_secure;
|
||||
};
|
||||
|
||||
/**HTTP message object.
|
||||
*
|
||||
* This structure contains a HTTP message object. It is used to access the
|
||||
* headers and payload within the message. The generic transport aspects of
|
||||
* the message, like network address, is accessed using a @b msg_t object
|
||||
* directly.
|
||||
*/
|
||||
struct http_s {
|
||||
msg_common_t http_common[1]; /**< For recursive inclusion */
|
||||
msg_pub_t *http_next; /**< Dummy pointer to next part */
|
||||
void *http_user; /**< Application data */
|
||||
unsigned http_size; /**< Size of this structure */
|
||||
int http_flags; /**< Flags */
|
||||
http_error_t *http_error; /**< Erroneous headers */
|
||||
|
||||
http_request_t *http_request; /**< Request line */
|
||||
http_status_t *http_status; /**< Status line */
|
||||
|
||||
/* === Headers start here */
|
||||
http_accept_t *http_accept; /**< Accept */
|
||||
http_accept_charset_t *http_accept_charset; /**< Accept-Charset */
|
||||
http_accept_encoding_t *http_accept_encoding; /**< Accept-Encoding */
|
||||
http_accept_language_t *http_accept_language; /**< Accept-Language */
|
||||
http_accept_ranges_t *http_accept_ranges; /**< Accept-Ranges */
|
||||
http_allow_t *http_allow; /**< Allow */
|
||||
http_authentication_info_t*http_authentication_info;/**<Authentication-Info*/
|
||||
http_authorization_t *http_authorization; /**< Authorization */
|
||||
http_age_t *http_age; /**< Age */
|
||||
http_cache_control_t *http_cache_control; /**< Cache-Control */
|
||||
http_connection_t *http_connection; /**< Connection */
|
||||
http_date_t *http_date; /**< Date */
|
||||
http_etag_t *http_etag; /**< ETag */
|
||||
http_expect_t *http_expect; /**< Expect */
|
||||
http_expires_t *http_expires; /**< Expires */
|
||||
http_from_t *http_from; /**< From */
|
||||
http_host_t *http_host; /**< Host */
|
||||
http_if_match_t *http_if_match; /**< If-Match */
|
||||
http_if_modified_since_t *http_if_modified_since; /**< If-Modified-Since */
|
||||
http_if_none_match_t *http_if_none_match; /**< If-None-Match */
|
||||
http_if_range_t *http_if_range; /**< If-Range */
|
||||
http_if_unmodified_since_t*http_if_unmodified_since;/**<If-Unmodified-Since*/
|
||||
http_last_modified_t *http_last_modified; /**< Last-Modified */
|
||||
http_location_t *http_location; /**< Location */
|
||||
http_max_forwards_t *http_max_forwards; /**< Max-Forwards */
|
||||
http_pragma_t *http_pragma; /**< Pragma */
|
||||
http_proxy_authenticate_t *http_proxy_authenticate;/**< Proxy-Authenticate */
|
||||
http_proxy_authorization_t*http_proxy_authorization;/**<Proxy-Authorization*/
|
||||
http_range_t *http_range; /**< Range */
|
||||
http_referer_t *http_referer; /**< Referer */
|
||||
http_retry_after_t *http_retry_after; /**< Retry-After */
|
||||
http_server_t *http_server; /**< Server */
|
||||
http_te_t *http_te; /**< TE */
|
||||
http_trailer_t *http_trailer; /**< Trailer */
|
||||
http_transfer_encoding_t *http_transfer_encoding; /**< Transfer-Encoding */
|
||||
http_upgrade_t *http_upgrade; /**< Upgrade */
|
||||
http_user_agent_t *http_user_agent; /**< User-Agent */
|
||||
http_vary_t *http_vary; /**< Vary */
|
||||
http_via_t *http_via; /**< Via */
|
||||
http_warning_t *http_warning; /**< Warning */
|
||||
http_www_authenticate_t *http_www_authenticate; /**< WWW-Authenticate */
|
||||
|
||||
http_proxy_connection_t *http_proxy_connection; /**< Proxy-Connection */
|
||||
http_set_cookie_t *http_set_cookie; /**< Set-Cookie */
|
||||
http_cookie_t *http_cookie; /**< Cookie */
|
||||
|
||||
http_mime_version_t *http_mime_version; /**< MIME-Version */
|
||||
http_content_encoding_t *http_content_encoding; /**< Content-Encoding */
|
||||
http_content_language_t *http_content_language; /**< Content-Language */
|
||||
http_content_length_t *http_content_length; /**< Content-Length */
|
||||
http_content_location_t *http_content_location; /**< Content-Location */
|
||||
http_content_md5_t *http_content_md5; /**< Content-MD5 */
|
||||
http_content_range_t *http_content_range; /**< Content-Range */
|
||||
http_content_type_t *http_content_type; /**< Content-Type */
|
||||
|
||||
/* === Headers end here */
|
||||
http_header_t *http_unknown; /**< Unknown headers. */
|
||||
http_separator_t *http_separator;
|
||||
/**< Separator between message and payload */
|
||||
http_payload_t *http_payload; /**< Message entity-body */
|
||||
};
|
||||
|
||||
/**Union representing any HTTP header.
|
||||
*
|
||||
* Each different header is an array of size 1.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
union http_header_u {
|
||||
msg_common_t sh_common[1];
|
||||
struct {
|
||||
msg_common_t shn_common;
|
||||
http_header_t *shn_next;
|
||||
} sh_header_next[1];
|
||||
|
||||
msg_auth_t sh_auth[1];
|
||||
msg_generic_t sh_generic[1];
|
||||
msg_numeric_t sh_numeric[1];
|
||||
|
||||
http_request_t sh_request[1];
|
||||
http_status_t sh_status[1];
|
||||
http_error_t sh_error[1];
|
||||
http_unknown_t sh_unknown[1];
|
||||
http_separator_t sh_separator[1];
|
||||
http_payload_t sh_payload[1];
|
||||
|
||||
/* Proper headers */
|
||||
http_via_t sh_via[1];
|
||||
http_host_t sh_host[1];
|
||||
http_from_t sh_from[1];
|
||||
http_referer_t sh_referer[1];
|
||||
http_connection_t sh_connection[1];
|
||||
|
||||
http_accept_t sh_accept[1];
|
||||
http_accept_charset_t sh_accept_charset[1];
|
||||
http_accept_encoding_t sh_accept_encoding[1];
|
||||
http_accept_language_t sh_accept_language[1];
|
||||
http_accept_ranges_t sh_accept_ranges[1];
|
||||
http_allow_t sh_allow[1];
|
||||
http_te_t sh_te[1];
|
||||
|
||||
http_authentication_info_t sh_authentication_info[1];
|
||||
http_authorization_t sh_authorization[1];
|
||||
http_www_authenticate_t sh_www_authenticate[1];
|
||||
http_proxy_authenticate_t sh_proxy_authenticate[1];
|
||||
http_proxy_authorization_t sh_proxy_authorization[1];
|
||||
|
||||
http_age_t sh_age[1];
|
||||
http_cache_control_t sh_cache_control[1];
|
||||
http_date_t sh_date[1];
|
||||
http_expires_t sh_expires[1];
|
||||
http_if_match_t sh_if_match[1];
|
||||
http_if_modified_since_t sh_if_modified_since[1];
|
||||
http_if_none_match_t sh_if_none_match[1];
|
||||
http_if_range_t sh_if_range[1];
|
||||
http_if_unmodified_since_t sh_if_unmodified_since[1];
|
||||
|
||||
http_etag_t sh_etag[1];
|
||||
http_expect_t sh_expect[1];
|
||||
http_last_modified_t sh_last_modified[1];
|
||||
http_location_t sh_location[1];
|
||||
http_max_forwards_t sh_max_forwards[1];
|
||||
http_pragma_t sh_pragma[1];
|
||||
http_range_t sh_range[1];
|
||||
http_retry_after_t sh_retry_after[1];
|
||||
http_trailer_t sh_trailer[1];
|
||||
http_upgrade_t sh_upgrade[1];
|
||||
http_vary_t sh_vary[1];
|
||||
http_warning_t sh_warning[1];
|
||||
|
||||
http_user_agent_t sh_user_agent[1];
|
||||
http_server_t sh_server[1];
|
||||
|
||||
http_mime_version_t sh_mime_version[1];
|
||||
http_content_language_t sh_content_language[1];
|
||||
http_content_location_t sh_content_location[1];
|
||||
http_content_md5_t sh_content_md5[1];
|
||||
http_content_range_t sh_content_range[1];
|
||||
http_content_encoding_t sh_content_encoding[1];
|
||||
http_transfer_encoding_t sh_transfer_encoding[1];
|
||||
http_content_type_t sh_content_type[1];
|
||||
http_content_length_t sh_content_length[1];
|
||||
|
||||
};
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_H) */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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_HCLASSES_H
|
||||
/** Defined when <sofia-sip/http_hclasses.h> has been included. */
|
||||
#define HTTP_HCLASSES_H
|
||||
|
||||
/**@file sofia-sip/http_hclasses.h
|
||||
* @brief HTTP header classes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MSG_TYPES_H
|
||||
#include <sofia-sip/msg_types.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* Use directly these header classes */
|
||||
|
||||
#define http_accept_class msg_accept_class
|
||||
#define http_accept_charset_class msg_accept_charset_class
|
||||
#define http_accept_encoding_class msg_accept_encoding_class
|
||||
#define http_accept_language_class msg_accept_language_class
|
||||
#define http_content_encoding_class msg_content_encoding_class
|
||||
#define http_content_length_class msg_content_length_class
|
||||
#define http_content_md5_class msg_content_md5_class
|
||||
#define http_content_type_class msg_content_type_class
|
||||
#define http_content_id_class msg_content_id_class
|
||||
#define http_content_location_class msg_content_location_class
|
||||
#define http_content_language_class msg_content_language_class
|
||||
#define http_mime_version_class msg_mime_version_class
|
||||
|
||||
#define http_error_class msg_error_class
|
||||
#define http_unknown_class msg_unknown_class
|
||||
#define http_separator_class msg_separator_class
|
||||
#define http_payload_class msg_payload_class
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#ifndef HTTP_PROTOS_H
|
||||
#define HTTP_HCLASSES_ONLY
|
||||
#include <sofia-sip/http_protos.h>
|
||||
#undef HTTP_HCLASSES_ONLY
|
||||
#endif
|
||||
|
||||
#endif /* !defined HTTP_HCLASSES_H */
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* 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_HEADER_H
|
||||
/** Defined when <sofia-sip/http_header.h> has been included.*/
|
||||
#define HTTP_HEADER_H
|
||||
|
||||
/**@file sofia-sip/http_header.h
|
||||
*
|
||||
* HTTP library prototypes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:58:26 2000 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_ALLOC_H
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef SU_TAG_H
|
||||
#include <sofia-sip/su_tag.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_HEADER_H
|
||||
#include <sofia-sip/msg_header.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 1) Macros
|
||||
*/
|
||||
|
||||
/** Initialize a HTTP header structure. */
|
||||
#define HTTP_HEADER_INIT(h, http_class, size) \
|
||||
((void)memset((h), 0, (size)), \
|
||||
(void)(((msg_common_t *)(h))->h_class = (http_class)), \
|
||||
(h))
|
||||
|
||||
#define HTTP_METHOD_NAME(method, name) \
|
||||
((method) == http_method_unknown ? (name) : http_method_name(method, name))
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 2) Variables
|
||||
*/
|
||||
|
||||
SOFIAPUBVAR char const http_method_name_get[];
|
||||
SOFIAPUBVAR char const http_method_name_post[];
|
||||
SOFIAPUBVAR char const http_method_name_head[];
|
||||
SOFIAPUBVAR char const http_method_name_options[];
|
||||
SOFIAPUBVAR char const http_method_name_put[];
|
||||
SOFIAPUBVAR char const http_method_name_delete[];
|
||||
SOFIAPUBVAR char const http_method_name_trace[];
|
||||
SOFIAPUBVAR char const http_method_name_connect[];
|
||||
|
||||
/** HTTP 0.9 */
|
||||
SOFIAPUBVAR char const http_version_0_9[];
|
||||
|
||||
/** HTTP 1.0 */
|
||||
SOFIAPUBVAR char const http_version_1_0[];
|
||||
|
||||
/** HTTP 1.1 version. */
|
||||
SOFIAPUBVAR char const http_version_1_1[];
|
||||
|
||||
#define HTTP_VERSION_CURRENT http_version_1_1
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 3) Prototypes
|
||||
*/
|
||||
|
||||
/** HTTP parser description. */
|
||||
SOFIAPUBFUN msg_mclass_t *http_default_mclass(void);
|
||||
|
||||
/** Complete a HTTP request. */
|
||||
SOFIAPUBFUN int http_request_complete(msg_t *msg);
|
||||
|
||||
/** Complete a HTTP message. */
|
||||
SOFIAPUBFUN int http_message_complete(msg_t *msg, http_t *http);
|
||||
|
||||
/** Add a duplicate of header object to a HTTP message. */
|
||||
SOFIAPUBFUN int http_add_dup(msg_t *, http_t *, http_header_t const *);
|
||||
|
||||
/** Add a header to the HTTP message. */
|
||||
SOFIAPUBFUN int http_add_make(msg_t *msg, http_t *http,
|
||||
msg_hclass_t *hc, char const *s);
|
||||
|
||||
/** Add a header to the HTTP message. */
|
||||
SOFIAPUBFUN int http_add_format(msg_t *msg, http_t *http, msg_hclass_t *hc,
|
||||
char const *fmt, ...);
|
||||
|
||||
/** Add tagged headers to the HTTP message */
|
||||
SOFIAPUBFUN int http_add_tl(msg_t *msg, http_t *http,
|
||||
tag_type_t tag, tag_value_t value, ...);
|
||||
|
||||
/** Remove schema, host, and port from URL */
|
||||
SOFIAPUBFUN int http_strip_hostport(url_t *url);
|
||||
|
||||
/** Add required headers to the response message */
|
||||
SOFIAPUBFUN int http_complete_response(msg_t *msg,
|
||||
int status, char const *phrase,
|
||||
http_t const *request);
|
||||
|
||||
/** Return string corresponding to the method. */
|
||||
SOFIAPUBFUN char const *http_method_name(http_method_t method,
|
||||
char const *name);
|
||||
|
||||
/** Return enum corresponding to the method name */
|
||||
SOFIAPUBFUN http_method_t http_method_code(char const *name);
|
||||
|
||||
#if !SU_HAVE_INLINE
|
||||
SOFIAPUBFUN http_t *http_object(msg_t *msg);
|
||||
SOFIAPUBFUN int http_header_insert(msg_t *msg, http_t *http, http_header_t *h);
|
||||
SOFIAPUBFUN int http_header_remove(msg_t *msg, http_t *http, http_header_t *h);
|
||||
SOFIAPUBFUN char const *http_header_name(http_header_t const *h, int compact);
|
||||
SOFIAPUBFUN void *http_header_data(http_header_t *h);
|
||||
SOFIAPUBFUN http_content_length_t *http_content_length_create(su_home_t *home,
|
||||
uint32_t n);
|
||||
SOFIAPUBFUN http_payload_t *http_payload_create(su_home_t *home,
|
||||
void const *data, usize_t len);
|
||||
SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home);
|
||||
#endif
|
||||
|
||||
SOFIAPUBFUN http_header_t *http_header_format(su_home_t *home, msg_hclass_t *,
|
||||
char const *fmt, ...);
|
||||
|
||||
|
||||
/** Create a request line object. */
|
||||
SOFIAPUBFUN http_request_t *http_request_create(su_home_t *home,
|
||||
http_method_t method,
|
||||
const char *name,
|
||||
url_string_t const *url,
|
||||
char const *version);
|
||||
|
||||
/** Create a status line object. */
|
||||
SOFIAPUBFUN http_status_t *http_status_create(su_home_t *home,
|
||||
unsigned status,
|
||||
char const *phrase,
|
||||
char const *version);
|
||||
|
||||
/** Create an @b Host header object. */
|
||||
SOFIAPUBFUN http_host_t *http_host_create(su_home_t *home,
|
||||
char const *host,
|
||||
char const *port);
|
||||
|
||||
/** Create an @b Date header object. */
|
||||
SOFIAPUBFUN http_date_t *http_date_create(su_home_t *home, http_time_t t);
|
||||
|
||||
/** Create an @b Expires header object. */
|
||||
SOFIAPUBFUN http_expires_t *http_expires_create(su_home_t *home,
|
||||
http_time_t delta);
|
||||
|
||||
/** Compare two HTTP URLs. */
|
||||
SOFIAPUBFUN int http_url_cmp(url_t const *a, url_t const *b);
|
||||
|
||||
/** Parse query part in HTTP URL. */
|
||||
SOFIAPUBFUN issize_t http_query_parse(char *query,
|
||||
/* char const *key, char **return_value, */
|
||||
...);
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 4) Inlined functions
|
||||
*/
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
/** Get HTTP structure from msg. */
|
||||
su_inline
|
||||
http_t *http_object(msg_t *msg)
|
||||
{
|
||||
return (http_t *)msg_public(msg, HTTP_PROTOCOL_TAG);
|
||||
}
|
||||
|
||||
/** Insert a (list of) header(s) to the header structure and fragment chain.
|
||||
*
|
||||
* The function @c http_header_insert() inserts header or list of headers
|
||||
* into a HTTP message. It also inserts them into the the message fragment
|
||||
* chain, if it exists.
|
||||
*
|
||||
* When inserting headers into the fragment chain, a request (or status) is
|
||||
* inserted first and replaces the existing request (or status). The Via
|
||||
* headers are inserted after the request or status, and rest of the headers
|
||||
* after request, status, or Via headers.
|
||||
*
|
||||
* If the header is a singleton, existing headers with the same class are
|
||||
* removed.
|
||||
*
|
||||
* @param msg message owning the fragment chain
|
||||
* @param http HTTP message structure to which header is added
|
||||
* @param h list of header(s) to be added
|
||||
*/
|
||||
su_inline
|
||||
int http_header_insert(msg_t *msg, http_t *http, http_header_t *h)
|
||||
{
|
||||
return msg_header_insert(msg, (msg_pub_t *)http, (msg_header_t *)h);
|
||||
}
|
||||
|
||||
/** Remove a header from a HTTP message. */
|
||||
su_inline
|
||||
int http_header_remove(msg_t *msg, http_t *http, http_header_t *h)
|
||||
{
|
||||
return msg_header_remove(msg, (msg_pub_t *)http, (msg_header_t *)h);
|
||||
}
|
||||
|
||||
/** Return name of the header. */
|
||||
su_inline
|
||||
char const *http_header_name(http_header_t const *h, int compact)
|
||||
{
|
||||
if (compact && h->sh_class->hc_short[0])
|
||||
return h->sh_class->hc_short;
|
||||
else
|
||||
return h->sh_class->hc_name;
|
||||
}
|
||||
|
||||
/** Return data after header structure. */
|
||||
su_inline
|
||||
void *http_header_data(http_header_t *h)
|
||||
{
|
||||
return h && h != HTTP_NONE ? h->sh_class->hc_size + (char *)h : NULL;
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_content_length_t *http_content_length_create(su_home_t *home, uint32_t n)
|
||||
{
|
||||
return msg_content_length_create(home, n);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_payload_t *http_payload_create(su_home_t *home, void const *data, isize_t len)
|
||||
{
|
||||
return msg_payload_create(home, data, len);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_separator_t *http_separator_create(su_home_t *home)
|
||||
{
|
||||
return msg_separator_create(home);
|
||||
}
|
||||
#endif
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#ifndef HTTP_PROTOS_H
|
||||
#include <sofia-sip/http_protos.h>
|
||||
#endif
|
||||
|
||||
#endif /* !defined(HTTP_HEADER_H) */
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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_PARSER_H
|
||||
/**Defined when <sofia-sip/http_parser.h> has been included.*/
|
||||
#define HTTP_PARSER_H
|
||||
/**@file sofia-sip/http_parser.h
|
||||
* @brief Typedefs and prototypes used by HTTP parser.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:58:26 2000 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_ALLOC_H
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_H
|
||||
#include <sofia-sip/msg.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_PARSER_H
|
||||
#include <sofia-sip/msg_parser.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_HEADER_H
|
||||
#include <sofia-sip/http_header.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 1) Macros for defining boilerplate functions and structures for each header
|
||||
*/
|
||||
|
||||
#define HTTP_HCLASS_TAG HTTP_PROTOCOL_TAG
|
||||
#define HTTP_HCLASS_TEST(x) ((x) && (x)->hc_tag == HTTP_PROTOCOL_TAG)
|
||||
#define HTTP_HDR_TEST(x) ((x)->sh_class && HTTP_HCLASS_TEST((x)->sh_class))
|
||||
|
||||
/** Define a header class for a HTTP header. */
|
||||
#define HTTP_HEADER_CLASS(c, l, params, kind, dup) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", params, kind, http_ ## dup, http_no)
|
||||
|
||||
/** This is used by headers with no extra data in copy */
|
||||
#define HTTP_HEADER_CLASS_G(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", g_common, kind, msg_generic, http_no)
|
||||
|
||||
/** Define a header class for a msg_list_t kind of header */
|
||||
#define HTTP_HEADER_CLASS_LIST(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", k_items, kind, msg_list, http_no)
|
||||
|
||||
/** Define a authorization header class */
|
||||
#define HTTP_HEADER_CLASS_AUTH(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", au_params, kind, msg_auth, http_no)
|
||||
|
||||
#define http_numeric_dup_xtra msg_default_dup_xtra
|
||||
#define http_numeric_dup_one msg_default_dup_one
|
||||
|
||||
#define http_default_dup_xtra msg_default_dup_xtra
|
||||
#define http_default_dup_one msg_default_dup_one
|
||||
|
||||
#define http_no_update NULL
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 2) Prototypes for HTTP-specific decoding/encoding functions
|
||||
*/
|
||||
|
||||
/* Version strings */
|
||||
SOFIAPUBFUN int http_version_d(char **ss, char const **ver);
|
||||
SOFIAPUBFUN isize_t http_version_xtra(char const *version);
|
||||
SOFIAPUBFUN void http_version_dup(char **pp, char const **dd, char const *s);
|
||||
|
||||
/* Method */
|
||||
SOFIAPUBFUN http_method_t http_method_d(char **ss, char const **nname);
|
||||
SOFIAPUBFUN char const *http_method_name(http_method_t method,
|
||||
char const *name);
|
||||
|
||||
/** Extract HTTP message body */
|
||||
SOFIAPUBFUN issize_t http_extract_body(msg_t *, http_t *,
|
||||
char b[], isize_t bsiz, int eos);
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_PARSER_H) */
|
||||
@@ -0,0 +1,311 @@
|
||||
/** -*- C -*-
|
||||
* @file sofia-sip/http_protos.h.in
|
||||
*
|
||||
* Template for <http_protos.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_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.
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @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 #xxxxxxx_xxxxxxx# */
|
||||
|
||||
/**@addtogroup http_#xxxxxx#*/ /** @{ */
|
||||
|
||||
enum {
|
||||
/** Hash of #xxxxxxx_xxxxxxx#. @internal*/
|
||||
http_#xxxxxx#_hash = #hash#
|
||||
};
|
||||
|
||||
/**Header class for HTTP #xxxxxxx_xxxxxxx#.
|
||||
*
|
||||
* The header class http_#xxxxxx#_class defines how a HTTP
|
||||
* #xxxxxxx_xxxxxxx# is parsed and printed. It also
|
||||
* contains methods used by HTTP parser and other functions
|
||||
* to manipulate the http_#xxxxxx#_t header structure.
|
||||
*
|
||||
*/
|
||||
SOFIAPUBVAR msg_hclass_t http_#xxxxxx#_class[];
|
||||
|
||||
#ifndef HTTP_HCLASSES_ONLY
|
||||
|
||||
/** Decode (parse) a #xxxxxxx_xxxxxxx#. @internal */
|
||||
SOFIAPUBFUN msg_parse_f http_#xxxxxx#_d;
|
||||
|
||||
/** Encode (print) a #xxxxxxx_xxxxxxx#. @internal */
|
||||
SOFIAPUBFUN msg_print_f http_#xxxxxx#_e;
|
||||
|
||||
/**Initializer for structure http_#xxxxxx#_t.
|
||||
*
|
||||
* A static http_#xxxxxx#_t structure must be initialized
|
||||
* with the HTTP_#XXXXXX#_INIT() macro. For instance,
|
||||
* @code
|
||||
*
|
||||
* http_#xxxxxx#_t http_#xxxxxx# = HTTP_#XXXXXX#_INIT;
|
||||
*
|
||||
* @endcode
|
||||
* @HI
|
||||
*/
|
||||
#define HTTP_#XXXXXX#_INIT() HTTP_HDR_INIT(#xxxxxx#)
|
||||
|
||||
/**Initialize a structure http_#xxxxxx#_t.
|
||||
*
|
||||
* An http_#xxxxxx#_t structure can be initialized with the
|
||||
* http_#xxxxxx#_init() function/macro. For instance,
|
||||
* @code
|
||||
*
|
||||
* http_#xxxxxx#_t http_#xxxxxx#;
|
||||
*
|
||||
* http_#xxxxxx#_init(&http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
* @HI
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline http_#xxxxxx#_t *http_#xxxxxx#_init(http_#xxxxxx#_t x[1])
|
||||
{
|
||||
return HTTP_HEADER_INIT(x, http_#xxxxxx#_class, sizeof(http_#xxxxxx#_t));
|
||||
}
|
||||
#else
|
||||
#define http_#xxxxxx#_init(x) \
|
||||
HTTP_HEADER_INIT(x, http_#xxxxxx#_class, sizeof(http_#xxxxxx#_t))
|
||||
#endif
|
||||
|
||||
/**Test if header object is instance of http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_is_#xxxxxx#() returns true (nonzero) if
|
||||
* the header class is an instance of #xxxxxxx_xxxxxxx#
|
||||
* object and false (zero) otherwise.
|
||||
*
|
||||
* @param header pointer to the header structure to be tested
|
||||
*
|
||||
* @return
|
||||
* The function http_is_x#xxxxxx#() returns true (nonzero) if
|
||||
* the header object is an instance of header #xxxxxx# and
|
||||
* false (zero) otherwise.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
int http_is_#xxxxxx#(http_header_t const *header)
|
||||
{
|
||||
return header && header->sh_class->hc_hash == http_#xxxxxx#_hash;
|
||||
}
|
||||
#else
|
||||
#define http_is_#xxxxxx#(h) \
|
||||
((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_#xxxxxx#_hash)
|
||||
#endif
|
||||
|
||||
/**Duplicate (deep copy) @c http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_#xxxxxx#_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
|
||||
*
|
||||
* #xxxxxx# = http_#xxxxxx#_dup(home, http->http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_dup() returns a pointer to the
|
||||
* newly duplicated http_#xxxxxx#_t header structure, or NULL
|
||||
* upon an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home,
|
||||
http_#xxxxxx#_t const *hdr)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Copy a http_#xxxxxx#_t header structure.
|
||||
*
|
||||
* The function http_#xxxxxx#_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
|
||||
*
|
||||
* #xxxxxx# = http_#xxxxxx#_copy(home, http->http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_copy() returns a pointer to
|
||||
* newly copied header structure, or NULL upon an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home,
|
||||
http_#xxxxxx#_t const *hdr)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Make a header structure http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_#xxxxxx#_make() makes a new
|
||||
* http_#xxxxxx#_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_#xxxxxx#_make() returns a pointer to
|
||||
* newly maked http_#xxxxxx#_t header structure, or NULL upon
|
||||
* an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Make a #xxxxxxx_xxxxxxx# from formatting result.
|
||||
*
|
||||
* The function http_#xxxxxx#_format() makes a new
|
||||
* #xxxxxxx_xxxxxxx# 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_#xxxxxx#_format() returns a pointer to newly
|
||||
* makes header structure, or NULL upon an error.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
|
||||
__attribute__((__malloc__, __format__ (printf, 2, 3)));
|
||||
|
||||
|
||||
/* Inlined functions */
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_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_#xxxxxx#_class, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return (http_#xxxxxx#_t *)h;
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home, http_#xxxxxx#_t const *o)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)
|
||||
msg_header_dup_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home, http_#xxxxxx#_t const *o)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)
|
||||
msg_header_copy_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)http_header_make(home, http_#xxxxxx#_class, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !define HTTP_HCLASSES_ONLY */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
SOFIA_END_DECLS
|
||||
#endif /* !defined(HTTP_PROTOS_H) */
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* 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_STATUS_H
|
||||
#define HTTP_STATUS_H
|
||||
|
||||
/**@file sofia-sip/http_status.h
|
||||
*
|
||||
* HTTP status codes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Sep 18 18:55:09 2001 ppessi
|
||||
*/
|
||||
|
||||
#include <sofia-sip/su_config.h>
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
SOFIAPUBFUN char const *http_status_phrase(int status);
|
||||
|
||||
#define HTTP_100_CONTINUE 100, http_100_continue
|
||||
#define HTTP_101_SWITCHING 101, http_101_switching
|
||||
#define HTTP_200_OK 200, http_200_ok
|
||||
#define HTTP_201_CREATED 201, http_201_created
|
||||
#define HTTP_202_ACCEPTED 202, http_202_accepted
|
||||
#define HTTP_203_NON_AUTH_INFO 203, http_203_non_auth_info
|
||||
#define HTTP_204_NO_CONTENT 204, http_204_no_content
|
||||
#define HTTP_205_RESET_CONTENT 205, http_205_reset_content
|
||||
#define HTTP_206_PARTIAL_CONTENT 206, http_206_partial_content
|
||||
#define HTTP_300_MULTIPLE_CHOICES 300, http_300_multiple_choices
|
||||
#define HTTP_301_MOVED_PERMANENTLY 301, http_301_moved_permanently
|
||||
#define HTTP_302_FOUND 302, http_302_found
|
||||
#define HTTP_303_SEE_OTHER 303, http_303_see_other
|
||||
#define HTTP_304_NOT_MODIFIED 304, http_304_not_modified
|
||||
#define HTTP_305_USE_PROXY 305, http_305_use_proxy
|
||||
#define HTTP_307_TEMPORARY_REDIRECT 307, http_307_temporary_redirect
|
||||
#define HTTP_400_BAD_REQUEST 400, http_400_bad_request
|
||||
#define HTTP_401_UNAUTHORIZED 401, http_401_unauthorized
|
||||
#define HTTP_402_PAYMENT_REQUIRED 402, http_402_payment_required
|
||||
#define HTTP_403_FORBIDDEN 403, http_403_forbidden
|
||||
#define HTTP_404_NOT_FOUND 404, http_404_not_found
|
||||
#define HTTP_405_NOT_ALLOWED 405, http_405_not_allowed
|
||||
#define HTTP_406_NOT_ACCEPTABLE 406, http_406_not_acceptable
|
||||
#define HTTP_407_PROXY_AUTH 407, http_407_proxy_auth
|
||||
#define HTTP_408_TIMEOUT 408, http_408_timeout
|
||||
#define HTTP_409_CONFLICT 409, http_409_conflict
|
||||
#define HTTP_410_GONE 410, http_410_gone
|
||||
#define HTTP_411_NO_LENGTH 411, http_411_no_length
|
||||
#define HTTP_412_PRECONDITION 412, http_412_precondition
|
||||
#define HTTP_413_ENTITY_TOO_LARGE 413, http_413_entity_too_large
|
||||
#define HTTP_414_URI_TOO_LONG 414, http_414_uri_too_long
|
||||
#define HTTP_415_MEDIA_TYPE 415, http_415_media_type
|
||||
#define HTTP_416_REQUESTED_RANGE 416, http_416_requested_range
|
||||
#define HTTP_417_EXPECTATION 417, http_417_expectation
|
||||
#define HTTP_426_UPGRADE 426, http_426_upgrade
|
||||
#define HTTP_500_INTERNAL_SERVER 500, http_500_internal_server
|
||||
#define HTTP_501_NOT_IMPLEMENTED 501, http_501_not_implemented
|
||||
#define HTTP_502_BAD_GATEWAY 502, http_502_bad_gateway
|
||||
#define HTTP_503_NO_SERVICE 503, http_503_no_service
|
||||
#define HTTP_504_GATEWAY_TIMEOUT 504, http_504_gateway_timeout
|
||||
#define HTTP_505_HTTP_VERSION 505, http_505_http_version
|
||||
|
||||
SOFIAPUBVAR char const http_100_continue[];
|
||||
SOFIAPUBVAR char const http_101_switching[];
|
||||
SOFIAPUBVAR char const http_200_ok[];
|
||||
SOFIAPUBVAR char const http_201_created[];
|
||||
SOFIAPUBVAR char const http_202_accepted[];
|
||||
SOFIAPUBVAR char const http_203_non_auth_info[];
|
||||
SOFIAPUBVAR char const http_204_no_content[];
|
||||
SOFIAPUBVAR char const http_205_reset_content[];
|
||||
SOFIAPUBVAR char const http_206_partial_content[];
|
||||
SOFIAPUBVAR char const http_300_multiple_choices[];
|
||||
SOFIAPUBVAR char const http_301_moved_permanently[];
|
||||
SOFIAPUBVAR char const http_302_found[];
|
||||
SOFIAPUBVAR char const http_303_see_other[];
|
||||
SOFIAPUBVAR char const http_304_not_modified[];
|
||||
SOFIAPUBVAR char const http_305_use_proxy[];
|
||||
SOFIAPUBVAR char const http_307_temporary_redirect[];
|
||||
SOFIAPUBVAR char const http_400_bad_request[];
|
||||
SOFIAPUBVAR char const http_401_unauthorized[];
|
||||
SOFIAPUBVAR char const http_402_payment_required[];
|
||||
SOFIAPUBVAR char const http_403_forbidden[];
|
||||
SOFIAPUBVAR char const http_404_not_found[];
|
||||
SOFIAPUBVAR char const http_405_not_allowed[];
|
||||
SOFIAPUBVAR char const http_406_not_acceptable[];
|
||||
SOFIAPUBVAR char const http_407_proxy_auth[];
|
||||
SOFIAPUBVAR char const http_408_timeout[];
|
||||
SOFIAPUBVAR char const http_409_conflict[];
|
||||
SOFIAPUBVAR char const http_410_gone[];
|
||||
SOFIAPUBVAR char const http_411_no_length[];
|
||||
SOFIAPUBVAR char const http_412_precondition[];
|
||||
SOFIAPUBVAR char const http_413_entity_too_large[];
|
||||
SOFIAPUBVAR char const http_414_uri_too_long[];
|
||||
SOFIAPUBVAR char const http_415_media_type[];
|
||||
SOFIAPUBVAR char const http_416_requested_range[];
|
||||
SOFIAPUBVAR char const http_417_expectation[];
|
||||
SOFIAPUBVAR char const http_426_upgrade[];
|
||||
SOFIAPUBVAR char const http_500_internal_server[];
|
||||
SOFIAPUBVAR char const http_501_not_implemented[];
|
||||
SOFIAPUBVAR char const http_502_bad_gateway[];
|
||||
SOFIAPUBVAR char const http_503_no_service[];
|
||||
SOFIAPUBVAR char const http_504_gateway_timeout[];
|
||||
SOFIAPUBVAR char const http_505_http_version[];
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* HTTP_STATUS_H */
|
||||
@@ -0,0 +1,236 @@
|
||||
/**@file sofia-sip/http_tag.h.in
|
||||
*
|
||||
* Template for <http_tag.h>.
|
||||
*
|
||||
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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_TAG_H
|
||||
/** Defined when <sofia-sip/http_tag.h> has been included. */
|
||||
#define HTTP_TAG_H
|
||||
|
||||
/**@file sofia-sip/http_tag.h
|
||||
* @brief Tag class for HTTP headers
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SU_TAG_H
|
||||
#include <sofia-sip/su_tag.h>
|
||||
#endif
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
#define HTTPTAG(c, x) httptag_##c, httptag_##c##_v(x)
|
||||
#define HTTPTAG_REF(c, x) httptag_##c##_ref, httptag_##c##_vr(&(x))
|
||||
#define HTTPTAG_STR(c, s) httptag_##c##_str, tag_str_v(s)
|
||||
#define HTTPTAG_STR_REF(c, s) httptag_##c##_str_ref, tag_str_vr(&(s))
|
||||
|
||||
/** Test if tag type marks a http_t structure. @HIDE */
|
||||
#define HTTPTAG_P(tt) ((tt)->tt_class == httphdrtag_class)
|
||||
/** Test if tag type marks a HTTP header string. @HIDE */
|
||||
#define HTTPTAG_STR_P(tt) ((tt)->tt_class == httpstrtag_class)
|
||||
/** Test if tag type marks a HTTP header structure. @HIDE */
|
||||
#define HTTPTAG_HTTP_P(tt) ((tt)->tt_class == httpmsgtag_class)
|
||||
|
||||
/** Test if tag item contains http_t structure. @HIDE */
|
||||
#define HTTPTAGI_P(t) (HTTPTAG_P((t)->t_tag))
|
||||
/** Test if tag item contains a HTTP header string. @HIDE */
|
||||
#define HTTPTAGI_STR_P(t) (HTTPTAG_STR_P((t)->t_tag))
|
||||
/** Test if tag item contains a HTTP header structure. @HIDE */
|
||||
#define HTTPTAGI_HTTP_P(t) (HTTPTAG_HTTP_P((t)->t_tag))
|
||||
|
||||
SOFIAPUBVAR tag_class_t httphdrtag_class[1];
|
||||
SOFIAPUBVAR tag_class_t httpstrtag_class[1];
|
||||
SOFIAPUBVAR tag_class_t httpmsgtag_class[1];
|
||||
|
||||
/** Filter tag matching any http tag. */
|
||||
#define HTTPTAG_ANY() httptag_any, ((tag_value_t)0)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_any;
|
||||
|
||||
/**Tag list item for @c http_t object.
|
||||
*
|
||||
* The HTTPTAG_HTTP() macro is used to include a tag item for a http_t object
|
||||
* in the tag list.
|
||||
*
|
||||
* @param x pointer to a http_t message object, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HTTP(x) httptag_http, httptag_http_v((x))
|
||||
|
||||
/** Tag for @c http_t */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_http;
|
||||
|
||||
#define HTTPTAG_HTTP_REF(x) httptag_http_ref, httptag_http_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_http_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline
|
||||
tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; }
|
||||
static inline
|
||||
tag_value_t httptag_http_vr(http_t const **vp) { return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_http_v(v) (tag_value_t)(v)
|
||||
#define httptag_http_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
/**Tag list item for http protocol version.
|
||||
*
|
||||
* The HTTPTAG_VERSION() macro is used to include a tag item for a HTTP
|
||||
* protocol version in the tag list.
|
||||
*
|
||||
* @param x pointer to a http_t message object, or NULL.
|
||||
*/
|
||||
#define HTTPTAG_VERSION(x) httptag_http, (tag_value_t)x
|
||||
|
||||
extern tag_typedef_t httptag_version;
|
||||
|
||||
/** Reference to HTTPTAG_VERSION */
|
||||
#define HTTPTAG_VERSION_REF(x) httptag_http_ref, (tag_value_t)&(x)
|
||||
|
||||
extern tag_typedef_t httptag_version_ref;
|
||||
|
||||
/**Tag list item for header string.
|
||||
*
|
||||
* The HTTPTAG_HEADER() macro is used to include a tag item containing an
|
||||
* unknown HTTP header in the tag list, e.g.,
|
||||
* @code
|
||||
* http_header_t *hdr;
|
||||
*
|
||||
* HTTPTAG_HEADER(hdr).
|
||||
* @endcode
|
||||
*
|
||||
* @param x pointer to a header structure, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HEADER(x) httptag_header, httptag_header_v((x))
|
||||
|
||||
/** Tag for header string */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header;
|
||||
|
||||
#define HTTPTAG_HEADER_REF(x) httptag_header_ref, httptag_header_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline tag_value_t
|
||||
httptag_header_v(http_header_t const *v)
|
||||
{ return (tag_value_t)v; }
|
||||
static inline tag_value_t
|
||||
httptag_header_vr(http_header_t const **vp)
|
||||
{ return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_header_v(v) (tag_value_t)(v)
|
||||
#define httptag_header_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
/**Tag list item for header string.
|
||||
*
|
||||
* The HTTPTAG_HEADER_STR() macro is used to include a tag item containing a
|
||||
* header string in the tag list.
|
||||
*
|
||||
* @param x pointer to a string, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HEADER_STR(x) httptag_header_str, tag_str_v((x))
|
||||
|
||||
/** Tag for header string */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_str;
|
||||
|
||||
#define HTTPTAG_HEADER_STR_REF(x) httptag_header_str_ref, tag_str_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_str_ref;
|
||||
|
||||
|
||||
/**@ingroup http_#xxxxxx#
|
||||
*
|
||||
* Tag list item for pointer to a #xxxxxxx_xxxxxxx# object.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#() macro is used to include a tag item with a
|
||||
* pointer to a http_#xxxxxx#_t object in a tag list.
|
||||
*
|
||||
* @param x pointer to a http_#xxxxxx#_t header structure, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_#XXXXXX#(x) HTTPTAG(#xxxxxx#, x)
|
||||
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#;
|
||||
|
||||
/**@ingroup http_#xxxxxx#
|
||||
*
|
||||
* Tag list item for string with #xxxxxxx_xxxxxxx# value.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#_STR() macro is used to include a tag item with a
|
||||
* string containing value of a http_#xxxxxx#_t header in a tag list.
|
||||
*
|
||||
* @param s pointer to a string containing http_#xxxxxx#_t value, or NULL.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#_STR string can be converted to a
|
||||
* http_#xxxxxx#_t header structure by giving the string @a s has
|
||||
* second argument to function http_#xxxxxx#_make().
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_#XXXXXX#_STR(s) HTTPTAG_STR(#xxxxxx#, s)
|
||||
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str;
|
||||
|
||||
#define HTTPTAG_#XXXXXX#_REF(x) HTTPTAG_REF(#xxxxxx#, x)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_ref;
|
||||
|
||||
#define HTTPTAG_#XXXXXX#_STR_REF(x) HTTPTAG_STR_REF(#xxxxxx#, x)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline tag_value_t
|
||||
httptag_#xxxxxx#_v(http_#xxxxxx#_t const *v)
|
||||
{ return (tag_value_t)v; }
|
||||
static inline tag_value_t
|
||||
httptag_#xxxxxx#_vr(http_#xxxxxx#_t const **vp)
|
||||
{ return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_#xxxxxx#_v(v) (tag_value_t)(v)
|
||||
#define httptag_#xxxxxx#_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
SOFIA_END_DECLS
|
||||
#endif /* !defined(HTTP_TAG_H) */
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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_TAG_CLASS_H
|
||||
/**Defined when http_tag_class.h have been included*/
|
||||
#define HTTP_TAG_CLASS_H
|
||||
|
||||
/**@file sofia-sip/http_tag_class.h
|
||||
* @brief Tag classes for HTTP headers.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_TAG_CLASS_H
|
||||
#include <sofia-sip/msg_tag_class.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/** Define a named tag type for HTTP header @a t. */
|
||||
#define HTTPHDRTAG_NAMED_TYPEDEF(n, t) \
|
||||
{{ TAG_NAMESPACE, #n, httphdrtag_class, \
|
||||
(tag_value_t)http_##t##_class }}
|
||||
|
||||
/** Define a tag type for HTTP header @a t. */
|
||||
#define HTTPHDRTAG_TYPEDEF(t) HTTPHDRTAG_NAMED_TYPEDEF(t, t)
|
||||
|
||||
/** Define a string tag type for HTTP header @a t. */
|
||||
#define HTTPSTRTAG_TYPEDEF(t) \
|
||||
{{ TAG_NAMESPACE, #t "_str", httpstrtag_class, \
|
||||
(tag_value_t)http_##t##_class }}
|
||||
|
||||
/** Define a tag type for HTTP message @a t. */
|
||||
#define HTTPMSGTAG_TYPEDEF(t) \
|
||||
{{ TAG_NAMESPACE, #t, httpmsgtag_class, \
|
||||
(tag_value_t)HTTP_PROTOCOL_TAG }}
|
||||
|
||||
/**@internal Filter HTTP header tag items. */
|
||||
SOFIAPUBFUN tagi_t *httptag_filter(tagi_t *dst, tagi_t const f[],
|
||||
tagi_t const *src,
|
||||
void **bb);
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_TAG_CLASS_H) */
|
||||
Reference in new issue
Block a user