146 lines
3.9 KiB
C
146 lines
3.9 KiB
C
/*
|
|
|
|
PrivL0TCP.h
|
|
|
|
*/
|
|
|
|
|
|
#ifndef PRIVL0TCP_H
|
|
#define PRIVL0TCP_H
|
|
|
|
#include <NET\L0TCP.h>
|
|
|
|
#if !defined(__L0TCPPCWIN95_TYPES__)
|
|
#define __L0TCPPCWIN95_TYPES__
|
|
|
|
#if !defined(ONLY_TYPES)
|
|
#define L0TCPPCWIN95_UNDEF
|
|
#define ONLY_TYPES
|
|
#endif /* !ONLY_TYPES */
|
|
|
|
/*
|
|
* include here any other include files you need
|
|
*/
|
|
#include <windows.h>
|
|
#include <NET\macros.h>
|
|
#include "L0GlDef.h"
|
|
|
|
#ifndef _WINSOCKAPI_
|
|
#include <winsock.h>
|
|
#endif
|
|
|
|
#if defined(L0TCPPCWIN95_UNDEF)
|
|
#undef ONLY_TYPES
|
|
#undef L0TCPPCWIN95_UNDEF
|
|
#endif /* !L0TCPPCWIN95_UNDEF */
|
|
|
|
/* maximum number of channels managed by the layer */
|
|
|
|
#define C_ucL0MaxNumberOfTCPChannels ((unsigned char)15)
|
|
|
|
|
|
/*
|
|
* template name for all structures
|
|
* typedef struct tdstL0PCWin95TCPChannel_
|
|
* {
|
|
* } tdstL0PCWin95TCP;
|
|
*/
|
|
|
|
typedef struct tdstL0PCWin95TCPChannel_
|
|
{
|
|
tdeNetTransferStatus eChannelStatus;
|
|
|
|
/* the socket descriptor used for this channel */
|
|
SOCKET uiSD;
|
|
|
|
/* IP address of the destination host */
|
|
struct sockaddr_in stRemoteAddr;
|
|
|
|
/* buffer for storing the message being received */
|
|
|
|
tdpPointer pMsg;
|
|
|
|
/* number of bytes read and left to read to get the complete current message */
|
|
unsigned long ulBytesRead, ulBytesLeft;
|
|
|
|
/* can this channel be used to send broadcast messages ? */
|
|
unsigned char ubf1IsBroadcast : 1;
|
|
/* is it a channel opened to have a direct route to a player ? */
|
|
unsigned char ubf1IsReconnect : 1;
|
|
/* is this slot in use in the protocol's array of channels ? */
|
|
unsigned char ubf1IsSlotInUse : 1;
|
|
/* is this slot connected ? (i.e. connect/accept handshake is complete)*/
|
|
unsigned char ubf1IsConnected : 1;
|
|
} tdstL0PCWin95TCPChannel;
|
|
|
|
typedef enum {
|
|
eFirstConnect, eReconnect
|
|
} tdeTCPConnectMode;
|
|
|
|
#endif /* !__L0TCPPCWIN95_TYPES__ */
|
|
|
|
#if !defined(ONLY_TYPES)
|
|
|
|
#if !defined(__L0TCPPCWIN95_VARS__)
|
|
#define __L0TCPPCWIN95_VARS__
|
|
|
|
#undef EXTERN
|
|
#undef extern
|
|
#if !defined(GLOBALS)
|
|
#define EXTERN extern
|
|
#else /* !GLOBALS */
|
|
#define EXTERN
|
|
#endif /* !GLOBALS */
|
|
|
|
/*
|
|
* variables of the above types are here. declarations with initialization
|
|
* are of the form:
|
|
*
|
|
* <type> <variable name>
|
|
* #if defined(GLOBALS)
|
|
* = <initial values>
|
|
* #endif
|
|
* ;
|
|
*/
|
|
#endif /* !__L0TCPPCWIN95_VARS__ */
|
|
|
|
#if !defined (__L0TCPPCWIN95_PROTOS__)
|
|
#define __L0TCPPCWIN95_PROTOS__
|
|
|
|
/*
|
|
* put here the prototypes of the handler functions for the object
|
|
*/
|
|
tduwNetChannel uwL0PCWin95TCPStartChannelScan(void);
|
|
tduwNetChannel uwL0PCWin95TCPNextChannel(tduwNetChannel);
|
|
tduwNetChannel uwL0PCWin95TCPStartBroadcastChannelScan(void);
|
|
tduwNetChannel uwL0PCWin95TCPNextBroadcastChannel(tduwNetChannel);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPReadData(tduwNetChannel *, tdpPointer *);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPSendData(tduwNetChannel , tdpPointer);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPQueryChannelStatus(tduwNetChannel);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPChannelConnect(unsigned short, long, tdeTCPConnectMode, tduwNetChannel *);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPReconnect(unsigned short, long);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPGetPortAndAddress(unsigned short *, unsigned long *);
|
|
void vL0PCWin95TCPNewRouteKnown(tduwNetChannel);
|
|
tduwNetChannel uwL0PCWin95TCPGetNewReconnectChannel(void);
|
|
NetLib_tdeErrorStatus eL0PCWin95TCPInit(void);
|
|
void vL0PCWin95TCPCloseProtocol(void);
|
|
|
|
/* declarations needed when compiling for gameservice */
|
|
|
|
#define GS_FUNCTIONCALL __cdecl
|
|
|
|
typedef void (*tdfn_vConnectionResult)(int);
|
|
|
|
_NET_EXPORT_ void _NET_CALLING_CONV_ vL0PCWin95TCPCloseListenPort();
|
|
_NET_EXPORT_ void _NET_CALLING_CONV_ vL0PCWin95TCPGSSetCallBackResult(tdfn_vConnectionResult pfnConnectionResult);
|
|
_NET_EXPORT_ void GS_FUNCTIONCALL vL0PCWin95TCPGSSetPLayer(unsigned short, unsigned short);
|
|
_NET_EXPORT_ void GS_FUNCTIONCALL vL0PCWin95TCPGSSetChannel(unsigned short, char *);
|
|
_NET_EXPORT_ void GS_FUNCTIONCALL vL0PCWin95TCPGSInitiateConnection(void);
|
|
|
|
#endif /* !__L0TCPPCWIN95_PROTOS__ */
|
|
|
|
#endif /* !ONLY_TYPES */
|
|
|
|
|
|
#endif /* PRIVL0TCP_H */
|