Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
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:

List of all members.

Classes

struct  LocalCallback
struct  LocalSlot
struct  LocalSlotObject

Public Member Functions

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 CallLoopback (const char *uniqueID, RakNet::BitStream *bitStream)
void InterruptSignal (void)
 If called while processing a slot, no further slots for the currently executing signal will be executed.
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.
bool RegisterFunction (const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet))
 Register a function pointer to be callable from a remote system.
void RegisterLocalCallback (const char *uniqueID, MessageID messageId)
void RegisterSlot (const char *sharedIdentifier, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet), int callPriority)
 RPC4 ()
void Signal (const char *sharedIdentifier, RakNet::BitStream *bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal)
bool UnregisterBlockingFunction (const char *uniqueID)
 Same as UnregisterFunction, except for a blocking function.
bool UnregisterFunction (const char *uniqueID)
 Unregister a function pointer previously registered with RegisterFunction()
bool UnregisterLocalCallback (const char *uniqueID, MessageID messageId)
bool UnregisterSlot (const char *sharedIdentifier)
virtual ~RPC4 ()

Static Public Member Functions

static void DestroyInstance (RPC4 *i)
static RPC4GetInstance (void)
static int LocalCallbackComp (const MessageID &key, LocalCallback *const &data)
static int LocalSlotObjectComp (const LocalSlotObject &key, const LocalSlotObject &data)

Public Attributes

DataStructures::Hash
< RakNet::RakString, LocalSlot
*, 256, RakNet::RakString::ToInteger > 
localSlots

Protected Member Functions

DataStructures::HashIndex GetLocalSlotIndex (const char *sharedIdentifier)
void InvokeSignal (DataStructures::HashIndex functionIndex, RakNet::BitStream *serializedParameters, Packet *packet)
virtual void OnAttach (void)
 Called when the interface is attached.
virtual PluginReceiveResult OnReceive (Packet *packet)

Protected Attributes

RakNet::BitStream blockingReturnValue
bool gotBlockingReturnValue
bool interruptSignal
DataStructures::OrderedList
< MessageID, LocalCallback
*, RPC4::LocalCallbackComp > 
localCallbacks
unsigned int nextSlotRegistrationCount
 Used so slots are called in the order they are registered.
DataStructures::Hash
< RakNet::RakString, void(*)(RakNet::BitStream
*, RakNet::BitStream *, Packet
*), 64, RakNet::RakString::ToInteger 
registeredBlockingFunctions )
DataStructures::Hash
< RakNet::RakString, void(*)(RakNet::BitStream
*, Packet
*), 64, RakNet::RakString::ToInteger 
registeredNonblockingFunctions )

Detailed Description

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

Definition at line 70 of file RPC4Plugin.h.


Constructor & Destructor Documentation

RakNet::RPC4::RPC4 ( )
virtual RakNet::RPC4::~RPC4 ( ) [virtual]

Member Function Documentation

void RakNet::RPC4::Call ( const char *  uniqueID,
RakNet::BitStream bitStream,
PacketPriority  priority,
PacketReliability  reliability,
char  orderingChannel,
const AddressOrGUID  systemIdentifier,
bool  broadcast 
)
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 
)
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 
)
Parameters:
[in]Identifieroriginally passed to RegisterFunction() on the local system
[in]bitStreambitStream encoded data to send to the function callback
static void RakNet::RPC4::DestroyInstance ( RPC4 i) [static]
static RPC4* RakNet::RPC4::GetInstance ( void  ) [static]
DataStructures::HashIndex RakNet::RPC4::GetLocalSlotIndex ( const char *  sharedIdentifier) [protected]
void RakNet::RPC4::InterruptSignal ( void  )
void RakNet::RPC4::InvokeSignal ( DataStructures::HashIndex  functionIndex,
RakNet::BitStream serializedParameters,
Packet packet 
) [protected]
static int RakNet::RPC4::LocalCallbackComp ( const MessageID key,
LocalCallback *const &  data 
) [static]
static int RakNet::RPC4::LocalSlotObjectComp ( const LocalSlotObject key,
const LocalSlotObject data 
) [static]
virtual void RakNet::RPC4::OnAttach ( void  ) [protected, virtual]

Reimplemented from RakNet::PluginInterface2.

virtual PluginReceiveResult RakNet::RPC4::OnReceive ( Packet packet) [protected, virtual]

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::RegisterBlockingFunction ( const char *  uniqueID,
void(*)(RakNet::BitStream *userData, RakNet::BitStream *returnData, Packet *packet functionPointer 
)
bool RakNet::RPC4::RegisterFunction ( const char *  uniqueID,
void(*)(RakNet::BitStream *userData, Packet *packet functionPointer 
)

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 
)
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::UnregisterBlockingFunction ( const char *  uniqueID)
bool RakNet::RPC4::UnregisterFunction ( const char *  uniqueID)
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()

Member Data Documentation

Definition at line 215 of file RPC4Plugin.h.

Definition at line 216 of file RPC4Plugin.h.

Definition at line 223 of file RPC4Plugin.h.

Definition at line 213 of file RPC4Plugin.h.

DataStructures::Hash<RakNet::RakString, LocalSlot*,256, RakNet::RakString::ToInteger> RakNet::RPC4::localSlots

Definition at line 201 of file RPC4Plugin.h.

unsigned int RakNet::RPC4::nextSlotRegistrationCount [protected]

Definition at line 221 of file RPC4Plugin.h.

DataStructures::Hash<RakNet::RakString, void ( * ) ( RakNet::BitStream *, RakNet::BitStream *, Packet * ),64, RakNet::RakString::ToInteger RakNet::RPC4::registeredBlockingFunctions) [protected]

Definition at line 212 of file RPC4Plugin.h.

DataStructures::Hash<RakNet::RakString, void ( * ) ( RakNet::BitStream *, Packet * ),64, RakNet::RakString::ToInteger RakNet::RPC4::registeredNonblockingFunctions) [protected]

Definition at line 211 of file RPC4Plugin.h.


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net