ReplicaNet and RNLobby  1
CXPSession.h
1 /* START_LICENSE_HEADER
2 
3 Copyright (C) 2000 Martin Piper, original design and program code
4 Copyright (C) 2001 Replica Software
5 
6 This program file is copyright (C) Replica Software and can only be used under license.
7 For more information visit: http://www.replicanet.com/
8 Or email: info@replicanet.com
9 
10 END_LICENSE_HEADER */
11 #include "RNPlatform/Inc/MemoryTracking.h"
12 #ifndef __CXPSESSION_H__
13 #define __CXPSESSION_H__
14 
15 #ifdef __cplusplus
16 extern "C"
17 {
18 #endif
19 
20 #ifndef __XPSESSION_H__
21 
22 /* Declare some defines for types used internal to XPSession */
23 #define kXPSessionUnknownID (-1)
24 #define kXPSessionBroadcastID (-2)
25 
26 /* These are the internal message types for session messages */
27 #define kXPSessionPacketType_Unreliable (0)
28 #define kXPSessionPacketType_Reliable (1<<0)
29 #define kXPSessionPacketType_Certain (1<<1)
30 
31 /* Error values */
32 #define kXPSession_EOK (0)
33 #define kXPSession_EERROR (-1)
34 #define kXPSession_ETRANSPORT_CLOSED (-2)
35 #define kXPSession_ETRANSPORT_ERROR (-3)
36 
37 #define kTransportAnyGameChannel (0)
38 
39 #endif
40 
41 /* The type define for the handle that has to be passed in to each function so that the API knows what session you are trying to access */
42 typedef struct sCXPSession *hCXPSession;
43 
44 /* What follows are 'C' style function wrappers for the C++ class */
45 
50 hCXPSession CXPSession_Allocate(void);
51 
56 void CXPSession_Free(const hCXPSession handle);
57 
63 void CXPSession_Create(const hCXPSession handle,const char *name);
64 
71 void CXPSession_CreateWithProtocol(const hCXPSession handle,const char *name,const char *protocols);
72 
79 void CXPSession_ExportURL(const hCXPSession handle,char *nameBuffer,const int length);
80 
86 void CXPSession_Join(const hCXPSession handle,const char *url);
87 
92 void CXPSession_Find(const hCXPSession handle);
93 
99 void CXPSession_FindWithProtocols(const hCXPSession handle,const char *protocols);
100 
108 int CXPSession_EnumerateFound(const hCXPSession handle,char *nameBuffer,const int length);
109 
115 int CXPSession_GetGameChannel(const hCXPSession handle);
116 
122 void CXPSession_SetGameChannel(const hCXPSession handle,const int channel);
123 
129 int CXPSession_GetSessionID(const hCXPSession handle);
130 
136 int CXPSession_IsStable(const hCXPSession handle);
137 
144 int CXPSession_GetStatus(const hCXPSession handle);
145 
153 void CXPSession_DataSendToSessionUnreliable(const hCXPSession handle,const int sessionid,const char *data,const int length);
154 
162 void CXPSession_DataSendToSessionReliable(const hCXPSession handle,const int sessionid,const char *data,const int length);
163 
171 void CXPSession_DataSendToSessionCertain(const hCXPSession handle,const int sessionid,const char *data,const int length);
172 
182 int CXPSession_DataReceive(const hCXPSession handle,int *const fromsessionid,char *const data,int *const length,unsigned char *const type);
183 
189 int CXPSession_IsMaster(const hCXPSession handle);
190 
196 int CXPSession_GetJoiner(const hCXPSession handle);
197 
203 int CXPSession_GetLeaver(const hCXPSession handle);
204 
210 double CXPSession_GetTime(const hCXPSession handle);
211 
217 double CXPSession_GetLocalTime(const hCXPSession handle);
218 
224 float CXPSession_GetNetworkSendRate(const hCXPSession handle);
225 
231 float CXPSession_GetNetworkReceiveRate(const hCXPSession handle);
232 
238 int CXPSession_GetNetworkPacketsLost(const hCXPSession handle);
239 
248 void CXPSession_Poll(const hCXPSession handle);
249 
257 void CXPSession_SetManualPoll(const hCXPSession handle);
258 
267 void CXPSession_SetAutomaticPoll(const hCXPSession handle);
268 
273 void CXPSession_SetManualPollXPURL(const hCXPSession handle);
274 
279 void CXPSession_SetAutomaticPollXPURL(const hCXPSession handle);
280 
281 
288 void CXPSession_SetCanSpider(const hCXPSession handle,const int canSpider);
289 
295 int CXPSession_GetCanSpider(const hCXPSession handle);
296 
303 void CXPSession_SetCanBecomeMaster(const hCXPSession handle,const int canBeMaster);
304 
310 int CXPSession_GetCanBecomeMaster(const hCXPSession handle);
311 
317 float CXPSession_GetLatencyToMasterSession(const hCXPSession handle);
318 
324 void CXPSession_SetLatencyRecalculationDelay(const hCXPSession handle,const float seconds);
325 
331 void CXPSession_SetEncryption(const hCXPSession handle,const int enable);
332 
337 int CXPSession_GetEncryption(const hCXPSession handle);
338 
344 void CXPSession_Disconnect(const hCXPSession handle,const int sessionID);
345 
351 int CXPSession_GetPreConnectStatus(const hCXPSession handle);
352 
364 void CXPSession_SetPreConnect(const hCXPSession handle,const int enable);
365 
371 int CXPSession_GetPreConnect(const hCXPSession handle);
372 
377 void CXPSession_PreConnectHasFinished(const hCXPSession handle);
378 
384 void CXPSession_SetAutomaticPacketCompression(const hCXPSession handle,const int enable);
385 
391 int CXPSession_GetAutomaticPacketCompression(const hCXPSession handle);
392 
400 void CXPSession_GetCompressionStatistics(const hCXPSession handle,int *const before,int *const after,const int reset);
401 
409 void CXPSession_GetMergedStatistics(const hCXPSession handle,int *const sent,int *const received,const int reset);
410 
416 int CXPSession_GetMasterSessionID(const hCXPSession handle);
417 
428 int CXPSession_GetURLFromSessionID(const hCXPSession handle,const int sessionID,char *const url,const int urlLen);
429 
436 void CXPSession_SetClientOnly(const hCXPSession handle,const int isClient);
437 
443 int CXPSession_GetClientOnly(const hCXPSession handle);
444 
455 int CXPSession_GetBandwidthFromSessionID(const hCXPSession handle,const int sessionID,int *const bandwidth,int *const output,int *const input);
456 
457 #ifdef __cplusplus
458 }
459 #endif
460 
461 #endif