# Remote Procedure Call Subsystem

Remote Function Invocation. More...

## Files

file | RPCNode.h
| Internal Stuff for RPC Handling.

file | RPCNode.cpp
| Internal Stuff for RPC Handling.

## Classes

struct | RPCNode
| Map registered procedure inside of a peer. More...

## Functions

void | RakPeer::RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionName)(char *input, int numberOfBitsOfData, PlayerID sender))
void | RakPeer::UnregisterAsRemoteProcedureCall (char *uniqueID)
bool | RakPeer::RPC (char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)
bool | RakPeer::RPC (char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)
virtual void | RakPeerInterface::RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionName)(char *input, int numberOfBitsOfData, PlayerID sender))=0
virtual void | RakPeerInterface::UnregisterAsRemoteProcedureCall (char *uniqueID)=0
virtual bool | RakPeerInterface::RPC (char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0
virtual bool | RakPeerInterface::RPC (char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0
void | RakServer::RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionName)(char *input, int numberOfBitsOfData, PlayerID sender))
void | RakServer::UnregisterAsRemoteProcedureCall (char *uniqueID)
bool | RakServer::RPC (char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)
bool | RakServer::RPC (char *uniqueID, RakNet::BitStream *parameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)
virtual void | RakServerInterface::RegisterAsRemoteProcedureCall (char *uniqueID, void(*functionName)(char *input, int numberOfBitsOfData, PlayerID sender))=0
virtual void | RakServerInterface::UnregisterAsRemoteProcedureCall (char *uniqueID)=0
virtual bool | RakServerInterface::RPC (char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0
virtual bool | RakServerInterface::RPC (char *uniqueID, RakNet::BitStream *parameters, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)=0

## Detailed Description

Remote Function Invocation.

The Remote Procedure Call Subsystem provide ability to call function on a remote host knowing its name and its parameters.

Todo:
  Add here an example on how to register and use an RPC.

## Function Documentation

virtual void RakServerInterface::RegisterAsRemoteProcedureCall | ( | char * | uniqueID,
|  | void(*)(char *input, int numberOfBitsOfData, PlayerID sender) | functionName
| ) | `[pure virtual, inherited]`

Register a C function as available for calling as a remote procedure call

Parameters:

  | uniqueID,: | A null terminated non-case senstive string of only letters to identify this procedure
  | functionName(...),: | The name of the C function or C++ singleton to be used as a function pointer This can be called whether the client is active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakServer.

void RakServer::RegisterAsRemoteProcedureCall | ( | char * | uniqueID,
|  | void(*)(char *input, int numberOfBitsOfData, PlayerID sender) | functionName
| ) | `[virtual, inherited]`

Register a C function as available for calling as a remote procedure call

Parameters:

  | uniqueID,: | A null terminated non-case senstive string of only letters to identify this procedure
  | functionName(...),: | The name of the C function or C++ singleton to be used as a function pointer This can be called whether the client is active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Reimplemented from RakPeer.

virtual void RakPeerInterface::RegisterAsRemoteProcedureCall | ( | char * | uniqueID,
|  | void(*)(char *input, int numberOfBitsOfData, PlayerID sender) | functionName
| ) | `[pure virtual, inherited]`

Register a C function as available for calling as a remote procedure call

Parameters:

  | uniqueID,: | A null terminated non-case senstive string of only letters to identify this procedure
  | functionName(...),: | The name of the C function or C++ singleton to be used as a function pointer This can be called whether the client is active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakClient, RakPeer, and RakServer.

void RakPeer::RegisterAsRemoteProcedureCall | ( | char * | uniqueID,
|  | void(*)(char *input, int numberOfBitsOfData, PlayerID sender) | functionName
| ) | `[virtual, inherited]`

Register a C function as available for calling as a remote procedure call

Parameters:

  | uniqueID,: | A null terminated non-case senstive string of only letters to identify this procedure
  | functionName(...),: | The name of the C function or C++ singleton to be used as a function pointer This can be called whether the client is active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implements RakPeerInterface.

Reimplemented in RakClient, and RakServer.

virtual bool RakServerInterface::RPC | ( | char * | uniqueID,
|  | RakNet::BitStream * | parameters,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[pure virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | parameters | The bitstream to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakServer.

virtual bool RakServerInterface::RPC | ( | char * | uniqueID,
|  | char * | data,
|  | unsigned long | bitLength,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[pure virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | data | The block of data to send
  | bitLength | The size in BITS of the data to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakServer.

bool RakServer::RPC | ( | char * | uniqueID,
|  | RakNet::BitStream * | parameters,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | parameters | The bitstream to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Reimplemented from RakPeer.

bool RakServer::RPC | ( | char * | uniqueID,
|  | char * | data,
|  | unsigned long | bitLength,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | data | The block of data to send
  | bitLength | The size in BITS of the data to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Reimplemented from RakPeer.

virtual bool RakPeerInterface::RPC | ( | char * | uniqueID,
|  | RakNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[pure virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | bitStream | The bitstream to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakPeer, and RakServer.

virtual bool RakPeerInterface::RPC | ( | char * | uniqueID,
|  | char * | data,
|  | unsigned long | bitLength,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[pure virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | data | The block of data to send
  | bitLength | The size in BITS of the data to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakPeer, and RakServer.

bool RakPeer::RPC | ( | char * | uniqueID,
|  | RakNet::BitStream * | bitStream,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | bitStream | The bitstream to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implements RakPeerInterface.

Reimplemented in RakServer.

bool RakPeer::RPC | ( | char * | uniqueID,
|  | char * | data,
|  | unsigned long | bitLength,
|  | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel,
|  | PlayerID | playerId,
|  | bool | broadcast,
|  | bool | shiftTimestamp
| ) | `[virtual, inherited]`

Calls a C function on the server that the server already registered using RegisterAsRemoteProcedureCall If you want that function to return data you should call RPC from that system in the same way Returns true on a successful packet send (this does not indicate the recipient performed the call), false on failure

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter
  | data | The block of data to send
  | bitLength | The size in BITS of the data to send
  | priority | What priority level to send on.
  | reliability | How reliability to send this data
  | orderingChannel | When using ordered or sequenced packets, what channel to order these on.
  | playerId | Who to send this packet to, or in the case of broadcasting who not to send it to. Use UNASSIGNED_PLAYER_ID to specify none
  | broadcast | True to send this packet to all connected systems. If true, then playerId specifies who not to send the packet to.
  | shiftTimestamp | True to treat the first 4 bytes as a timestamp and make it system relative on arrival (Same as ID_TIMESTAMP for a packet enumeration type)

Returns:
  True on a successful packet send (this does not indicate the recipient performed the call), false on failure

Note:
  This is part of the Remote Procedure Call Subsystem

Implements RakPeerInterface.

Reimplemented in RakServer.

virtual void RakServerInterface::UnregisterAsRemoteProcedureCall | ( | char * | uniqueID | ) | `[pure virtual, inherited]`

Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter passed to RegisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakServer.

void RakServer::UnregisterAsRemoteProcedureCall | ( | char * | uniqueID | ) | `[virtual, inherited]`

Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter passed to RegisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Reimplemented from RakPeer.

virtual void RakPeerInterface::UnregisterAsRemoteProcedureCall | ( | char * | uniqueID | ) | `[pure virtual, inherited]`

Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter passed to RegisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implemented in RakClient, RakPeer, and RakServer.

void RakPeer::UnregisterAsRemoteProcedureCall | ( | char * | uniqueID | ) | `[virtual, inherited]`

Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall

Parameters:

  | uniqueID | A null terminated non-case senstive string of only letters to identify this procedure. Must match the parameter passed to RegisterAsRemoteProcedureCall

Note:
  This is part of the Remote Procedure Call Subsystem

Implements RakPeerInterface.

Reimplemented in RakClient, and RakServer.