Drag[en]gine Game Engine  1.0
deConnection Class Reference

Connection Class. More...

#include <deConnection.h>

Inheritance diagram for deConnection:
deResource deObject

Public Member Functions

Management
const char * GetLocalAddress () const
 
void SetLocalAddress (const char *address)
 
const char * GetRemoteAddress () const
 
void SetRemoteAddress (const char *address)
 
bool GetConnected () const
 
void SetConnected (bool connected)
 
bool ConnectTo (const char *address)
 
void Disconnect ()
 
void SendMessage (const char *message, int length, int maxDelay)
 
void SendReliableMessage (const char *message, int length)
 
void LinkState (const char *message, int length, deNetworkState *state)
 
System Peers
deBaseNetworkConnectionGetNetworkConnection () const
 
void SetNetworkConnection (deBaseNetworkConnection *netCon)
 
deBaseScriptingConnectionGetScriptingConnection () const
 
void SetScriptingConnection (deBaseScriptingConnection *scrCon)
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deConnection (deConnectionManager *manager)
 
virtual ~deConnection ()
 Clean up connection object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Connection Class.

Manages a connection in a network game. Connections are usually made between the player and a server but can also be established between servers themselves or between individual players.

Author
Pl├╝ss Roland
Version
1.0
Date
2008

Constructor & Destructor Documentation

◆ deConnection()

deConnection::deConnection ( deConnectionManager manager)

Creates a new connection object.

◆ ~deConnection()

virtual deConnection::~deConnection ( )
protectedvirtual

Clean up connection object.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ ConnectTo()

bool deConnection::ConnectTo ( const char *  address)

Connects to the a connection object on the host at the given address. Returns true if the connection request has been send or false if an error occured. Connection success or failure is reported through the scripting peer. The format of the address is specific to the network module.

Referenced by GetConnected().

◆ Disconnect()

void deConnection::Disconnect ( )

Disconnects from a remote connection if connected.

Referenced by GetConnected().

◆ GetConnected()

bool deConnection::GetConnected ( ) const
inline

Determines if a connection to a remote host is established.

References ConnectTo(), Disconnect(), LinkState(), SendMessage(), SendReliableMessage(), and SetConnected().

◆ GetLocalAddress()

const char* deConnection::GetLocalAddress ( ) const
inline

Retrieves the local address.

References SetLocalAddress().

◆ GetNetworkConnection()

deBaseNetworkConnection* deConnection::GetNetworkConnection ( ) const
inline

Retrieves the network system peer object.

References SetNetworkConnection().

◆ GetRemoteAddress()

const char* deConnection::GetRemoteAddress ( ) const
inline

Retrieves the remove address.

References SetRemoteAddress().

◆ GetScriptingConnection()

deBaseScriptingConnection* deConnection::GetScriptingConnection ( ) const
inline

Retrieves the scripting system peer object.

References SetScriptingConnection().

◆ LinkState()

void deConnection::LinkState ( const char *  message,
int  length,
deNetworkState state 
)

Links a network state to a remote network state. The message contains informations for the remote system to know what state to link to. The request is queued and carried out as soon as possible. The local state is considered the master state and the remote state the slave state. By default only the master state can apply changes.

Referenced by GetConnected().

◆ SendMessage()

void deConnection::SendMessage ( const char *  message,
int  length,
int  maxDelay 
)

Sends a message to the remote connection if connected. The message can be queued and send at a later time to optimize throughput. The message will be not delayed longer than the given amount of milliseconds. The message is send unreliable and it is acceptable for the message to get lost due to transmission failure.

Referenced by GetConnected().

◆ SendReliableMessage()

void deConnection::SendReliableMessage ( const char *  message,
int  length 
)

Sens a reliable message to the remote connection if connected. The message is append to already waiting reliable messages and send as soon as possible. Reliable messages always arrive in the same order they have been queued.

Referenced by GetConnected().

◆ SetConnected()

void deConnection::SetConnected ( bool  connected)

Sets if a connection to a remote host is established. Intended to be used by the network module only so do not call otherwise.

Referenced by GetConnected().

◆ SetLocalAddress()

void deConnection::SetLocalAddress ( const char *  address)

Sets the local address. Intended to be used by the network module only so do not call it otherwise.

Referenced by GetLocalAddress().

◆ SetNetworkConnection()

void deConnection::SetNetworkConnection ( deBaseNetworkConnection netCon)

Sets the network system peer object.

Referenced by GetNetworkConnection().

◆ SetRemoteAddress()

void deConnection::SetRemoteAddress ( const char *  address)

Sets the remote address. Intended to be used by the network module only so do not call otherwise.

Referenced by GetRemoteAddress().

◆ SetScriptingConnection()

void deConnection::SetScriptingConnection ( deBaseScriptingConnection scrCon)

Sets the scripting system peer object.

Referenced by GetScriptingConnection().


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