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

Mini HTTPD Server
[State Utility Library]


Data Structures

struct  sul_httpd_req_t

Typedefs

typedef enum min_req_url_code_e min_req_url_code_e
typedef mini_httpd_t mini_httpd_t
typedef mini_req_t mini_req_t
typedef mini_hook_t mini_hook_t
typedef sul_error_t *(* mini_handler_fnptr_t )(mini_req_t *req, apr_pool_t *pool)
typedef sul_boolean_t(* mini_access_fnptr_t )(mini_req_t *req, apr_pool_t *pool)
typedef sul_httpd_req_t sul_httpd_req_t

Enumerations

enum  min_req_url_code_e { URL_BAD_REQUEST, URL_NOT_FOUND, URL_OK }
enum  min_req_type_t { MINI_RT_UNKNOWN = 0, MINI_RT_HTTP_POST = 1, MINI_RT_HTTP_GET = 2 }

Functions

 mini_httpd_create (mini_httpd_t **self, short port, apr_pool_t *pool)
 mini_httpd_listen (mini_httpd_t *httpd, apr_pool_t *pool)
 mini_httpd_add_hook (mini_httpd_t *self, const char *url, mini_handler_fnptr_t fnptr, void *param, apr_pool_t *pool)
 mini_httpd_add_hook_re (mini_httpd_t *self, const char *url, mini_handler_fnptr_t fnptr, void *param, apr_pool_t *pool)
 mini_httpd_tick (mini_httpd_t *self, apr_pool_t *pool)
 mini_httpd_handle (mini_httpd_t *self, apr_socket_t *req_sock, apr_pool_t *pool)
 mini_httpd_max_size_set (mini_httpd_t *self, apr_size_t size)
 mini_req_create (mini_req_t **self, mini_httpd_t *httpd, apr_socket_t *sock, apr_pool_t *pool)
 mini_httpd_set_access_fn (mini_httpd_t *self, mini_access_fnptr_t fn)
 mini_req_headers_read (mini_req_t *req)
 mini_req_process (mini_req_t *req)
 mini_req_headers_write (mini_req_t *req)
 mini_req_write (mini_req_t *req, const char *ptr)
 mini_req_printf (mini_req_t *req, const char *ptr,...)
 mini_req_hook_param_get (mini_req_t *req)
 mini_req_params (mini_req_t *req)
 mini_req_query_get (mini_req_t *req)
 mini_req_param_get (mini_req_t *req)
 mini_httpd_param_set (mini_httpd_t *self, void *value)
 mini_req_local_ip (mini_req_t *req)
 mini_req_remote_ip (mini_req_t *req)
 mini_req_get_package (mini_req_t *req, const char **pkg, apr_size_t *sz)
 sul_httpd_req_create (sul_httpd_req_t **req, const char *ip, short port, const char *url, apr_pool_t *pool)
 sul_httpd_req_send (sul_httpd_req_t *req, const char *str)
 sul_httpd_req_open (sul_httpd_req_t *req, sul_boolean_t cfail, apr_status_t *state, apr_ssize_t secs)
 sul_httpd_req_retrieve (sul_httpd_req_t *req)
 sul_httpd_req_close (sul_httpd_req_t *req)
 sul_unescape_url (char *url)

Typedef Documentation

typedef sul_error_t*(* mini_handler_fnptr_t)(mini_req_t *req, apr_pool_t *pool)
 

A handler is invoked whenever a connection is established and the other end asks for a URL. A REQ object is given containing details and the data should be written back for the users browser or whatever. POOL is destroyed immediately after the function returns.

typedef struct mini_hook_t mini_hook_t
 

Opaque Mini Hook object for wrapping URL hooks.

typedef struct mini_httpd_t mini_httpd_t
 

Opaque Mini HTTPD server object.

typedef struct mini_req_t mini_req_t
 

Opaque Mini request object.


Enumeration Type Documentation

enum min_req_type_t
 

Type of HTTP action being conducted during a request.

Enumeration values:
MINI_RT_UNKNOWN  Unknown, either unrecognized, never given, or unparsable.
MINI_RT_HTTP_POST  A POST operation.
MINI_RT_HTTP_GET  A GET operation.


Function Documentation

mini_httpd_add_hook mini_httpd_t self,
const char *  url,
mini_handler_fnptr_t  fnptr,
void *  param,
apr_pool_t *  pool
 

Registers a new function hook to service the given URL.

Parameters:
self HTTP server to register the URL under.
url URL being registered.
fnptr Pointer to the hook function for handling URL.
param User data to hand off to the hook when it's invoked, this way customized data structures can be associated with hooks when they're first registered.
pool Pool to allocate any overhead from.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_httpd_create mini_httpd_t **  self,
short  port,
apr_pool_t *  pool
 

Creates a new HTTP server.

Parameters:
self Pointer to receive the HTTP server.
port Port to listen for connections on.
pool Pool to allocate the server from.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_httpd_set_access_fn mini_httpd_t self,
mini_access_fnptr_t  fn
 

Sets the access control function that this HTTPD server should use.

Parameters:
self 
fn 
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_httpd_tick mini_httpd_t self,
apr_pool_t *  pool
 

Checks for any pending connections and handles them. This function blocks for a second in the polling section.

Parameters:
self HTTP server being ticked.
pool Pool to allocate any overhead from.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_create mini_req_t **  self,
mini_httpd_t httpd,
apr_socket_t *  sock,
apr_pool_t *  pool
 

Parameters:
self Request pointer to receive the new request.
httpd Server responsible for serving the new request.
sock Socket to communicate over for this request.
pool Pool to allocate the request from and to associate with REQ permanantly.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_get_package mini_req_t req,
const char **  pkg,
apr_size_t *  sz
 

Parameters:
req 
pkg 
sz 
Returns:
TRUE if there is a package avaialble and FALSE otherwise.

mini_req_headers_read mini_req_t req  ) 
 

Reads the initial headers for the REQ connection.

Parameters:
req Request connection to write the data to.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_headers_write mini_req_t req  ) 
 

Writes any pending headers for REQ to its connection.

Parameters:
req Request connection to write the data to.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_printf mini_req_t req,
const char *  ptr,
... 
 

Writes a string of data to REQ's connection.

Parameters:
req Request connection to write the data to.
ptr String data to write to the connection.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_process mini_req_t req  ) 
 

Processes a REQ.

Parameters:
req Request connection to write the data to.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

mini_req_write mini_req_t req,
const char *  ptr
 

Writes a string of data to REQ's connection.

Parameters:
req Request connection to write the data to.
ptr String data to write to the connection.
Returns:
An sul_error_t instance if an error occured and NULL otherwise.

sul_httpd_req_close sul_httpd_req_t *  req  ) 
 

Parameters:
req 
Returns:

sul_httpd_req_create sul_httpd_req_t **  req,
const char *  ip,
short  port,
const char *  url,
apr_pool_t *  pool
 

Parameters:
req 
ip 
port 
url 
pool 
Returns:

sul_httpd_req_open sul_httpd_req_t *  req,
sul_boolean_t  cfail,
apr_status_t *  state,
apr_ssize_t  secs
 

Parameters:
req 
cfail 
state 
secs 
Returns:

sul_httpd_req_retrieve sul_httpd_req_t *  req  ) 
 

Parameters:
req 
Returns:

sul_httpd_req_send sul_httpd_req_t *  req,
const char *  str
 

Parameters:
req 
str 
Returns:


Generated on Wed Apr 28 09:38:38 2004 for State by doxygen 1.3.5