| 1 |
#include "rakserver.h" |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
extern "C" { |
|---|
| 5 |
|
|---|
| 6 |
RakServerInterface *rakServerInterface; |
|---|
| 7 |
|
|---|
| 8 |
// external bitstream server can send |
|---|
| 9 |
extern RakNet::BitStream *dataStream; |
|---|
| 10 |
|
|---|
| 11 |
bool rakServerInterface_RPC(char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp) |
|---|
| 12 |
{ |
|---|
| 13 |
return rakServerInterface->RPC(uniqueID, data, bitLength, priority, reliability, orderingChannel, playerId, broadcast, shiftTimestamp); |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
bool rakServerInterface_Start(unsigned short AllowedPlayers, unsigned long connectionValidationInteger, int threadSleepTimer, unsigned short port) |
|---|
| 17 |
{ |
|---|
| 18 |
printf("%d %d %d %d\n", AllowedPlayers, connectionValidationInteger, threadSleepTimer, port); |
|---|
| 19 |
return rakServerInterface->Start(AllowedPlayers, connectionValidationInteger, threadSleepTimer, port); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
void rakServerInterface_Initialize() |
|---|
| 23 |
{ |
|---|
| 24 |
rakServerInterface=RakNetworkFactory::GetRakServerInterface(); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
void rakServerInterface_REG_AS_RPC(char* uniqueID, void ( *functionName ) ( char *input, int numberOfBitsOfData, PlayerID sender )) |
|---|
| 28 |
{ |
|---|
| 29 |
rakServerInterface->RegisterAsRemoteProcedureCall(uniqueID, functionName); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
// C interface to raknet |
|---|
| 33 |
bool isRakServerInterface() |
|---|
| 34 |
{ |
|---|
| 35 |
if (rakServerInterface != NULL) |
|---|
| 36 |
return true; |
|---|
| 37 |
|
|---|
| 38 |
return false; |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
Packet * rakServerInterface_ReceivePacket() |
|---|
| 42 |
{ |
|---|
| 43 |
return rakServerInterface->Receive(); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
void rakServerInterface_DeallocatePacket(Packet *p) |
|---|
| 47 |
{ |
|---|
| 48 |
rakServerInterface->DeallocatePacket(p); |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
void RakServerInterface_Destroy() |
|---|
| 53 |
{ |
|---|
| 54 |
RakNetworkFactory::DestroyRakServerInterface(rakServerInterface); |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
bool rakServerInterface_SendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast) |
|---|
| 59 |
{ |
|---|
| 60 |
return rakServerInterface->Send(dataStream, priority, reliability, orderingChannel, playerId, broadcast); |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
void rakServerInterface_Disconnect( unsigned blockDuration ) |
|---|
| 64 |
{ |
|---|
| 65 |
rakServerInterface->Disconnect(blockDuration); |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
int rakServerInterface_GetIndexFromPlayerID(PlayerID pid) |
|---|
| 69 |
{ |
|---|
| 70 |
return rakServerInterface->GetIndexFromPlayerID(pid); |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
} |
|---|