Functions | |
int | createSocket (int port) |
Create a socket for the WCCP port. More... | |
int | getPacket (int fd, int timeout, void *buf, int len, struct sockaddr_in *from, socklen_t *fromlen) |
Get a single packet from the socket. More... | |
void | processPacket (int fd, void *buf, int len, struct sockaddr_in *client, socklen_t *client_len) |
Process a single packet, and send a reply if applicable. More... | |
void | main_loop (int fd) |
The main loop of the daemon. More... | |
int | main (int argc, char **argv) |
The main function. More... | |
Variables | |
int | fShutdown = 0 |
The shutdown flag, incremented when the daemon receives a SIGTERM/SIGINT. |
|
Create a socket for the WCCP port.
|
|
Get a single packet from the socket.
|
|
The main function. It parses options and optionally daemonizes the program. Then it creates the socket and calls main_loop.
|
|
The main loop of the daemon. It loops until fShutdown is greater than 0. Each interaction it times-out clients, gets a packet and processes it.
|
|
Process a single packet, and send a reply if applicable. If the len is less than or equals to 0, then there was an error receiving the packet, so we should ignore the request.
|
|
The shutdown flag, incremented when the daemon receives a SIGTERM/SIGINT.
|