#include <linux/types.h>
#include <linux/slab.h>
#include "kre_list.h"
#include "kre_debug.h"
#include "kre_options.h"
Go to the source code of this file.
Data Structures | |
struct | kre_config_entry |
Configuration entry. More... | |
Typedefs | |
typedef struct list_head | kre_config |
Main kREproxy configuration structure. | |
Functions | |
void | kre_config_register (kre_config *) |
kREproxy configuration registration | |
int | kre_config_unregister (kre_config *) |
kREproxy configuration unregistration | |
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) |
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_entry * | kre_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. |
typedef struct list_head kre_config |
Main kREproxy configuration structure.
This should be declared once in global scope.
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.
dst_host | Destination host. | |
dst_port | Destination port. |
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.
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. |
int kre_config_add_entry_tail | ( | struct kre_config_entry * | new, | |
kre_config * | conf | |||
) |
Adding new configuration entry in tail of configuration list.
new | New added entry. | |
conf | Actual configuration - place to add new entry. |
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.
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. |
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.
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. |
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.
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. |
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.
req | Http GET/POST request. | |
host | Http Host: entry. | |
dst_host | Destination address IP. | |
dst_port | Destination port. |
void kre_config_register | ( | kre_config * | ) |
kREproxy configuration registration
Pointer | to main configuration structure. |
int kre_config_unregister | ( | kre_config * | ) |
kREproxy configuration unregistration
Pointer | to main configuration structure. |