http 1.12.11devel
Loading...
Searching...
No Matches
http_parser.h
Go to the documentation of this file.
1/*
2 * This file is part of the Sofia-SIP package
3 *
4 * Copyright (C) 2005 Nokia Corporation.
5 *
6 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef HTTP_PARSER_H
27#define HTTP_PARSER_H
36#ifndef SU_ALLOC_H
37#include <sofia-sip/su_alloc.h>
38#endif
39
40#ifndef MSG_H
41#include <sofia-sip/msg.h>
42#endif
43
44#ifndef MSG_PARSER_H
46#endif
47
48#ifndef HTTP_H
49#include <sofia-sip/http.h>
50#endif
51
52#ifndef HTTP_HEADER_H
54#endif
55
56SOFIA_BEGIN_DECLS
57
58/* ---------------------------------------------------------------------------
59 * 1) Macros for defining boilerplate functions and structures for each header
60 */
61
62#define HTTP_HCLASS_TAG HTTP_PROTOCOL_TAG
63#define HTTP_HCLASS_TEST(x) ((x) && (x)->hc_tag == HTTP_PROTOCOL_TAG)
64#define HTTP_HDR_TEST(x) ((x)->sh_class && HTTP_HCLASS_TEST((x)->sh_class))
65
67#define HTTP_HEADER_CLASS(c, l, params, kind, dup) \
68 MSG_HEADER_CLASS(http_, c, l, "", params, kind, http_ ## dup, http_no)
69
71#define HTTP_HEADER_CLASS_G(c, l, kind) \
72 MSG_HEADER_CLASS(http_, c, l, "", g_common, kind, msg_generic, http_no)
73
75#define HTTP_HEADER_CLASS_LIST(c, l, kind) \
76 MSG_HEADER_CLASS(http_, c, l, "", k_items, kind, msg_list, http_no)
77
79#define HTTP_HEADER_CLASS_AUTH(c, l, kind) \
80 MSG_HEADER_CLASS(http_, c, l, "", au_params, kind, msg_auth, http_no)
81
82#define http_numeric_dup_xtra msg_default_dup_xtra
83#define http_numeric_dup_one msg_default_dup_one
84
85#define http_default_dup_xtra msg_default_dup_xtra
86#define http_default_dup_one msg_default_dup_one
87
88#define http_no_update NULL
89
90/* ---------------------------------------------------------------------------
91 * 2) Prototypes for HTTP-specific decoding/encoding functions
92 */
93
94/* Version strings */
95SOFIAPUBFUN int http_version_d(char **ss, char const **ver);
96SOFIAPUBFUN isize_t http_version_xtra(char const *version);
97SOFIAPUBFUN void http_version_dup(char **pp, char const **dd, char const *s);
98
99/* Method */
100SOFIAPUBFUN http_method_t http_method_d(char **ss, char const **nname);
102 char const *name);
103
106 char b[], isize_t bsiz, int eos);
107
108SOFIA_END_DECLS
109
110#endif /* !defined(HTTP_PARSER_H) */
HTTP message, methods, headers.
http_method_t
IDs for well-known HTTP methods.
Definition http.h:69
HTTP library prototypes.
char const * http_method_name(http_method_t method, char const *name)
Return string corresponding to the method.
Definition http_parser.c:416
void http_version_dup(char **pp, char const **dd, char const *s)
Duplicate a transport string.
Definition http_parser.c:382
int http_version_d(char **ss, char const **ver)
Parse HTTP version.
Definition http_parser.c:307
issize_t http_extract_body(msg_t *, http_t *, char b[], isize_t bsiz, int eos)
Extract HTTP message body.
Definition http_parser.c:84
isize_t http_version_xtra(char const *version)
Calculate extra space required by version string.
Definition http_parser.c:371
http_method_t http_method_d(char **ss, char const **nname)
Parse a HTTP method name.
Definition http_parser.c:447
HTTP message object.
Definition http.h:323
#define SOFIAPUBFUN

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.