Orxonox
0.0.5 Codename: Arcturus
|
Client *client; The network/Client class This class implements all necessary function for the network communication It is the root class of the network module. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/Client.h>
Public Member Functions | |
Client () | |
Constructor for the Client class initializes the address and the port to default localhost:NETWORK_PORT. More... | |
~Client () | |
virtual bool | closeConnection () override |
closes the Connection to the Server More... | |
virtual void | doReceiveChat (const std::string &message, unsigned int sourceID, unsigned int targetID) override |
Gets called if a packet::Chat packet is received. More... | |
virtual void | doSendChat (const std::string &message, unsigned int sourceID, unsigned int targetID) override |
Sends a chat message to the server. More... | |
virtual bool | establishConnection () override |
Establish the Connection to the Server. More... | |
virtual void | printRTT () override |
virtual void | queuePacket (ENetPacket *packet, int clientID, uint8_t channelID) override |
virtual bool | sendPacket (packet::Packet *packet) override |
void | setDestination (const std::string &serverAddress, unsigned int port) |
void | update (const Clock &time) |
Processes incoming packets, sends a gamestate to the server and does the cleanup. More... | |
Public Member Functions inherited from orxonox::Host | |
bool | isActive () |
Public Member Functions inherited from orxonox::GamestateManager | |
GamestateManager () | |
~GamestateManager () | |
virtual bool | ackGamestate (unsigned int gamestateID, unsigned int peerID) override |
Acknowledge a received gamestate. More... | |
virtual bool | addGamestate (packet::Gamestate *gs, unsigned int peerID) override |
void | addPeer (uint32_t peerID) |
Add a peer to the game. More... | |
void | finishGamestate (unsigned int peerID, packet::Gamestate *&destgamestate, packet::Gamestate *base, packet::Gamestate *gamestate) |
virtual uint32_t | getCurrentGamestateID () override |
std::vector< packet::Gamestate * > | getGamestates () |
Return a vector with the gamestates of all peers. More... | |
virtual uint32_t | getLastReceivedGamestateID (unsigned int peerID) override |
Return the ID of the last received gamestate for a certain peer. More... | |
bool | getSnapshot () |
Update the current gamestate. More... | |
bool | hasPeers () |
bool | processGamestates () |
Process the queued gamestates. More... | |
void | removePeer (uint32_t peerID) |
Remove a peer from the game. More... | |
bool | sendAck (unsigned int gamestateID, uint32_t peerID) |
Send Acknowledgement packet. More... | |
void | setSynched (uint32_t peerID) |
bool | update () |
Static Public Member Functions | |
static Client * | getInstance () |
Static Public Member Functions inherited from orxonox::Host | |
static void | addPacket (ENetPacket *packet, int clientID=NETWORK_PEER_ID_SERVER, uint8_t channelID=0) |
This function is used to add an enetpacket to be sent to another peer. More... | |
static Host * | getActiveInstance () |
Singleton implementation. More... | |
static unsigned int | getPlayerID () |
static bool | isServer () |
static bool | running () |
static void | sendChat (const std::string &message, unsigned int sourceID, unsigned int targetID) |
Sends a chat message through the network. More... | |
static void | setClientID (unsigned int id) |
Static Public Member Functions inherited from orxonox::Singleton< Client > | |
static bool | exists () |
Tells whether the singleton has been created. More... | |
static Client & | getInstance () |
Returns a reference to the singleton instance. More... | |
Protected Member Functions | |
virtual void | connectionClosed () override |
Protected Member Functions inherited from orxonox::Host | |
Host () | |
Constructor: assures that only one reference will be created and sets the pointer. More... | |
virtual | ~Host () |
Destructor: resets the instance pointer to nullptr. More... | |
void | setActive (bool bActive) |
Protected Member Functions inherited from orxonox::GamestateHandler | |
GamestateHandler () | |
virtual | ~GamestateHandler () |
Protected Member Functions inherited from orxonox::ClientConnection | |
uint32_t | getRTT () |
ClientConnection () | |
virtual | ~ClientConnection () |
void | addPacket (ENetPacket *packet, uint8_t channelID) |
bool | isConnected () |
void | setPort (unsigned int port) |
void | setServerAddress (const std::string &serverAddress) |
Protected Member Functions inherited from orxonox::Connection | |
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... | |
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... | |
void | processQueue () |
void | startCommunicationThread () |
Start the main communication thread. More... | |
void | stopCommunicationThread () |
Stop the main communication thread. More... | |
void | waitOutgoingQueue () |
virtual | ~Connection () |
Destructor. More... | |
Protected Member Functions inherited from orxonox::Singleton< Client > | |
Singleton () | |
Constructor sets the singleton instance pointer. More... | |
virtual | ~Singleton () |
Destructor resets the singleton instance pointer. More... | |
Private Member Functions | |
Client (const Client ©) | |
virtual bool | isServer_ () override |
virtual void | processPacket (packet::Packet *packet) override |
Private Attributes | |
bool | gameStateFailure_ |
bool | isSynched_ |
std::deque< packet::Packet * > | packetQueue_ |
float | timeSinceLastUpdate_ |
Static Private Attributes | |
static Client * | singletonPtr_s |
Friends | |
class | Singleton< Client > |
Additional Inherited Members | |
Static Protected Member Functions inherited from orxonox::Singleton< Client > | |
static bool | exists () |
Tells whether the singleton has been created. More... | |
static Client & | getInstance () |
Returns a reference to the singleton instance. More... | |
Protected Attributes inherited from orxonox::Connection | |
ENetHost * | host_ |
Client *client; The network/Client class This class implements all necessary function for the network communication It is the root class of the network module.
orxonox::Client::Client | ( | ) |
Constructor for the Client class initializes the address and the port to default localhost:NETWORK_PORT.
orxonox::Client::~Client | ( | ) |
|
private |
|
overridevirtual |
|
overrideprotectedvirtual |
Implements orxonox::ClientConnection.
|
overridevirtual |
Gets called if a packet::Chat packet is received.
Calls the parent function which passes the message to the listeners.
Implements orxonox::Host.
|
overridevirtual |
Sends a chat message to the server.
message | message to be sent |
sourceID | the ID of the sender |
targetID | the ID of the receiver |
Implements orxonox::Host.
|
overridevirtual |
Establish the Connection to the Server.
Reimplemented from orxonox::ClientConnection.
|
inlinestatic |
|
inlineoverrideprivatevirtual |
Implements orxonox::Host.
|
overridevirtual |
Implements orxonox::Host.
|
overrideprivatevirtual |
Implements orxonox::Connection.
|
overridevirtual |
Implements orxonox::Host.
|
inlineoverridevirtual |
Implements orxonox::GamestateManager.
void orxonox::Client::setDestination | ( | const std::string & | serverAddress, |
unsigned int | port | ||
) |
Processes incoming packets, sends a gamestate to the server and does the cleanup.
time |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |