Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cfcgi.h File Reference

Classic Forum CGI-Library. More...

Go to the source code of this file.

Data Structures

struct  s_cf_cgi_param

Typedefs

typedef s_cf_cgi_param t_cf_cgi_param

Functions

t_cf_hashcf_cgi_new ()
void cf_cgi_parse_path_info (t_array *ary)
u_char * cf_cgi_url_encode (const u_char *str, size_t len)
u_char * cf_cgi_url_decode (const u_char *str, size_t len)
u_char * cf_cgi_get (t_cf_hash *cgi, u_char *name)
void cf_cgi_set (t_cf_hash *hash, const u_char *name, const u_char *value)
t_cf_cgi_paramcf_cgi_get_multiple (t_cf_hash *hash, u_char *param)
void cf_cgi_destroy (t_cf_hash *hash)
u_int32_t path_info_parsed (u_char ***infos)


Detailed Description

Classic Forum CGI-Library.

Author:
Christian Kruse, <cjk@wwwtech.de>
This is a small but hopefully fast CGI library. It was developed within the Classic Forum project, <http://cforum.teamone.de/>

It can handle POST and GET requests, but no multipart/form-data requests. It can handle multiple form values (form fields with the same names, e.g. checkboxes or something like that). Within these basic conditions it should work very fast and reliable.

This library consists of functions around a hash which contains the CGI parameters. So the Classic Forum hash library is also needed.

Definition in file cfcgi.h.


Typedef Documentation

typedef struct s_cf_cgi_param t_cf_cgi_param
 

this type is used for multiple form values (such as checkboxes or something like that)


Function Documentation

void cf_cgi_destroy t_cf_hash hash  ) 
 

This function destroys a CGI hash.

Parameters:
hash The CGI hash

Definition at line 397 of file cfcgi.c.

u_char* cf_cgi_get t_cf_hash cgi,
u_char *  name
 

This function gets a single CGI value and returns it as a C string.

Attention:
You may not free this returned value! This will be done when you call cf_cgi_destroy().

Definition at line 340 of file cfcgi.c.

t_cf_cgi_param* cf_cgi_get_multiple t_cf_hash hash,
u_char *  param
 

This function returns a double linked list of parameters with the name the parameter 'param' defines.

Parameters:
hash the CGI hash
param the parameter name
Attention:
You may not free() anything in this list! This is done by the cf_cgi_destroy_entry() function!
Returns:
The linked list if the entry could be found, NULL if the entry was not found.

Definition at line 386 of file cfcgi.c.

t_cf_hash* cf_cgi_new  ) 
 

this function is the constructor for the CGI hash. It reads the CGI data from the environment, parses it and decodes it.

Returns:
It returns NULL on error or the CGI hash on success.

Definition at line 73 of file cfcgi.c.

void cf_cgi_parse_path_info t_array ary  ) 
 

This function parses a query string

Parameters:
ary A pointer to a array structure

Definition at line 116 of file cfcgi.c.

void cf_cgi_set t_cf_hash hash,
const u_char *  name,
const u_char *  value
 

This function sets a CGI param value

Parameters:
hash The CGI object hash
name The parameter name
value The value of the parameter

Definition at line 350 of file cfcgi.c.

u_char* cf_cgi_url_decode const u_char *  str,
size_t  len
 

This function decodes an URL encoded string. This means, <2-digit-hexvalue> will be decoded to the corresponding character

Parameters:
str the URL encoded string as a C string
len the length of the string
Returns:
It returns NULL on failure (e.g. out of memory or something like that) and the decoded string on success.

Definition at line 153 of file cfcgi.c.

u_char* cf_cgi_url_encode const u_char *  str,
size_t  len
 

This function encodes a string to an URL encoded string. This means, all characters < 48, > 122 except '_', '.' and '-' will be encoded to '%<2 digit hexvalue of character>'. Space will be converted to '+'.

Parameters:
str the string as a C string
len the length of the string
Returns:
It returns NULL on failure (e.g. out of memory or something like that) and the decoded string on success.
Attention:
You have to free() the u_char array!

Definition at line 188 of file cfcgi.c.

u_int32_t path_info_parsed u_char ***  infos  ) 
 

This function parses a PATH_INFO string

Definition at line 404 of file cfcgi.c.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5