src/vfer_accept_queue.c File Reference

Implements an accept queue to hold to be accepted connections from remote clients. More...

#include "vfer_accept_queue.h"

Go to the source code of this file.

Functions

accept_queueAccept_Queue_Create (int backlog)
void Accept_Queue_Delete (accept_queue *ac)
queued_connAccept_Queue_Dequeue (accept_queue *ac)
int Accept_Queue_Enqueue (accept_queue *ac, int fd, struct sockaddr sa, packet *request)


Detailed Description

Implements an accept queue to hold to be accepted connections from remote clients.

Author:
Ivan Beschastnikh
The queue size is determine by the backlog argument to Accept_Queue_Create. The queue wraps around upon reaching the end, so that older connection requests are overwritten if they are not taken off the queue in time. note that the top pointer in the Accept_Queue structure always points to the oldest connection request record in the queue. Once the next_free pointer wraps around to bump against the top of the queue, the top of the queue moves up by one (thus loosing the oldest connection request)

Implemented with blocking in mind, the Dequeue function blocks if the queue is empty and wakes up when something appears in the queue

Definition in file vfer_accept_queue.c.


Function Documentation

accept_queue* Accept_Queue_Create ( int  backlog  ) 

Creates the accept queue structure and initializes the data members.

Parameters:
backlog the max number of connection to queue in this queue. backlog > 0 right now there is no limit on the size of the backlog
Returns:
pointer to an new accept_queue with backlog max depth on succes NULL on error

Definition at line 44 of file vfer_accept_queue.c.

void Accept_Queue_Delete ( accept_queue ac  ) 

Deletes the accept queue structure.

Parameters:
ac accept_queue pointer

Definition at line 64 of file vfer_accept_queue.c.

queued_conn* Accept_Queue_Dequeue ( accept_queue ac  ) 

Removes and returns a queued connection from the front of the queue.

This function does not block.

Parameters:
ac accept queue pointer from which we dequeu
Returns:
queued connection structure on success (if not empty queue) NULL on error (empty queue or otherwise)

Definition at line 159 of file vfer_accept_queue.c.

int Accept_Queue_Enqueue ( accept_queue ac,
int  fd,
struct sockaddr  sa,
packet request 
)

Adds a queued connection to a queue.

If the queue is full, then we merely wrap around and overwrite old connections

Parameters:
ac accept_queue pointer to which we are trying to enqueue the connection
fd the file descriptor of the open connection
sa the socke address strucutre describing the remote connection
request request packet associated with the new connection
Returns:
0 on succes -1 on error

Definition at line 92 of file vfer_accept_queue.c.


Generated on Tue Aug 8 16:07:20 2006 for VFER by  doxygen 1.4.7