#include <networkcomponent.h>

Public Member Functions | |
| NetworkComponent (const std::string &gameName, const int gameVersion, const std::string &logFile="") | |
| Construct a NetworkComponent with a game name and version to be used by GNE Calls InitializeNetwork to initialize GNE. | |
| virtual void | OnAddedToGM () |
| Called immediately after a component is added to the GM. | |
| virtual void | ProcessMessage (const dtGame::Message &message) |
| Function called by a GameManager to process Messages. | |
| virtual void | ProcessNetClientRequestConnection (const MachineInfoMessage &msg) |
| Processes a MessageType::NETCLIENT_REQUEST_CONNECTION Message. | |
| virtual void | ProcessNetServerAcceptConnection (const MachineInfoMessage &msg) |
| Processes a MessageType::NETSERVER_ACCEPT_CONNECTION Message. | |
| virtual void | ProcessNetServerRejectConnection (const dtGame::NetServerRejectMessage &msg) |
| Processes a MessageType::NETSERVER_REJECT_CONNECTION Message. | |
| virtual void | ProcessInfoClientConnected (const MachineInfoMessage &msg) |
| Processes a MessageType::INFO_CLIENT_CONNECTED Message. | |
| virtual void | ProcessNetClientNotifyDisconnect (const MachineInfoMessage &msg) |
| Processes a MessageType::NETCLIENT_NOTIFY_DISCONNECT Message. | |
| virtual void | ProcessNetServerRejectMessage (const dtGame::ServerMessageRejected &msg) |
| Processes a MessageType::SERVER_REQUEST_REJECTED Message. | |
| void | SetConnectionParameters (bool reliable=true, int bandWidthIn=0, int bandWidthOut=0) |
| Sets the connection Parameters to be used by GNE. | |
| virtual void | OnNewConnection (NetworkBridge &networkBridge) |
| Function called by a NetworkBridge if a new connection is received. | |
| virtual void | OnConnect (NetworkBridge &networkBridge) |
| Function called by a NetworkBridge if a new connection is made. | |
| virtual void | OnExit (NetworkBridge &networkBridge) |
| Function called by a NetworkBridge if a connection exits. | |
| virtual void | OnDisconnect (NetworkBridge &networkBridge) |
| Function called by a NetworkBridge if a connection disconnects. | |
| virtual void | OnFailure (NetworkBridge &networkBridge, const GNE::Error &error) |
| Function called by a NetworkBridge if a failure occurs. | |
| virtual void | OnError (NetworkBridge &networkBridge, const GNE::Error &error) |
| Function called by a NetworkBridge if an error occurs. | |
| virtual void | OnConnectFailure (NetworkBridge &networkBridge, const GNE::Error &error) |
| Function called by a NetworkBridge if a connection failure occurs. | |
| virtual void | OnTimeOut (NetworkBridge &networkBridge) |
| Function called by a NetworkBridge if a timeout occurs. | |
| virtual void | DispatchNetworkMessage (const dtGame::Message &message) |
| Function called by a GameManager to send Messages accross a Network. | |
| virtual void | OnReceivedDataStream (NetworkBridge &networkBridge, dtUtil::DataStream &dataStream) |
| Function called by a Networkbridge to Signal a received DataStream The network component creates the message and checks for destination and / or connection info contained in the message. | |
| virtual void | OnReceivedNetworkMessage (const dtGame::Message &message, NetworkBridge &networkBridge) |
| void | SendNetworkMessage (const dtGame::Message &message, const DestinationType &destinationType=DestinationType::DESTINATION) |
| dtUtil::DataStream | CreateDataStream (const dtGame::Message &message) |
| dtCore::RefPtr< dtGame::Message > | CreateMessage (dtUtil::DataStream &dataStream, const NetworkBridge &networkBridge) |
| const bool & | IsReliable () const |
| Is our GNE connection reliable. | |
| const bool & | IsGneInitialized () const |
| Is GNE already initialized. | |
| virtual const bool | IsServer () const |
| Is this NetworkComponent a server? | |
| void | GetConnectedClients (std::vector< NetworkBridge * > &connectedClients) |
| Retrieves a vector containing all NetworkBridge which have an accepted client connection. | |
| virtual void | ShutdownNetwork () |
| Shutdown network communications and clear connections. | |
| bool | IsShuttingDown () |
| Are we shutting down? | |
Protected Member Functions | |
| virtual | ~NetworkComponent (void) |
| void | AddConnection (NetworkBridge *networkBridge) |
| Adds a NetworkBridge to the map. | |
| void | RemoveConnection (const dtGame::MachineInfo &machineInfo) |
| Removes a NetworkBridge from the map. | |
| NetworkBridge * | GetConnection (const dtGame::MachineInfo &machineInfo) |
| Retrieves a NetworkBridge from the map If no networkbridge is found, NULL is returned. | |
| virtual const dtGame::MachineInfo * | GetMachineInfo (const dtCore::UniqueId &uniqueId) |
| Retrieves a dtGame::MachineInfo* from the stored connections If no matching connection is found, NULL is returned. | |
Protected Attributes | |
| std::vector< NetworkBridge * > | mConnections |
| bool | mReliable |
| int | mRateOut |
| int | mRateIn |
| GNE::Mutex | mMutex |
Classes | |
| class | DestinationType |
| enumeration class to address different stored connections More... | |
| dtNetGM::NetworkComponent::NetworkComponent | ( | const std::string & | gameName, | |
| const int | gameVersion, | |||
| const std::string & | logFile = "" | |||
| ) |
Construct a NetworkComponent with a game name and version to be used by GNE Calls InitializeNetwork to initialize GNE.
| gameName | The game name | |
| gameVersion | The game version | |
| logFile | The logfile name |
| dtNetGM::NetworkComponent::~NetworkComponent | ( | void | ) | [protected, virtual] |
| void dtNetGM::NetworkComponent::OnAddedToGM | ( | ) | [virtual] |
Called immediately after a component is added to the GM.
Used to register 'additional' Network Messages on the GameManager
Reimplemented from dtGame::GMComponent.
| void dtNetGM::NetworkComponent::ProcessMessage | ( | const dtGame::Message & | message | ) | [virtual] |
Function called by a GameManager to process Messages.
This function forwards the connection related messages to the functions processing these messages.
| The | Message to be process |
Reimplemented from dtGame::GMComponent.
| virtual void dtNetGM::NetworkComponent::ProcessNetClientRequestConnection | ( | const MachineInfoMessage & | msg | ) | [inline, virtual] |
Processes a MessageType::NETCLIENT_REQUEST_CONNECTION Message.
| msg | The message |
Reimplemented in dtNetGM::ServerNetworkComponent.
| virtual void dtNetGM::NetworkComponent::ProcessNetServerAcceptConnection | ( | const MachineInfoMessage & | msg | ) | [inline, virtual] |
Processes a MessageType::NETSERVER_ACCEPT_CONNECTION Message.
| msg | The message |
Reimplemented in dtNetGM::ClientNetworkComponent.
| virtual void dtNetGM::NetworkComponent::ProcessNetServerRejectConnection | ( | const dtGame::NetServerRejectMessage & | msg | ) | [inline, virtual] |
Processes a MessageType::NETSERVER_REJECT_CONNECTION Message.
| msg | The message |
Reimplemented in dtNetGM::ClientNetworkComponent.
| virtual void dtNetGM::NetworkComponent::ProcessInfoClientConnected | ( | const MachineInfoMessage & | msg | ) | [inline, virtual] |
Processes a MessageType::INFO_CLIENT_CONNECTED Message.
| msg | The message |
Reimplemented in dtNetGM::ClientNetworkComponent.
| virtual void dtNetGM::NetworkComponent::ProcessNetClientNotifyDisconnect | ( | const MachineInfoMessage & | msg | ) | [inline, virtual] |
Processes a MessageType::NETCLIENT_NOTIFY_DISCONNECT Message.
| msg | The message |
Reimplemented in dtNetGM::ClientNetworkComponent.
| virtual void dtNetGM::NetworkComponent::ProcessNetServerRejectMessage | ( | const dtGame::ServerMessageRejected & | msg | ) | [inline, virtual] |
Processes a MessageType::SERVER_REQUEST_REJECTED Message.
| msg | The message |
Reimplemented in dtNetGM::ClientNetworkComponent.
| void dtNetGM::NetworkComponent::SetConnectionParameters | ( | bool | reliable = true, |
|
| int | bandWidthIn = 0, |
|||
| int | bandWidthOut = 0 | |||
| ) |
Sets the connection Parameters to be used by GNE.
| reliable | The reliability of the connection | |
| bandWidthIn | The incoming bandwidth throttle | |
| bandWidthOut | The outgoing bandwidth throttle |
| void dtNetGM::NetworkComponent::OnNewConnection | ( | NetworkBridge & | networkBridge | ) | [virtual] |
| void dtNetGM::NetworkComponent::OnConnect | ( | NetworkBridge & | networkBridge | ) | [virtual] |
| void dtNetGM::NetworkComponent::OnExit | ( | NetworkBridge & | networkBridge | ) | [virtual] |
| void dtNetGM::NetworkComponent::OnDisconnect | ( | NetworkBridge & | networkBridge | ) | [virtual] |
Function called by a NetworkBridge if a connection disconnects.
| The | NetworkBridge |
Reimplemented in dtNetGM::ClientNetworkComponent, and dtNetGM::ServerNetworkComponent.
| void dtNetGM::NetworkComponent::OnFailure | ( | NetworkBridge & | networkBridge, | |
| const GNE::Error & | error | |||
| ) | [virtual] |
Function called by a NetworkBridge if a failure occurs.
| networkBridge | The NetworkBridge | |
| error | The GNE::Error description |
| void dtNetGM::NetworkComponent::OnError | ( | NetworkBridge & | networkBridge, | |
| const GNE::Error & | error | |||
| ) | [virtual] |
Function called by a NetworkBridge if an error occurs.
| networkBridge | The NetworkBridge | |
| error | The GNE::Error description |
| void dtNetGM::NetworkComponent::OnConnectFailure | ( | NetworkBridge & | networkBridge, | |
| const GNE::Error & | error | |||
| ) | [virtual] |
Function called by a NetworkBridge if a connection failure occurs.
| networkBridge | The NetworkBridge | |
| error | The GNE::Error description |
| void dtNetGM::NetworkComponent::OnTimeOut | ( | NetworkBridge & | networkBridge | ) | [virtual] |
| void dtNetGM::NetworkComponent::DispatchNetworkMessage | ( | const dtGame::Message & | message | ) | [virtual] |
Function called by a GameManager to send Messages accross a Network.
| The | Message to be sent |
Reimplemented from dtGame::GMComponent.
| void dtNetGM::NetworkComponent::OnReceivedDataStream | ( | NetworkBridge & | networkBridge, | |
| dtUtil::DataStream & | dataStream | |||
| ) | [virtual] |
Function called by a Networkbridge to Signal a received DataStream The network component creates the message and checks for destination and / or connection info contained in the message.
If appropriate, the message is delivered to the GameManager
| networkBridge | The NetworkBridge which received the MessagePakcet | |
| dataStream | The DataStream received |
| void dtNetGM::NetworkComponent::OnReceivedNetworkMessage | ( | const dtGame::Message & | message, | |
| NetworkBridge & | networkBridge | |||
| ) | [virtual] |
| void dtNetGM::NetworkComponent::SendNetworkMessage | ( | const dtGame::Message & | message, | |
| const DestinationType & | destinationType = DestinationType::DESTINATION | |||
| ) |
| dtUtil::DataStream dtNetGM::NetworkComponent::CreateDataStream | ( | const dtGame::Message & | message | ) |
| dtCore::RefPtr< dtGame::Message > dtNetGM::NetworkComponent::CreateMessage | ( | dtUtil::DataStream & | dataStream, | |
| const NetworkBridge & | networkBridge | |||
| ) |
| const bool& dtNetGM::NetworkComponent::IsReliable | ( | ) | const [inline] |
Is our GNE connection reliable.
| const bool& dtNetGM::NetworkComponent::IsGneInitialized | ( | ) | const [inline] |
Is GNE already initialized.
| virtual const bool dtNetGM::NetworkComponent::IsServer | ( | ) | const [inline, virtual] |
| void dtNetGM::NetworkComponent::GetConnectedClients | ( | std::vector< NetworkBridge * > & | connectedClients | ) |
Retrieves a vector containing all NetworkBridge which have an accepted client connection.
| The | vector to be filled |
| void dtNetGM::NetworkComponent::ShutdownNetwork | ( | ) | [virtual] |
Shutdown network communications and clear connections.
| bool dtNetGM::NetworkComponent::IsShuttingDown | ( | ) | [inline] |
Are we shutting down?
| void dtNetGM::NetworkComponent::AddConnection | ( | NetworkBridge * | networkBridge | ) | [protected] |
| void dtNetGM::NetworkComponent::RemoveConnection | ( | const dtGame::MachineInfo & | machineInfo | ) | [protected] |
| NetworkBridge * dtNetGM::NetworkComponent::GetConnection | ( | const dtGame::MachineInfo & | machineInfo | ) | [protected] |
Retrieves a NetworkBridge from the map If no networkbridge is found, NULL is returned.
| The | machineinfo |
| const dtGame::MachineInfo * dtNetGM::NetworkComponent::GetMachineInfo | ( | const dtCore::UniqueId & | uniqueId | ) | [protected, virtual] |
Retrieves a dtGame::MachineInfo* from the stored connections If no matching connection is found, NULL is returned.
| dtCore::UniqueId | of the MachineInfo |
Reimplemented in dtNetGM::ClientNetworkComponent.
std::vector<NetworkBridge*> dtNetGM::NetworkComponent::mConnections [protected] |
bool dtNetGM::NetworkComponent::mReliable [protected] |
int dtNetGM::NetworkComponent::mRateOut [protected] |
int dtNetGM::NetworkComponent::mRateIn [protected] |
GNE::Mutex dtNetGM::NetworkComponent::mMutex [protected] |