Commit db555d76 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Updated headers.

Added sofia-sip/ prefix to documentation entries referring to include files.

Added SOFIAPUBFUN and SOFIAPUBVAR to files that missed them.

Removed some deprecated functions and macros.

darcs-hash:20060511143741-65a35-63e87cd71cb4839bf777488dcc66fbd0cb0a50a5.gz
parent 24ebb36d
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
* *
*/ */
#ifndef BNF_H /** Defined when bnf.h has been included. */ #ifndef BNF_H /** Defined when <sofia-sip/bnf.h> has been included. */
#define BNF_H #define BNF_H
/**@file bnf.h /**@file sofia-sip/bnf.h
* *
* Parsing macros and prototypes for HTTP-like protocols. * Parsing macros and prototypes for HTTP-like protocols.
* *
......
...@@ -44,18 +44,18 @@ ...@@ -44,18 +44,18 @@
extern "C" { extern "C" {
#endif #endif
extern char const * const sofia_sip_name_version; SOFIAPUBVAR char const * const sofia_sip_name_version;
extern char const * const sofia_sip_has_smime; SOFIAPUBVAR char const * const sofia_sip_has_smime;
extern char const * const sofia_sip_has_tls; SOFIAPUBVAR char const * const sofia_sip_has_tls;
extern char const * const sofia_sip_has_dtls; SOFIAPUBVAR char const * const sofia_sip_has_dtls;
extern char const * const sofia_sip_has_tls_sctp; SOFIAPUBVAR char const * const sofia_sip_has_tls_sctp;
extern char const * const sofia_sip_has_sigcomp; SOFIAPUBVAR char const * const sofia_sip_has_sigcomp;
extern char const * const sofia_sip_has_stun; SOFIAPUBVAR char const * const sofia_sip_has_stun;
extern char const * const sofia_sip_has_turn; SOFIAPUBVAR char const * const sofia_sip_has_turn;
extern char const * const sofia_sip_has_upnp; SOFIAPUBVAR char const * const sofia_sip_has_upnp;
extern char const * const sofia_sip_has_sctp; SOFIAPUBVAR char const * const sofia_sip_has_sctp;
extern char const * const sofia_sip_has_ipv6; SOFIAPUBVAR char const * const sofia_sip_has_ipv6;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
* *
*/ */
#ifndef HTTP_H /** Defined when http.h has been included. */ #ifndef HTTP_H
/** Defined when <sofia-sip/http.h> has been included. */
#define HTTP_H #define HTTP_H
/**@file http.h /**@file sofia-sip/http.h
* *
* HTTP message, methods, headers. * HTTP message, methods, headers.
* *
......
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
* *
*/ */
#ifndef HTTP_HCLASSES_H /** Defined when http_hclasses.h has been included. */ #ifndef HTTP_HCLASSES_H
/** Defined when <sofia-sip/http_hclasses.h> has been included. */
#define HTTP_HCLASSES_H #define HTTP_HCLASSES_H
/**@file http_hclasses.h /**@file sofia-sip/http_hclasses.h
* @brief HTTP header classes. * @brief HTTP header classes.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
......
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
* *
*/ */
#ifndef HTTP_HEADER_H /** Defined when http_header.h has been included.*/ #ifndef HTTP_HEADER_H
/** Defined when <sofia-sip/http_header.h> has been included.*/
#define HTTP_HEADER_H #define HTTP_HEADER_H
/**@file http_header.h /**@file sofia-sip/http_header.h
* *
* HTTP library prototypes. * HTTP library prototypes.
* *
...@@ -67,28 +68,119 @@ SOFIA_BEGIN_DECLS ...@@ -67,28 +68,119 @@ SOFIA_BEGIN_DECLS
* 2) Variables * 2) Variables
*/ */
HTTP_DLL extern char const http_method_name_get[]; SOFIAPUBVAR char const http_method_name_get[];
HTTP_DLL extern char const http_method_name_post[]; SOFIAPUBVAR char const http_method_name_post[];
HTTP_DLL extern char const http_method_name_head[]; SOFIAPUBVAR char const http_method_name_head[];
HTTP_DLL extern char const http_method_name_options[]; SOFIAPUBVAR char const http_method_name_options[];
HTTP_DLL extern char const http_method_name_put[]; SOFIAPUBVAR char const http_method_name_put[];
HTTP_DLL extern char const http_method_name_delete[]; SOFIAPUBVAR char const http_method_name_delete[];
HTTP_DLL extern char const http_method_name_trace[]; SOFIAPUBVAR char const http_method_name_trace[];
HTTP_DLL extern char const http_method_name_connect[]; SOFIAPUBVAR char const http_method_name_connect[];
/** HTTP 0.9 */ /** HTTP 0.9 */
HTTP_DLL extern char const http_version_0_9[]; SOFIAPUBVAR char const http_version_0_9[];
/** HTTP 1.0 */ /** HTTP 1.0 */
HTTP_DLL extern char const http_version_1_0[]; SOFIAPUBVAR char const http_version_1_0[];
/** HTTP 1.1 version. */ /** HTTP 1.1 version. */
HTTP_DLL extern char const http_version_1_1[]; SOFIAPUBVAR char const http_version_1_1[];
#define HTTP_VERSION_CURRENT http_version_1_1 #define HTTP_VERSION_CURRENT http_version_1_1
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* 3) Inlined functions * 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);
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, int len);
SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home);
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 int http_query_parse(char *query,
/* char const *key, char **return_value, */
...);
/* ----------------------------------------------------------------------
* 4) Inlined functions
*/ */
#if SU_HAVE_INLINE #if SU_HAVE_INLINE
...@@ -117,7 +209,7 @@ http_t *http_object(msg_t *msg) ...@@ -117,7 +209,7 @@ http_t *http_object(msg_t *msg)
* @param http HTTP message structure to which header is added * @param http HTTP message structure to which header is added
* @param h list of header(s) to be added * @param h list of header(s) to be added
*/ */
su_inline su_inline
int http_header_insert(msg_t *msg, http_t *http, http_header_t *h) 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); return msg_header_insert(msg, (msg_pub_t *)http, (msg_header_t *)h);
...@@ -166,90 +258,6 @@ http_separator_t *http_separator_create(su_home_t *home) ...@@ -166,90 +258,6 @@ http_separator_t *http_separator_create(su_home_t *home)
} }
#endif #endif
/* ----------------------------------------------------------------------
* 3) Prototypes
*/
/** HTTP parser description. */
msg_mclass_t *http_default_mclass(void);
/** Complete a HTTP request. */
int http_request_complete(msg_t *msg);
/** Complete a HTTP message. */
int http_message_complete(msg_t *msg, http_t *http);
/** Add a duplicate of header object to a HTTP message. */
int http_add_dup(msg_t *, http_t *, http_header_t const *);
/** Add a header to the HTTP message. */
int http_add_make(msg_t *msg, http_t *http,
msg_hclass_t *hc, char const *s);
/** Add a header to the HTTP message. */
int http_add_format(msg_t *msg, http_t *http, msg_hclass_t *hc,
char const *fmt, ...);
/** Add tagged headers to the HTTP message */
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 */
int http_strip_hostport(url_t *url);
/** Add required headers to the response message */
int http_complete_response(msg_t *msg,
int status, char const *phrase,
http_t const *request);
/** Return string corresponding to the method. */
char const *http_method_name(http_method_t method, char const *name);
/** Return enum corresponding to the method name */
http_method_t http_method_code(char const *name);
http_t *http_object(msg_t *msg);
int http_header_insert(msg_t *msg, http_t *http, http_header_t *h);
int http_header_remove(msg_t *msg, http_t *http, http_header_t *h);
char const *http_header_name(http_header_t const *h, int compact);
void *http_header_data(http_header_t *h);
http_content_length_t *http_content_length_create(su_home_t *home, uint32_t n);
http_payload_t *http_payload_create(su_home_t *home, void const *data, int len);
http_separator_t *http_separator_create(su_home_t *home);
http_header_t *http_header_format(su_home_t *home, msg_hclass_t *hc, char const *fmt,...);
/** Create a request line object. */
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. */
http_status_t *http_status_create(su_home_t *home,
unsigned status,
char const *phrase,
char const *version);
/** Create an @b Host header object. */
http_host_t *http_host_create(su_home_t *home,
char const *host, char const *port);
/** Create an @b Date header object. */
http_date_t *http_date_create(su_home_t *home, http_time_t t);
/** Create an @b Expires header object. */
http_expires_t *http_expires_create(su_home_t *home, http_time_t delta);
/** Compare two HTTP URLs. */
int http_url_cmp(url_t const *a, url_t const *b);
/** Parse query part in HTTP URL. */
int http_query_parse(char *query,
/* char const *key, char **return_value, */
...);
#ifndef HTTP_PROTOS_H #ifndef HTTP_PROTOS_H
#include <sofia-sip/http_protos.h> #include <sofia-sip/http_protos.h>
#endif #endif
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
* *
*/ */
#ifndef HTTP_PARSER_H /**Defined when http_parser.h has been included.*/ #ifndef HTTP_PARSER_H
/**Defined when <sofia-sip/http_parser.h> has been included.*/
#define HTTP_PARSER_H #define HTTP_PARSER_H
/**@file http_parser.h /**@file sofia-sip/http_parser.h
* @brief Typedefs and prototypes used by HTTP parser. * @brief Typedefs and prototypes used by HTTP parser.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
...@@ -78,34 +79,31 @@ SOFIA_BEGIN_DECLS ...@@ -78,34 +79,31 @@ SOFIA_BEGIN_DECLS
#define HTTP_HEADER_CLASS_AUTH(c, l, kind) \ #define HTTP_HEADER_CLASS_AUTH(c, l, kind) \
MSG_HEADER_CLASS(http_, c, l, "", au_params, kind, msg_auth, http_no) 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 * 2) Prototypes for HTTP-specific decoding/encoding functions
*/ */
/* Version strings */ /* Version strings */
int http_version_d(char **ss, char const **ver); SOFIAPUBFUN int http_version_d(char **ss, char const **ver);
int http_version_xtra(char const *version); SOFIAPUBFUN int http_version_xtra(char const *version);
void http_version_dup(char **pp, char const **dd, char const *s); SOFIAPUBFUN void http_version_dup(char **pp, char const **dd, char const *s);
/* Method */ /* Method */
http_method_t http_method_d(char **ss, char const **nname); SOFIAPUBFUN http_method_t http_method_d(char **ss, char const **nname);
char const *http_method_name(http_method_t method, char const *name); SOFIAPUBFUN char const *http_method_name(http_method_t method,
char const *name);
/** Extract HTTP message body */ /** Extract HTTP message body */
int http_extract_body(msg_t *msg, http_t *http, char b[], int bsiz, int eos); SOFIAPUBFUN int http_extract_body(msg_t *, http_t *,
char b[], int bsiz, int eos);
/* ---------------------------------------------------------------------------
* 3) Compatibility macros
*/
#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
SOFIA_END_DECLS SOFIA_END_DECLS
......
/** -*- C -*- /** -*- C -*-
* @file http_protos.h.in * @file sofia-sip/http_protos.h.in
* *
* Template for <http_protos.h>. * Template for <http_protos.h>.
*/ */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#ifndef HTTP_PROTOS_H /** Defined when http_protos.h has been included. */ #ifndef HTTP_PROTOS_H /** Defined when http_protos.h has been included. */
#define HTTP_PROTOS_H #define HTTP_PROTOS_H
/**@file http_protos.h /**@file sofia-sip/http_protos.h
* *
* Macros for each HTTP header. * Macros for each HTTP header.
* *
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
((http_header_t *)msg_header_make((h), (c), (s))) ((http_header_t *)msg_header_make((h), (c), (s)))
#define http_header_vformat(h, c, f, a) \ #define http_header_vformat(h, c, f, a) \
((http_header_t *)msg_header_vformat((h), (c), (f), (a))) ((http_header_t *)msg_header_vformat((h), (c), (f), (a)))
SOFIA_BEGIN_DECLS SOFIA_BEGIN_DECLS
/* Declare internal prototypes for #xxxxxxx_xxxxxxx# */ /* Declare internal prototypes for #xxxxxxx_xxxxxxx# */
...@@ -71,15 +72,15 @@ enum { ...@@ -71,15 +72,15 @@ enum {
* to manipulate the http_#xxxxxx#_t header structure. * to manipulate the http_#xxxxxx#_t header structure.
* *
*/ */
HTTP_DLL extern msg_hclass_t http_#xxxxxx#_class[]; SOFIAPUBVAR msg_hclass_t http_#xxxxxx#_class[];
#ifndef HTTP_HCLASSES_ONLY #ifndef HTTP_HCLASSES_ONLY
/** Decode (parse) a #xxxxxxx_xxxxxxx#. @internal */ /** Decode (parse) a #xxxxxxx_xxxxxxx#. @internal */
msg_parse_f http_#xxxxxx#_d; SOFIAPUBFUN msg_parse_f http_#xxxxxx#_d;
/** Encode (print) a #xxxxxxx_xxxxxxx#. @internal */ /** Encode (print) a #xxxxxxx_xxxxxxx#. @internal */
msg_print_f http_#xxxxxx#_e; SOFIAPUBFUN msg_print_f http_#xxxxxx#_e;
/**Initializer for structure http_#xxxxxx#_t. /**Initializer for structure http_#xxxxxx#_t.
* *
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef HTTP_STATUS_H #ifndef HTTP_STATUS_H
#define HTTP_STATUS_H #define HTTP_STATUS_H
/**@file http_status.h /**@file sofia-sip/http_status.h
* *
* HTTP status codes. * HTTP status codes.
* *
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
SOFIA_BEGIN_DECLS SOFIA_BEGIN_DECLS
char const *http_status_phrase(int status); SOFIAPUBFUN char const *http_status_phrase(int status);
#define HTTP_100_CONTINUE 100, http_100_continue #define HTTP_100_CONTINUE 100, http_100_continue
#define HTTP_101_SWITCHING 101, http_101_switching #define HTTP_101_SWITCHING 101, http_101_switching
...@@ -82,47 +82,47 @@ char const *http_status_phrase(int status); ...@@ -82,47 +82,47 @@ char const *http_status_phrase(int status);
#define HTTP_504_GATEWAY_TIMEOUT 504, http_504_gateway_timeout #define HTTP_504_GATEWAY_TIMEOUT 504, http_504_gateway_timeout
#define HTTP_505_HTTP_VERSION 505, http_505_http_version #define HTTP_505_HTTP_VERSION 505, http_505_http_version
HTTP_DLL extern char const http_100_continue[]; SOFIAPUBVAR char const http_100_continue[];
HTTP_DLL extern char const http_101_switching[]; SOFIAPUBVAR char const http_101_switching[];
HTTP_DLL extern char const http_200_ok[]; SOFIAPUBVAR char const http_200_ok[];
HTTP_DLL extern char const http_201_created[]; SOFIAPUBVAR char const http_201_created[];
HTTP_DLL extern char const http_202_accepted[]; SOFIAPUBVAR char const http_202_accepted[];
HTTP_DLL extern char const http_203_non_auth_info[]; SOFIAPUBVAR char const http_203_non_auth_info[];
HTTP_DLL extern char const http_204_no_content[]; SOFIAPUBVAR char const http_204_no_content[];
HTTP_DLL extern char const http_205_reset_content[]; SOFIAPUBVAR char const http_205_reset_content[];
HTTP_DLL extern char const http_206_partial_content[]; SOFIAPUBVAR char const http_206_partial_content[];
HTTP_DLL extern char const http_300_multiple_choices[]; SOFIAPUBVAR char const http_300_multiple_choices[];
HTTP_DLL extern char const http_301_moved_permanently[]; SOFIAPUBVAR char const http_301_moved_permanently[];
HTTP_DLL extern char const http_302_found[]; SOFIAPUBVAR char const http_302_found[];
HTTP_DLL extern char const http_303_see_other[]; SOFIAPUBVAR char const http_303_see_other[];
HTTP_DLL extern char const http_304_not_modified[]; SOFIAPUBVAR char const http_304_not_modified[];
HTTP_DLL extern char const http_305_use_proxy[]; SOFIAPUBVAR char const http_305_use_proxy[];
HTTP_DLL extern char const http_307_temporary_redirect[]; SOFIAPUBVAR char const http_307_temporary_redirect[];
HTTP_DLL extern char const http_400_bad_request[]; SOFIAPUBVAR char const http_400_bad_request[];
HTTP_DLL extern char const http_401_unauthorized[]; SOFIAPUBVAR char const http_401_unauthorized[];
HTTP_DLL extern char const http_402_payment_required[]; SOFIAPUBVAR char const http_402_payment_required[];
HTTP_DLL extern char const http_403_forbidden[]; SOFIAPUBVAR char const http_403_forbidden[];
HTTP_DLL extern char const http_404_not_found[]; SOFIAPUBVAR char const http_404_not_found[];
HTTP_DLL extern char const http_405_not_allowed[];