Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page   Data Structures   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                             3
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 
00139 #define HTTP_STOP_SERVERTASK               0
00140 
00144 #define HTTP_RUN_SERVERTASK                1
00145 
00150 #define DEFAULT_BUF_SIZE                           400
00151 
00156 #define DEFAULT_MAX_PENDING_CONNECIONS  5
00157 
00162 #define HTTP_DEFAULT_PORT                       80
00163 
00168 #define HTTP_MAX_URL                            400
00169 
00174 #define HTTP_MAX_BUFSIZE                        400
00175 
00180 #define HTTP_GET_METHOD                         1
00181 
00186 #define HTTP_POST_METHOD                        2
00187 
00192 #define HTTP_HEAD_METHOD                        3
00193 
00197 typedef struct _http_variable
00198 {
00199     char *var_name;             
00200     char *value;                
00201     struct http_variable *next; 
00202 } http_variable;
00203 
00207 typedef struct _http_request
00208 {
00209     char path[HTTP_MAX_URL];    
00210     char request_method;        
00211     char *query_string;         
00212     char *req_headers;          
00213     char *message_body;         
00214     http_variable *varlist;     
00215 } http_request;
00216 
00220 typedef struct _http_response
00221 {
00222     char *res_headers;                    
00223     char response[HTTP_MAX_BUFSIZE];      
00224     char content_type[HTTP_MAX_BUFSIZE];  
00225     int contentlength;                    
00226 } http_response;
00227 
00231 typedef struct _http_session
00232 {
00233     int sock_handler;        
00234     struct sockaddr address; 
00235     http_request  request;   
00236     http_response response;  
00237 } http_session;
00238 
00244 unsigned int http_version(void);
00245 
00261 int  http_init(struct sockaddr server_addr);
00262 
00280 int  http_setrootdir(char *rootdir);
00281 
00292 char *http_getrootdir(void);
00293 
00311 int  http_setindexpage(char *index);
00312 
00323 char *http_getindexpage(void);
00324 
00339 void http_setportnumber(int portnumber);
00340 
00351 int  http_getportnumber(void);
00352 
00365 void http_setheaderbufsize(int buffersize);
00366 
00377 int  http_getheaderbufsize(void);
00378 
00391 void http_set_req_linesize(int buffersize);
00392 
00403 int  http_get_req_linesize(void);
00404 
00425 void http_set_req_process_options(char flag);
00426 
00435 char http_get_req_process_options(void);
00436 
00447 int  http_getlogging(void);
00448 
00462 int  http_setlogging(char logstatus);
00463 
00475 char *http_getlogfilename(void);
00476 
00496 int  http_setlogfilename(char *logfilename);
00497 
00510 void http_setmaxconnections(int max_connection);
00511 
00522 int  http_getmaxconnections(void);
00523 
00536 void http_setclientsocktimeout(long milli_sec);
00537 
00548 long  http_getclientsocktimeout(void);
00549 
00573 void http_reg_req_callback(int (*func)());
00574 
00599 void http_reg_acl_callback(int (*func)());
00600 
00615 void http_sendheaders(http_session *https);
00616 
00628 int  http_start_server(void);
00629 
00640 int  http_kill_server(void);
00641 
00653 void http_decode_urlencodeddata(char *pathname);
00654 
00667 char http_hex_from_ascii (char c);
00668 
00681 int http_change_server_state(char server_state);
00682 
00683 #endif

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