Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

rom400_http.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------
00002  *  Copyright (C) 2003-2004 Dallas Semiconductor Corporation, All Rights Reserved.
00003  * 
00004  *  Permission is hereby granted, free of charge, to any person obtaining a
00005  *  copy of this software and associated documentation files (the "Software"),
00006  *  to deal in the Software without restriction, including without limitation
00007  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008  *  and/or sell copies of the Software, and to permit persons to whom the
00009  *  Software is furnished to do so, subject to the following conditions:
00010  * 
00011  *  The above copyright notice and this permission notice shall be included
00012  *  in all copies or substantial portions of the Software.
00013  * 
00014  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  *  MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  *  IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
00018  *  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  *  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  *  OTHER DEALINGS IN THE SOFTWARE.
00021  * 
00022  *  Except as contained in this notice, the name of Dallas Semiconductor
00023  *  shall not be used except as stated in the Dallas Semiconductor
00024  *  Branding Policy.
00025  * ---------------------------------------------------------------------------
00026  *
00027  * This file contains function definitions for the built-in ROM functions 
00028  * of the Dallas Semiconductor 400 processor.  This file is intended for use 
00029  * with the Keil MicroVision (uVision) C compiler.
00030  *
00031  * ---------------------------------------------------------------------------
00032  */
00033 
00034 #ifndef __rom400_http_
00035 #define __rom400_http_
00036 
00058 #define HTTP_VERSION                                8
00059 
00065 #define HTTP_INSUFFICIENT_MEMORY            -1
00066 
00070 #define HTTP_LOGFILE_ERROR                          -2
00071 
00075 #define HTTP_SOCKET_ERROR                           -3
00076 
00080 #define HTTP_REQUEST_NOT_PROCESSED      -4
00081 
00085 #define HTTP_DENY_CONNECTION                -5
00086 
00090 #define HTTP_TASK_ERROR                             -6
00091 
00095 #define HTTP_SERVER_ALREADY_RUNNING     -7
00096 
00101 #define HTTP_NOSERVERTASK                   -8
00102 
00110 #define HTTP_STATUS_SUCCESS                     0
00111 
00116 #define HTTP_DISABLE_LOG                0
00117 
00122 #define HTTP_ENABLE_LOG                 1
00123 
00128 #define HTTP_ENABLE_VARIABLE_PARSING    1
00129 
00134 #define HTTP_DISABLE_VARIABLE_PARSING   0
00135 
00140 #define HTTP_ENABLE_MESSAGEBODY_READING 2
00141 
00146 #define HTTP_DISABLE_MESSAGEBODY_READING 0
00147 
00151 #define HTTP_STOP_SERVERTASK                 0
00152 
00156 #define HTTP_RUN_SERVERTASK                  1
00157 
00162 #define DEFAULT_BUF_SIZE                             400
00163 
00168 #define DEFAULT_MAX_PENDING_CONNECIONS   5
00169 
00174 #define HTTP_DEFAULT_PORT                            80
00175 
00180 #define HTTP_MAX_URL                                 400
00181 
00186 #define HTTP_MAX_BUFSIZE                             400
00187 
00192 #define HTTP_GET_METHOD                              1
00193 
00198 #define HTTP_POST_METHOD                             2
00199 
00204 #define HTTP_HEAD_METHOD                             3
00205 
00209 typedef struct _http_variable
00210 {
00211     char *var_name;             
00212     char *value;                
00213     struct http_variable *next; 
00214 } http_variable;
00215 
00219 typedef struct _http_request
00220 {
00221     char path[HTTP_MAX_URL];    
00222     char request_method;        
00223     char *query_string;         
00224     char *req_headers;          
00225     char *message_body;         
00226     long contentlength;         
00227     http_variable *varlist;     
00228 } http_request;
00229 
00233 typedef struct _http_response
00234 {
00235     char *res_headers;                    
00236     char response[HTTP_MAX_BUFSIZE];      
00237     char content_type[HTTP_MAX_BUFSIZE];  
00238     int  contentlength;                   
00239 } http_response;
00240 
00244 typedef struct _http_session
00245 {
00246     int sock_handler;        
00247     struct sockaddr address; 
00248     http_request  request;   
00249     http_response response;  
00250 } http_session;
00251 
00257 unsigned int http_version(void);
00258 
00274 int  http_init(struct sockaddr server_addr);
00275 
00293 int  http_setrootdir(char *rootdir);
00294 
00305 char *http_getrootdir(void);
00306 
00324 int  http_setindexpage(char *index);
00325 
00336 char *http_getindexpage(void);
00337 
00352 void http_setportnumber(int portnumber);
00353 
00364 int  http_getportnumber(void);
00365 
00378 void http_setheaderbufsize(int buffersize);
00379 
00390 int  http_getheaderbufsize(void);
00391 
00404 void http_set_req_linesize(int buffersize);
00405 
00416 int  http_get_req_linesize(void);
00417 
00483 void http_set_req_process_options(char flag);
00484 
00493 char http_get_req_process_options(void);
00494 
00505 int  http_getlogging(void);
00506 
00520 int  http_setlogging(char logstatus);
00521 
00533 char *http_getlogfilename(void);
00534 
00554 int  http_setlogfilename(char *logfilename);
00555 
00568 void http_setmaxconnections(int max_connection);
00569 
00580 int  http_getmaxconnections(void);
00581 
00594 void http_setclientsocktimeout(long milli_sec);
00595 
00606 long  http_getclientsocktimeout(void);
00607 
00631 void http_reg_req_callback(int (*func)());
00632 
00657 void http_reg_acl_callback(int (*func)());
00658 
00673 void http_sendheaders(http_session *https);
00674 
00686 int  http_start_server(void);
00687 
00698 int  http_kill_server(void);
00699 
00711 void http_decode_urlencodeddata(char *pathname);
00712 
00725 char http_hex_from_ascii (char c);
00726 
00739 int http_change_server_state(char server_state);
00740 
00741 #endif

Copyright 2005 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.