http 1.12.10

sofia-sip/http.h

Go to the documentation of this file.
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_H
00026 
00027 #define HTTP_H
00028 
00040 #ifndef MSG_H
00041 #include <sofia-sip/msg.h>
00042 #endif
00043 #ifndef URL_H
00044 #include <sofia-sip/url.h>
00045 #endif
00046 #ifndef MSG_MIME_H
00047 #include <sofia-sip/msg_mime.h>
00048 #endif
00049 
00050 SOFIA_BEGIN_DECLS
00051 
00052 /* ----------------------------------------------------------------------
00053  * 1) Constants
00054  */
00055 
00056 #define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE)
00057 #define HTTP_DEFAULT_PORT (80)
00058 #define HTTP_DEFAULT_SERV "80"
00059 
00061 #define HTTP_PROTOCOL_TAG   ((void *)0x48545450)        /* 'HTTP' */
00062 
00064 enum {
00065   HTTP_FLG_NO_BODY = (1 << 15)
00066 };
00067 
00069 typedef enum {
00070   http_method_invalid = -1,     
00071   http_method_unknown = 0,      
00072   http_method_get,              
00073   http_method_post,             
00074   http_method_head,             
00075   http_method_options,          
00076   http_method_put,              
00077   http_method_delete,           
00078   http_method_trace,            
00079   http_method_connect,          
00080 } http_method_t;
00081 
00082 #define HTTP_METHOD(s)          http_method_unknown, #s
00083 #define HTTP_NO_METHOD          http_method_unknown, NULL
00084 #define HTTP_METHOD_GET         http_method_get, "GET"
00085 #define HTTP_METHOD_POST        http_method_post, "POST"
00086 #define HTTP_METHOD_HEAD        http_method_head, "HEAD"
00087 #define HTTP_METHOD_OPTIONS     http_method_options, "OPTIONS"
00088 #define HTTP_METHOD_PUT         http_method_put, "PUT"
00089 #define HTTP_METHOD_DELETE      http_method_delete, "DELETE"
00090 #define HTTP_METHOD_TRACE       http_method_trace, "TRACE"
00091 #define HTTP_METHOD_CONNECT     http_method_connect, "CONNECT"
00092 
00093 /* ----------------------------------------------------------------------
00094  * 2) Type declarations
00095  */
00096 
00098 typedef struct http_s               http_t;
00099 
00101 typedef union http_header_u         http_header_t;
00102 
00103 typedef struct http_request_s       http_request_t;
00104 typedef struct http_status_s        http_status_t;
00105 typedef msg_accept_t                http_accept_t;
00106 typedef msg_accept_charset_t        http_accept_charset_t;
00107 typedef msg_accept_encoding_t       http_accept_encoding_t;
00108 typedef msg_accept_language_t       http_accept_language_t;
00109 typedef msg_list_t                  http_accept_ranges_t;
00110 typedef msg_numeric_t               http_age_t;
00111 typedef msg_list_t                  http_allow_t;
00112 typedef msg_auth_info_t             http_authentication_info_t;
00113 typedef msg_auth_t                  http_authorization_t;
00114 typedef msg_list_t                  http_cache_control_t;
00115 typedef msg_list_t                  http_connection_t;
00116 typedef msg_content_encoding_t      http_content_encoding_t;
00117 typedef msg_content_language_t      http_content_language_t;
00118 typedef msg_content_length_t        http_content_length_t;
00119 typedef msg_content_location_t      http_content_location_t;
00120 typedef msg_generic_t               http_content_md5_t;
00121 typedef struct http_content_range_s http_content_range_t;
00122 typedef msg_content_type_t          http_content_type_t;
00123 typedef struct http_date_s          http_date_t;
00124 typedef msg_generic_t               http_etag_t;
00125 typedef msg_generic_t               http_expect_t;
00126 typedef http_date_t                 http_expires_t;
00127 typedef msg_generic_t               http_from_t;
00128 typedef struct http_host_s          http_host_t;
00129 typedef msg_list_t                  http_if_match_t;
00130 typedef http_date_t                 http_if_modified_since_t;
00131 typedef msg_list_t                  http_if_none_match_t;
00132 typedef struct http_if_range_s      http_if_range_t;
00133 typedef http_date_t                 http_if_unmodified_since_t;
00134 typedef http_date_t                 http_last_modified_t;
00135 typedef struct http_location_s      http_location_t;
00136 typedef struct http_max_forwards_s  http_max_forwards_t;
00137 typedef msg_generic_t               http_mime_version_t;
00138 typedef msg_list_t                  http_pragma_t;
00139 typedef msg_auth_t                  http_proxy_authenticate_t;
00140 typedef msg_auth_t                  http_proxy_authorization_t;
00141 typedef struct http_range_s         http_range_t;
00142 typedef struct http_location_s      http_referer_t;
00143 typedef struct http_retry_after_s   http_retry_after_t;
00144 typedef msg_generic_t               http_server_t;
00145 typedef struct http_te_s            http_te_t;
00146 typedef msg_list_t                  http_trailer_t;
00147 typedef msg_list_t                  http_transfer_encoding_t;
00148 typedef msg_list_t                  http_upgrade_t;
00149 typedef msg_generic_t               http_user_agent_t;
00150 typedef msg_list_t                  http_vary_t;
00151 typedef struct http_via_s           http_via_t;
00152 typedef msg_warning_t               http_warning_t;
00153 typedef msg_auth_t                  http_www_authenticate_t;
00154 
00155 typedef msg_list_t                  http_proxy_connection_t;
00156 
00157 typedef struct http_set_cookie_s    http_set_cookie_t;
00158 typedef struct http_cookie_s        http_cookie_t;
00159 
00161 typedef msg_error_t                 http_error_t;
00163 typedef msg_generic_t               http_unknown_t;
00165 typedef msg_separator_t             http_separator_t;
00167 typedef msg_payload_t               http_payload_t;
00169 typedef unsigned long               http_time_t;
00171 typedef unsigned long               http_off_t;
00172 
00173 
00174 /* ----------------------------------------------------------------------
00175  * 3) Structure definitions
00176  */
00177 
00179 struct http_request_s {
00180   msg_common_t      rq_common[1];
00181   http_error_t     *rq_next;
00182   http_method_t     rq_method;          
00183   char const       *rq_method_name;     
00184   url_t             rq_url[1];          
00185   char const       *rq_version;         
00186 };
00187 
00189 struct http_status_s {
00190   msg_common_t      st_common[1];
00191   http_error_t     *st_next;
00192   char const       *st_version;
00193   int               st_status;
00194   char const       *st_phrase;
00195 };
00196 
00202 struct http_authentication_info_s
00203 {
00204   msg_common_t        ai_common[1]; 
00205   msg_error_t        *ai_next;      
00206   msg_param_t const  *ai_params;    
00207 };
00208 
00210 struct http_content_range_s {
00211   msg_common_t      cr_common[1];
00212   http_error_t     *cr_next;
00213   http_off_t        cr_first;   
00214   http_off_t        cr_last;    
00215   http_off_t        cr_length;  
00216 };
00217 
00219 struct http_date_s {
00220   msg_common_t      d_common[1];
00221   http_error_t     *d_next;
00222   http_time_t       d_time;     
00223 };
00224 
00226 struct http_host_s {
00227   msg_common_t         h_common[1];
00228   http_error_t        *h_next;
00229   char const          *h_host;
00230   char const          *h_port;
00231 };
00232 
00234 struct http_if_range_s {
00235   msg_common_t         ifr_common[1];
00236   http_error_t        *ifr_next;
00237   char const          *ifr_tag;  
00238   http_time_t          ifr_time; 
00239 };
00240 
00242 struct http_location_s {
00243   msg_common_t         loc_common[1];
00244   http_error_t        *loc_next;
00245   url_t                loc_url[1];
00246 };
00247 
00249 struct http_max_forwards_s {
00250   msg_common_t         mf_common[1];
00251   http_error_t        *mf_next;
00252   unsigned long        mf_count;
00253 };
00254 
00256 struct http_range_s
00257 {
00258   msg_common_t         rng_common[1];
00259   http_error_t        *rng_next;
00260   char const          *rng_unit;
00261   char const         **rng_specs;
00262 };
00263 
00265 struct http_retry_after_s {
00266   msg_common_t         ra_common[1];    
00267   http_error_t        *ra_next;         
00268   http_time_t          ra_date;         
00269   http_time_t          ra_delta;        
00270 };
00271 
00273 struct http_te_s {
00274   msg_common_t         te_common[1];    
00275   http_te_t           *te_next;         
00276   char const          *te_extension;    
00277   msg_param_t const   *te_params;       
00278   char const          *te_q;            
00279 };
00280 
00282 struct http_via_s {
00283   msg_common_t         v_common[1];
00284   http_via_t          *v_next;
00285   char const          *v_version;
00286   char const          *v_host;
00287   char const          *v_port;
00288   char const          *v_comment;
00289 };
00290 
00292 struct http_cookie_s {
00293   msg_common_t         c_common[1];
00294   http_cookie_t       *c_next;
00295   msg_param_t const   *c_params;
00296   char const          *c_version;
00297   char const          *c_name;
00298   char const          *c_domain;
00299   char const          *c_path;
00300 };
00301 
00303 struct http_set_cookie_s {
00304   msg_common_t         sc_common[1];
00305   http_set_cookie_t   *sc_next;
00306   msg_param_t const   *sc_params;
00307   char const          *sc_name;
00308   char const          *sc_version;
00309   char const          *sc_domain;
00310   char const          *sc_path;
00311   char const          *sc_comment;
00312   char const          *sc_max_age;
00313   unsigned             sc_secure;
00314 };
00315 
00323 struct http_s {
00324   msg_common_t               http_common[1];    
00325   msg_pub_t                 *http_next;      
00326   void                      *http_user;                
00327   unsigned                   http_size;          
00328   int                        http_flags;                          
00329   http_error_t              *http_error;              
00331   http_request_t            *http_request;                
00332   http_status_t             *http_status;                   
00334   /* === Headers start here */
00335   http_accept_t             *http_accept;                        
00336   http_accept_charset_t     *http_accept_charset;        
00337   http_accept_encoding_t    *http_accept_encoding;      
00338   http_accept_language_t    *http_accept_language;      
00339   http_accept_ranges_t      *http_accept_ranges;          
00340   http_allow_t              *http_allow;                          
00341   http_authentication_info_t*http_authentication_info;
00342   http_authorization_t      *http_authorization;          
00343   http_age_t                *http_age;                              
00344   http_cache_control_t      *http_cache_control;          
00345   http_connection_t         *http_connection;                
00346   http_date_t               *http_date;                            
00347   http_etag_t               *http_etag;                            
00348   http_expect_t             *http_expect;                        
00349   http_expires_t            *http_expires;                      
00350   http_from_t               *http_from;                            
00351   http_host_t               *http_host;                            
00352   http_if_match_t           *http_if_match;                    
00353   http_if_modified_since_t  *http_if_modified_since;  
00354   http_if_none_match_t      *http_if_none_match;          
00355   http_if_range_t           *http_if_range;                    
00356   http_if_unmodified_since_t*http_if_unmodified_since;
00357   http_last_modified_t      *http_last_modified;          
00358   http_location_t           *http_location;                    
00359   http_max_forwards_t       *http_max_forwards;            
00360   http_pragma_t             *http_pragma;                        
00361   http_proxy_authenticate_t *http_proxy_authenticate;
00362   http_proxy_authorization_t*http_proxy_authorization;
00363   http_range_t              *http_range;                          
00364   http_referer_t            *http_referer;                      
00365   http_retry_after_t        *http_retry_after;              
00366   http_server_t             *http_server;                        
00367   http_te_t                 *http_te;                                
00368   http_trailer_t            *http_trailer;                      
00369   http_transfer_encoding_t  *http_transfer_encoding;  
00370   http_upgrade_t            *http_upgrade;                      
00371   http_user_agent_t         *http_user_agent;                
00372   http_vary_t               *http_vary;                            
00373   http_via_t                *http_via;                              
00374   http_warning_t            *http_warning;                      
00375   http_www_authenticate_t   *http_www_authenticate;    
00377   http_proxy_connection_t   *http_proxy_connection;    
00378   http_set_cookie_t         *http_set_cookie;                
00379   http_cookie_t             *http_cookie;                        
00381   http_mime_version_t       *http_mime_version;            
00382   http_content_encoding_t   *http_content_encoding;    
00383   http_content_language_t   *http_content_language;    
00384   http_content_length_t     *http_content_length;        
00385   http_content_location_t   *http_content_location;    
00386   http_content_md5_t        *http_content_md5;              
00387   http_content_range_t      *http_content_range;          
00388   http_content_type_t       *http_content_type;            
00390   /* === Headers end here */
00391   http_header_t             *http_unknown;             
00392   http_separator_t          *http_separator;
00394   http_payload_t            *http_payload;          
00395 };
00396 
00403 union http_header_u {
00404   msg_common_t                sh_common[1];
00405   struct {
00406     msg_common_t              shn_common;
00407     http_header_t            *shn_next;
00408   }                           sh_header_next[1];
00409 
00410   msg_auth_t                  sh_auth[1];
00411   msg_generic_t               sh_generic[1];
00412   msg_numeric_t               sh_numeric[1];
00413 
00414   http_request_t              sh_request[1];
00415   http_status_t               sh_status[1];
00416   http_error_t                sh_error[1];
00417   http_unknown_t              sh_unknown[1];
00418   http_separator_t            sh_separator[1];
00419   http_payload_t              sh_payload[1];
00420 
00421   /* Proper headers */
00422   http_via_t                 sh_via[1];
00423   http_host_t                sh_host[1];
00424   http_from_t                sh_from[1];
00425   http_referer_t             sh_referer[1];
00426   http_connection_t          sh_connection[1];
00427 
00428   http_accept_t              sh_accept[1];
00429   http_accept_charset_t      sh_accept_charset[1];
00430   http_accept_encoding_t     sh_accept_encoding[1];
00431   http_accept_language_t     sh_accept_language[1];
00432   http_accept_ranges_t       sh_accept_ranges[1];
00433   http_allow_t               sh_allow[1];
00434   http_te_t                  sh_te[1];
00435 
00436   http_authentication_info_t sh_authentication_info[1];
00437   http_authorization_t       sh_authorization[1];
00438   http_www_authenticate_t    sh_www_authenticate[1];
00439   http_proxy_authenticate_t  sh_proxy_authenticate[1];
00440   http_proxy_authorization_t sh_proxy_authorization[1];
00441 
00442   http_age_t                 sh_age[1];
00443   http_cache_control_t       sh_cache_control[1];
00444   http_date_t                sh_date[1];
00445   http_expires_t             sh_expires[1];
00446   http_if_match_t            sh_if_match[1];
00447   http_if_modified_since_t   sh_if_modified_since[1];
00448   http_if_none_match_t       sh_if_none_match[1];
00449   http_if_range_t            sh_if_range[1];
00450   http_if_unmodified_since_t sh_if_unmodified_since[1];
00451 
00452   http_etag_t                sh_etag[1];
00453   http_expect_t              sh_expect[1];
00454   http_last_modified_t       sh_last_modified[1];
00455   http_location_t            sh_location[1];
00456   http_max_forwards_t        sh_max_forwards[1];
00457   http_pragma_t              sh_pragma[1];
00458   http_range_t               sh_range[1];
00459   http_retry_after_t         sh_retry_after[1];
00460   http_trailer_t             sh_trailer[1];
00461   http_upgrade_t             sh_upgrade[1];
00462   http_vary_t                sh_vary[1];
00463   http_warning_t             sh_warning[1];
00464 
00465   http_user_agent_t          sh_user_agent[1];
00466   http_server_t              sh_server[1];
00467 
00468   http_mime_version_t        sh_mime_version[1];
00469   http_content_language_t    sh_content_language[1];
00470   http_content_location_t    sh_content_location[1];
00471   http_content_md5_t         sh_content_md5[1];
00472   http_content_range_t       sh_content_range[1];
00473   http_content_encoding_t    sh_content_encoding[1];
00474   http_transfer_encoding_t   sh_transfer_encoding[1];
00475   http_content_type_t        sh_content_type[1];
00476   http_content_length_t      sh_content_length[1];
00477 
00478 };
00479 
00480 SOFIA_END_DECLS
00481 
00482 #endif /* !defined(HTTP_H) */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

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