NetServerTCP2Destination Class Reference

#include <NetServerTCP2Destination.h>

Inheritance diagram for NetServerTCP2Destination:

NetMessageHandlerI

List of all members.

Public Member Functions

 NetServerTCP2Destination (NetMessageHandler *incomingMessageHandler, TCPsocket socket, unsigned int destinationId)
virtual ~NetServerTCP2Destination ()
void printStats (unsigned int destinationId)
void stop ()
bool finished ()
unsigned int getIpAddress ()
void addMessage (NetMessage *message)
virtual void processMessage (NetMessage &message)

Static Public Member Functions

static unsigned int getIpAddressFromSocket (TCPsocket socket)

Protected Types

enum  HeaderType { TypeNone = 0, TypeMessage = 1, TypeLast = 4 }
enum  SocketResult { SocketActivity, SocketEmpty, SocketClosed }

Protected Member Functions

SocketResult checkIncoming ()
SocketResult checkOutgoing ()
void actualSendRecvFunc ()
bool sendHeader (char headerType, int len)

Static Protected Member Functions

static int sendRecvThreadFunc (void *c)

Protected Attributes

bool packetLogging_
unsigned int destinationId_
SDL_Thread * sendRecvThread_
TCPsocket socket_
SDLNet_SocketSet socketSet_
NetBuffer currentMessagePart_
NetMessagecurrentMessage_
int currentMessageLen_
char currentMessageType_
int currentMessageSentLen_
unsigned int messagesSent_
unsigned int messagesRecieved_
unsigned int bytesIn_
unsigned int bytesOut_
bool stopped_
bool finished_
NetMessageHandler outgoingMessageHandler_
NetMessageHandlerincomingMessageHandler_
std::list< NetMessage * > outgoingMessages_


Detailed Description

Definition at line 29 of file NetServerTCP2Destination.h.


Member Enumeration Documentation

enum NetServerTCP2Destination::HeaderType [protected]

Enumerator:
TypeNone 
TypeMessage 
TypeLast 

Definition at line 52 of file NetServerTCP2Destination.h.

enum NetServerTCP2Destination::SocketResult [protected]

Enumerator:
SocketActivity 
SocketEmpty 
SocketClosed 

Definition at line 76 of file NetServerTCP2Destination.h.


Constructor & Destructor Documentation

NetServerTCP2Destination::NetServerTCP2Destination ( NetMessageHandler incomingMessageHandler,
TCPsocket  socket,
unsigned int  destinationId 
)

Definition at line 98 of file NetServerTCP2Destination.cpp.

References NetOptions::getPacketLogging(), NetOptions::instance(), Logger::log(), outgoingMessageHandler_, packetLogging_, sendRecvThread_, sendRecvThreadFunc(), NetMessageHandler::setMessageHandler(), socket_, and socketSet_.

NetServerTCP2Destination::~NetServerTCP2Destination (  )  [virtual]

Definition at line 128 of file NetServerTCP2Destination.cpp.

References NetMessagePool::addToPool(), currentMessage_, destinationId_, S3D::formatStringBuffer(), NetMessagePool::instance(), Logger::log(), outgoingMessages_, packetLogging_, sendRecvThread_, socket_, and socketSet_.


Member Function Documentation

void NetServerTCP2Destination::printStats ( unsigned int  destinationId  ) 

Definition at line 462 of file NetServerTCP2Destination.cpp.

References bytesIn_, bytesOut_, S3D::formatStringBuffer(), Logger::log(), messagesRecieved_, and messagesSent_.

Referenced by NetServerTCP2::destroyDestination().

void NetServerTCP2Destination::stop (  )  [inline]

Definition at line 37 of file NetServerTCP2Destination.h.

References stopped_.

Referenced by NetServerTCP2::destroyDestination().

bool NetServerTCP2Destination::finished (  )  [inline]

Definition at line 38 of file NetServerTCP2Destination.h.

References finished_.

Referenced by NetServerTCP2::checkClients().

unsigned int NetServerTCP2Destination::getIpAddress (  ) 

Definition at line 158 of file NetServerTCP2Destination.cpp.

References getIpAddressFromSocket(), and socket_.

Referenced by NetServerTCP2::addDestination(), checkIncoming(), NetServerTCP2::destroyDestination(), and processMessage().

unsigned int NetServerTCP2Destination::getIpAddressFromSocket ( TCPsocket  socket  )  [static]

Definition at line 163 of file NetServerTCP2Destination.cpp.

Referenced by getIpAddress().

void NetServerTCP2Destination::addMessage ( NetMessage message  )  [inline]

Definition at line 43 of file NetServerTCP2Destination.h.

References NetMessageHandler::addMessage(), and outgoingMessageHandler_.

Referenced by NetServerTCP2::processMessage().

void NetServerTCP2Destination::processMessage ( NetMessage message  )  [virtual]

Implements NetMessageHandlerI.

Definition at line 250 of file NetServerTCP2Destination.cpp.

References NetBuffer::allocate(), destinationId_, S3D::formatStringBuffer(), NetBuffer::getBuffer(), NetMessage::getBuffer(), NetMessage::getDestinationId(), getIpAddress(), NetMessagePool::instance(), Logger::log(), outgoingMessages_, packetLogging_, NetMessage::SentMessage, and NetBuffer::setBufferUsed().

NetServerTCP2Destination::SocketResult NetServerTCP2Destination::checkIncoming (  )  [protected]

Definition at line 276 of file NetServerTCP2Destination.cpp.

References NetBuffer::addDataToBuffer(), NetMessageHandler::addMessage(), NetMessage::BufferMessage, bytesIn_, currentMessage_, currentMessageLen_, currentMessagePart_, currentMessageType_, destinationId_, S3D::formatStringBuffer(), NetBuffer::getBuffer(), NetMessage::getBuffer(), NetBuffer::getBufferUsed(), NetInterface::getBytesIn(), NetBufferReader::getFromBuffer(), getIpAddress(), incomingMessageHandler_, NetMessagePool::instance(), Logger::log(), messagesRecieved_, packetLogging_, NetBuffer::reset(), SDLNet_TCP_Recv_Wrapper(), socket_, SocketActivity, SocketClosed, SocketEmpty, socketSet_, TypeLast, and TypeMessage.

Referenced by actualSendRecvFunc().

NetServerTCP2Destination::SocketResult NetServerTCP2Destination::checkOutgoing (  )  [protected]

Definition at line 377 of file NetServerTCP2Destination.cpp.

References NetMessageHandler::addMessage(), bytesOut_, currentMessageSentLen_, destinationId_, S3D::formatStringBuffer(), NetBuffer::getBuffer(), NetMessage::getBuffer(), NetBuffer::getBufferUsed(), NetInterface::getBytesOut(), incomingMessageHandler_, Logger::log(), messagesSent_, outgoingMessages_, packetLogging_, SDLNet_TCP_Send_Wrapper(), sendHeader(), socket_, SocketActivity, SocketClosed, SocketEmpty, TypeLast, and TypeMessage.

Referenced by actualSendRecvFunc().

int NetServerTCP2Destination::sendRecvThreadFunc ( void *  c  )  [static, protected]

Definition at line 174 of file NetServerTCP2Destination.cpp.

References actualSendRecvFunc(), and finished_.

Referenced by NetServerTCP2Destination().

void NetServerTCP2Destination::actualSendRecvFunc (  )  [protected]

Definition at line 183 of file NetServerTCP2Destination.cpp.

References checkIncoming(), checkOutgoing(), destinationId_, S3D::formatStringBuffer(), Clock::getTimeDifference(), Logger::log(), outgoingMessageHandler_, packetLogging_, NetMessageHandler::processMessages(), SocketClosed, SocketEmpty, and stopped_.

Referenced by sendRecvThreadFunc().

bool NetServerTCP2Destination::sendHeader ( char  headerType,
int  len 
) [protected]

Definition at line 433 of file NetServerTCP2Destination.cpp.

References NetBuffer::addToBuffer(), NetMessagePool::addToPool(), NetMessage::BufferMessage, bytesOut_, destinationId_, S3D::formatStringBuffer(), NetBuffer::getBuffer(), NetMessage::getBuffer(), NetBuffer::getBufferUsed(), NetInterface::getBytesOut(), NetMessagePool::instance(), Logger::log(), SDLNet_TCP_Send_Wrapper(), and socket_.

Referenced by checkOutgoing().


Member Data Documentation

bool NetServerTCP2Destination::packetLogging_ [protected]

Definition at line 59 of file NetServerTCP2Destination.h.

Referenced by actualSendRecvFunc(), checkIncoming(), checkOutgoing(), NetServerTCP2Destination(), processMessage(), and ~NetServerTCP2Destination().

unsigned int NetServerTCP2Destination::destinationId_ [protected]

Definition at line 60 of file NetServerTCP2Destination.h.

Referenced by actualSendRecvFunc(), checkIncoming(), checkOutgoing(), processMessage(), sendHeader(), and ~NetServerTCP2Destination().

SDL_Thread* NetServerTCP2Destination::sendRecvThread_ [protected]

Definition at line 61 of file NetServerTCP2Destination.h.

Referenced by NetServerTCP2Destination(), and ~NetServerTCP2Destination().

TCPsocket NetServerTCP2Destination::socket_ [protected]

Definition at line 62 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), checkOutgoing(), getIpAddress(), NetServerTCP2Destination(), sendHeader(), and ~NetServerTCP2Destination().

SDLNet_SocketSet NetServerTCP2Destination::socketSet_ [protected]

Definition at line 63 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), NetServerTCP2Destination(), and ~NetServerTCP2Destination().

NetBuffer NetServerTCP2Destination::currentMessagePart_ [protected]

Definition at line 64 of file NetServerTCP2Destination.h.

Referenced by checkIncoming().

NetMessage* NetServerTCP2Destination::currentMessage_ [protected]

Definition at line 65 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), and ~NetServerTCP2Destination().

int NetServerTCP2Destination::currentMessageLen_ [protected]

Definition at line 66 of file NetServerTCP2Destination.h.

Referenced by checkIncoming().

char NetServerTCP2Destination::currentMessageType_ [protected]

Definition at line 67 of file NetServerTCP2Destination.h.

Referenced by checkIncoming().

int NetServerTCP2Destination::currentMessageSentLen_ [protected]

Definition at line 68 of file NetServerTCP2Destination.h.

Referenced by checkOutgoing().

unsigned int NetServerTCP2Destination::messagesSent_ [protected]

Definition at line 69 of file NetServerTCP2Destination.h.

Referenced by checkOutgoing(), and printStats().

unsigned int NetServerTCP2Destination::messagesRecieved_ [protected]

Definition at line 69 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), and printStats().

unsigned int NetServerTCP2Destination::bytesIn_ [protected]

Definition at line 70 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), and printStats().

unsigned int NetServerTCP2Destination::bytesOut_ [protected]

Definition at line 70 of file NetServerTCP2Destination.h.

Referenced by checkOutgoing(), printStats(), and sendHeader().

bool NetServerTCP2Destination::stopped_ [protected]

Definition at line 71 of file NetServerTCP2Destination.h.

Referenced by actualSendRecvFunc(), and stop().

bool NetServerTCP2Destination::finished_ [protected]

Definition at line 71 of file NetServerTCP2Destination.h.

Referenced by finished(), and sendRecvThreadFunc().

NetMessageHandler NetServerTCP2Destination::outgoingMessageHandler_ [protected]

Definition at line 72 of file NetServerTCP2Destination.h.

Referenced by actualSendRecvFunc(), addMessage(), and NetServerTCP2Destination().

NetMessageHandler* NetServerTCP2Destination::incomingMessageHandler_ [protected]

Definition at line 73 of file NetServerTCP2Destination.h.

Referenced by checkIncoming(), and checkOutgoing().

std::list<NetMessage *> NetServerTCP2Destination::outgoingMessages_ [protected]

Definition at line 74 of file NetServerTCP2Destination.h.

Referenced by checkOutgoing(), processMessage(), and ~NetServerTCP2Destination().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:04 2009 for Scorched3D by  doxygen 1.5.3