http 1.12.10
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef HTTP_PARSER_H 00026 00027 #define HTTP_PARSER_H 00028 00036 #ifndef SU_ALLOC_H 00037 #include <sofia-sip/su_alloc.h> 00038 #endif 00039 00040 #ifndef MSG_H 00041 #include <sofia-sip/msg.h> 00042 #endif 00043 00044 #ifndef MSG_PARSER_H 00045 #include <sofia-sip/msg_parser.h> 00046 #endif 00047 00048 #ifndef HTTP_H 00049 #include <sofia-sip/http.h> 00050 #endif 00051 00052 #ifndef HTTP_HEADER_H 00053 #include <sofia-sip/http_header.h> 00054 #endif 00055 00056 SOFIA_BEGIN_DECLS 00057 00058 /* --------------------------------------------------------------------------- 00059 * 1) Macros for defining boilerplate functions and structures for each header 00060 */ 00061 00062 #define HTTP_HCLASS_TAG HTTP_PROTOCOL_TAG 00063 #define HTTP_HCLASS_TEST(x) ((x) && (x)->hc_tag == HTTP_PROTOCOL_TAG) 00064 #define HTTP_HDR_TEST(x) ((x)->sh_class && HTTP_HCLASS_TEST((x)->sh_class)) 00065 00067 #define HTTP_HEADER_CLASS(c, l, params, kind, dup) \ 00068 MSG_HEADER_CLASS(http_, c, l, "", params, kind, http_ ## dup, http_no) 00069 00071 #define HTTP_HEADER_CLASS_G(c, l, kind) \ 00072 MSG_HEADER_CLASS(http_, c, l, "", g_common, kind, msg_generic, http_no) 00073 00075 #define HTTP_HEADER_CLASS_LIST(c, l, kind) \ 00076 MSG_HEADER_CLASS(http_, c, l, "", k_items, kind, msg_list, http_no) 00077 00079 #define HTTP_HEADER_CLASS_AUTH(c, l, kind) \ 00080 MSG_HEADER_CLASS(http_, c, l, "", au_params, kind, msg_auth, http_no) 00081 00082 #define http_numeric_dup_xtra msg_default_dup_xtra 00083 #define http_numeric_dup_one msg_default_dup_one 00084 00085 #define http_default_dup_xtra msg_default_dup_xtra 00086 #define http_default_dup_one msg_default_dup_one 00087 00088 #define http_no_update NULL 00089 00090 /* --------------------------------------------------------------------------- 00091 * 2) Prototypes for HTTP-specific decoding/encoding functions 00092 */ 00093 00094 /* Version strings */ 00095 SOFIAPUBFUN int http_version_d(char **ss, char const **ver); 00096 SOFIAPUBFUN isize_t http_version_xtra(char const *version); 00097 SOFIAPUBFUN void http_version_dup(char **pp, char const **dd, char const *s); 00098 00099 /* Method */ 00100 SOFIAPUBFUN http_method_t http_method_d(char **ss, char const **nname); 00101 SOFIAPUBFUN char const *http_method_name(http_method_t method, 00102 char const *name); 00103 00105 SOFIAPUBFUN issize_t http_extract_body(msg_t *, http_t *, 00106 char b[], isize_t bsiz, int eos); 00107 00108 SOFIA_END_DECLS 00109 00110 #endif /* !defined(HTTP_PARSER_H) */