|
Orxonox
0.0.5 Codename: Arcturus
|
This class is the root class of the network module for a server. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/Server.h>
Public Member Functions | |
| Server () | |
| Constructor for default values (bindaddress is set to ENET_HOST_ANY. More... | |
| Server (int port) | |
| Constructor. More... | |
| Server (int port, const std::string &bindAddress) | |
| Constructor. More... | |
| ~Server () | |
| Destructor. More... | |
| void | close () |
| This function closes the server. More... | |
| int | getClientCount () |
| std::string | getServerName () |
| void | open () |
| This function opens the server by creating the listener thread. More... | |
| virtual void | printRTT () override |
| Print ping time to client in milliseconds. More... | |
| virtual void | queuePacket (ENetPacket *packet, int clientID, uint8_t channelID) override |
| virtual bool | sendPacket (packet::Packet *packet) override |
| void | update (const Clock &time) |
| Run this function once every tick calls processQueue and updateGamestate. 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 () |
Public Member Functions inherited from orxonox::ServerConnection | |
| ~ServerConnection () | |
| Destructor. More... | |
| void | addPacket (ENetPacket *packet, unsigned int ID, uint8_t channelID) |
| Add outgoing packet to queue. More... | |
| bool | closeListener () |
| Stop listening. More... | |
| void | disconnectClient (int clientID) |
| Terminate connection with a peer. More... | |
| bool | openListener () |
| void | setBindAddress (const std::string &bindAddress) |
| Set address on which to listen. More... | |
| void | setPort (unsigned int port) |
| Set port on which to listen on. More... | |
Public Member Functions inherited from orxonox::Connection | |
| virtual | ~Connection () |
| Destructor. More... | |
Public Member Functions inherited from orxonox::LANDiscoverable | |
| LANDiscoverable () | |
| virtual | ~LANDiscoverable () |
| void | setActivity (bool bActive) |
| void | setConfigValues () |
| Function used for the configuration file parameter update. More... | |
| void | update () |
| void | updateClientNumber (int clientNumber) |
Public Member Functions inherited from orxonox::Configurable | |
| Configurable () | |
| void | setConfigValues () |
| Function to collect the SetConfigValue-macro calls. More... | |
Public Member Functions inherited from orxonox::Listable | |
| Listable () | |
| Constructor: Allocates space in the element list. More... | |
| Listable (Context *context) | |
| Constructor: Allocates space in the element list and assigns the context. More... | |
| virtual | ~Listable () |
| Destructor: Removes the object from the object-lists. More... | |
| Context * | getContext () const |
| void | setContext (Context *context) |
| Changes the context. More... | |
| void | unregisterObject () |
| Removes this object from the object-lists. More... | |
Public Member Functions inherited from orxonox::Identifiable | |
| Identifiable () | |
| Constructor: Sets the default values. More... | |
| virtual | ~Identifiable () |
| ORX_FORCEINLINE void * | getDerivedPointer (unsigned int classID) |
| Returns a valid pointer of any derived type that is registered in the class hierarchy. More... | |
| template<class T > | |
| ORX_FORCEINLINE T * | getDerivedPointer (unsigned int classID) |
| Version of getDerivedPointer with template. More... | |
| template<class T > | |
| ORX_FORCEINLINE const T * | getDerivedPointer (unsigned int classID) const |
| Const version of getDerivedPointer with template. More... | |
| Identifier * | getIdentifier () const |
| Returns the Identifier of the object. More... | |
| bool | isA (const Identifier *identifier) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| template<class B > | |
| bool | isA (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| bool | isA (const Identifiable *object) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| bool | isChildOf (const Identifier *identifier) |
| Returns true if the object's class is a child of the given type. More... | |
| template<class B > | |
| bool | isChildOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a child of the given type. More... | |
| bool | isChildOf (const Identifiable *object) |
| Returns true if the object's class is a child of the given type. More... | |
| bool | isDirectChildOf (const Identifier *identifier) |
| Returns true if the object's class is a direct child of the given type. More... | |
| template<class B > | |
| bool | isDirectChildOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isDirectChildOf (const Identifiable *object) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isDirectParentOf (const Identifier *identifier) |
| Returns true if the object's class is a direct parent of the given type. More... | |
| template<class B > | |
| bool | isDirectParentOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a direct parent of the given type. More... | |
| bool | isDirectParentOf (const Identifiable *object) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isExactlyA (const Identifier *identifier) |
| Returns true if the object's class is exactly of the given type. More... | |
| template<class B > | |
| bool | isExactlyA (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is exactly of the given type. More... | |
| bool | isExactlyA (const Identifiable *object) |
| Returns true if the object's class is exactly of the given type. More... | |
| bool | isParentOf (const Identifier *identifier) |
| Returns true if the object's class is a parent of the given type. More... | |
| template<class B > | |
| bool | isParentOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a parent of the given type. More... | |
| bool | isParentOf (const Identifiable *object) |
| Returns true if the object's class is a parent of the given type. More... | |
Public Member Functions inherited from orxonox::WANDiscoverable | |
| WANDiscoverable () | |
| constructor More... | |
| ~WANDiscoverable () | |
| destructor More... | |
| std::string | getMSAddress () |
| void | setActivity (bool bActive) |
| Function used to set the activity/discoverability. More... | |
| void | setConfigValues () |
| Function used for the configuration file parameter update. More... | |
| void | updateClientNumber (int clientNumber) |
Protected Member Functions | |
| void | updateGamestate () |
| Take a new snapshot of the gamestate and send it to the clients. More... | |
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::ServerConnection | |
| ServerConnection () | |
| Constructor. More... | |
| void | disconnectClients () |
| Disconnect all peers. More... | |
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 () |
Private Member Functions | |
| virtual void | addPeer (uint32_t peerID) override |
| Add a new peer to the server. More... | |
| bool | createClient (int clientID) |
| Create a client. More... | |
| void | disconnectClient (uint32_t clientID) |
| Disconnect a client. 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 given target ID. More... | |
| virtual bool | isServer_ () override |
| bool | isValidTarget (unsigned int targetID) |
| Returns true if the target ID is in the list of clients (or if it corresponds to the broadcast or the server ID). More... | |
| unsigned int | playerID () |
| virtual void | processPacket (packet::Packet *packet) override |
| Process an incoming packet. More... | |
| virtual void | removePeer (uint32_t peerID) override |
| Remove a peer from the server. More... | |
| bool | sendGameStates () |
| Send the current gamestate to all peers. More... | |
| bool | sendObjectDeletes () |
| Send 'DeleteObjects' packet. More... | |
| void | syncClassid (unsigned int clientID) |
Private Attributes | |
| std::vector< uint32_t > | clientIDs_ |
| std::deque< packet::Packet * > | packetQueue_ |
| std::string | serverName_ |
| float | timeSinceLastUpdate_ |
Additional Inherited Members | |
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) |
Public Attributes inherited from orxonox::WANDiscoverable | |
| MasterServerComm | msc |
| Master server communications object. More... | |
Protected Attributes inherited from orxonox::Connection | |
| ENetHost * | host_ |
This class is the root class of the network module for a server.
It implements all functions necessary for a Server
| orxonox::Server::Server | ( | ) |
Constructor for default values (bindaddress is set to ENET_HOST_ANY.
| orxonox::Server::Server | ( | int | port | ) |
Constructor.
| port | Port to listen on |
| orxonox::Server::Server | ( | int | port, |
| const std::string & | bindAddress | ||
| ) |
Constructor.
| port | Port to listen on |
| bindAddress | Address to listen on |
| orxonox::Server::~Server | ( | ) |
Destructor.
|
overrideprivatevirtual |
Add a new peer to the server.
Implements orxonox::Connection.
| void orxonox::Server::close | ( | ) |
This function closes the server.
|
private |
Create a client.
|
private |
Disconnect a client.
|
overrideprivatevirtual |
Gets called if a packet::Chat packet is received.
Forwards the packet to the target and calls the parent function if necessary.
Implements orxonox::Host.
|
overrideprivatevirtual |
Sends a chat message to the given target ID.
| message | message to be sent |
| sourceID | the ID of the sender |
| targetID | the ID of the receiver |
Implements orxonox::Host.
|
inline |
|
inline |
|
inlineoverrideprivatevirtual |
Implements orxonox::Host.
|
private |
Returns true if the target ID is in the list of clients (or if it corresponds to the broadcast or the server ID).
| void orxonox::Server::open | ( | ) |
This function opens the server by creating the listener thread.
|
inlineprivate |
|
overridevirtual |
Print ping time to client in milliseconds.
Implements orxonox::Host.
|
overrideprivatevirtual |
Process an incoming packet.
Implements orxonox::Connection.
|
overridevirtual |
Implements orxonox::Host.
|
overrideprivatevirtual |
Remove a peer from the server.
Implements orxonox::Connection.
|
private |
Send the current gamestate to all peers.
|
private |
Send 'DeleteObjects' packet.
|
inlineoverridevirtual |
Implements orxonox::GamestateManager.
|
private |
Run this function once every tick calls processQueue and updateGamestate.
| time | time since last tick |
|
protected |
Take a new snapshot of the gamestate and send it to the clients.
|
private |
|
private |
|
private |
|
private |
1.8.11