Nut/OS  5.0.5
API Reference
Environment variables
Collaboration diagram for Environment variables:

Data Structures

struct  _HTTP_ENVVAR_ENTRY
 Environment variable entry structure. More...

Typedefs

typedef const char *(* HTTP_ENV_HANDLER )(HTTPD_SESSION *, const char *name)
 Environment handler function type.
typedef const char *(* HTTP_ENVVAR_HANDLER )(HTTPD_SESSION *, int)
 Environment variable handler function type.
typedef struct _HTTP_ENVVAR_ENTRY HTTP_ENVVAR_ENTRY
 Environment variable entry structure type.

Functions

int EnvInitDefaults (void)
 Initialize the default environment variables.
int EnvRegisterVariable (char *name, HTTP_ENVVAR_HANDLER handler, int item)
 Register an environment variable.
const HTTP_ENVVAR_ENTRYEnvVarGetEntry (const char *name)
 Retrieve entry of a registered environment variable.
const char * EnvHandler (HTTPD_SESSION *hs, const char *name)
 Default environment handler.
const char * HttpStreamInfo (HTTPD_SESSION *hs, int item)
 Default handler of stream related environment variables.
const char * HttpSessionInfo (HTTPD_SESSION *hs, int item)
 Default handler of session related environment variables.

Default environment variables

#define HSITEM_DATE_GMT   1
 The current date and time in Greenwich Mean Time.
#define HSITEM_DATE_LOCAL   2
 The current date and time in the server's timezone.
#define HSITEM_DOCUMENT_NAME   3
 The file name of the document requested by the client.
#define HSITEM_DOCUMENT_ROOT   4
 The root directory of this site.
#define HSITEM_HTTP_ACCEPT_ENCODING   5
 The MIME types the requestor will accept.
#define HSITEM_HTTP_CONNECTION   6
 The type of connection.
#define HSITEM_HTTP_COOKIE   7
 The value of any cookie.
#define HSITEM_HTTP_HOST   8
 The base URL of the host.
#define HSITEM_HTTP_REFERER   9
 The URL of the page that made this request.
#define HSITEM_HTTP_USER_AGENT   10
 The browser id or user-agent string identifying the browser.
#define HSITEM_QUERY_STRING   11
 The argument string for this request.
#define HSITEM_QUERY_STRING_UNESCAPED   12
 The argument string for this request.
#define HSITEM_REQUEST_METHOD   13
 The method used for this request.
#define HSITEM_REQUEST_URI   14
 The URI for this request.
#define HSITEM_SCRIPT_FILENAME   15
 The path to the script being executed.
#define HSITEM_SCRIPT_NAME   16
 The file name of the script being executed.

Define Documentation

#define HSITEM_DATE_GMT   1

The current date and time in Greenwich Mean Time.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_DATE_LOCAL   2

The current date and time in the server's timezone.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_DOCUMENT_NAME   3

The file name of the document requested by the client.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_DOCUMENT_ROOT   4

The root directory of this site.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_ACCEPT_ENCODING   5

The MIME types the requestor will accept.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_CONNECTION   6

The type of connection.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_COOKIE   7

The value of any cookie.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_HOST   8

The base URL of the host.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_REFERER   9

The URL of the page that made this request.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_HTTP_USER_AGENT   10

The browser id or user-agent string identifying the browser.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_QUERY_STRING   11

The argument string for this request.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_QUERY_STRING_UNESCAPED   12

The argument string for this request.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_REQUEST_METHOD   13

The method used for this request.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_REQUEST_URI   14

The URI for this request.

Referenced by HttpSessionInfo(), and ISC_LIST().

#define HSITEM_SCRIPT_FILENAME   15

The path to the script being executed.

Referenced by ISC_LIST().

#define HSITEM_SCRIPT_NAME   16

The file name of the script being executed.

Referenced by ISC_LIST().


Typedef Documentation

typedef const char*(* HTTP_ENV_HANDLER)(HTTPD_SESSION *, const char *name)

Environment handler function type.

typedef const char*(* HTTP_ENVVAR_HANDLER)(HTTPD_SESSION *, int)

Environment variable handler function type.

Environment variable entry structure type.


Function Documentation

int EnvInitDefaults ( void  )

Initialize the default environment variables.

Returns:
0 on success or -1 on error.

References ENVVAR_DEFAULTS, ISC_LIST_APPEND, and ISC_LIST_INIT.

int EnvRegisterVariable ( char *  name,
HTTP_ENVVAR_HANDLER  handler,
int  item 
)

Register an environment variable.

Parameters:
nameName of the environment variable.
handlerThis function will be called to retrieve the variable's value.
itemNumeric identifier that will be passed to the handler.
Returns:
0 on success or -1 on error.

References calloc, _HTTP_ENVVAR_ENTRY::env_handler, _HTTP_ENVVAR_ENTRY::env_index, _HTTP_ENVVAR_ENTRY::env_name, free(), ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INSERTBEFORE, ISC_LIST_NEXT, ISC_LIST_UNLINK_TYPE, rc, strcasecmp, and strdup().

Here is the call graph for this function:

const HTTP_ENVVAR_ENTRY* EnvVarGetEntry ( const char *  name)

Retrieve entry of a registered environment variable.

const char* EnvHandler ( HTTPD_SESSION hs,
const char *  name 
)

Default environment handler.

Parameters:
hsPointer to the session info structure.
nameName of the environment variable.
Returns:
Pointer to the value. If the variable does not exists, then NULL is returned.

References _HTTP_ENVVAR_ENTRY::env_handler, _HTTP_ENVVAR_ENTRY::env_index, _HTTP_ENVVAR_ENTRY::env_name, ISC_LIST_HEAD, ISC_LIST_NEXT, NULL, and strcasecmp.

const char* HttpStreamInfo ( HTTPD_SESSION hs,
int  item 
)

Default handler of stream related environment variables.

Parameters:
hsPointer to the session info structure.
itemNumeric identifier of the variable.
Returns:
Pointer to the value.

References _HTTPD_SESSION::s_stream, and StreamInfo().

Referenced by ISC_LIST().

Here is the call graph for this function:

const char* HttpSessionInfo ( HTTPD_SESSION hs,
int  item 
)

Default handler of session related environment variables.

Parameters:
hsPointer to the session info structure.
itemNumeric identifier of the variable.
Returns:
Pointer to the value.

$Id$

References ct_close, ct_GET, ct_HEAD, ct_Keep_Alive, ct_POST, free(), gmtime(), HSITEM_DATE_GMT, HSITEM_DATE_LOCAL, HSITEM_DOCUMENT_NAME, HSITEM_DOCUMENT_ROOT, HSITEM_HTTP_ACCEPT_ENCODING, HSITEM_HTTP_CONNECTION, HSITEM_HTTP_COOKIE, HSITEM_HTTP_HOST, HSITEM_HTTP_REFERER, HSITEM_HTTP_USER_AGENT, HSITEM_QUERY_STRING, HSITEM_QUERY_STRING_UNESCAPED, HSITEM_REQUEST_METHOD, HSITEM_REQUEST_URI, HTTP_CONN_KEEP_ALIVE, HTTP_METHOD_GET, HTTP_METHOD_HEAD, HTTP_METHOD_POST, HTTP_ROOT, HttpUrlUnescape(), localtime(), NULL, Rfc1123TimeString(), strdup(), strrchr(), and time().

Referenced by ISC_LIST().

Here is the call graph for this function: