Nut/OS  5.0.5
API Reference
envvars.h
Go to the documentation of this file.
00001 #ifndef _PRO_UHTTP_ENVVARS_H_
00002 #define _PRO_UHTTP_ENVVARS_H_
00003 
00004 /*
00005  * Copyright (C) 2012 by egnite GmbH
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the copyright holders nor the names of
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  */
00037 
00038 /*
00039  * $Id$
00040  */
00041 
00042 #include <isc/list.h>
00043 
00044 #include <pro/uhttp/uhttpd.h>
00045 
00051 
00055 #define HSITEM_DATE_GMT                 1
00056 
00057 #define HSITEM_DATE_LOCAL               2
00058 
00059 #define HSITEM_DOCUMENT_NAME            3
00060 
00061 #define HSITEM_DOCUMENT_ROOT            4
00062 
00063 #define HSITEM_HTTP_ACCEPT_ENCODING     5
00064 
00065 #define HSITEM_HTTP_CONNECTION          6
00066 
00067 #define HSITEM_HTTP_COOKIE              7
00068 
00069 #define HSITEM_HTTP_HOST                8
00070 
00071 #define HSITEM_HTTP_REFERER             9
00072 
00073 #define HSITEM_HTTP_USER_AGENT          10
00074 
00075 #define HSITEM_QUERY_STRING             11
00076 
00077 #define HSITEM_QUERY_STRING_UNESCAPED   12
00078 
00079 #define HSITEM_REQUEST_METHOD           13
00080 
00081 #define HSITEM_REQUEST_URI              14
00082 
00083 #define HSITEM_SCRIPT_FILENAME          15
00084 
00085 #define HSITEM_SCRIPT_NAME              16
00086 
00089 typedef const char* (*HTTP_ENV_HANDLER) (HTTPD_SESSION*, const char *name);
00090 
00092 typedef const char* (*HTTP_ENVVAR_HANDLER) (HTTPD_SESSION*, int);
00093 
00095 typedef struct _HTTP_ENVVAR_ENTRY HTTP_ENVVAR_ENTRY;
00096 
00098 struct _HTTP_ENVVAR_ENTRY {
00100     ISC_LINK(HTTP_ENVVAR_ENTRY) env_link;
00102     char *env_name;
00104     HTTP_ENVVAR_HANDLER env_handler;
00105     int env_index;
00106     int env_flags;
00107 };
00108 
00114 extern int EnvInitDefaults(void);
00115 
00125 extern int EnvRegisterVariable(char *name, HTTP_ENVVAR_HANDLER handler, int item);
00126 
00130 extern const HTTP_ENVVAR_ENTRY* EnvVarGetEntry(const char *name);
00131 
00141 extern const char *EnvHandler(HTTPD_SESSION *hs, const char *name);
00142 
00151 extern const char *HttpStreamInfo(HTTPD_SESSION *hs, int item);
00152 
00161 extern const char *HttpSessionInfo(HTTPD_SESSION *hs, int item);
00162 
00165 #endif
00166