SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SLNet::ConnectionGraph2 Class Reference

A one hop connection graph. More...

`#include <slikenet/ConnectionGraph2.h>`

Inheritance diagram for SLNet::ConnectionGraph2:

## Classes

struct | RemoteSystem
struct | SystemAddressAndGuid

## Public Member Functions

| ConnectionGraph2 ()
| ~ConnectionGraph2 ()
bool | GetConnectionListForRemoteSystem (RakNetGUID remoteSystemGuid, SystemAddress *saOut, RakNetGUID *guidOut, unsigned int *outLength)
| Given a remote system identified by RakNetGUID, return the list of SystemAddresses and RakNetGUIDs they are connected to.
bool | ConnectionExists (RakNetGUID g1, RakNetGUID g2)
| Returns if g1 is connected to g2.
uint16_t | GetPingBetweenSystems (RakNetGUID g1, RakNetGUID g2) const
| Returns the average ping between two systems in the connection graph. Returns -1 if no connection exists between those systems.
RakNetGUID | GetLowestAveragePingSystem (void) const
void | SetAutoProcessNewConnections (bool b)
| If called with false, then new connections are only added to the connection graph when you call ProcessNewConnection();.
bool | GetAutoProcessNewConnections (void) const
| Returns value passed to SetAutoProcessNewConnections()
void | AddParticipant (const SystemAddress &systemAddress, RakNetGUID rakNetGUID)
| If you call SetAutoProcessNewConnections(false);, then you will need to manually call ProcessNewConnection() on new connections.
void | GetParticipantList (DataStructures::OrderedList< RakNetGUID, RakNetGUID > &participantList)
Public Member Functions inherited from SLNet::PluginInterface2
| PluginInterface2 ()
virtual | ~PluginInterface2 ()
virtual void | OnAttach (void)
| Called when the interface is attached.
virtual void | OnDetach (void)
| Called when the interface is detached.
virtual void | Update (void)
| Update is called every time a packet is checked for .
virtual void | OnRakPeerStartup (void)
| Called when RakPeer is initialized.
virtual void | OnRakPeerShutdown (void)
| Called when RakPeer is shutdown.
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
virtual bool | UsesReliabilityLayer (void) const
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time, int isSend)
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, SLNet::TimeMS time)
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
RakPeerInterface * | GetRakPeerInterface (void) const
RakNetGUID | GetMyGUIDUnified (void) const
void | SetRakPeerInterface (RakPeerInterface *ptr)
void | SetTCPInterface (TCPInterface *ptr)

## Static Public Member Functions

static int | SystemAddressAndGuidComp (const SystemAddressAndGuid &key, const SystemAddressAndGuid &data)
static int | RemoteSystemComp (const RakNetGUID &key, RemoteSystem *const &data)

## Protected Member Functions

virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual PluginReceiveResult | OnReceive (Packet *packet)
Protected Member Functions inherited from SLNet::PluginInterface2
void | SendUnified (const SLNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
void | SendUnified (const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
bool | SendListUnified (const char **data, const int *lengths, const int numParameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)
Packet * | AllocatePacketUnified (unsigned dataSize)
void | PushBackPacketUnified (Packet *packet, bool pushAtHead)
void | DeallocPacketUnified (Packet *packet)

## Protected Attributes

DataStructures::OrderedList < RakNetGUID, RemoteSystem *, ConnectionGraph2::RemoteSystemComp > | remoteSystems
bool | autoProcessNewConnections
Protected Attributes inherited from SLNet::PluginInterface2
RakPeerInterface * | rakPeerInterface
TCPInterface * | tcpInterface

## Detailed Description

A one hop connection graph.

Sends ID_REMOTE_CONNECTION_LOST, ID_REMOTE_DISCONNECTION_NOTIFICATION, ID_REMOTE_NEW_INCOMING_CONNECTION
All identifiers are followed by SystemAddress, then RakNetGUID Also stores the list for you, which you can access with GetConnectionListForRemoteSystem

Definition at line 45 of file ConnectionGraph2.h.

## Class Documentation

struct SLNet::ConnectionGraph2::RemoteSystem

Definition at line 104 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid |
OrderedList < SystemAddressAndGuid, SystemAddressAndGuid, SystemAddressAndGuidComp > | remoteConnections |

struct SLNet::ConnectionGraph2::SystemAddressAndGuid

Definition at line 94 of file ConnectionGraph2.h.

Class Members
RakNetGUID | guid |
uint16_t | sendersPingToThatSystem |
SystemAddress | systemAddress |

## Constructor & Destructor Documentation

SLNet::ConnectionGraph2::ConnectionGraph2 | ( |  | ) |

SLNet::ConnectionGraph2::~ConnectionGraph2 | ( |  | ) |

## Member Function Documentation

void SLNet::ConnectionGraph2::AddParticipant | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID
| ) |  |

If you call SetAutoProcessNewConnections(false);, then you will need to manually call ProcessNewConnection() on new connections.

On ID_NEW_INCOMING_CONNECTION or ID_CONNECTION_REQUEST_ACCEPTED, adds that system to the graph Do not call ProcessNewConnection() manually otherwise

Parameters

  [in] | The | packet->SystemAddress member
  [in] | The | packet->guid member

bool SLNet::ConnectionGraph2::ConnectionExists | ( | RakNetGUID | g1,
|  | RakNetGUID | g2
| ) |  |

Returns if g1 is connected to g2.

bool SLNet::ConnectionGraph2::GetAutoProcessNewConnections | ( | void |  | ) | const

Returns value passed to SetAutoProcessNewConnections()

Returns
  Value passed to SetAutoProcessNewConnections(), or the default of true if it was never called

bool SLNet::ConnectionGraph2::GetConnectionListForRemoteSystem | ( | RakNetGUID | remoteSystemGuid,
|  | SystemAddress * | saOut,
|  | RakNetGUID * | guidOut,
|  | unsigned int * | outLength
| ) |  |

Given a remote system identified by RakNetGUID, return the list of SystemAddresses and RakNetGUIDs they are connected to.

Parameters

  [in] | remoteSystemGuid | Which system we are referring to. This only works for remote systems, not ourselves.
  [out] | saOut | A preallocated array to hold the output list of SystemAddress. Can be 0 if you don't care.
  [out] | guidOut | A preallocated array to hold the output list of RakNetGUID. Can be 0 if you don't care.
  [in,out] | outLength | On input, the size of saOut and guidOut. On output, modified to reflect the number of elements actually written

Returns
  True if remoteSystemGuid was found. Otherwise false, and saOut, guidOut remain unchanged. outLength will be set to 0.

RakNetGUID SLNet::ConnectionGraph2::GetLowestAveragePingSystem | ( | void |  | ) | const

Returns the system with the lowest average ping among all its connections. If you need one system in the peer to peer group to relay data, have the FullyConnectedMesh2 host call this function after host migration, and use that system

void SLNet::ConnectionGraph2::GetParticipantList | ( | DataStructures::OrderedList< RakNetGUID, RakNetGUID > & | participantList | ) |

Get the participants added with AddParticipant()

Parameters

  [out] | participantList | Participants added with AddParticipant();

uint16_t SLNet::ConnectionGraph2::GetPingBetweenSystems | ( | RakNetGUID | g1,
|  | RakNetGUID | g2
| ) |  | const

Returns the average ping between two systems in the connection graph. Returns -1 if no connection exists between those systems.

virtual void SLNet::ConnectionGraph2::OnClosedConnection | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | PI2_LostConnectionReason | lostConnectionReason
| ) |  |

protectedvirtual

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 SLNet::PluginInterface2.

virtual void SLNet::ConnectionGraph2::OnNewConnection | ( | const SystemAddress & | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | bool | isIncoming
| ) |  |

protectedvirtual

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 SLNet::PluginInterface2.

virtual PluginReceiveResult SLNet::ConnectionGraph2::OnReceive | ( | Packet * | packet | ) |

protectedvirtual

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 SLNet::PluginInterface2.

static int SLNet::ConnectionGraph2::RemoteSystemComp | ( | const RakNetGUID & | key,
|  | RemoteSystem *const & | data
| ) |  |

static

void SLNet::ConnectionGraph2::SetAutoProcessNewConnections | ( | bool | b | ) |

If called with false, then new connections are only added to the connection graph when you call ProcessNewConnection();.

This is useful if you want to perform validation before connecting a system to a mesh, or if you want a submesh (for example a server cloud)

Parameters

  [in] | b | True to automatically call ProcessNewConnection() on any new connection, false to not do so. Defaults to true.

static int SLNet::ConnectionGraph2::SystemAddressAndGuidComp | ( | const SystemAddressAndGuid & | key,
|  | const SystemAddressAndGuid & | data
| ) |  |

static

## Member Data Documentation

bool SLNet::ConnectionGraph2::autoProcessNewConnections

protected

Definition at line 123 of file ConnectionGraph2.h.

DataStructures::OrderedList<RakNetGUID, RemoteSystem*, ConnectionGraph2::RemoteSystemComp> SLNet::ConnectionGraph2::remoteSystems

protected

Definition at line 121 of file ConnectionGraph2.h.

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

- Source/include/slikenet/ConnectionGraph2.h