reman3/Rayman_X/cpa/public/NET/NetSer.h

219 lines
12 KiB
C

/*
NetSer.h : API general functions
*/
#ifndef NETSER_H
#define NETSER_H
#include <NET\NetDef.h>
/* Contains players informations : */
typedef struct NetLib_tdstPlayerInfo_
{
NetLib_tduxPlayerId m_uxPlayerId;
tdpPointer pPlayerDescriptionData;
NetLib_tduxDescriptionLength uxPlayerDescriptionLength;
NetLib_tducBigLittleEndian m_ucLittleBigEndian;
NetLib_tduwJoinType JoinType;
char *Options;
short wNewPlayer;
char m_bOverInternet;
}NetLib_tdstPlayerInfo;
/* Contains session informations */
typedef struct NetLib_tdstSessionInfo_
{
NetLib_tduxSessionId uxSessionId;
NetLib_tdstPlayerInfo *d_stPlayerInfo;
tdpPointer pSessionDescriptionData;
unsigned short uwMaxNumberOfPlayers;
unsigned short uwNumberOfPlayers;
unsigned short uwIndexOfLocalPlayer;
NetLib_tduxDescriptionLength uxSessionDescriptionLength;
char *GameOptions;
NetLib_tduxDescriptionLength uxPlayerDescTruncation;
}NetLib_tdstSessionInfo;
typedef void (_NET_CALLING_CONV_ *NetLib_tdfnvReadReceiptCallback)(NetLib_tduxPlayerId,NetLib_uxReadReceiptId,NetLib_ucReadReceiptFlag,long);
typedef NetLib_tdulTimeInfo (_NET_CALLING_CONV_*NetLib_tdfnulGetTimeInfo)(void);
typedef unsigned long (_NET_CALLING_CONV_ *NetLib_tdfnulRandom)(void);
typedef void (_NET_CALLING_CONV_*NetLib_tdfnvDisconnectCallback)(NetLib_tduxPlayerId);
typedef NetLib_tdeErrorStatus (_NET_CALLING_CONV_*NetLib_tdfneFilterSessionCallback)(NetLib_tdstSessionInfo*);
typedef NetLib_tdeErrorStatus (_NET_CALLING_CONV_*NetLib_tdfnePlayerConnectionRequestFilterCallback)(NetLib_tdstPlayerInfo*,long*);
typedef struct NetLib_tdstReadReceiptDesc_
{
NetLib_tdulTimeInfo m_ulMaxWaitingTime;
NetLib_tdulTimeInfo m_ulReemitFreq;
NetLib_uxReadReceiptId m_uxReadReceiptId;
long m_lCallbackParam;
NetLib_tdfnvReadReceiptCallback p_fnv_ReadReceiptCallback;
}NetLib_tdstReadReceiptDesc;
/* Description of a send operation */
typedef struct NetLib_tdstSendDesc_
{
NetLib_tduxPlayerId m_tduxRecipientId; /*the recipient of the message*/
NetLib_tdulTimeInfo m_ulMaxWaitingTime; /* time-out */
tdpPointer m_pMessageData; /* a buffer containing the message */
unsigned short m_uwMessageLength; /* the length of the message*/
NetLib_tduxPriority m_uxPriority; /* Priority */
NetLib_tduxReplaceType m_uxReplaceType; /* Replace type */
NetLib_tduxReplaceFlag m_uxReplaceFlag; /* Replace flag */
NetLib_ucReadReceiptFlag m_ucReadReceiptFlag;/* flag for read receipt*/
NetLib_tdstReadReceiptDesc m_stReadReceiptDesc;/* Description of the read receipt*/
}NetLib_tdstSendDesc;
/* Description of a reading operation */
typedef struct NetLib_tdstReadDesc_
{
NetLib_tduxPlayerId m_uxSenderId; /* the sender of the message */
unsigned long m_uwMessageLength; /* the length of the buffer that will receive the message*/
unsigned long m_uwOrigMsgLength; /* the length of the message in the lib*/
tdpPointer m_pMessageData; /* the message */
NetLib_tdulTimeInfo m_ulMaxWaitingTime; /* time-out */
unsigned char m_bRemoveFromQueue; /* removing the message from the lib ?*/
}NetLib_tdstReadDesc;
/* Description of a listening operation */
typedef struct NetLib_tdstListenDesc_
{
NetLib_tdulTimeInfo m_ulMaxWaitingTime; /* time-out */
NetLib_tduxPlayerId m_uxPlayerId; /* the id of the new player */
tdpPointer m_pPlayerDescriptionData;/* description of the player */
NetLib_tduxDescriptionLength m_uxPlayerDescriptionLength;/* the length of the description buffer */
}NetLib_tdstListenDesc;
/* Description of a connecttosession operation*/
typedef struct NetLib_tdstConnectDesc_
{
NetLib_tdulTimeInfo m_ulMaxWaitingTime;/*time-out*/
NetLib_tduxSessionId m_uxSessionId; /* the id of the session to join*/
long m_lConDenyParam;
}NetLib_tdstConnectDesc;
typedef struct NetLib_tdstDoForAllDesc_
{
NetLib_tdeErrorStatus (_NET_CALLING_CONV_ *m_pfn_eForAll)(NetLib_tduxPlayerId,long);
long m_lParameter;
NetLib_tdeErrorStatus m_eGoOnCondition;
unsigned char m_ucIncludeLocal;
}NetLib_tdstDoForAllDesc;
/* Struct for blocking loop :*/
typedef struct tdstNetBlockingLoopDescription_
{
NetLib_tdulTimeInfo m_ulMaxWaitingTime;
NetLib_tdeErrorStatus (_NET_CALLING_CONV_ *m_pfn_eEvaluation)(long);
long m_lParam;
NetLib_tdeErrorStatus m_eGoOnCondition;
}tdstNetBlockingLoopDescription;
#define NetLib_C_ucAcceptWithoutListening ((unsigned char)1)
#define NetLib_C_ucListenForAccept ((unsigned char)0)
#define NetLib_C_uwInvalidPosition ((unsigned short)-1)
#define NetLib_C_ucNotIncludeLocalPlayer ((unsigned char)0)
#define NetLib_C_ucIncludeLocalPlayer ((unsigned char)1)
/* defining read receipt flags*/
#define NetLib_C_ucNoReadReceipt ((unsigned char)-1)
#define NetLib_C_ucReadReceiptRequired ((unsigned char)1)
#define NetLib_C_ucReadReceiptSuccess ((unsigned char)2)
#define NetLib_C_ucReadReceiptFailure ((unsigned char)0)
/* defining broadcast state */
#define NetLib_C_TrueBroadcast 1
#define NetLib_C_SimulBroadcast 0
/*////////////////////////////////////////////////////////////////////
DEFINITION OF FUNCTIONS :
////////////////////////////////////////////////////////////////////*/
/* Initialisation functions :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eInitializeGlobalData(unsigned long, char*,NetLib_tduwMode uwMode,short BroadcastIpx);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_eSetBroadcastState(short BroadcastIpx);
/* Callback initialisation function :*/
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vInitializeGetTimeInfoFunction(NetLib_tdfnulGetTimeInfo, unsigned long);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vInitializeMemcopyFunction(td_pfn_vNetMemcpy);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vInitializeRandomFunction(NetLib_tdfnulRandom);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vRegisterDisconnectCallback(NetLib_tdfnvDisconnectCallback);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vRegisterFilterSessionCallback(NetLib_tdfneFilterSessionCallback);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vRegisterPlayerConnectionRequestFilter(NetLib_tdfnePlayerConnectionRequestFilterCallback);
/* Setting NetLib parameters :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSetMaxNumberOfPlayers(unsigned short NewMaxNumberOfPlayer);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSetSessionDescription(NetLib_tduxDescriptionLength,tdpPointer,char);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSetLocalPlayerDescription(NetLib_tduxDescriptionLength,tdpPointer,char);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSetPlayerDescription(NetLib_tduxPlayerId,NetLib_tduxDescriptionLength,tdpPointer,char);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vSetAcceptWithoutListening(unsigned char);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSetInternetSimulDelay(NetLib_tdulTimeInfo ulTimeToWait,NetLib_tdulTimeInfo ulRandom);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vSetPreSessionPlayerMaxWaitingTime(NetLib_tdulTimeInfo);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vSetReemissionMode(unsigned char);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSampleLagsAndLatencies(unsigned short,unsigned long);
/* getting informations :*/
_NET_EXPORT_ NetLib_tducBigLittleEndian _NET_CALLING_CONV_ NetLib_ucGetLittleBigEndian(void);
_NET_EXPORT_ NetLib_tducBigLittleEndian _NET_CALLING_CONV_ NetLib_ucGetPlayerLittleBigEndian(NetLib_tduxPlayerId);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eIsPlayerOverInternet(NetLib_tduxPlayerId);
_NET_EXPORT_ NetLib_tduxSessionId _NET_CALLING_CONV_ NetLib_uxGetSessionId(void);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eGetSessionDescription(NetLib_tduxDescriptionLength*,tdpPointer);
_NET_EXPORT_ NetLib_tduxDescriptionLength _NET_CALLING_CONV_ NetLib_uxGetSessionDescriptionLength(void);
_NET_EXPORT_ unsigned short _NET_CALLING_CONV_ NetLib_uwGetMaxNumberOfPlayers(void);
_NET_EXPORT_ unsigned short _NET_CALLING_CONV_ NetLib_uwGetTotalNumberPlayer(void);
_NET_EXPORT_ NetLib_tduxPlayerId _NET_CALLING_CONV_ NetLib_uxGetOwnPlayerId(void);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eGetPlayersIdFromSession(NetLib_tduxPlayerId *,unsigned short *);
_NET_EXPORT_ unsigned short _NET_CALLING_CONV_ NetLib_uwGetFirstRemotePlayerIdPosition(void);
_NET_EXPORT_ NetLib_tduxPlayerId _NET_CALLING_CONV_ NetLib_uxGetNextRemotePlayerId(unsigned short*);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eGetPlayerDescription(NetLib_tduxDescriptionLength*,tdpPointer, NetLib_tduxPlayerId);
_NET_EXPORT_ NetLib_tduxDescriptionLength _NET_CALLING_CONV_ NetLib_uxGetPlayerDescriptionLength(NetLib_tduxPlayerId);
_NET_EXPORT_ NetLib_tdulTimeInfo _NET_CALLING_CONV_ NetLib_ulTellRemoteTimerValue(NetLib_tduxPlayerId ,NetLib_tdulTimeInfo);
_NET_EXPORT_ NetLib_tdulTimeInfo _NET_CALLING_CONV_ NetLib_ulTellRemotePlayerLag(NetLib_tduxPlayerId ulRemoteId,unsigned short *pNumberOfPing);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eAcceptWithoutListening();
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_eGetPlayerName(NetLib_tduxPlayerId uxPlayerId,char *Name,unsigned short SizeMaxName);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_eGetGameName(char *Name,unsigned short SizeMaxName);
/* Getting sessions :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eOpenGetActiveSessions(unsigned short,NetLib_tdulTimeInfo,NetLib_tduxDescriptionLength uxMaxPlayerInfo);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eCloseGetActiveSessions(void);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eCloseAndResetGetActiveSessions(void);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eGetSessionsFound(unsigned short *,NetLib_tdstSessionInfo **);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eGetActiveSessions(unsigned short*,NetLib_tdstSessionInfo**,NetLib_tdulTimeInfo,NetLib_tduxDescriptionLength uxMaxPlayerInfo);
/* Connecting to a session :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eConnectToSession(NetLib_tdstConnectDesc*);
/* Accepting a player in the session :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eListenForRequest(NetLib_tdstListenDesc*);
/* Disconnection */
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eDisconnectRemotePlayer(NetLib_tduxPlayerId);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vDisconnectAllRemotePlayers(void);
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vDisconnectFromSession(void);
/* Sending message functions :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eSendMessage(NetLib_tdstSendDesc *);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eFlushSendingList(NetLib_tdulTimeInfo);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_ePlayerFlushCompleted(NetLib_tduxPlayerId,long);
/* getting message functions :*/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eReadMessage(NetLib_tdstReadDesc *);
/* Engine :*/
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vEngine(void);
/**/
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eDoForAllPlayers(NetLib_tdstDoForAllDesc *);
_NET_EXPORT_ NetLib_tdeErrorStatus _NET_CALLING_CONV_ NetLib_eBlockingLoop(tdstNetBlockingLoopDescription *);
/* Closing the librairy :*/
_NET_EXPORT_ void _NET_CALLING_CONV_ NetLib_vCloseLibrary(void);
#endif /* NETSER_H */