/*
 
PrivL0IPX.h
 
*/
 
 
/* 
 * universal multiplayer library level 0 header file
 * transport layer: IPX PC-windows 95
 */
 
#if !defined(__L0IPXPCWIN95_TYPES__)
#define __L0IPXPCWIN95_TYPES__
 
#if !defined(ONLY_TYPES)
#define L0IPXPCWIN95_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
 
#include <wsipx.h>
/*#include "ipxaddress.h" not required ? */
 
#if defined(L0IPXPCWIN95_UNDEF)
#undef ONLY_TYPES
#undef L0IPXPCWIN95_UNDEF
#endif /* !L0IPXPCWIN95_UNDEF */
 
/* maximum number of channels managed by the layer */
 
#define C_ucL0MaxNumberOfIPXChannels ((unsigned char)15)
 
 
/* 
 * template name for all structures
 * typedef struct tdstL0PCWin95IPXChannel_
 * {
 * } tdstL0PCWin95IPX;
 */
 
typedef struct tdstL0PCWin95IPXChannel_
{
 tdeNetTransferStatus eChannelStatus;
 
 /* IPX address of the destination host */
 
 SOCKADDR_IPX stRemoteAddr;
 
 /* ring of messages received but not read yet */
 /* note that for  the broadcast channels, the array doesn't contain pointers to messages, it holds */
 /* channel numbers (cast to char *) instead. We rely on the possibility to cast an unsigned short into a tdpPointer */
 /* without loss of precision. it would be good to use a union to solve this problem ... */
 
 tdpPointer apMsgQueue[C_ucL0MaxNumberOfMsgPerChannel];
 unsigned char ucHead;
 unsigned char ucTail;
 
 /* can this channel be used to send broadcast messages ? */
 unsigned char ubf1IsBroadcast : 1;
 /* is this slot in use in the protocol's array of channels ? */
 unsigned char ubf1IsSlotInUse : 1;
 /* is this slot ready for reading ? */
 unsigned char ubf1IsReadable : 1;
 
} tdstL0PCWin95IPXChannel;
 
#endif /* !__L0IPXPCWIN95_TYPES__ */
 
#if !defined(ONLY_TYPES)
 
#if !defined(__L0IPXPCWIN95_VARS__)
#define __L0IPXPCWIN95_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 /* !__L0IPXPCWIN95_VARS__ */
 
#if !defined (__L0IPXPCWIN95_PROTOS__)
#define __L0IPXPCWIN95_PROTOS__
 
 /*
 * put here the prototypes of the handler functions for the object
 */
 
tduwNetChannel uwL0PCWin95IPXStartChannelScan(void);
tduwNetChannel uwL0PCWin95IPXNextChannel(tduwNetChannel);
tduwNetChannel uwL0PCWin95IPXStartBroadcastChannelScan(void);
tduwNetChannel uwL0PCWin95IPXNextBroadcastChannel(tduwNetChannel);
NetLib_tdeErrorStatus eL0PCWin95IPXReadData(tduwNetChannel*,tdpPointer*);
NetLib_tdeErrorStatus eL0PCWin95IPXSendData(tduwNetChannel,tdpPointer);
NetLib_tdeErrorStatus eL0PCWin95IPXQueryChannelStatus(tduwNetChannel);
void vL0PCWin95IPXCloseChannel(tduwNetChannel);
void vL0PCWin95IPXCloseProtocol(void);
 
NetLib_tdeErrorStatus eL0PCWin95IPXInit(unsigned short);
tduwNetChannel uwL0PCWin95IPXGetChannel(SOCKADDR_IPX*);
tduwNetChannel uwL0PCWin95IPXOpenChannel(SOCKADDR_IPX*,unsigned short);
NetLib_tdeErrorStatus eL0PCWin95IPXInsertMessage(tduwNetChannel,tdpPointer);
NetLib_tdeErrorStatus eL0PCWin95IPXRemoveMessage(tduwNetChannel,tdpPointer*);
NetLib_tdeErrorStatus eL0PCWin95IPXMessageAvailable(void);
 
#include <NET\L0IPX.h>
 
#endif /* !__L0IPXPCWIN95_PROTOS__ */
 
#endif /* !ONLY_TYPES */
 
