Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

hi_ui_server_lookup.c File Reference

This file contains functions to access the SERVER_LOOKUP structure. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "hi_util_xmalloc.h"
#include "hi_util_kmap.h"
#include "hi_ui_config.h"
#include "hi_return_codes.h"

Go to the source code of this file.

Functions

int hi_ui_server_lookup_init (SERVER_LOOKUP **ServerLookup)
int hi_ui_server_lookup_add (SERVER_LOOKUP *ServerLookup, unsigned long Ip, HTTPINSPECT_CONF *ServerConf)
HTTPINSPECT_CONFhi_ui_server_lookup_find (SERVER_LOOKUP *ServerLookup, unsigned long Ip, int *iError)
HTTPINSPECT_CONFhi_ui_server_lookup_first (SERVER_LOOKUP *ServerLookup, int *iError)
HTTPINSPECT_CONFhi_ui_server_lookup_next (SERVER_LOOKUP *ServerLookup, int *iError)


Detailed Description

This file contains functions to access the SERVER_LOOKUP structure.

Author:
Daniel Roelker <droelker@sourcefire.com>
We wrap the access to SERVER_LOOKUP so changing the lookup algorithms are more modular and independent. This is the only file that would need to be changed to change the algorithmic lookup.

NOTES:

Definition in file hi_ui_server_lookup.c.


Function Documentation

int hi_ui_server_lookup_add SERVER_LOOKUP ServerLookup,
unsigned long  Ip,
HTTPINSPECT_CONF ServerConf
 

Add a server configuration to the list.

We add these keys like you would normally think to add them, because on low endian machines the least significant byte is compared first. This is what we want to compare IPs backward, doesn't work on high endian machines, but oh well. Our platform is Intel.

Parameters:
ServerLookup a pointer to the lookup structure
Ip the IP address of the server (the key)
ServerConf a pointer to the server configuration
Returns:
integer
Return values:
HI_SUCCESS function successful
HI_INVALID_ARG invalid argument, most likely NULL pointer
HI_MEM_ALLOC_FAIL memory allocation failed
HI_NONFATAL_ERR key is already in table, don't overwrite configuration.

Definition at line 79 of file hi_ui_server_lookup.c.

References HI_INVALID_ARG, HI_MEM_ALLOC_FAIL, HI_NONFATAL_ERR, HI_SUCCESS, and KMapAdd().

Referenced by hi_ui_config_add_server().

HTTPINSPECT_CONF* hi_ui_server_lookup_find SERVER_LOOKUP ServerLookup,
unsigned long  Ip,
int *  iError
 

Find a server configuration given a IP.

We look up a server configuration given an IP and return a pointer to that server configuration if found.

Parameters:
ServerLookup pointer to the server lookup structure
Ip the IP to lookup
iError the error return code
Returns:
integer
Return values:
HI_SUCCESS function sucessful
HI_INVALID_ARG argument(s) are invalid
HI_NOT_FOUND IP not found

Definition at line 127 of file hi_ui_server_lookup.c.

References HI_INVALID_ARG, HI_NOT_FOUND, HI_SUCCESS, KMapFind(), and NULL.

Referenced by InitServerConf().

HTTPINSPECT_CONF* hi_ui_server_lookup_first SERVER_LOOKUP ServerLookup,
int *  iError
 

This lookups the first server configuration, so we can iterate through the configurations.

Parameters:
ServerLookup pointer to the server lookup structure
iError pointer to the integer to set for errors
Returns:
integer
Return values:
HI_INVALID_ARG invalid argument
HI_NOT_FOUND configuration not found (no first config)
HI_SUCCESS function successful

Definition at line 170 of file hi_ui_server_lookup.c.

References HI_INVALID_ARG, HI_NOT_FOUND, HI_SUCCESS, KMapFindFirst(), and NULL.

int hi_ui_server_lookup_init SERVER_LOOKUP **  ServerLookup  ) 
 

Initialize the server_lookup structure.

We need to initialize the server_lookup structure for the server configuration access. Don't want a NULL pointer flying around, when we have to look for server configs.

Parameters:
ServerLookup pointer to the pointer of the server lookup structure.
Returns:
integer
Return values:
HI_SUCCESS function successful.
HI_MEM_ALLOC_FAIL memory allocation failed

Definition at line 44 of file hi_ui_server_lookup.c.

References HI_MEM_ALLOC_FAIL, HI_SUCCESS, KMapNew(), and NULL.

Referenced by hi_ui_config_init_global_conf().

HTTPINSPECT_CONF* hi_ui_server_lookup_next SERVER_LOOKUP ServerLookup,
int *  iError
 

Iterates to the next configuration, like a list it just returns the next config in the config list.

Parameters:
ServerLookup pointer to the server lookup structure
iError pointer to the integer to set for errors
Returns:
integer
Return values:
HI_INVALID_ARG invalid argument
HI_NOT_FOUND configuration not found (no first config)
HI_SUCCESS function successful

Definition at line 213 of file hi_ui_server_lookup.c.

References HI_INVALID_ARG, HI_NOT_FOUND, HI_SUCCESS, KMapFindNext(), and NULL.


Generated on Sun May 14 14:51:25 2006 by  doxygen 1.4.2