/*
 
 
L0GlDef.h : public type declaration
 
 
*/
 
#if !defined(__L0COMMONPCWIN95_TYPES__)
#define __L0COMMONPCWIN95_TYPES__
 
#if !defined(ONLY_TYPES)
#define L0COMMONPCWIN95_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
 
/*
 * include files
 */
#include <NET\macros.h>
#include "PrivNetDef.h"
 
#if defined(L0COMMONPCWIN95_UNDEF)
#undef ONLY_TYPES
#undef L0COMMONPCWIN95_UNDEF
#endif /* !L0COMMONPCWIN95_UNDEF */
 
M_BeginDeclareEnumerate(tdeNetTransferStatus)
 E_ts_OK,
 E_ts_UnknownSenderId, 
 E_ts_RouteUnknown,
 
 E_ts_EmissionInProgress,
 E_ts_PacketFailure,
 E_ts_ChannelUnitialized,
 E_ts_InvalidChannel,
 E_ts_Invalid
/*
 * constants are here
 */
M_EndDeclareEnumerate(tdeNetTransferStatus, unsigned char)
 
/* function type :*/
typedef tduwNetChannel (*tdfn_uwStartChannelScan)(void);
typedef tduwNetChannel (*tdfn_uwNextChannelScan)(tduwNetChannel);
typedef NetLib_tdeErrorStatus (*tdfn_eReadData)(tduwNetChannel*,tdpPointer*);
typedef NetLib_tdeErrorStatus (*tdfn_eSendData)(tduwNetChannel,tdpPointer);
typedef NetLib_tdeErrorStatus (*tdfn_eQueryChannelStatus)(tduwNetChannel);
typedef void (*tdfn_vCloseChannel)(tduwNetChannel);
typedef void (*tdfn_vLevel0NetEngine)(void);
typedef void (*tdfn_vLevel0CloseProtocol)(void);
typedef NetLib_tdeErrorStatus (*tdfn_eAddNewPlayer)(tduwNetChannel*,void*);
 
/* maximum number of messages that can be stored in a channel's waiting queue */
 
#define C_ucL0MaxNumberOfMsgPerChannel 20
 
/* 
 * control structure to physically address a given protocol
 */
typedef struct tdstNetProtocolInterface_
{
 /* logical identification of the protocol */
 tdeNetProtocol eProtocol;
 
 /* 
  * functions for:
  * 1: scanning the channels (init scan / step channel forward)
  * 2: reading data
  * 3: sending data
  * 4: querying channel status
  * 5: closing a channel
  * 6: level0-net engine 
  * 7: closing the protocol
  *
  * 8: (a boolean, not a function) is it a protocol that sends over the internet ?
  */
  tdfn_uwStartChannelScan fn_uwStartChannelScan;
  tdfn_uwStartChannelScan fn_uwStartBroadcastChannelScan;
  tdfn_uwNextChannelScan fn_uwNextChannel;
  tdfn_uwNextChannelScan fn_uwNextBroadcastChannel;
  tdfn_eReadData fn_eReadData;
  tdfn_eSendData fn_eSendData;
  tdfn_eQueryChannelStatus fn_eQueryChannelStatus;
  tdfn_vCloseChannel fn_vCloseChannel;
  tdfn_vLevel0NetEngine fn_vLevel0NetEngine;
  tdfn_vLevel0CloseProtocol fn_vLevel0CloseProtocol;
  tdfn_eAddNewPlayer fn_eAddNewPlayer;
  NetLib_tdeErrorStatus eIsInternet;
} tdstNetProtocolInterface;
 
 
typedef NetLib_tdeErrorStatus (*tdfn_eTCPReconnect)(unsigned short, long);
typedef NetLib_tdeErrorStatus (*tdfn_eTCPGetPortAndAddress)(unsigned short *, unsigned long *);
typedef void (*tdfn_vTCPNewRouteKnown)(tduwNetChannel);
typedef tduwNetChannel (*tdfn_uwTCPGetNewReconnectChannel)(void);
 
typedef struct
{
  tdfn_eTCPReconnect pfn_eTCPReconnect;
  tdfn_eTCPGetPortAndAddress pfn_eTCPGetPortAndAddress;
  tdfn_vTCPNewRouteKnown pfn_vTCPNewRouteKnown;
  tdfn_uwTCPGetNewReconnectChannel pfn_uwTCPGetNewReconnectChannel;
}tdstTCPReconnectInterface;
 
#endif /* !__L0COMMONPCWIN95_TYPES__ */
 
#if !defined(ONLY_TYPES)
 
#if !defined(__L0COMMONPCWIN95_VARS__)
#define __L0COMMONPCWIN95_VARS__
 
#undef EXTERN
#undef extern
#if !defined(GLOBALS)
#define EXTERN extern
#else /* !GLOBALS */
#define EXTERN
#endif /* !GLOBALS */
 
/*
 * <type> <variable name>
 * #if defined(GLOBALS)
 * = <initial values>
 * #endif
 * ;
 */
#endif /* !__L0COMMONPCWIN95_VARS__ */
 
#if !defined (__L0COMMONPCWIN95_PROTOS__)
#define __L0COMMONPCWIN95_PROTOS__
 
/*
 * Prototypes of the handler functions
 */
void vNetFillInvalidProtocolInterface(tdstNetProtocolInterface *);
 
tduwNetChannel uwNetL0InvalidStartChannelScan(void);
tduwNetChannel uwNetL0InvalidStartBroadcastChannelScan(void);
NetLib_tdeErrorStatus eNetL0InvalidQueryChannelStatus(tduwNetChannel);
 
 
tdstTCPReconnectInterface *pstNetGetTCPReconnectInterface(void);
 
tdstNetProtocolInterface *pstLevel1AddProtocol(void);
void vLevel1RemoveProtocol(tdeNetProtocol);
 
#endif /* !__L0COMMONPCWIN95_PROTOS__ */
 
#endif /* !ONLY_TYPES */
 
