# RakNet::RPC4Plugin Class Reference
[RPC]

The RPC4Plugin plugin is just an association between a C function pointer and a string. More...

`#include <RPC4Plugin.h>`

Inheritance diagram for RakNet::RPC4Plugin:

List of all members.

## Public Member Functions

bool | RegisterFunction (const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet))
| Register a function pointer to be callable from a remote system.
bool | UnregisterFunction (const char *uniqueID)
| Unregister a function pointer previously registered with RegisterFunction().
void | CallLoopback (const char *uniqueID, RakNet::BitStream *bitStream)
void | Call (const char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast)

## Protected Member Functions

virtual PluginReceiveResult | OnReceive (Packet *packet)

## Detailed Description

The RPC4Plugin plugin is just an association between a C function pointer and a string.

It is for users that want to use RPC, but do not want to use boost. You do not have the automatic serialization or other features of RPC3, and C++ member calls are not supported.

## Member Function Documentation

void RakNet::RPC4Plugin::Call | ( | const char * | uniqueID,
|  | RakNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | const AddressOrGUID | systemIdentifier,
|  | bool | broadcast |
| ) |  |  |

Send to the specified remote instance of RakPeer.

Parameters:

  `[in]` | Identifier | originally passed to RegisterFunction() on the remote system(s)
  `[in]` | bitStream | bitStream encoded data to send to the function callback
  `[in]` | priority | See RakPeerInterface::Send()
  `[in]` | reliability | See RakPeerInterface::Send()
  `[in]` | orderingChannel | See RakPeerInterface::Send()
  `[in]` | systemIdentifier | See RakPeerInterface::Send()
  `[in]` | broadcast | See RakPeerInterface::Send()

void RakNet::RPC4Plugin::CallLoopback | ( | const char * | uniqueID,
|  | RakNet::BitStream * | bitStream |
| ) |  |  |

Send to the attached instance of RakPeer. See RakPeerInterface::SendLoopback()

Parameters:

  `[in]` | Identifier | originally passed to RegisterFunction() on the local system
  `[in]` | bitStream | bitStream encoded data to send to the function callback

virtual PluginReceiveResult RakNet::RPC4Plugin::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.

bool RakNet::RPC4Plugin::RegisterFunction | ( | const char * | uniqueID,
|  | void(*)(RakNet::BitStream *userData, Packet *packet) | functionPointer |
| ) |  |  |

Register a function pointer to be callable from a remote system.

The hash of the function name will be stored as an association with the function pointer When a call is made to call this function from the Call() or CallLoopback() function, the function pointer will be invoked with the passed bitStream to Call() and the actual Packet that RakNet got.

Parameters:

  `[in]` | uniqueID | Identifier to be associated with functionPointer. If this identifier is already in use, the call will return false.
  `[in]` | functionPointer | C function pointer to be called

Returns:
  True if the hash of uniqueID is not in use, false otherwise.

bool RakNet::RPC4Plugin::UnregisterFunction | ( | const char * | uniqueID | ) |

Unregister a function pointer previously registered with RegisterFunction().

Parameters:

  `[in]` | Identifier | originally passed to RegisterFunction()

Returns:
  True if the hash of uniqueID was in use, and hence removed. false otherwise.

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

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