kre_config.c File Reference

kREproxy configuration interface implementation. More...

#include "kre_config.h"

Functions

void kre_config_register (kre_config *c)
 kREproxy configuration registration
int kre_config_unregister (kre_config *c)
 kREproxy configuration unregistration
struct kre_config_entrykre_config_new_entry (const char *req, size_t req_size, const char *host, size_t host_size, u8 dst_host[], int dst_port)
 Creating new config entry.
int kre_config_add_entry_tail (struct kre_config_entry *new, kre_config *conf)
 Adding new configuration entry in tail of configuration list.
int kre_config_add_entry (kre_config *c, const char *uri, size_t us, const char *host, size_t hs, u8 dst_host[], int dst_port)
 Creating and adding configuration entry.
int kre_config_add_default_entry (kre_config *c, u8 dst_host[], int dst_port)
 Adding default entry.
int kre_config_is_uri_equal (const char *u1, size_t s1, const char *u2, size_t s2)
 Equal test of two uri from HTTP request and from configuration.
int kre_config_is_host_equal (const char *h1, size_t s1, const char *h2, size_t s2)
 Equal test of two hosts from HTTP request and configuation.
struct kre_config_entrykre_config_find (kre_config *c, const char *uri, size_t us, const char *host, size_t hs)
 Find configuration structure witch tell kreproxy where pass the request from client.


Detailed Description

kREproxy configuration interface implementation.


Function Documentation

int kre_config_add_default_entry ( kre_config c,
u8  dst_host[],
int  dst_port 
)

Adding default entry.

This is default destination host to service requst which not match to any other configuration entry. YOU HAVE TO REMEMBER THAT THIS ENTRY MUST BE SET AS LAST CONFIGURATION ENTRY.

Parameters:
dst_host Destination host.
dst_port Destination port.
Returns:
error code or 0

int kre_config_add_entry ( kre_config c,
const char *  uri,
size_t  us,
const char *  host,
size_t  hs,
u8  dst_host[],
int  dst_port 
)

Creating and adding configuration entry.

This is main configuration adding function which end user should use.

Parameters:
c Pointer to main kREproxy configuration.
uri HTTP URI.
us Size of URI.
host HTTP host.
hs Size of host.
dst_host Destination host.
dst_port Destination port.
Returns:
Error code or 0.

int kre_config_add_entry_tail ( struct kre_config_entry new,
kre_config conf 
)

Adding new configuration entry in tail of configuration list.

Parameters:
new New added entry.
conf Actual configuration - place to add new entry.
Returns:
Error code or 0.

struct kre_config_entry* kre_config_find ( kre_config c,
const char *  uri,
size_t  us,
const char *  host,
size_t  hs 
) [read]

Find configuration structure witch tell kreproxy where pass the request from client.

Parameters:
c Pointer to main kREproxy configuration.
uri URI from client HTTP request.
us Size of URI.
host Host from client HTTP request.
hs Size of host.
Returns:
Pointer to right configuration entry.

int kre_config_is_host_equal ( const char *  h1,
size_t  s1,
const char *  h2,
size_t  s2 
)

Equal test of two hosts from HTTP request and configuation.

This is simple equal test. If all of chars are equal this function return 1 in other hand 0.

Parameters:
h1 Host 1 to equal test, which have to come from kre configuration.
s1 Size of host 1.
h2 Host 2 to equal test, which have to come from HTTP request.
s2 Size of host 2.
Returns:
0 if not equal or 1 if equal.

int kre_config_is_uri_equal ( const char *  u1,
size_t  s1,
const char *  u2,
size_t  s2 
)

Equal test of two uri from HTTP request and from configuration.

This is specific kreproxy comparison this can interpret asterisk ('*') symbol on The end of uri as string of any char or zero chars.

Parameters:
u1 URI 1 to equal test, which have to come from kre configuration.
s1 Size of uri 1.
u2 URI 2 to equal test, which have to come from HTTP request.
s2 Size of uri 2.
Returns:
0 if not equal, if equal 1.

struct kre_config_entry* kre_config_new_entry ( const char *  req,
size_t  req_size,
const char *  host,
size_t  host_size,
u8  dst_host[],
int  dst_port 
) [read]

Creating new config entry.

This function create new configuration entry allocate memory for new entry copy data and return address of this entry.

Parameters:
req Http GET/POST request.
host Http Host: entry.
dst_host Destination address IP.
dst_port Destination port.
Returns:
Pointer to new allocated entry.

void kre_config_register ( kre_config  ) 

kREproxy configuration registration

Parameters:
Pointer to main configuration structure.

int kre_config_unregister ( kre_config  ) 

kREproxy configuration unregistration

Parameters:
Pointer to main configuration structure.
Returns:
error output or 0 if everythig ok


Generated on Fri Feb 20 19:46:05 2009 for kREproxy by  doxygen 1.5.8