Fastcgipp::Transceiver Class Reference

Handles low level communication with "the other side". More...

#include <transceiver.hpp>

List of all members.

Public Member Functions

bool handler ()
 General transceiver handler.
Block requestWrite (size_t size)
 Direct interface to Buffer::requestWrite().
void secureWrite (size_t size, Protocol::FullId id, bool kill)
 Direct interface to Buffer::secureWrite().
 Transceiver (int fd_, boost::function< void(Protocol::FullId, Message)> sendMessage_)
 Constructor.
void sleep ()
 Blocks until there is data to receive or a SIGUSR2 is caught.

Private Member Functions

int transmit ()
 Transmit all buffered data possible.

Private Attributes

Buffer buffer
 Buffer for transmitting data
boost::function< void(Protocol::FullId,
Message)> 
sendMessage
 Function to call to pass messages to requests.
int socket
 Socket to listen for connections on.
int epollFd
 File descriptor to epoll.
std::map< int, fdBufferfdBuffers
 Container associating file descriptors with their receive buffers.

Classes

class  Buffer
 Buffer type for transmission of FastCGI records More...
struct  fdBuffer
 Buffer type for receiving FastCGI records More...


Detailed Description

Handles low level communication with "the other side".

This class handles the sending/receiving/buffering of data through the OS level sockets and also the creation/destruction of the sockets themselves.

Definition at line 77 of file transceiver.hpp.


Constructor & Destructor Documentation

Fastcgipp::Transceiver::Transceiver ( int  fd_,
boost::function< void(Protocol::FullId, Message)>  sendMessage_ 
)

Constructor.

Construct a transceiver object based on an initial file descriptor to listen on and a function to pass messages on to.

Parameters:
[in] fd_ File descriptor to listen for connections on
[in] sendMessage_ Function to call to pass messages to requests

Definition at line 183 of file transceiver.cpp.

References epollFd, and socket.


Member Function Documentation

bool Fastcgipp::Transceiver::handler (  ) 

General transceiver handler.

This function is called by Manager::handler() to both transmit data passed to it from requests and relay received data back to them as a Message. The function will return true if there is nothing at all for it to do.

Returns:
Boolean value indicating whether there is data to be transmitted or received

Definition at line 64 of file transceiver.cpp.

References Fastcgipp::Message::data, epollFd, fdBuffers, sendMessage, Fastcgipp::Message::size, socket, transmit(), and Fastcgipp::Message::type.

Referenced by Fastcgipp::Manager< T >::handler().

Block Fastcgipp::Transceiver::requestWrite ( size_t  size  )  [inline]

void Fastcgipp::Transceiver::secureWrite ( size_t  size,
Protocol::FullId  id,
bool  kill 
) [inline]

void Fastcgipp::Transceiver::sleep (  ) 

Blocks until there is data to receive or a SIGUSR2 is caught.

Definition at line 173 of file transceiver.cpp.

References epollFd.

Referenced by Fastcgipp::Manager< T >::handler().

int Fastcgipp::Transceiver::transmit (  )  [private]


Member Data Documentation

Buffer for transmitting data

Definition at line 248 of file transceiver.hpp.

Referenced by requestWrite(), secureWrite(), and transmit().

Function to call to pass messages to requests.

Definition at line 250 of file transceiver.hpp.

Referenced by handler().

Socket to listen for connections on.

Definition at line 252 of file transceiver.hpp.

Referenced by handler(), and Transceiver().

File descriptor to epoll.

Definition at line 254 of file transceiver.hpp.

Referenced by handler(), sleep(), Transceiver(), and transmit().

std::map<int, fdBuffer> Fastcgipp::Transceiver::fdBuffers [private]

Container associating file descriptors with their receive buffers.

Definition at line 256 of file transceiver.hpp.

Referenced by handler().


The documentation for this class was generated from the following files:

Generated on Sat Sep 6 18:13:22 2008 for fastcgi++ by  doxygen 1.5.6