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

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

# AutoRPC Class Reference
[AutoRPC]

`#include <AutoRPC.h>`

Inheritance diagram for AutoRPC:

List of all members.

## Public Member Functions
| AutoRPC ()
| Constructor.
virtual | ~AutoRPC ()
| Destructor.
void | SetNetworkIDManager (NetworkIDManager *idMan)
bool | RegisterFunction (const char *uniqueIdentifier, void *functionPtr, bool isObjectMember)
bool | UnregisterFunction (const char *uniqueIdentifier, bool isObjectMember)
void | SetTimestamp (RakNetTime timeStamp)
void | SetSendParams (PacketPriority priority, PacketReliability reliability, char orderingChannel)
void | SetRecipientAddress (SystemAddress systemAddress, bool broadcast)
void | SetRecipientObject (NetworkID networkID)
RakNet::BitStream * | SetOutgoingExtraData (void)
RakNetTime | GetLastSenderTimestamp (void) const
SystemAddress | GetLastSenderAddress (void) const
RakPeerInterface * | GetRakPeer (void) const
| Returns the instance of RakPeer this plugin was attached to.
const char * | GetCurrentExecution (void) const
RakNet::BitStream * | GetIncomingExtraData (void)
bool | Call (const char *uniqueIdentifier)
template<class P1>
bool | Call (const char *uniqueIdentifier, P1 p1, bool es1=true)
template<class P1, class P2>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, bool es1=true, bool es2=true)
template<class P1, class P2, class P3>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, bool es1=true, bool es2=true, bool es3=true)
template<class P1, class P2, class P3, class P4>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, P4 p4, bool es1=true, bool es2=true, bool es3=true, bool es4=true)
template<class P1, class P2, class P3, class P4, class P5>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, bool es1=true, bool es2=true, bool es3=true, bool es4=true, bool es5=true)
template<class P1, class P2, class P3, class P4, class P5, class P6>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, bool es1=true, bool es2=true, bool es3=true, bool es4=true, bool es5=true, bool es6=true)
template<class P1, class P2, class P3, class P4, class P5, class P6, class P7>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, bool es1=true, bool es2=true, bool es3=true, bool es4=true, bool es5=true, bool es6=true, bool es7=true)
template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
bool | Call (const char *uniqueIdentifier, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, bool es1=true, bool es2=true, bool es3=true, bool es4=true, bool es5=true, bool es6=true, bool es7=true, bool es8=true)
## Protected Member Functions
void | OnAttach (RakPeerInterface *peer)
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)
virtual void | OnCloseConnection (RakPeerInterface *peer, SystemAddress systemAddress)
virtual void | OnShutdown (RakPeerInterface *peer)

## Detailed Description

The AutoRPC plugin allows you to call remote functions as if they were local functions, using the standard function call syntax No serialization or deserialization is needed. Advantages are that this is easier to use than regular RPC system. Disadvantages is that all parameters must be passable on the stack using memcpy (shallow copy). For other types of parameters, use SetOutgoingExtraData() and GetIncomingExtraData() Use the old system, or regular message passing, if you need greater flexibility

## Member Function Documentation

void AutoRPC::SetNetworkIDManager | ( | NetworkIDManager * | idMan | ) |

Sets the network ID manager to use for object lookup Required to call C++ object member functions via SetRecipientObject()

Parameters:

  `[in]` | idMan | Pointer to the network ID manager to use

bool AutoRPC::RegisterFunction | ( | const char * | uniqueIdentifier,
|  | void * | functionPtr,
|  | bool | isObjectMember |
| ) |  |  |

Registers a function pointer to be callable given an identifier for the pointer

Parameters:

  `[in]` | uniqueIdentifier | String identifying the function. Recommended that this is the name of the function
  `[in]` | functionPtr | Pointer to the function. For C, just pass the name of the function. For C++, use ARPC_REGISTER_CPP_FUNCTION
  `[in]` | isObjectMember | false if a C function. True if a member function of an object (C++)

Returns:
  True on success, false on uniqueIdentifier already used

bool AutoRPC::UnregisterFunction | ( | const char * | uniqueIdentifier,
|  | bool | isObjectMember |
| ) |  |  |

Unregisters a function pointer to be callable given an identifier for the pointer

Parameters:

  `[in]` | uniqueIdentifier | String identifying the function.
  `[in]` | isObjectMember | false if a C function. True if a member function of an object (C++)

Returns:
  True on success, false on function was not previously or is not currently registered.

void AutoRPC::SetTimestamp | ( | RakNetTime | timeStamp | ) |

Send or stop sending a timestamp with all following calls to Call() Use GetLastSenderTimestamp() to read the timestamp.

Parameters:

  `[in]` | timeStamp | Non-zero to pass this timestamp using the ID_TIMESTAMP system. 0 to clear passing a timestamp.

void AutoRPC::SetSendParams | ( | PacketPriority | priority,
|  | PacketReliability | reliability,
|  | char | orderingChannel |
| ) |  |  |

Set parameters to pass to RakPeer::Send() for all following calls to Call() Deafults to HIGH_PRIORITY, RELIABLE_ORDERED, ordering channel 0

Parameters:

  `[in]` | priority | See RakPeer::Send()
  `[in]` | reliability | See RakPeer::Send()
  `[in]` | orderingChannel | See RakPeer::Send()

void AutoRPC::SetRecipientAddress | ( | SystemAddress | systemAddress,
|  | bool | broadcast |
| ) |  |  |

Set system to send to for all following calls to Call() Defaults to UNASSIGNED_SYSTEM_ADDRESS, broadcast=true

Parameters:

  `[in]` | systemAddress | See RakPeer::Send()
  `[in]` | broadcast | See RakPeer::Send()

void AutoRPC::SetRecipientObject | ( | NetworkID | networkID | ) |

Set the NetworkID to pass for all following calls to Call() Defaults to UNASSIGNED_NETWORK_ID (none) If set, the remote function will be considered a C++ function, e.g. an object member function If set to UNASSIGNED_NETWORK_ID (none), the remote function will be considered a C function If this is set incorrectly, you will get back either RPC_ERROR_CALLING_C_AS_CPP or RPC_ERROR_CALLING_CPP_AS_C

See also:
  NetworkIDManager

Parameters:

  `[in]` | networkID | Returned from NetworkIDObject::GetNetworkID()

RakNet::BitStream * AutoRPC::SetOutgoingExtraData | ( | void |  | ) |

Write extra data to pass for all following calls to Call() Use BitStream::Reset to clear extra data. Don't forget to do this or you will waste bandwidth.

Returns:
  A bitstream you can write to to send extra data with each following call to Call()

RakNetTime AutoRPC::GetLastSenderTimestamp | ( | void |  | ) | const

If the last received function call has a timestamp included, it is stored and can be retrieved with this function.

Returns:
  0 if the last call did not have a timestamp, else non-zero

SystemAddress AutoRPC::GetLastSenderAddress | ( | void |  | ) | const

Returns the system address of the last system to send us a received function call Equivalent to the old system RPCParameters::sender

Returns:
  Last system to send an RPC call using this system

const char * AutoRPC::GetCurrentExecution | ( | void |  | ) | const

Returns the currently running RPC call identifier, set from RegisterFunction::uniqueIdentifier Returns an empty string "" if none

Returns:
  which RPC call is currently running

RakNet::BitStream * AutoRPC::GetIncomingExtraData | ( | void |  | ) |

Gets the bitstream written to via SetOutgoingExtraData(). Data is updated with each incoming function call

Returns:
  A bitstream you can read from with extra data that was written with SetOutgoingExtraData();

bool AutoRPC::Call | ( | const char * | uniqueIdentifier | ) | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

template<class P1>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | bool | es1 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | bool | es1 = `true`,
|  | bool | es2 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3, class P4>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | P4 | p4,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true`,
|  | bool | es4 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3, class P4, class P5>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | P4 | p4,
|  | P5 | p5,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true`,
|  | bool | es4 = `true`,
|  | bool | es5 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3, class P4, class P5, class P6>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | P4 | p4,
|  | P5 | p5,
|  | P6 | p6,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true`,
|  | bool | es4 = `true`,
|  | bool | es5 = `true`,
|  | bool | es6 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3, class P4, class P5, class P6, class P7>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | P4 | p4,
|  | P5 | p5,
|  | P6 | p6,
|  | P7 | p7,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true`,
|  | bool | es4 = `true`,
|  | bool | es5 = `true`,
|  | bool | es6 = `true`,
|  | bool | es7 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

template<class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>

bool AutoRPC::Call | ( | const char * | uniqueIdentifier,
|  | P1 | p1,
|  | P2 | p2,
|  | P3 | p3,
|  | P4 | p4,
|  | P5 | p5,
|  | P6 | p6,
|  | P7 | p7,
|  | P8 | p8,
|  | bool | es1 = `true`,
|  | bool | es2 = `true`,
|  | bool | es3 = `true`,
|  | bool | es4 = `true`,
|  | bool | es5 = `true`,
|  | bool | es6 = `true`,
|  | bool | es7 = `true`,
|  | bool | es8 = `true` |
| ) |  |  | `[inline]`

Calls a remote function, using whatever was last passed to SetTimestamp(), SetSendParams(), SetRecipientAddress(), and SetRecipientObject() Passed parameter(s), if any, are passed via memcpy and pushed on the stack for the remote function

Note:
  This ONLY works with variables that are passable via memcpy! If you need more flexibility, use SetOutgoingExtraData() and GetIncomingExtraData()

  The this pointer, for this instance of AutoRPC, is pushed as the last parameter on the stack. See AutoRPCSample.ccp for an example of this

Parameters:

  `[in]` | es1 | Endian swap parameter 1..x if necessary. Requires __BITSTREAM_NATIVE_END is undefined in RakNetDefines.h

void AutoRPC::OnAttach | ( | RakPeerInterface * | peer | ) | `[protected, virtual]`

Called when the interface is attached

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

PluginReceiveResult AutoRPC::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet |
| ) |  |  | `[protected, 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 from PluginInterface.

void AutoRPC::OnCloseConnection | ( | RakPeerInterface * | peer,
|  | SystemAddress | systemAddress |
| ) |  |  | `[protected, 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]` | systemAddress | The system whose connection was closed

Reimplemented from PluginInterface.

void AutoRPC::OnShutdown | ( | RakPeerInterface * | peer | ) | `[protected, virtual]`

Called when RakPeer is shutdown

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface.

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

- C:/RakNet/Source/AutoRPC.h
- C:/RakNet/Source/AutoRPC.cpp