root/trunk/raknet/raknet/server.d

Revision 32, 2.4 kB (checked in by clayasaurus, 6 years ago)

updated raknet to include more functionality

Line 
1 module raknet.server;
2
3 import raknet.raknet;
4
5
6 bool RPC(char *uniqueID, char *data, uint bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp)
7 {        
8    return rakServerInterface_RPC(uniqueID, data, bitLength, priority, reliability, orderingChannel, playerId, broadcast, shiftTimestamp);
9 }
10
11 bool start(ushort AllowedPlayers, uint connectionValidationInteger, int threadSleepTimer, ushort port)
12 {
13    return rakServerInterface_Start(AllowedPlayers, connectionValidationInteger, threadSleepTimer, port);
14 }
15
16 void initialize()
17 { 
18    rakServerInterface_Initialize();
19 }
20
21 bool isServer()
22 {
23    return isRakServerInterface();
24 }
25
26 Packet* receivePacket()
27 {
28    return rakServerInterface_ReceivePacket();
29 }
30
31 void deallocatePacket(Packet *p)
32 {
33    rakServerInterface_DeallocatePacket(p);
34 }
35
36 void destroy()
37 {
38    RakServerInterface_Destroy();
39 }
40
41 void disconnect( uint blockDuration )
42 {
43    rakServerInterface_Disconnect(blockDuration);
44 }
45
46 bool sendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel,
47                    PlayerID playerId, bool broadcast)
48 {
49    return rakServerInterface_SendBitstream(priority, reliability, orderingChannel, playerId, broadcast);
50 }
51
52 int getIndexFromPlayerID(PlayerID pid)
53 {
54    return rakServerInterface_GetIndexFromPlayerID(pid);
55 }
56
57 // will crash if not alias'd
58 alias rakServerInterface_REG_AS_RPC REG_AS_RPC;
59
60 extern(C):
61
62
63 private
64 {
65 // hide ugly function names
66 bool rakServerInterface_RPC(char *uniqueID, char *data, uint bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast, bool shiftTimestamp);
67 bool rakServerInterface_Start(ushort AllowedPlayers, uint connectionValidationInteger, int threadSleepTimer, ushort port);
68 void rakServerInterface_Initialize();
69 void rakServerInterface_REG_AS_RPC(char* uniqueID, void ( *functionName ) ( char *input, int numberOfBitsOfData, PlayerID sender )  );
70 bool isRakServerInterface();
71 Packet* rakServerInterface_ReceivePacket();
72 void rakServerInterface_DeallocatePacket(Packet *);
73 void RakServerInterface_Destroy();
74 bool rakServerInterface_SendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel, PlayerID playerId, bool broadcast);
75 void rakServerInterface_Disconnect( uint blockDuration );
76 int rakServerInterface_GetIndexFromPlayerID(PlayerID pid);
77 }
Note: See TracBrowser for help on using the browser.