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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# PluginInterface Class Reference
[PluginInterface]

PluginInterface provides a mechanism to add functionality in a modular way. MessageHandlers should derive from PluginInterface and be attached to RakPeer using the function AttachPlugin On a user call to Receive, OnReceive is called for every PluginInterface, which can then take action based on the message passed to it. This is used to transparently add game-independent functional modules, similar to browser plugins. More...

`#include <PluginInterface.h>`

Inheritance diagram for PluginInterface:

List of all members.

## Public Member Functions
virtual void | OnAttach (RakPeerInterface *peer)
virtual void | OnDetach (RakPeerInterface *peer)
virtual void | OnInitialize (RakPeerInterface *peer)
virtual void | Update (RakPeerInterface *peer)
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)
virtual void | OnDisconnect (RakPeerInterface *peer)
virtual void | OnCloseConnection (RakPeerInterface *peer, PlayerID playerId)
virtual void | OnDirectSocketSend (const char *data, const unsigned bitsUsed, PlayerID remoteSystemID)
virtual void | OnDirectSocketReceive (const char *data, const unsigned bitsUsed, PlayerID remoteSystemID)
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, PlayerID remoteSystemID, RakNetTime time, bool isSend)

## Detailed Description

PluginInterface provides a mechanism to add functionality in a modular way. MessageHandlers should derive from PluginInterface and be attached to RakPeer using the function AttachPlugin On a user call to Receive, OnReceive is called for every PluginInterface, which can then take action based on the message passed to it. This is used to transparently add game-independent functional modules, similar to browser plugins.

See also:
  ReplicaManager

  FullyConnectedMesh

  PacketLogger

## Member Function Documentation

void PluginInterface::OnAttach | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when the interface is attached Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
Reimplemented in DirectoryDeltaTransfer, FileListTransfer, LightweightDatabaseClient, LightweightDatabaseServer, NatPunchthrough, PacketFileLogger, PacketLogger, ReplicaManager, and Router.

void PluginInterface::OnCloseConnection | ( | RakPeerInterface * | peer,
|  | PlayerID | playerId
| ) | `[virtual]`

  | Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | playerId | The system whose connection was closed
Reimplemented in ConnectionGraph, FileListTransfer, LightweightDatabaseServer, NatPunchthrough, ReplicaManager, and Router.

void PluginInterface::OnDetach | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when the interface is detached Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
Reimplemented in Router.

void PluginInterface::OnDirectSocketReceive | ( | const char * | data,
|  | const unsigned | bitsUsed,
|  | PlayerID | remoteSystemID
| ) | `[virtual]`

  | Called on a receive from the socket, per datagram, that does not go through the reliability layer Parameters:
  `[in]` | data | The data being sent
  `[in]` | bitsUsed | How many bits long data is
  `[in]` | remoteSystemID | Which system this message is being sent to
Reimplemented in PacketLogger.

void PluginInterface::OnDirectSocketSend | ( | const char * | data,
|  | const unsigned | bitsUsed,
|  | PlayerID | remoteSystemID
| ) | `[virtual]`

  | Called on a send to the socket, per datagram, that does not go through the reliability layer Parameters:
  `[in]` | data | The data being sent
  `[in]` | bitsUsed | How many bits long data is
  `[in]` | remoteSystemID | Which system this message is being sent to
Reimplemented in PacketLogger.

void PluginInterface::OnDisconnect | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when RakPeer is shutdown Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
Reimplemented in ConnectionGraph, DirectoryDeltaTransfer, FileListTransfer, FullyConnectedMesh, LightweightDatabaseServer, NatPunchthrough, ReplicaManager, and Router.

void PluginInterface::OnInitialize | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when RakPeer is initialized Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive

void PluginInterface::OnInternalPacket | ( | InternalPacket * | internalPacket,
|  | unsigned | frameNumber,
|  | PlayerID | remoteSystemID,
|  | RakNetTime | time,
|  | bool | isSend
| ) | `[virtual]`

  | Called on a send or recieve within the reliability layer Parameters:
  `[in]` | internalPacket | The user message, along with all send data.
  `[in]` | frameNumber | The number of frames sent or received so far for this player depending on isSend . Indicates the frame of this user message.
  `[in]` | remoteSystemID | The player we sent or got this packet from
  `[in]` | time | The current time as returned by RakNet::GetTime()
  `[in]` | isSend | Is this callback representing a send event or receive event?
Reimplemented in PacketLogger.

PluginReceiveResult PluginInterface::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet
| ) | `[virtual]`

  | OnReceive is called for every packet. Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[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 in ConnectionGraph, DirectoryDeltaTransfer, FileListTransfer, FullyConnectedMesh, LightweightDatabaseClient, LightweightDatabaseServer, NatPunchthrough, ReplicaManager, and Router.

void PluginInterface::Update | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Update is called every time a packet is checked for . Parameters:
  `[in]` | peer | - the instance of RakPeer that is calling Receive
Reimplemented in ConnectionGraph, DirectoryDeltaTransfer, FullyConnectedMesh, LightweightDatabaseServer, NatPunchthrough, ReplicaManager, and Router.

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

- C:/RakNet 2.518/Include/PluginInterface.h
- C:/RakNet 2.518/Source/PluginInterface.cpp