Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
orxonox::Connection Class Referenceabstract

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/Connection.h>

Inheritance diagram for orxonox::Connection:
orxonox::ClientConnection orxonox::ServerConnection orxonox::Client orxonox::Server

Public Member Functions

virtual ~Connection ()
 Destructor. More...
 

Protected Member Functions

 Connection (uint32_t firstPeerID=NETWORK_PEER_ID_SERVER+1)
 Constructor. More...
 
void addPacket (ENetPacket *packet, uint32_t peerID, uint8_t channelID)
 Send a packet. More...
 
virtual void addPeer (uint32_t peerID)=0
 
void broadcastPacket (ENetPacket *packet, uint8_t channelID)
 Send a broadcast packet. More...
 
void disconnectPeer (uint32_t peerID)
 Send an outgoing event of type 'disconnectPeer'. More...
 
void disconnectPeers ()
 Send an outgoing event of type 'disconnectPeers'. More...
 
void disconnectPeersInternal ()
 
void enableCompression ()
 
incomingEvent preprocessConnectEvent (ENetEvent &event)
 
incomingEvent preprocessDisconnectEvent (ENetEvent &event)
 
incomingEvent preprocessReceiveEvent (ENetEvent &event)
 
void processIncomingEvent (ENetEvent &event)
 Handle an incoming event. More...
 
void processOutgoingEvent (outgoingEvent &event)
 Send an event. More...
 
virtual void processPacket (packet::Packet *packet)=0
 
void processQueue ()
 
virtual void removePeer (uint32_t peerID)=0
 
void startCommunicationThread ()
 Start the main communication thread. More...
 
void stopCommunicationThread ()
 Stop the main communication thread. More...
 
void waitOutgoingQueue ()
 

Protected Attributes

ENetHosthost_
 

Private Member Functions

void communicationThread ()
 Main communication thread. More...
 

Private Attributes

bool bCommunicationThreadRunning_
 
ENetAddressbindAddress_
 
boost::thread * communicationThread_
 
std::deque< incomingEventincomingEvents_
 
boost::mutex * incomingEventsMutex_
 
uint32_t nextPeerID_
 
std::deque< outgoingEventoutgoingEvents_
 
boost::mutex * outgoingEventsMutex_
 
boost::mutex * overallMutex_
 
std::map< ENetPeer *, uint32_t > peerIDMap_
 
std::map< uint32_t, ENetPeer * > peerMap_
 

Constructor & Destructor Documentation

orxonox::Connection::~Connection ( )
virtual

Destructor.

orxonox::Connection::Connection ( uint32_t  firstPeerID = NETWORK_PEER_ID_SERVER + 1)
protected

Constructor.

Parameters
firstPeerIdThe initial value of nextPeerID_

Member Function Documentation

void orxonox::Connection::addPacket ( ENetPacket packet,
uint32_t  peerID,
uint8_t  channelID 
)
protected

Send a packet.

Parameters
packetPointer to the packet to send
peerIDThe peer to which the event is sent
channelIdThe channel ID
virtual void orxonox::Connection::addPeer ( uint32_t  peerID)
protectedpure virtual
void orxonox::Connection::broadcastPacket ( ENetPacket packet,
uint8_t  channelID 
)
protected

Send a broadcast packet.

Parameters
packetPointer to the packet to send
channelIdThe channel ID
void orxonox::Connection::communicationThread ( )
private

Main communication thread.

void orxonox::Connection::disconnectPeer ( uint32_t  peerID)
protected

Send an outgoing event of type 'disconnectPeer'.

Parameters
peerIDThe peer to which the event is sent
void orxonox::Connection::disconnectPeers ( )
protected

Send an outgoing event of type 'disconnectPeers'.

void orxonox::Connection::disconnectPeersInternal ( )
protected
void orxonox::Connection::enableCompression ( )
protected
incomingEvent orxonox::Connection::preprocessConnectEvent ( ENetEvent event)
protected
incomingEvent orxonox::Connection::preprocessDisconnectEvent ( ENetEvent event)
protected
incomingEvent orxonox::Connection::preprocessReceiveEvent ( ENetEvent event)
protected
void orxonox::Connection::processIncomingEvent ( ENetEvent event)
protected

Handle an incoming event.

Parameters
eventThe incoming event
void orxonox::Connection::processOutgoingEvent ( outgoingEvent event)
protected

Send an event.

Parameters
eventThe event to send
virtual void orxonox::Connection::processPacket ( packet::Packet packet)
protectedpure virtual

Implemented in orxonox::Client, and orxonox::Server.

void orxonox::Connection::processQueue ( )
protected
virtual void orxonox::Connection::removePeer ( uint32_t  peerID)
protectedpure virtual
void orxonox::Connection::startCommunicationThread ( )
protected

Start the main communication thread.

void orxonox::Connection::stopCommunicationThread ( )
protected

Stop the main communication thread.

void orxonox::Connection::waitOutgoingQueue ( )
protected

Member Data Documentation

bool orxonox::Connection::bCommunicationThreadRunning_
private
ENetAddress* orxonox::Connection::bindAddress_
private
boost::thread* orxonox::Connection::communicationThread_
private
ENetHost* orxonox::Connection::host_
protected
std::deque<incomingEvent> orxonox::Connection::incomingEvents_
private
boost::mutex* orxonox::Connection::incomingEventsMutex_
private
uint32_t orxonox::Connection::nextPeerID_
private
std::deque<outgoingEvent> orxonox::Connection::outgoingEvents_
private
boost::mutex* orxonox::Connection::outgoingEventsMutex_
private
boost::mutex* orxonox::Connection::overallMutex_
private
std::map<ENetPeer*, uint32_t> orxonox::Connection::peerIDMap_
private
std::map<uint32_t, ENetPeer*> orxonox::Connection::peerMap_
private

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