http  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
http.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_H
26 
27 #define HTTP_H
28 
40 #ifndef MSG_H
41 #include <sofia-sip/msg.h>
42 #endif
43 #ifndef URL_H
44 #include <sofia-sip/url.h>
45 #endif
46 #ifndef MSG_MIME_H
47 #include <sofia-sip/msg_mime.h>
48 #endif
49 
50 SOFIA_BEGIN_DECLS
51 
52 /* ----------------------------------------------------------------------
53  * 1) Constants
54  */
55 
56 #define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE)
57 #define HTTP_DEFAULT_PORT (80)
58 #define HTTP_DEFAULT_SERV "80"
59 
61 #define HTTP_PROTOCOL_TAG ((void *)(uintptr_t)0x48545450) /* 'HTTP' */
62 
64 enum {
65  HTTP_FLG_NO_BODY = (1 << 15)
66 };
67 
69 typedef enum {
81 
82 #define HTTP_METHOD(s) http_method_unknown, #s
83 #define HTTP_NO_METHOD http_method_unknown, NULL
84 #define HTTP_METHOD_GET http_method_get, "GET"
85 #define HTTP_METHOD_POST http_method_post, "POST"
86 #define HTTP_METHOD_HEAD http_method_head, "HEAD"
87 #define HTTP_METHOD_OPTIONS http_method_options, "OPTIONS"
88 #define HTTP_METHOD_PUT http_method_put, "PUT"
89 #define HTTP_METHOD_DELETE http_method_delete, "DELETE"
90 #define HTTP_METHOD_TRACE http_method_trace, "TRACE"
91 #define HTTP_METHOD_CONNECT http_method_connect, "CONNECT"
92 
93 /* ----------------------------------------------------------------------
94  * 2) Type declarations
95  */
96 
98 typedef struct http_s http_t;
99 
102 
103 typedef struct http_request_s http_request_t;
104 typedef struct http_status_s http_status_t;
106 typedef msg_accept_charset_t http_accept_charset_t;
107 typedef msg_accept_encoding_t http_accept_encoding_t;
108 typedef msg_accept_language_t http_accept_language_t;
110 typedef msg_numeric_t http_age_t;
111 typedef msg_list_t http_allow_t;
112 typedef msg_auth_info_t http_authentication_info_t;
113 typedef msg_auth_t http_authorization_t;
119 typedef msg_content_location_t http_content_location_t;
120 typedef msg_generic_t http_content_md5_t;
123 typedef struct http_date_s http_date_t;
124 typedef msg_generic_t http_etag_t;
125 typedef msg_generic_t http_expect_t;
127 typedef msg_generic_t http_from_t;
128 typedef struct http_host_s http_host_t;
132 typedef struct http_if_range_s http_if_range_t;
137 typedef msg_generic_t http_mime_version_t;
138 typedef msg_list_t http_pragma_t;
139 typedef msg_auth_t http_proxy_authenticate_t;
140 typedef msg_auth_t http_proxy_authorization_t;
141 typedef struct http_range_s http_range_t;
144 typedef msg_generic_t http_server_t;
145 typedef struct http_te_s http_te_t;
146 typedef msg_list_t http_trailer_t;
148 typedef msg_list_t http_upgrade_t;
149 typedef msg_generic_t http_user_agent_t;
150 typedef msg_list_t http_vary_t;
151 typedef struct http_via_s http_via_t;
153 typedef msg_auth_t http_www_authenticate_t;
154 
156 
159 
163 typedef msg_generic_t http_unknown_t;
169 typedef unsigned long http_time_t;
171 typedef unsigned long http_off_t;
172 
173 
174 /* ----------------------------------------------------------------------
175  * 3) Structure definitions
176  */
177 
180  msg_common_t rq_common[1];
181  http_error_t *rq_next;
182  http_method_t rq_method;
183  char const *rq_method_name;
185  char const *rq_version;
186 };
187 
190  msg_common_t st_common[1];
191  http_error_t *st_next;
192  char const *st_version;
193  int st_status;
194  char const *st_phrase;
195 };
196 
203 {
206  msg_param_t const *ai_params;
207 };
208 
211  msg_common_t cr_common[1];
212  http_error_t *cr_next;
213  http_off_t cr_first;
214  http_off_t cr_last;
215  http_off_t cr_length;
216 };
217 
219 struct http_date_s {
220  msg_common_t d_common[1];
221  http_error_t *d_next;
222  http_time_t d_time;
223 };
224 
226 struct http_host_s {
227  msg_common_t h_common[1];
228  http_error_t *h_next;
229  char const *h_host;
230  char const *h_port;
231 };
232 
235  msg_common_t ifr_common[1];
236  http_error_t *ifr_next;
237  char const *ifr_tag;
238  http_time_t ifr_time;
239 };
240 
243  msg_common_t loc_common[1];
244  http_error_t *loc_next;
245  url_t loc_url[1];
246 };
247 
250  msg_common_t mf_common[1];
251  http_error_t *mf_next;
252  unsigned long mf_count;
253 };
254 
257 {
258  msg_common_t rng_common[1];
259  http_error_t *rng_next;
260  char const *rng_unit;
261  char const **rng_specs;
262 };
263 
267  http_error_t *ra_next;
268  http_time_t ra_date;
269  http_time_t ra_delta;
270 };
271 
273 struct http_te_s {
276  char const *te_extension;
277  msg_param_t const *te_params;
278  char const *te_q;
279 };
280 
282 struct http_via_s {
283  msg_common_t v_common[1];
284  http_via_t *v_next;
285  char const *v_version;
286  char const *v_host;
287  char const *v_port;
288  char const *v_comment;
289 };
290 
293  msg_common_t c_common[1];
294  http_cookie_t *c_next;
295  msg_param_t const *c_params;
296  char const *c_version;
297  char const *c_name;
298  char const *c_domain;
299  char const *c_path;
300 };
301 
304  msg_common_t sc_common[1];
305  http_set_cookie_t *sc_next;
306  msg_param_t const *sc_params;
307  char const *sc_name;
308  char const *sc_version;
309  char const *sc_domain;
310  char const *sc_path;
311  char const *sc_comment;
312  char const *sc_max_age;
313  unsigned sc_secure;
314 };
315 
323 struct http_s {
326  void *http_user;
327  unsigned http_size;
329  http_error_t *http_error;
334  /* === Headers start here */
335  http_accept_t *http_accept;
336  http_accept_charset_t *http_accept_charset;
337  http_accept_encoding_t *http_accept_encoding;
338  http_accept_language_t *http_accept_language;
339  http_accept_ranges_t *http_accept_ranges;
340  http_allow_t *http_allow;
341  http_authentication_info_t*http_authentication_info;
342  http_authorization_t *http_authorization;
343  http_age_t *http_age;
344  http_cache_control_t *http_cache_control;
345  http_connection_t *http_connection;
347  http_etag_t *http_etag;
348  http_expect_t *http_expect;
349  http_expires_t *http_expires;
350  http_from_t *http_from;
352  http_if_match_t *http_if_match;
353  http_if_modified_since_t *http_if_modified_since;
354  http_if_none_match_t *http_if_none_match;
356  http_if_unmodified_since_t*http_if_unmodified_since;
357  http_last_modified_t *http_last_modified;
360  http_pragma_t *http_pragma;
361  http_proxy_authenticate_t *http_proxy_authenticate;
362  http_proxy_authorization_t*http_proxy_authorization;
366  http_server_t *http_server;
368  http_trailer_t *http_trailer;
369  http_transfer_encoding_t *http_transfer_encoding;
370  http_upgrade_t *http_upgrade;
371  http_user_agent_t *http_user_agent;
372  http_vary_t *http_vary;
374  http_warning_t *http_warning;
375  http_www_authenticate_t *http_www_authenticate;
377  http_proxy_connection_t *http_proxy_connection;
381  http_mime_version_t *http_mime_version;
382  http_content_encoding_t *http_content_encoding;
383  http_content_language_t *http_content_language;
384  http_content_length_t *http_content_length;
385  http_content_location_t *http_content_location;
386  http_content_md5_t *http_content_md5;
388  http_content_type_t *http_content_type;
390  /* === Headers end here */
392  http_separator_t *http_separator;
394  http_payload_t *http_payload;
395 };
396 
404  msg_common_t sh_common[1];
405  struct {
406  msg_common_t shn_common;
407  http_header_t *shn_next;
408  } sh_header_next[1];
409 
410  msg_auth_t sh_auth[1];
411  msg_generic_t sh_generic[1];
412  msg_numeric_t sh_numeric[1];
413 
414  http_request_t sh_request[1];
415  http_status_t sh_status[1];
416  http_error_t sh_error[1];
417  http_unknown_t sh_unknown[1];
418  http_separator_t sh_separator[1];
419  http_payload_t sh_payload[1];
420 
421  /* Proper headers */
422  http_via_t sh_via[1];
423  http_host_t sh_host[1];
424  http_from_t sh_from[1];
425  http_referer_t sh_referer[1];
426  http_connection_t sh_connection[1];
427 
428  http_accept_t sh_accept[1];
429  http_accept_charset_t sh_accept_charset[1];
430  http_accept_encoding_t sh_accept_encoding[1];
431  http_accept_language_t sh_accept_language[1];
432  http_accept_ranges_t sh_accept_ranges[1];
433  http_allow_t sh_allow[1];
434  http_te_t sh_te[1];
435 
436  http_authentication_info_t sh_authentication_info[1];
437  http_authorization_t sh_authorization[1];
438  http_www_authenticate_t sh_www_authenticate[1];
439  http_proxy_authenticate_t sh_proxy_authenticate[1];
440  http_proxy_authorization_t sh_proxy_authorization[1];
441 
442  http_age_t sh_age[1];
443  http_cache_control_t sh_cache_control[1];
444  http_date_t sh_date[1];
445  http_expires_t sh_expires[1];
446  http_if_match_t sh_if_match[1];
447  http_if_modified_since_t sh_if_modified_since[1];
448  http_if_none_match_t sh_if_none_match[1];
449  http_if_range_t sh_if_range[1];
450  http_if_unmodified_since_t sh_if_unmodified_since[1];
451 
452  http_etag_t sh_etag[1];
453  http_expect_t sh_expect[1];
454  http_last_modified_t sh_last_modified[1];
455  http_location_t sh_location[1];
456  http_max_forwards_t sh_max_forwards[1];
457  http_pragma_t sh_pragma[1];
458  http_range_t sh_range[1];
459  http_retry_after_t sh_retry_after[1];
460  http_trailer_t sh_trailer[1];
461  http_upgrade_t sh_upgrade[1];
462  http_vary_t sh_vary[1];
463  http_warning_t sh_warning[1];
464 
465  http_user_agent_t sh_user_agent[1];
466  http_server_t sh_server[1];
467 
468  http_mime_version_t sh_mime_version[1];
469  http_content_language_t sh_content_language[1];
470  http_content_location_t sh_content_location[1];
471  http_content_md5_t sh_content_md5[1];
472  http_content_range_t sh_content_range[1];
473  http_content_encoding_t sh_content_encoding[1];
474  http_transfer_encoding_t sh_transfer_encoding[1];
475  http_content_type_t sh_content_type[1];
476  http_content_length_t sh_content_length[1];
477 
478 };
479 
480 SOFIA_END_DECLS
481 
482 #endif /* !defined(HTTP_H) */

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