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

wccpv1_proto.c File Reference


Functions

struct msghdr* build_I_SEE_YOU (WCCP1_CLIENT *client)
 Build a I SEE YOU reply packet for the given client. More...

struct msghdr* handle_WCCP1_HERE_I_AM (u_int32 ip, WCCP1_HERE_I_AM_MSG *request)
 Handle a HERE I AM request packet for the given client. More...

int validate_IPs (u_int32 ip, u_int32 wccount, u_int32 *ips)
 Validate that all the IPs are valid, usable caches. More...

int build_hashes (u_int32 ip, u_int32 wccount, WCCP1_ASSIGN_BUCKET_HASHINFO *hinfo, WCCP1_HINFO hashes[])
 Build the hashes for all the caches. More...

void handle_ASSIGN_BUCKET (u_int32 ip, void *packet, int len)
 Handle a ASSIGN BUCKET request packet for the given client. More...

struct msghdr* WCCP1Receive (u_int32 ip, void *packet, int len)
 Process a received WCCP version 1 packet. More...

void WCCP1FreeReply (struct msghdr *reply)
 Frees a reply from WCCP1Receive. More...


Function Documentation

void WCCP1FreeReply ( struct msghdr * reply )
 

Frees a reply from WCCP1Receive.

Parameters:
reply   the pointer to the msghdr obtained from WCCP1Receive.

struct msghdr* WCCP1Receive ( u_int32 ip,
void * packet,
int len )
 

Process a received WCCP version 1 packet.

This is the entry point for all WCCP version 1 packet processing.

This function does not fill in the msghdr.msg_name and msghdr.msg_namelen, that will be taken care of by the caller. The caller is also responsible of deallocating the reply by calling WCCP1FreeReply.

Parameters:
ip   the IP address of the client that sent this packet.
packet   the packet's data.
len   the length of the packet, as received from the socket layer.
Returns:
a pointer to a msghdr with the reply to send to the client thru sendmsg.

struct msghdr* build_I_SEE_YOU ( WCCP1_CLIENT * client ) [static]
 

Build a I SEE YOU reply packet for the given client.

This function does not fill in the msghdr.msg_name and msghdr.msg_namelen, that will be taken care of by the caller. The caller is also responsible of deallocating the reply by calling WCCP1FreeReply.

Parameters:
client   the client that will receive this packet.
Returns:
a pointer to a msghdr with the reply to send to the client thru sendmsg.

int build_hashes ( u_int32 ip,
u_int32 wccount,
WCCP1_ASSIGN_BUCKET_HASHINFO * hinfo,
WCCP1_HINFO hashes[] ) [static]
 

Build the hashes for all the caches.

It packs the bucket data into the WebCache's hash information bitmap.

The hashes are indexed identical to the IP address array.

Parameters:
ip   the IP address of the client that sent this packet.
wccount   the number of entries in the following array.
hinfo   an array of assigned WebCache indexes for each bucket.
hashes   an array of bitmap (hash information) for each assigned WebCache.
Returns:
0 if successful, -1 otherwise.

void handle_ASSIGN_BUCKET ( u_int32 ip,
void * packet,
int len ) [static]
 

Handle a ASSIGN BUCKET request packet for the given client.

It validates the IP and that it's a valid and usable client, then checks the Received Id is equal to the one sent in our last I SEE YOU. Then it checks the IPs in the list, and then builds and updates the new hashes.

Parameters:
ip   the IP address of the client that sent this packet.
packet   the packet's data.
len   the length of the packet, as received from the socket layer.

struct msghdr* handle_WCCP1_HERE_I_AM ( u_int32 ip,
WCCP1_HERE_I_AM_MSG * request ) [static]
 

Handle a HERE I AM request packet for the given client.

In case of a reply, this function does not fill in the msghdr.msg_name and msghdr.msg_namelen, that will be taken care of by the caller. The caller is also responsible of deallocating the reply by calling WCCP1FreeReply.

Parameters:
ip   the IP address of the client that sent this packet.
request   the WCCP version 1 HERE I AM packet.
Returns:
a pointer to a msghdr with the reply to send to the client thru sendmsg.

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

Validate that all the IPs are valid, usable caches.

Parameters:
ip   the IP address of the client that sent this packet.
wccount   the number of entries in the following array.
ips   the array of IPs to validate.
Returns:
0 if successful, -1 otherwise.


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