RakNet
4.0
|
The RPC4 plugin is just an association between a C function pointer and a string. More...
#include <RPC4Plugin.h>
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. | |
void | RegisterSlot (const char *sharedIdentifier, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet), int callPriority) |
bool | RegisterBlockingFunction (const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, RakNet::BitStream *returnData, Packet *packet)) |
Same as RegisterFunction, but is called with CallBlocking() instead of Call() and returns a value to the caller. | |
void | RegisterLocalCallback (const char *uniqueID, MessageID messageId) |
bool | UnregisterFunction (const char *uniqueID) |
Unregister a function pointer previously registered with RegisterFunction() | |
bool | UnregisterBlockingFunction (const char *uniqueID) |
Same as UnregisterFunction, except for a blocking function. | |
bool | UnregisterLocalCallback (const char *uniqueID, MessageID messageId) |
bool | UnregisterSlot (const char *sharedIdentifier) |
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) |
bool | CallBlocking (const char *uniqueID, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, RakNet::BitStream *returnData) |
Same as call, but don't return until the remote system replies. Broadcasting parameter does not exist, this can only call one remote system. | |
void | Signal (const char *sharedIdentifier, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal) |
void | InterruptSignal (void) |
If called while processing a slot, no further slots for the currently executing signal will be executed. | |
![]() | |
virtual void | OnDetach (void) |
Called when the interface is detached. | |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual void | OnRakPeerStartup (void) |
Called when RakPeer is initialized. | |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
virtual void | OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason) |
virtual bool | UsesReliabilityLayer (void) const |
virtual void | OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
virtual void | OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError) |
virtual void | OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend) |
virtual void | OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time) |
virtual void | OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress) |
Protected Member Functions | |
virtual void | OnAttach (void) |
Called when the interface is attached. | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
Protected Attributes | |
unsigned int | nextSlotRegistrationCount |
Used so slots are called in the order they are registered. | |
The RPC4 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.
void RakNet::RPC4::Call | ( | const char * | uniqueID, |
RakNet::BitStream * | bitStream, | ||
PacketPriority | priority, | ||
PacketReliability | reliability, | ||
char | orderingChannel, | ||
const AddressOrGUID | systemIdentifier, | ||
bool | broadcast | ||
) |
[in] | uniqueID | 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() |
bool RakNet::RPC4::CallBlocking | ( | const char * | uniqueID, |
RakNet::BitStream * | bitStream, | ||
PacketPriority | priority, | ||
PacketReliability | reliability, | ||
char | orderingChannel, | ||
const AddressOrGUID | systemIdentifier, | ||
RakNet::BitStream * | returnData | ||
) |
Same as call, but don't return until the remote system replies. Broadcasting parameter does not exist, this can only call one remote system.
[in] | Identifier | originally passed to RegisterBlockingFunction() 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() |
[out] | returnData | Written to by the function registered with RegisterBlockingFunction. |
void RakNet::RPC4::CallLoopback | ( | const char * | uniqueID, |
RakNet::BitStream * | bitStream | ||
) |
[in] | Identifier | originally passed to RegisterFunction() on the local system |
[in] | bitStream | bitStream encoded data to send to the function callback |
|
protectedvirtual |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.
bool RakNet::RPC4::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.
[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 |
void RakNet::RPC4::RegisterLocalCallback | ( | const char * | uniqueID, |
MessageID | messageId | ||
) |
[in] | uniqueID | Identifier passed to RegisterFunction() |
[in] | messageId | What RakNet packet ID to call on, for example ID_DISCONNECTION_NOTIFICATION or ID_CONNECTION_LOST |
void RakNet::RPC4::RegisterSlot | ( | const char * | sharedIdentifier, |
void(*)(RakNet::BitStream *userData, Packet *packet) | functionPointer, | ||
int | callPriority | ||
) |
Register a slot, which is a function pointer to one or more implementations that supports this function signature When a signal occurs, all slots with the same identifier are called.
[in] | sharedIdentifier | A string to identify the slot. Recommended to be the same as 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] | callPriority | Slots are called by order of the highest callPriority first. For slots with the same priority, they are called in the order they are registered |
void RakNet::RPC4::Signal | ( | const char * | sharedIdentifier, |
RakNet::BitStream * | bitStream, | ||
PacketPriority | priority, | ||
PacketReliability | reliability, | ||
char | orderingChannel, | ||
const AddressOrGUID | systemIdentifier, | ||
bool | broadcast, | ||
bool | invokeLocal | ||
) |
Calls zero or more functions identified by sharedIdentifier registered with RegisterSlot()
[in] | sharedIdentifier | parameter of the same name passed to RegisterSlot() on the remote system |
[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() |
[in] | invokeLocal | If true, also sends to self. |
bool RakNet::RPC4::UnregisterFunction | ( | const char * | uniqueID | ) |
Unregister a function pointer previously registered with RegisterFunction()
[in] | Identifier | originally passed to RegisterFunction() |
bool RakNet::RPC4::UnregisterLocalCallback | ( | const char * | uniqueID, |
MessageID | messageId | ||
) |
Remove the association created with RegisterPacketCallback()
[in] | uniqueID | Identifier passed as uniqueID to RegisterLocalCallback() |
[in] | messageId | Identifier passed as messageId to RegisterLocalCallback() |
bool RakNet::RPC4::UnregisterSlot | ( | const char * | sharedIdentifier | ) |
Remove the association created with RegisterSlot()
[in] | sharedIdentifier | Identifier passed as sharedIdentifier to RegisterSlot() |