RakNet  4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RakNet::RPC4 Class Reference

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

#include <RPC4Plugin.h>

Inheritance diagram for RakNet::RPC4:
RakNet::PluginInterface2

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.
 
- Public Member Functions inherited from RakNet::PluginInterface2
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.
 

Detailed Description

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.

Note
You cannot use RPC4 at the same time as RPC3Plugin

Member Function Documentation

void RakNet::RPC4::Call ( const char *  uniqueID,
RakNet::BitStream bitStream,
PacketPriority  priority,
PacketReliability  reliability,
char  orderingChannel,
const AddressOrGUID  systemIdentifier,
bool  broadcast 
)
Deprecated:
, use Signal() Send to the specified remote instance of RakPeer.
Parameters
[in]uniqueIDIdentifier originally passed to RegisterFunction() on the remote system(s)
[in]bitStreambitStream encoded data to send to the function callback
[in]prioritySee RakPeerInterface::Send()
[in]reliabilitySee RakPeerInterface::Send()
[in]orderingChannelSee RakPeerInterface::Send()
[in]systemIdentifierSee RakPeerInterface::Send()
[in]broadcastSee 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.

Note
This function does not return until the remote system responds, disconnects, or was never connected to begin with
Parameters
[in]Identifieroriginally passed to RegisterBlockingFunction() on the remote system(s)
[in]bitStreambitStream encoded data to send to the function callback
[in]prioritySee RakPeerInterface::Send()
[in]reliabilitySee RakPeerInterface::Send()
[in]orderingChannelSee RakPeerInterface::Send()
[in]systemIdentifierSee RakPeerInterface::Send()
[out]returnDataWritten to by the function registered with RegisterBlockingFunction.
Returns
true if successfully called. False on disconnect, function not registered, or not connected to begin with
void RakNet::RPC4::CallLoopback ( const char *  uniqueID,
RakNet::BitStream bitStream 
)
Deprecated:
Use RegisterSlot() and Signal() with your own RakNetGUID as the send target Send to the attached instance of RakPeer. See RakPeerInterface::SendLoopback()
Parameters
[in]Identifieroriginally passed to RegisterFunction() on the local system
[in]bitStreambitStream encoded data to send to the function callback
virtual PluginReceiveResult RakNet::RPC4::OnReceive ( Packet packet)
protectedvirtual

OnReceive is called for every packet.

Parameters
[in]packetthe 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 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.

Deprecated:
Use RegisterSlot

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.

See Also
RegisterPacketCallback()
Parameters
[in]uniqueIDIdentifier to be associated with functionPointer. If this identifier is already in use, the call will return false.
[in]functionPointerC function pointer to be called
Returns
True if the hash of uniqueID is not in use, false otherwise.
void RakNet::RPC4::RegisterLocalCallback ( const char *  uniqueID,
MessageID  messageId 
)
Deprecated:
Use RegisterSlot and invoke on self only when the packet you want arrives When a RakNet Packet with the specified identifier is returned, execute CallLoopback() on a function previously registered with RegisterFunction() For example, you could call "OnClosedConnection" whenever you get ID_DISCONNECTION_NOTIFICATION or ID_CONNECTION_LOST
Parameters
[in]uniqueIDIdentifier passed to RegisterFunction()
[in]messageIdWhat 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.

Parameters
[in]sharedIdentifierA string to identify the slot. Recommended to be the same as the name of the function.
[in]functionPtrPointer to the function. For C, just pass the name of the function. For C++, use ARPC_REGISTER_CPP_FUNCTION
[in]callPrioritySlots 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()

Parameters
[in]sharedIdentifierparameter of the same name passed to RegisterSlot() on the remote system
[in]bitStreambitStream encoded data to send to the function callback
[in]prioritySee RakPeerInterface::Send()
[in]reliabilitySee RakPeerInterface::Send()
[in]orderingChannelSee RakPeerInterface::Send()
[in]systemIdentifierSee RakPeerInterface::Send()
[in]broadcastSee RakPeerInterface::Send()
[in]invokeLocalIf true, also sends to self.
bool RakNet::RPC4::UnregisterFunction ( const char *  uniqueID)

Unregister a function pointer previously registered with RegisterFunction()

Parameters
[in]Identifieroriginally passed to RegisterFunction()
Returns
True if the hash of uniqueID was in use, and hence removed. false otherwise.
bool RakNet::RPC4::UnregisterLocalCallback ( const char *  uniqueID,
MessageID  messageId 
)

Remove the association created with RegisterPacketCallback()

Parameters
[in]uniqueIDIdentifier passed as uniqueID to RegisterLocalCallback()
[in]messageIdIdentifier passed as messageId to RegisterLocalCallback()
Returns
True if the combination of uniqueID and messageId was in use, and hence removed
bool RakNet::RPC4::UnregisterSlot ( const char *  sharedIdentifier)

Remove the association created with RegisterSlot()

Parameters
[in]sharedIdentifierIdentifier passed as sharedIdentifier to RegisterSlot()

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