# ConnectionGraph2 Class Reference
[ConnectionGraph]

A one hop connection graph. More...

`#include <ConnectionGraph2.h>`

Inheritance diagram for ConnectionGraph2:

List of all members.

## Public Member Functions

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.

## Protected Member Functions

virtual void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
virtual void | OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
virtual PluginReceiveResult | OnReceive (Packet *packet)

## Detailed Description

A one hop connection graph.

Sends ID_CONNECTION_GRAPH_DISCONNECTION_NOTIFICATION, ID_CONNECTION_GRAPH_CONNECTION_LOST, ID_CONNECTION_GRAPH_NEW_CONNECTION
All identifiers are followed by SystemAddress, then RakNetGUID Also stores the list for you, which you can access with GetConnectionListForRemoteSystem

## Member Function Documentation

bool 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.

virtual void ConnectionGraph2::OnClosedConnection | ( | 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

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.

virtual void ConnectionGraph2::OnNewConnection | ( | SystemAddress | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | bool | isIncoming |
| ) |  |  | `[protected, 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.

virtual PluginReceiveResult ConnectionGraph2::OnReceive | ( | Packet * | packet | ) | `[protected, 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.

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

- d:/RakNet-3.x/Source/ConnectionGraph2.h