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

ConnectionGraph Class Reference
[ConnectionGraph]

A connection graph. Each peer will know about all other peers. More...

#include <ConnectionGraph.h>

Inherits PluginInterface2.

Collaboration diagram for ConnectionGraph:
Collaboration graph
[legend]

List of all members.

Classes

struct  SystemAddressAndGroupId
 A node in the connection graph. More...

Public Member Functions

 ConnectionGraph ()
virtual ~ConnectionGraph ()
void SetPassword (const char *password)
 Plaintext encoding of the password, or 0 for none. If you use a password, use secure connections.
DataStructures::WeightedGraph
< ConnectionGraph::SystemAddressAndGroupId,
unsigned short, false > * 
GetGraph (void)
 Returns the connection graph.
void SetAutoAddNewConnections (bool autoAdd)
 Automatically add new connections to the connection graph.
void RequestConnectionGraph (SystemAddress systemAddress)
 Requests the connection graph from another system.
void AddNewConnection (RakPeerInterface *peer, SystemAddress systemAddress, RakNetGUID guid, ConnectionGraphGroupID groupId)
 Adds a new connection to the connection graph from this system to the specified system. Also assigns a group identifier for that system.
void SetGroupId (ConnectionGraphGroupID groupId)
 Sets our own group ID.
void SubscribeToGroup (ConnectionGraphGroupID groupId)
 Allows adding to the connection graph nodes with this groupId.
void UnsubscribeFromGroup (ConnectionGraphGroupID groupId)
 Disables addition of graph nodes with this groupId.
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
virtual void Update (void)
 Update is called every time a packet is checked for .
virtual PluginReceiveResult OnReceive (Packet *packet)
virtual void OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)

Protected Member Functions

void HandleDroppedConnection (RakPeerInterface *peer, SystemAddress systemAddress, unsigned char packetId)
void DeleteFromPeerList (SystemAddress systemAddress)
void OnNewIncomingConnection (Packet *packet)
void OnConnectionGraphRequest (Packet *packet)
void OnConnectionGraphReply (Packet *packet)
void OnConnectionGraphUpdate (Packet *packet)
void OnNewConnectionInternal (Packet *packet)
bool OnConnectionLostInternal (Packet *packet, unsigned char packetId)
void OnConnectionAddition (Packet *packet)
void OnConnectionRemoval (Packet *packet)
void SendConnectionGraph (SystemAddress target, unsigned char packetId, RakPeerInterface *peer)
void SerializeWeightedGraph (RakNet::BitStream *out, const DataStructures::WeightedGraph< ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > &g) const
bool DeserializeWeightedGraph (RakNet::BitStream *inBitstream, RakPeerInterface *peer)
void AddAndRelayConnection (DataStructures::OrderedList< SystemAddress, SystemAddress > &ignoreList, const SystemAddressAndGroupId &conn1, const SystemAddressAndGroupId &conn2, unsigned short ping, RakPeerInterface *peer)
bool RemoveAndRelayConnection (DataStructures::OrderedList< SystemAddress, SystemAddress > &ignoreList, unsigned char packetId, const SystemAddress node1, const SystemAddress node2, RakPeerInterface *peer)
void RemoveParticipant (SystemAddress systemAddress)
void AddParticipant (SystemAddress systemAddress)
void BroadcastGraphUpdate (DataStructures::OrderedList< SystemAddress, SystemAddress > &ignoreList, RakPeerInterface *peer)
void NotifyUserOfRemoteConnection (const SystemAddressAndGroupId &conn1, const SystemAddressAndGroupId &conn2, unsigned short ping, RakPeerInterface *peer)
bool IsNewRemoteConnection (const SystemAddressAndGroupId &conn1, const SystemAddressAndGroupId &conn2, RakPeerInterface *peer)
bool DeserializeIgnoreList (DataStructures::OrderedList< SystemAddress, SystemAddress > &ignoreList, RakNet::BitStream *inBitstream)
void SerializeIgnoreListAndBroadcast (RakNet::BitStream *outBitstream, DataStructures::OrderedList< SystemAddress, SystemAddress > &ignoreList, RakPeerInterface *peer)

Protected Attributes

RakNetTime nextWeightUpdate
char * pw
DataStructures::OrderedList
< SystemAddress, SystemAddress
participantList
DataStructures::WeightedGraph
< ConnectionGraph::SystemAddressAndGroupId,
unsigned short, false > 
graph
bool autoAddNewConnections
ConnectionGraphGroupID myGroupId
DataStructures::OrderedList
< ConnectionGraphGroupID,
ConnectionGraphGroupID
subscribedGroups

Detailed Description

A connection graph. Each peer will know about all other peers.

Deprecated:
Use ConnectionGraph2

Definition at line 36 of file ConnectionGraph.h.


Constructor & Destructor Documentation

ConnectionGraph::ConnectionGraph (  ) 

Definition at line 57 of file ConnectionGraph.cpp.

Here is the call graph for this function:

ConnectionGraph::~ConnectionGraph (  )  [virtual]

Definition at line 71 of file ConnectionGraph.cpp.

Here is the call graph for this function:


Member Function Documentation

void ConnectionGraph::AddAndRelayConnection ( DataStructures::OrderedList< SystemAddress, SystemAddress > &  ignoreList,
const SystemAddressAndGroupId conn1,
const SystemAddressAndGroupId conn2,
unsigned short  ping,
RakPeerInterface peer 
) [protected]

Definition at line 485 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::AddNewConnection ( RakPeerInterface peer,
SystemAddress  systemAddress,
RakNetGUID  guid,
ConnectionGraphGroupID  groupId 
)

Adds a new connection to the connection graph from this system to the specified system. Also assigns a group identifier for that system.

Only used and valid when SetAutoAddNewConnections(false) is called. Call this for this system sometime after getting ID_NEW_INCOMING_CONNECTION or ID_CONNECTION_REQUEST_ACCEPTED for systems that contain a connection graph Groups are sets of one or more nodes in the total graph We only add to the graph groups which we subscribe to

Parameters:
[in] peer The instance of RakPeer to send through
[in] systemAddress The system that is connected to us.
[in] guid The system that is connected to us.
[in] groupId Just a number representing a group. Important: 0 is reserved to mean unassigned group ID and is assigned to all systems added with SetAutoAddNewConnections(true)

Definition at line 193 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::AddParticipant ( SystemAddress  systemAddress  )  [protected]

Definition at line 480 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::BroadcastGraphUpdate ( DataStructures::OrderedList< SystemAddress, SystemAddress > &  ignoreList,
RakPeerInterface peer 
) [protected]

Definition at line 541 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::DeleteFromPeerList ( SystemAddress  systemAddress  )  [protected]
bool ConnectionGraph::DeserializeIgnoreList ( DataStructures::OrderedList< SystemAddress, SystemAddress > &  ignoreList,
RakNet::BitStream inBitstream 
) [protected]

Definition at line 358 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConnectionGraph::DeserializeWeightedGraph ( RakNet::BitStream inBitstream,
RakPeerInterface peer 
) [protected]

Definition at line 425 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

DataStructures::WeightedGraph< ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > * ConnectionGraph::GetGraph ( void   ) 

Returns the connection graph.

Returns:
The connection graph, stored as map of adjacency lists

Definition at line 92 of file ConnectionGraph.cpp.

void ConnectionGraph::HandleDroppedConnection ( RakPeerInterface peer,
SystemAddress  systemAddress,
unsigned char  packetId 
) [protected]

Definition at line 182 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConnectionGraph::IsNewRemoteConnection ( const SystemAddressAndGroupId conn1,
const SystemAddressAndGroupId conn2,
RakPeerInterface peer 
) [protected]

Definition at line 573 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::NotifyUserOfRemoteConnection ( const SystemAddressAndGroupId conn1,
const SystemAddressAndGroupId conn2,
unsigned short  ping,
RakPeerInterface peer 
) [protected]

Definition at line 588 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::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 172 of file ConnectionGraph.cpp.

Here is the call graph for this function:

void ConnectionGraph::OnConnectionAddition ( Packet packet  )  [protected]
void ConnectionGraph::OnConnectionGraphReply ( Packet packet  )  [protected]

Definition at line 255 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::OnConnectionGraphRequest ( Packet packet  )  [protected]

Definition at line 229 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::OnConnectionGraphUpdate ( Packet packet  )  [protected]

Definition at line 297 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ConnectionGraph::OnConnectionLostInternal ( Packet packet,
unsigned char  packetId 
) [protected]

Definition at line 339 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::OnConnectionRemoval ( Packet packet  )  [protected]
void ConnectionGraph::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 119 of file ConnectionGraph.cpp.

Here is the call graph for this function:

void ConnectionGraph::OnNewConnectionInternal ( Packet packet  )  [protected]

Definition at line 316 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::OnNewIncomingConnection ( Packet packet  )  [protected]
void ConnectionGraph::OnRakPeerShutdown ( void   )  [virtual]

Called when RakPeer is shutdown.

Reimplemented from PluginInterface2.

Definition at line 100 of file ConnectionGraph.cpp.

Here is the call graph for this function:

PluginReceiveResult ConnectionGraph::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 140 of file ConnectionGraph.cpp.

Here is the call graph for this function:

bool ConnectionGraph::RemoveAndRelayConnection ( DataStructures::OrderedList< SystemAddress, SystemAddress > &  ignoreList,
unsigned char  packetId,
const SystemAddress  node1,
const SystemAddress  node2,
RakPeerInterface peer 
) [protected]

Definition at line 518 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::RemoveParticipant ( SystemAddress  systemAddress  )  [protected]

Definition at line 471 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::RequestConnectionGraph ( SystemAddress  systemAddress  ) 

Requests the connection graph from another system.

Only necessary to call if SetAutoAddNewConnections(false) is called. You should call this sometime after getting ID_CONNECTION_REQUEST_ACCEPTED and systemAddress is or should be a node on the connection graph

Parameters:
[in] systemAddress The system to send to

Definition at line 218 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::SendConnectionGraph ( SystemAddress  target,
unsigned char  packetId,
RakPeerInterface peer 
) [protected]
void ConnectionGraph::SerializeIgnoreListAndBroadcast ( RakNet::BitStream outBitstream,
DataStructures::OrderedList< SystemAddress, SystemAddress > &  ignoreList,
RakPeerInterface peer 
) [protected]

Definition at line 548 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::SerializeWeightedGraph ( RakNet::BitStream out,
const DataStructures::WeightedGraph< ConnectionGraph::SystemAddressAndGroupId, unsigned short, false > &  g 
) const [protected]

Definition at line 375 of file ConnectionGraph.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectionGraph::SetAutoAddNewConnections ( bool  autoAdd  ) 

Automatically add new connections to the connection graph.

Defaults to true If true, then the system will automatically add all new connections for you, assigning groupId 0 to these systems. If you want more control, you should call SetAutoAddNewConnections(false); When false, it is up to you to call RequestConnectionGraph and AddNewConnection to complete the graph However, this way you can choose which nodes are on the graph for this system and can assign groupIds to those nodes

Parameters:
[in] autoAdd true to automatically add new connections to the connection graph. False to not do so.

Definition at line 96 of file ConnectionGraph.cpp.

void ConnectionGraph::SetGroupId ( ConnectionGraphGroupID  groupId  ) 

Sets our own group ID.

Only used and valid when SetAutoAddNewConnections(false) is called. Defaults to 0

Parameters:
[in] groupId Our group ID

Definition at line 189 of file ConnectionGraph.cpp.

void ConnectionGraph::SetPassword ( const char *  password  ) 

Plaintext encoding of the password, or 0 for none. If you use a password, use secure connections.

Definition at line 77 of file ConnectionGraph.cpp.

Here is the call graph for this function:

void ConnectionGraph::SubscribeToGroup ( ConnectionGraphGroupID  groupId  ) 

Allows adding to the connection graph nodes with this groupId.

By default, you subscribe to group 0, which are all systems automatically added with SetAutoAddNewConnections(true) Calling this does not add nodes which were previously rejected due to an unsubscribed group - it only allows addition of nodes after the fact

Parameters:
[in] groupId Just a number representing a group. 0 is reserved to mean unassigned group ID, automatically added with SetAutoAddNewConnections(true)

Definition at line 210 of file ConnectionGraph.cpp.

Here is the call graph for this function:

void ConnectionGraph::UnsubscribeFromGroup ( ConnectionGraphGroupID  groupId  ) 

Disables addition of graph nodes with this groupId.

Calling this does not add remove nodes with this groupId which are already present in the graph. It only disables addition of nodes after the fact

Parameters:
[in] groupId Just a number representing a group. 0 is reserved to mean unassigned group ID, automatically added with SetAutoAddNewConnections(true)

Definition at line 214 of file ConnectionGraph.cpp.

Here is the call graph for this function:

void ConnectionGraph::Update ( void   )  [virtual]

Update is called every time a packet is checked for .

Reimplemented from PluginInterface2.

Definition at line 106 of file ConnectionGraph.cpp.


Member Data Documentation

Definition at line 156 of file ConnectionGraph.h.

Definition at line 155 of file ConnectionGraph.h.

Definition at line 157 of file ConnectionGraph.h.

Definition at line 151 of file ConnectionGraph.h.

Definition at line 153 of file ConnectionGraph.h.

char* ConnectionGraph::pw [protected]

Definition at line 152 of file ConnectionGraph.h.

Definition at line 159 of file ConnectionGraph.h.


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