RakNet  4.0
Public Member Functions | List of all members
RakNet::RelayPlugin Class Reference

A simple class to relay messages from one system to another through an intermediary. More...

#include <RelayPlugin.h>

Inheritance diagram for RakNet::RelayPlugin:
RakNet::PluginInterface2

Public Member Functions

 RelayPlugin ()
 Constructor.
 
virtual ~RelayPlugin ()
 Destructor.
 
bool AddParticipant (const RakString &key, const RakNetGUID &guid)
 Forward messages from any system, to the system specified by the combination of key and guid. The sending system only needs to know the key.
 
void SendToParticipant (const RakNetGUID &relayPluginServerGuid, const RakString &key, BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel)
 Request that the server relay bitStream to the system designated by key.
 
virtual PluginReceiveResult OnReceive (Packet *packet)
 
virtual void OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
 
- Public Member Functions inherited from RakNet::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 OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
 
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, RakNet::TimeMS time, int isSend)
 
virtual void OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time)
 
virtual void OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
 

Detailed Description

A simple class to relay messages from one system to another through an intermediary.

Member Function Documentation

bool RakNet::RelayPlugin::AddParticipant ( const RakString key,
const RakNetGUID guid 
)

Forward messages from any system, to the system specified by the combination of key and guid. The sending system only needs to know the key.

Parameters
[in]keyA string to identify the target's RakNetGUID. This is so the sending system does not need to know the RakNetGUID of the target system. The key should be unique among all guids added. If the key is not unique, only one system will be sent to (at random).
[in]guidThe RakNetGuid of the system to send to. If this system disconnects, it is removed from the internal hash
Returns
true if the participant was added. False if the target guid is not connected
virtual void RakNet::RelayPlugin::OnClosedConnection ( const 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]systemAddressThe system whose connection was closed
[in]rakNetGuidThe guid of the specified system
[in]lostConnectionReasonHow the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from RakNet::PluginInterface2.

virtual PluginReceiveResult RakNet::RelayPlugin::OnReceive ( Packet packet)
virtual

OnReceive is called for every packet.

Parameters
[in]packetthe 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 RakNet::PluginInterface2.

void RakNet::RelayPlugin::SendToParticipant ( const RakNetGUID relayPluginServerGuid,
const RakString key,
BitStream bitStream,
PacketPriority  priority,
PacketReliability  reliability,
char  orderingChannel 
)

Request that the server relay bitStream to the system designated by key.

Parameters
[in]relayPluginServerGuidthe RakNetGUID of the system running RelayPlugin
[in]keyThe key value passed to AddParticipant() earlier on the server. If this was not done, the server will not relay the message (it will be silently discarded).
[in]bitStreamThe data to relay
[in]prioritySee the parameter of the same name in RakPeerInterface::Send()
[in]reliabilitySee the parameter of the same name in RakPeerInterface::Send()
[in]orderingChannelSee the parameter of the same name in RakPeerInterface::Send()

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