Files | |
file | RPCMap.h |
[Internal] A container class for a list of RPCNodes | |
file | RPCNode.h |
[Internal] Holds information related to a RPC | |
Defines | |
#define | REGISTER_STATIC_RPC(networkObject, functionName) (networkObject)->RegisterAsRemoteProcedureCall((#functionName),(functionName)) |
RPC Function Implementation Use RPC3. | |
#define | CLASS_MEMBER_ID(className, functionName) #className "_" #functionName |
Concatenate two strings. | |
#define | REGISTER_CLASS_MEMBER_RPC(networkObject, className, functionName) {union {void (__cdecl className::*cFunc)( RPCParameters *rpcParms ); void* voidFunc;}; cFunc=&className::functionName; networkObject->RegisterClassMemberRPC(CLASS_MEMBER_ID(className, functionName),voidFunc);} |
Register a member function of an instantiated object as a Remote procedure call. | |
#define | UNREGISTER_STATIC_RPC(networkObject, functionName) (networkObject)->UnregisterAsRemoteProcedureCall((#functionName)) |
Functions | |
void | RakPeer::RegisterAsRemoteProcedureCall (const char *uniqueID, void(*functionPointer)(RPCParameters *rpcParms)) |
Register a C or static member function as available for calling a remote procedure call. | |
void | RakPeer::RegisterClassMemberRPC (const char *uniqueID, void *functionPointer) |
Register a C++ member function as available for calling as a remote procedure call. | |
void | RakPeer::UnregisterAsRemoteProcedureCall (const char *uniqueID) |
Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall. Only call offline. | |
void | RakPeer::SetNetworkIDManager (NetworkIDManager *manager) |
Used by Object member RPC to lookup objects given that object's ID. Also used by the ReplicaManager plugin. | |
bool | RakPeer::RPC (const char *uniqueID, const char *data, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget) |
bool | RakPeer::RPC (const char *uniqueID, const RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget) |
Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall. | |
virtual void | RakPeerInterface::RegisterAsRemoteProcedureCall (const char *uniqueID, void(*functionPointer)(RPCParameters *rpcParms))=0 |
virtual void | RakPeerInterface::RegisterClassMemberRPC (const char *uniqueID, void *functionPointer)=0 |
virtual void | RakPeerInterface::UnregisterAsRemoteProcedureCall (const char *uniqueID)=0 |
virtual void | RakPeerInterface::SetNetworkIDManager (NetworkIDManager *manager)=0 |
virtual bool | RakPeerInterface::RPC (const char *uniqueID, const char *data, BitSize_t bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0 |
virtual bool | RakPeerInterface::RPC (const char *uniqueID, const RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, RakNetTime *includedTimestamp, NetworkID networkID, RakNet::BitStream *replyFromTarget)=0 |
Use RPC3
#define REGISTER_CLASS_MEMBER_RPC | ( | networkObject, | |||
className, | |||||
functionName | ) | {union {void (__cdecl className::*cFunc)( RPCParameters *rpcParms ); void* voidFunc;}; cFunc=&className::functionName; networkObject->RegisterClassMemberRPC(CLASS_MEMBER_ID(className, functionName),voidFunc);} |
Register a member function of an instantiated object as a Remote procedure call.
RPC member Functions MUST be marked __cdecl!
[in] | networkObject | Your instance of RakPeer, RakPeer, or RakPeer |
[in] | className | The class containing the function |
[in] | functionName | The name of the function (not in quotes, just the name) |
#define REGISTER_STATIC_RPC | ( | networkObject, | |||
functionName | ) | (networkObject)->RegisterAsRemoteProcedureCall((#functionName),(functionName)) |
RPC Function Implementation Use RPC3.
The Remote Procedure Call Subsystem provide the RPC paradigm to RakNet user. It consists in providing remote function call over the network. A call to a remote function require you to prepare the data for each parameter (using BitStream) for example.
Use the following C function prototype for your callbacks
void functionName(RPCParameters *rpcParms);
void MyFunc(RPCParameters *rpcParms) {} RakPeer *rakClient; REGISTER_AS_REMOTE_PROCEDURE_CALL(rakClient, MyFunc); This would allow MyFunc to be called from the server using (for example) rakServer->RPC("MyFunc", 0, clientID, false);
Register a C function as a Remote procedure.
[in] | networkObject | Your instance of RakPeer, RakPeer, or RakPeer |
[in] | functionName | The name of the C function to call |
#define UNREGISTER_STATIC_RPC | ( | networkObject, | |||
functionName | ) | (networkObject)->UnregisterAsRemoteProcedureCall((#functionName)) |
Unregisters a remote procedure call RPC member Functions MUST be marked __cdecl! See the ObjectMemberRPC example.
[in] | networkObject | The object that manages the function |
[in] | functionName | The function name |
virtual void RakPeerInterface::RegisterAsRemoteProcedureCall | ( | const char * | uniqueID, | |
void(*)(RPCParameters *rpcParms) | functionPointer | |||
) | [pure virtual, inherited] |
Register a C or static member function as available for calling as a remote procedure call
[in] | uniqueID | A null-terminated unique string to identify this procedure. See RegisterClassMemberRPC() for class member functions. |
[in] | functionPointer(...) | The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered |
Implemented in RakPeer.
void RakPeer::RegisterAsRemoteProcedureCall | ( | const char * | uniqueID, | |
void(*)(RPCParameters *rpcParms) | functionPointer | |||
) | [virtual, inherited] |
Register a C or static member function as available for calling a remote procedure call.
[in] | uniqueID | A null-terminated unique string to identify this procedure. See RegisterClassMemberRPC() for class member functions. |
[in] | functionPointer(...) | The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered |
Implements RakPeerInterface.
virtual void RakPeerInterface::RegisterClassMemberRPC | ( | const char * | uniqueID, | |
void * | functionPointer | |||
) | [pure virtual, inherited] |
Register a C++ member function as available for calling as a remote procedure call.
[in] | uniqueID | A null terminated string to identify this procedure. Recommended you use the macro REGISTER_CLASS_MEMBER_RPC to create the string. Use RegisterAsRemoteProcedureCall() for static functions. |
[in] | functionPointer | The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall |
Implemented in RakPeer.
void RakPeer::RegisterClassMemberRPC | ( | const char * | uniqueID, | |
void * | functionPointer | |||
) | [virtual, inherited] |
Register a C++ member function as available for calling as a remote procedure call.
[in] | uniqueID | A null terminated string to identify this procedure. It is recommended to use the macro REGISTER_CLASS_MEMBER_RPC to create the string. Use RegisterAsRemoteProcedureCall() for static functions. |
[in] | functionPointer | The name of the function to be used as a function pointer. This can be called whether active or not, and registered functions stay registered unless unregistered with UnregisterAsRemoteProcedureCall. |
Implements RakPeerInterface.
virtual bool RakPeerInterface::RPC | ( | const char * | uniqueID, | |
const RakNet::BitStream * | bitStream, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
const AddressOrGUID | systemIdentifier, | |||
bool | broadcast, | |||
RakNetTime * | includedTimestamp, | |||
NetworkID | networkID, | |||
RakNet::BitStream * | replyFromTarget | |||
) | [pure virtual, inherited] |
Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall. If you want that function to return data you should call RPC from that system in the same wayReturns true on a successful packet send (this does not indicate the recipient performed the call), false on failure
[in] | uniqueID | A NULL terminated string identifying the function to call. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
[in] | data | The data to send |
[in] | bitLength | The number of bits of data |
[in] | priority | What priority level to send on. See PacketPriority.h. |
[in] | reliability | How reliability to send this data. See PacketPriority.h. |
[in] | orderingChannel | When using ordered or sequenced message, what channel to order these on. |
[in] | systemAddress | Who to send this message to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
[in] | includedTimestamp | Pass a timestamp if you wish, to be adjusted in the usual fashion as per ID_TIMESTAMP. Pass 0 to not include a timestamp. |
[in] | networkID | For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDObject and pass the value returned by NetworkIDObject::GetNetworkID for that object. |
[in] | replyFromTarget | If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which should be remotely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed. |
Implemented in RakPeer.
virtual bool RakPeerInterface::RPC | ( | const char * | uniqueID, | |
const char * | data, | |||
BitSize_t | bitLength, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
const AddressOrGUID | systemIdentifier, | |||
bool | broadcast, | |||
RakNetTime * | includedTimestamp, | |||
NetworkID | networkID, | |||
RakNet::BitStream * | replyFromTarget | |||
) | [pure virtual, inherited] |
Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall().
[in] | uniqueID | A NULL terminated string identifying the function to call. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
[in] | data | The data to send |
[in] | bitLength | The number of bits of data |
[in] | priority | What priority level to send on. See PacketPriority.h. |
[in] | reliability | How reliability to send this data. See PacketPriority.h. |
[in] | orderingChannel | When using ordered or sequenced message, what channel to order these on. |
[in] | systemAddress | Who to send this message to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
[in] | includedTimestamp | Pass a timestamp if you wish, to be adjusted in the usual fashion as per ID_TIMESTAMP. Pass 0 to not include a timestamp. |
[in] | networkID | For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDObject and pass the value returned by NetworkIDObject::GetNetworkID for that object. |
[in] | replyFromTarget | If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which should be remotely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed. |
Implemented in RakPeer.
bool RakPeer::RPC | ( | const char * | uniqueID, | |
const RakNet::BitStream * | bitStream, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
const AddressOrGUID | systemIdentifier, | |||
bool | broadcast, | |||
RakNetTime * | includedTimestamp, | |||
NetworkID | networkID, | |||
RakNet::BitStream * | replyFromTarget | |||
) | [virtual, inherited] |
Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall.
------------------------------------------- Deprecated -------------------------
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.
[in] | uniqueID | A NULL terminated string identifying the function to call. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
[in] | bitStream | The bit stream to send. |
[in] | priority | What priority level to send on. See PacketPriority.h. |
[in] | reliability | How reliably to send this data. See PacketPriority.h. |
[in] | orderingChannel | When using ordered or sequenced message, what channel to order these on. |
[in] | systemAddress | Who to send this message to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
[in] | includedTimestamp | Pass a timestamp if you wish, to be adjusted in the usual fashion as per ID_TIMESTAMP. Pass 0 to not include a timestamp. |
[in] | networkID | For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDObject and pass the value returned by NetworkIDObject::GetNetworkID for that object. |
[in] | replyFromTarget | If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which should be remotely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed. |
Implements RakPeerInterface.
bool RakPeer::RPC | ( | const char * | uniqueID, | |
const char * | data, | |||
BitSize_t | bitLength, | |||
PacketPriority | priority, | |||
PacketReliability | reliability, | |||
char | orderingChannel, | |||
const AddressOrGUID | systemIdentifier, | |||
bool | broadcast, | |||
RakNetTime * | includedTimestamp, | |||
NetworkID | networkID, | |||
RakNet::BitStream * | replyFromTarget | |||
) | [virtual, inherited] |
------------------------------------------- Deprecated -------------------------
Calls a C function on the remote system that was already registered using RegisterAsRemoteProcedureCall().
[in] | uniqueID | A NULL terminated string identifying the function to call. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
[in] | data | The data to send |
[in] | bitLength | The number of bits of data |
[in] | priority | What priority level to send on. See PacketPriority.h. |
[in] | reliability | How reliability to send this data. See PacketPriority.h. |
[in] | orderingChannel | When using ordered or sequenced message, what channel to order these on. |
[in] | systemAddress | Who to send this message to, or in the case of broadcasting who not to send it to. Pass either a SystemAddress structure or a RakNetGUID structure. Use UNASSIGNED_SYSTEM_ADDRESS or to specify none |
[in] | broadcast | True to send this packet to all connected systems. If true, then systemAddress specifies who not to send the packet to. |
[in] | includedTimestamp | Pass a timestamp if you wish, to be adjusted in the usual fashion as per ID_TIMESTAMP. Pass 0 to not include a timestamp. |
[in] | networkID | For static functions, pass UNASSIGNED_NETWORK_ID. For member functions, you must derive from NetworkIDObject and pass the value returned by NetworkIDObject::GetNetworkID for that object. |
[in] | replyFromTarget | If 0, this function is non-blocking. Otherwise it will block while waiting for a reply from the target procedure, which should be remotely written to RPCParameters::replyToSender and copied to replyFromTarget. The block will return early on disconnect or if the sent packet is unreliable and more than 3X the ping has elapsed. |
Implements RakPeerInterface.
virtual void RakPeerInterface::SetNetworkIDManager | ( | NetworkIDManager * | manager | ) | [pure virtual, inherited] |
Used by Object member RPC to lookup objects given that object's ID Also used by the ReplicaManager plugin
[in] | An | instance of NetworkIDManager to use for the lookup. |
Implemented in RakPeer.
void RakPeer::SetNetworkIDManager | ( | NetworkIDManager * | manager | ) | [virtual, inherited] |
Used by Object member RPC to lookup objects given that object's ID. Also used by the ReplicaManager plugin.
[in] | An | instance of NetworkIDManager to use for the loookup. |
Implements RakPeerInterface.
virtual void RakPeerInterface::UnregisterAsRemoteProcedureCall | ( | const char * | uniqueID | ) | [pure virtual, inherited] |
Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall. Only call offline.
[in] | uniqueID | A string of only letters to identify this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
Implemented in RakPeer.
void RakPeer::UnregisterAsRemoteProcedureCall | ( | const char * | uniqueID | ) | [virtual, inherited] |
Unregisters a C function as available for calling as a remote procedure call that was formerly registered with RegisterAsRemoteProcedureCall. Only call offline.
[in] | uniqueID | A string of only letters to identify this procedure. Recommended you use the macro CLASS_MEMBER_ID for class member functions. |
Implements RakPeerInterface.