Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

wccpv1_clients.c File Reference


Functions

int indexOf (u_int32 ip, u_int32 wccount, u_int32 *ips)
 Get the index of the given IP address in the given array of IPs. More...

char* hinfo2str (WCCP1_HINFO hinfo, char *buf)
 Convert a WCCP1_HINFO structure to a hexadecimal string. More...

void enableWCCP ()
 Enable the WCCP version 1 WebCache redirection engine. More...

void disableWCCP ()
 Disable the WCCP version 1 WebCache redirection engine. More...

void enableCache (WCCP1_CLIENT *client)
 Enable a WCCP version 1 WebCache. More...

void disableCache (WCCP1_CLIENT *client)
 Disable a WCCP version 1 WebCache. More...

void changeCache (WCCP1_CLIENT *client, WCCP1_HINFO hash)
 Change WCCP version 1 cache information. More...

void WCCP1Init ()
 Initialize WCCP version 1 client database.

WCCP1_CLIENTWCCP1GetClientByIP (u_int32 ip)
 Get a WCCP version 1 client by IP address. More...

WCCP1_CLIENTWCCP1AddClient (u_int32 ip)
 Adds a WCCP version 1 client with the given IP address to the list of clients. More...

void WCCP1UpdateChangeNumber ()
 Update the global WCCP version 1 change number. More...

u_int32 WCCP1GetChangeNumber ()
 Get the current global WCCP version 1 change number. More...

u_int32 WCCP1GetUsableCacheCount ()
 Gets a count of usable client caches. More...

void WCCP1GetUsableCacheData (struct iovec *iov)
 Gets the data to be sent for each usable client cache. More...

void WCCP1UpdateHashInfo (u_int32 wccount, u_int32 *ips, WCCP1_HINFO hashes[])
 Update the hash information with the given IPs and hashes. More...

int WCCP1TimeOutEntries ()
 Expire timed-out clints, and get when will the next timeout will be. More...

void WCCP1ClearAllClients ()
 Disables all WebCaches and clears the clients database.


Variables

WCCP1_CLIENTclient_list = NULL
 The list of clients.

u_int32 changeNumber = 1
 Change number, updated every time a usable cache is added or deleted, or it's hash information changes.

WCCP1_HINFO emptyHINFO = { 0, 0, 0, 0, 0, 0, 0, 0 }
 An empty Hash Information to compare. More...

int assignedClients = 0
 Current number of assigned clients.


Function Documentation

WCCP1_CLIENT* WCCP1AddClient ( u_int32 ip )
 

Adds a WCCP version 1 client with the given IP address to the list of clients.

Parameters:
ip   the IP address of the client to add.
Returns:
the newly created client's data, or NULL if allocation failed.

void WCCP1ClearAllClients ( )
 

Disables all WebCaches and clears the clients database.

u_int32 WCCP1GetChangeNumber ( )
 

Get the current global WCCP version 1 change number.

Returns:
the current change number.

WCCP1_CLIENT* WCCP1GetClientByIP ( u_int32 ip )
 

Get a WCCP version 1 client by IP address.

Parameters:
ip   the IP address of the client to get.
Returns:
the client's data, or NULL if no client was found for the given IP.

u_int32 WCCP1GetUsableCacheCount ( )
 

Gets a count of usable client caches.

Usable caches are those for which reachability has been tested.

Returns:
the number of usable caches.

void WCCP1GetUsableCacheData ( struct iovec * iov )
 

Gets the data to be sent for each usable client cache.

Usable caches are those for which reachability has been tested. It fills the given iov vector with pointers to the data element of each client. It is assumed that enough iov entries were provided. This function will typically be called after WCCP1GetUsableCacheCount.

Parameters:
iov   a iov array where the data must be stored.

void WCCP1Init ( )
 

Initialize WCCP version 1 client database.

int WCCP1TimeOutEntries ( )
 

Expire timed-out clints, and get when will the next timeout will be.

Returns:
the number of seconds until the next timeout.

void WCCP1UpdateChangeNumber ( )
 

Update the global WCCP version 1 change number.

According to the specs, the change number must be updated each time a usable cache is added, deleted, or changes it's hash information.

void WCCP1UpdateHashInfo ( u_int32 wccount,
u_int32 * ips,
WCCP1_HINFO hashes[] )
 

Update the hash information with the given IPs and hashes.

The caller must ensure that all the given IPs in the list belong to valid and usable clients before calling this function.

Parameters:
wccount   the number of cache entries in this update.
ips   a vector of IP addresses for this update.
hashes   the new hash for each of the above given IPs.

void changeCache ( WCCP1_CLIENT * client,
WCCP1_HINFO hash ) [static]
 

Change WCCP version 1 cache information.

This function is called when a cache's hash information is changed. It is only when after an enableCache call, and before the disableCache. This function also copies the new hash information into the existing client data structure.

Parameters:
client   the client which change it's hash information.
hash   the new hash information for this client.

void disableCache ( WCCP1_CLIENT * client ) [static]
 

Disable a WCCP version 1 WebCache.

This function is called when a cache must be disabled (no buckets assigned to it).

Parameters:
client   the client which must be disabled.

void disableWCCP ( ) [static]
 

Disable the WCCP version 1 WebCache redirection engine.

This function is called just after the last cache is disabled.

void enableCache ( WCCP1_CLIENT * client ) [static]
 

Enable a WCCP version 1 WebCache.

This function is called when a cache must be enabled (buckets assigned to it, and not previously assigned).

Parameters:
client   the client which must be enabled.

void enableWCCP ( ) [static]
 

Enable the WCCP version 1 WebCache redirection engine.

This function is called just before the first cache is enabled.

char* hinfo2str ( WCCP1_HINFO hinfo,
char * buf ) [static]
 

Convert a WCCP1_HINFO structure to a hexadecimal string.

Parameters:
hinfo   the hash information to convert.
buf   the buffer to store the string representation in.
Returns:
the hexadecimal string representation of the hash information.

int indexOf ( u_int32 ip,
u_int32 wccount,
u_int32 * ips ) [static]
 

Get the index of the given IP address in the given array of IPs.

Parameters:
ip   the IP address to look for.
wccount   the number of IP addresses in the array.
the   array of IPs to look into.
Returns:
the index of the IP address in the array, or -1 if not found.


Variable Documentation

int assignedClients = 0 [static]
 

Current number of assigned clients.

u_int32 changeNumber = 1 [static]
 

Change number, updated every time a usable cache is added or deleted, or it's hash information changes.

WCCP1_CLIENT* client_list = NULL [static]
 

The list of clients.

WCCP1_HINFO emptyHINFO = { 0, 0, 0, 0, 0, 0, 0, 0 } [static]
 

An empty Hash Information to compare.

(to choose between changeCache and disableCache)


Generated at Fri Jan 25 19:22:24 2002 for wccpd by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001