mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-23 06:57:31 +08:00
68 lines
2.4 KiB
C
68 lines
2.4 KiB
C
// TODO: Implement NetworkTypes.h
|
|
|
|
#ifndef __NETWORK_TYPES_H
|
|
#define __NETWORK_TYPES_H
|
|
|
|
// Define __GET_TIME_64BIT if you want to use large types for GetTime (takes more bandwidth when you transmit time though!)
|
|
// You would want to do this if your system is going to run long enough to overflow the millisecond counter (over a month)
|
|
#ifdef __GET_TIME_64BIT
|
|
typedef long long RakNetTime;
|
|
typedef long long RakNetTimeNS;
|
|
#else
|
|
typedef unsigned int RakNetTime;
|
|
typedef long long RakNetTimeNS;
|
|
#endif
|
|
|
|
/// \brief Unique identifier for a system.
|
|
/// Corresponds to a network address
|
|
struct RAK_DLL_EXPORT PlayerID
|
|
{
|
|
///The peer address from inet_addr.
|
|
unsigned int binaryAddress;
|
|
///The port number
|
|
unsigned short port;
|
|
|
|
bool operator==( const PlayerID& right ) const;
|
|
};
|
|
|
|
/// This represents a user message from another system.
|
|
struct Packet
|
|
{
|
|
/// The data from the sender
|
|
unsigned char* data;
|
|
};
|
|
|
|
struct RPCParameters
|
|
{
|
|
char _gap0; // TODO: RPCParameters
|
|
};
|
|
|
|
/// Index of an invalid PlayerID
|
|
const PlayerID UNASSIGNED_PLAYER_ID =
|
|
{
|
|
0xFFFFFFFF, 0xFFFF
|
|
};
|
|
|
|
/// \def REGISTER_STATIC_RPC
|
|
/// \ingroup RAKNET_RPC
|
|
/// Register a C function as a Remote procedure.
|
|
/// \param[in] networkObject Your instance of RakPeer, RakServer, or RakClient
|
|
/// \param[in] functionName The name of the C function to call
|
|
/// \attention 12/01/05 REGISTER_AS_REMOTE_PROCEDURE_CALL renamed to REGISTER_STATIC_RPC. Delete the old name sometime in the future
|
|
//#pragma deprecated(REGISTER_AS_REMOTE_PROCEDURE_CALL)
|
|
//#define REGISTER_AS_REMOTE_PROCEDURE_CALL(networkObject, functionName) REGISTER_STATIC_RPC(networkObject, functionName)
|
|
#define REGISTER_STATIC_RPC(networkObject, functionName) (networkObject)->RegisterAsRemoteProcedureCall((RPC_##functionName),(functionName))
|
|
|
|
/// \def UNREGISTER_STATIC_RPC
|
|
/// \ingroup RAKNET_RPC
|
|
/// Unregisters a remote procedure call
|
|
/// RPC member Functions MUST be marked __cdecl! See the ObjectMemberRPC example.
|
|
/// \param[in] networkObject The object that manages the function
|
|
/// \param[in] functionName The function name
|
|
// 12/01/05 UNREGISTER_AS_REMOTE_PROCEDURE_CALL Renamed to UNREGISTER_STATIC_RPC. Delete the old name sometime in the future
|
|
//#pragma deprecated(UNREGISTER_AS_REMOTE_PROCEDURE_CALL)
|
|
//#define UNREGISTER_AS_REMOTE_PROCEDURE_CALL(networkObject,functionName) UNREGISTER_STATIC_RPC(networkObject,functionName)
|
|
#define UNREGISTER_STATIC_RPC(networkObject,functionName) (networkObject)->UnregisterAsRemoteProcedureCall((RPC_##functionName))
|
|
|
|
#endif
|