Classes | Public Member Functions | Protected Member Functions | Protected Attributes

FullyConnectedMesh2 Class Reference
[FullyConnectedMesh]

Fully connected mesh plugin, revision 2. More...

#include <FullyConnectedMesh2.h>

Inherits PluginInterface2.

Collaboration diagram for FullyConnectedMesh2:
Collaboration graph
[legend]

List of all members.

Classes

struct  FCM2Participant

Public Member Functions

 FullyConnectedMesh2 ()
virtual ~FullyConnectedMesh2 ()
void SetConnectOnNewRemoteConnection (bool attemptConnection, RakNet::RakString pw)
RakNetGUID GetConnectedHost (void) const
 The connected host is whichever system we are connected to that has been running the longest.
SystemAddress GetConnectedHostAddr (void) const
RakNetGUID GetHostSystem (void) const
bool IsHostSystem (void) const
bool IsConnectedHost (void) const
void SetAutoparticipateConnections (bool b)
 Automatically add new connections to the fully connected mesh.
void ResetHostCalculation (void)
 Clear our own host order, and recalculate as if we had just reconnected.
void AddParticipant (RakNetGUID rakNetGuid)
 if SetAutoparticipateConnections() is called with false, then you need to use AddParticipant before these systems will be added to the mesh
unsigned int GetParticipantCount (void) const
void GetParticipantCount (DataStructures::DefaultIndexType *participantListSize) const
RakNetTimeUS GetElapsedRuntime (void)
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void OnRakPeerStartup (void)
 Called when RakPeer is initialized.
virtual void OnAttach (void)
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
virtual void OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)

Protected Member Functions

void Clear (void)
void PushNewHost (const RakNetGUID &guid)
void SendOurFCMGuid (SystemAddress addr)
void SendFCMGuidRequest (RakNetGUID rakNetGuid)
void SendConnectionCountResponse (SystemAddress addr, unsigned int responseTotalConnectionCount)
void OnRequestFCMGuid (Packet *packet)
void OnRespondConnectionCount (Packet *packet)
void OnInformFCMGuid (Packet *packet)
void AssignOurFCMGuid (void)
void CalculateHost (RakNetGUID *rakNetGuid, FCM2Guid *fcm2Guid)
bool AddParticipantInternal (RakNetGUID rakNetGuid, FCM2Guid theirFCMGuid)
void CalculateAndPushHost (void)
bool ParticipantListComplete (void)
void IncrementTotalConnectionCount (unsigned int i)

Protected Attributes

RakNetTimeUS startupTime
bool autoParticipateConnections
unsigned int totalConnectionCount
FCM2Guid ourFCMGuid
DataStructures::List
< FCM2Participant
participantList
 List of systems we know the FCM2Guid for.
RakNetGUID lastPushedHost
RakNetGUID hostRakNetGuid
FCM2Guid hostFCM2Guid
RakNet::RakString connectionPassword
bool connectOnNewRemoteConnections

Detailed Description

Fully connected mesh plugin, revision 2.

This will connect RakPeer to all connecting peers, and all peers the connecting peer knows about.
It will also calculate which system has been running longest, to find out who should be host, if you need one system to act as a host

Precondition:
You must also install the ConnectionGraph2 plugin

Definition at line 30 of file FullyConnectedMesh2.h.


Constructor & Destructor Documentation

FullyConnectedMesh2::FullyConnectedMesh2 (  ) 

Definition at line 20 of file FullyConnectedMesh2.cpp.

FullyConnectedMesh2::~FullyConnectedMesh2 (  )  [virtual]

Definition at line 28 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:


Member Function Documentation

void FullyConnectedMesh2::AddParticipant ( RakNetGUID  rakNetGuid  ) 

if SetAutoparticipateConnections() is called with false, then you need to use AddParticipant before these systems will be added to the mesh

Parameters:
[in] participant The new participant

Definition at line 92 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool FullyConnectedMesh2::AddParticipantInternal ( RakNetGUID  rakNetGuid,
FCM2Guid  theirFCMGuid 
) [protected]

Definition at line 71 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::AssignOurFCMGuid ( void   )  [protected]

Definition at line 265 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::CalculateAndPushHost ( void   )  [protected]

Definition at line 421 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::CalculateHost ( RakNetGUID rakNetGuid,
FCM2Guid fcm2Guid 
) [protected]

Definition at line 276 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::Clear ( void   )  [protected]

Definition at line 210 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

RakNetGUID FullyConnectedMesh2::GetConnectedHost ( void   )  const

The connected host is whichever system we are connected to that has been running the longest.

Will return UNASSIGNED_RAKNET_GUID if we are not connected to anyone, or if we are connected and are calculating the host If includeCalculating is true, will return the estimated calculated host as long as the calculation is nearly complete includeCalculating should be true if you are taking action based on another system becoming host, because not all host calculations may compelte at the exact same time

Returns:
System address of whichever system is host.

Definition at line 32 of file FullyConnectedMesh2.cpp.

Here is the caller graph for this function:

SystemAddress FullyConnectedMesh2::GetConnectedHostAddr ( void   )  const

Definition at line 38 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

RakNetTimeUS FullyConnectedMesh2::GetElapsedRuntime ( void   ) 

Definition at line 193 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

RakNetGUID FullyConnectedMesh2::GetHostSystem ( void   )  const
Returns:
System address of whichever system is host. Always returns something, even though it may be our own system.

Definition at line 44 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int FullyConnectedMesh2::GetParticipantCount ( void   )  const

Definition at line 417 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::GetParticipantCount ( DataStructures::DefaultIndexType participantListSize  )  const

Definition at line 412 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::IncrementTotalConnectionCount ( unsigned int  i  )  [protected]

Definition at line 445 of file FullyConnectedMesh2.cpp.

Here is the caller graph for this function:

bool FullyConnectedMesh2::IsConnectedHost ( void   )  const
Parameters:
[in] includeCalculating If true, and we are currently calculating a new host, return the new host if the calculation is nearly complete
Returns:
If our system is host

Definition at line 55 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

bool FullyConnectedMesh2::IsHostSystem ( void   )  const
Returns:
If our system is host

Definition at line 51 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnAttach ( void   )  [virtual]

Called when the interface is attached

Parameters:
[in] peer the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface2.

Definition at line 146 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnClosedConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
) [virtual]

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:
[in] systemAddress The system whose connection was closed
[in] rakNetGuid The guid of the specified system
[in] lostConnectionReason How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from PluginInterface2.

Definition at line 158 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnInformFCMGuid ( Packet packet  )  [protected]

Definition at line 398 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::OnNewConnection ( SystemAddress  systemAddress,
RakNetGUID  rakNetGUID,
bool  isIncoming 
) [virtual]

Called when we got a new connection

Parameters:
[in] systemAddress Address of the new connection
[in] rakNetGuid The guid of the specified system
[in] isIncoming If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent

Reimplemented from PluginInterface2.

Definition at line 201 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnRakPeerShutdown ( void   )  [virtual]

Called when RakPeer is shutdown.

Reimplemented from PluginInterface2.

Definition at line 153 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnRakPeerStartup ( void   )  [virtual]

Called when RakPeer is initialized.

Reimplemented from PluginInterface2.

Definition at line 141 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

PluginReceiveResult FullyConnectedMesh2::OnReceive ( Packet packet  )  [virtual]

OnReceive is called for every packet.

Parameters:
[in] packet the packet that is being returned to the user
Returns:
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from PluginInterface2.

Definition at line 104 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::OnRequestFCMGuid ( Packet packet  )  [protected]

Definition at line 302 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::OnRespondConnectionCount ( Packet packet  )  [protected]

Definition at line 371 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool FullyConnectedMesh2::ParticipantListComplete ( void   )  [protected]

Definition at line 436 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::PushNewHost ( const RakNetGUID guid  )  [protected]

Definition at line 218 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::ResetHostCalculation ( void   ) 

Clear our own host order, and recalculate as if we had just reconnected.

Definition at line 63 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

void FullyConnectedMesh2::SendConnectionCountResponse ( SystemAddress  addr,
unsigned int  responseTotalConnectionCount 
) [protected]

Definition at line 258 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::SendFCMGuidRequest ( RakNetGUID  rakNetGuid  )  [protected]

Definition at line 229 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::SendOurFCMGuid ( SystemAddress  addr  )  [protected]

Definition at line 249 of file FullyConnectedMesh2.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void FullyConnectedMesh2::SetAutoparticipateConnections ( bool  b  ) 

Automatically add new connections to the fully connected mesh.

Defaults to true.

Parameters:
[in] b As stated

Definition at line 59 of file FullyConnectedMesh2.cpp.

void FullyConnectedMesh2::SetConnectOnNewRemoteConnection ( bool  attemptConnection,
RakNet::RakString  pw 
)

When the message ID_REMOTE_NEW_INCOMING_CONNECTION arrives, we try to connect to that system

Parameters:
[in] attemptConnection If true, we try to connect to any systems we are notified about with ID_REMOTE_NEW_INCOMING_CONNECTION, which comes from the ConnectionGraph2 plugin. Defaults to true.
[in] pw The password to use to connect with. Only used if attemptConnection is true

Definition at line 453 of file FullyConnectedMesh2.cpp.


Member Data Documentation

Definition at line 121 of file FullyConnectedMesh2.h.

Definition at line 140 of file FullyConnectedMesh2.h.

Definition at line 141 of file FullyConnectedMesh2.h.

Definition at line 138 of file FullyConnectedMesh2.h.

Definition at line 137 of file FullyConnectedMesh2.h.

Definition at line 134 of file FullyConnectedMesh2.h.

Definition at line 129 of file FullyConnectedMesh2.h.

List of systems we know the FCM2Guid for.

Definition at line 132 of file FullyConnectedMesh2.h.

Definition at line 118 of file FullyConnectedMesh2.h.

Definition at line 126 of file FullyConnectedMesh2.h.


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