![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
A one hop connection graph. More...
#include <ConnectionGraph2.h>
Inheritance diagram for RakNet::ConnectionGraph2:Classes | |
| struct | RemoteSystem |
| struct | SystemAddressAndGuid |
Public Member Functions | |
| void | AddParticipant (const SystemAddress &systemAddress, RakNetGUID rakNetGUID) |
| If you call SetAutoProcessNewConnections(false);, then you will need to manually call ProcessNewConnection() on new connections. | |
| bool | ConnectionExists (RakNetGUID g1, RakNetGUID g2) |
| Returns if g1 is connected to g2. | |
| ConnectionGraph2 () | |
| bool | GetAutoProcessNewConnections (void) const |
| Returns value passed to SetAutoProcessNewConnections() | |
| 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. | |
| RakNetGUID | GetLowestAveragePingSystem (void) const |
| void | GetParticipantList (DataStructures::OrderedList< RakNetGUID, RakNetGUID > &participantList) |
| 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. | |
| void | SetAutoProcessNewConnections (bool b) |
| If called with false, then new connections are only added to the connection graph when you call ProcessNewConnection();. | |
| ~ConnectionGraph2 () | |
Static Public Member Functions | |
| static void | DestroyInstance (ConnectionGraph2 *i) |
| static ConnectionGraph2 * | GetInstance (void) |
| static int | RemoteSystemComp (const RakNetGUID &key, RemoteSystem *const &data) |
| static int | SystemAddressAndGuidComp (const SystemAddressAndGuid &key, const SystemAddressAndGuid &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 Attributes | |
| bool | autoProcessNewConnections |
| DataStructures::OrderedList < RakNetGUID, RemoteSystem *, ConnectionGraph2::RemoteSystemComp > | remoteSystems |
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 32 of file ConnectionGraph2.h.
| RakNet::ConnectionGraph2::ConnectionGraph2 | ( | ) |
| RakNet::ConnectionGraph2::~ConnectionGraph2 | ( | ) |
| void RakNet::ConnectionGraph2::AddParticipant | ( | const SystemAddress & | systemAddress, |
| RakNetGUID | rakNetGUID | ||
| ) |
On ID_NEW_INCOMING_CONNECTION or ID_CONNECTION_REQUEST_ACCEPTED, adds that system to the graph Do not call ProcessNewConnection() manually otherwise
| [in] | The | packet->SystemAddress member |
| [in] | The | packet->guid member |
| bool RakNet::ConnectionGraph2::ConnectionExists | ( | RakNetGUID | g1, |
| RakNetGUID | g2 | ||
| ) |
| static void RakNet::ConnectionGraph2::DestroyInstance | ( | ConnectionGraph2 * | i | ) | [static] |
| bool RakNet::ConnectionGraph2::GetAutoProcessNewConnections | ( | void | ) | const |
| bool RakNet::ConnectionGraph2::GetConnectionListForRemoteSystem | ( | RakNetGUID | remoteSystemGuid, |
| SystemAddress * | saOut, | ||
| RakNetGUID * | guidOut, | ||
| unsigned int * | outLength | ||
| ) |
| [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 |
| static ConnectionGraph2* RakNet::ConnectionGraph2::GetInstance | ( | void | ) | [static] |
| RakNetGUID RakNet::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 RakNet::ConnectionGraph2::GetParticipantList | ( | DataStructures::OrderedList< RakNetGUID, RakNetGUID > & | participantList | ) |
Get the participants added with AddParticipant()
| [out] | participantList | Participants added with AddParticipant(); |
| uint16_t RakNet::ConnectionGraph2::GetPingBetweenSystems | ( | RakNetGUID | g1, |
| RakNetGUID | g2 | ||
| ) | const |
| virtual void RakNet::ConnectionGraph2::OnClosedConnection | ( | const SystemAddress & | systemAddress, |
| RakNetGUID | rakNetGUID, | ||
| PI2_LostConnectionReason | lostConnectionReason | ||
| ) | [protected, virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
| [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 RakNet::PluginInterface2.
| virtual void RakNet::ConnectionGraph2::OnNewConnection | ( | const SystemAddress & | systemAddress, |
| RakNetGUID | rakNetGUID, | ||
| bool | isIncoming | ||
| ) | [protected, virtual] |
Called when we got a new connection
| [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 RakNet::PluginInterface2.
| virtual PluginReceiveResult RakNet::ConnectionGraph2::OnReceive | ( | Packet * | packet | ) | [protected, virtual] |
OnReceive is called for every packet.
| [in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
| static int RakNet::ConnectionGraph2::RemoteSystemComp | ( | const RakNetGUID & | key, |
| RemoteSystem *const & | data | ||
| ) | [static] |
| void RakNet::ConnectionGraph2::SetAutoProcessNewConnections | ( | bool | b | ) |
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)
| [in] | b | True to automatically call ProcessNewConnection() on any new connection, false to not do so. Defaults to true. |
| static int RakNet::ConnectionGraph2::SystemAddressAndGuidComp | ( | const SystemAddressAndGuid & | key, |
| const SystemAddressAndGuid & | data | ||
| ) | [static] |
Definition at line 110 of file ConnectionGraph2.h.
DataStructures::OrderedList<RakNetGUID, RemoteSystem*, ConnectionGraph2::RemoteSystemComp> RakNet::ConnectionGraph2::remoteSystems [protected] |
Definition at line 108 of file ConnectionGraph2.h.
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.