diff --git a/raknet/NetworkTypes.h b/raknet/NetworkTypes.h index f1d44d7..c5ae444 100644 --- a/raknet/NetworkTypes.h +++ b/raknet/NetworkTypes.h @@ -13,4 +13,9 @@ typedef unsigned int RakNetTime; typedef long long RakNetTimeNS; #endif +struct RPCParameters +{ + char _gap0; // TODO: RPCParameters +}; + #endif diff --git a/raknet/RPCMap.cpp b/raknet/RPCMap.cpp new file mode 100644 index 0000000..83c3a74 --- /dev/null +++ b/raknet/RPCMap.cpp @@ -0,0 +1,14 @@ +// TODO: Implement RPCMap.cpp + +// Called from the user thread for the local system +void RPCMap::AddIdentifierWithFunction(unsigned char uniqueIdentifier, void *functionPointer, bool isPointerToMember) +{ + RPCNode *node; + + node = new RPCNode; + node->uniqueIdentifier = uniqueIdentifier; + node->functionPointer=functionPointer; + node->isPointerToMember=isPointerToMember; + + rpcSet[uniqueIdentifier] = node; +} diff --git a/raknet/RPCMap.h b/raknet/RPCMap.h new file mode 100644 index 0000000..deaeb02 --- /dev/null +++ b/raknet/RPCMap.h @@ -0,0 +1,19 @@ +// TODO: Implement RPCMap.h + +#ifndef __RPC_MAP +#define __RPC_MAP + +#include "RPCNode.h" +#include "Export.h" + +#define RPC_MAP_SIZE 256 + +struct RAK_DLL_EXPORT RPCMap +{ +public: + void AddIdentifierWithFunction(unsigned char uniqueIdentifier, void *functionPointer, bool isPointerToMember); +protected: + RPCNode *rpcSet[RPC_MAP_SIZE]; +}; + +#endif diff --git a/raknet/RPCNode.h b/raknet/RPCNode.h new file mode 100644 index 0000000..a0077bf --- /dev/null +++ b/raknet/RPCNode.h @@ -0,0 +1,39 @@ +// TODO: Implement RPCNode.h + +#ifndef __RPC_NODE +#define __RPC_NODE + +#include "NetworkTypes.h" +#include "Export.h" + +/// \defgroup RAKNET_RPC Remote Procedure Call Subsystem +/// \brief A system to call C or object member procudures on other systems, and even to return return values. + +/// \ingroup RAKNET_RPC +/// \internal +/// +/// \brief Map registered procedure inside of a peer. +/// +struct RAK_DLL_EXPORT RPCNode +{ + /// String identifier of the RPC + unsigned char uniqueIdentifier + + /// Force casting of member functions to void * + union + { + void ( *staticFunctionPointer ) ( RPCParameters *rpcParms ); + #if (defined(__GNUC__) || defined(__GCCXML__)) + void (*memberFunctionPointer)(void* _this, RPCParameters *rpcParms); + #else + void (__cdecl *memberFunctionPointer)(void* _this, RPCParameters *rpcParms); + #endif + + void *functionPointer; + }; + + /// Is this a member function pointer? True if so. If false it's a regular C function. + bool isPointerToMember; +}; + +#endif