/*****************************************************************************
 *
 * Program Name:  SAP_Module
 *
 * Filename:	  comm.h
 *
 * Version:		  1.0
 *
 * Programmers:	  Bryan Sparks
 *
 * Comments:	  Typedefs and such for IPX and SPX communications.
 *
 ****************************************************************************/
struct	IPXAddress
{
	unsigned char	Network[4];	/* high-low */
	unsigned char	Node[6];	/* high-low */
	unsigned int 	Socket;		/* high-low */
};

typedef struct IPXPacketStructure
{
	unsigned int				PacketCheckSum;			/* high-low */
	unsigned int    			PacketLength;			/* high-low */
	unsigned char				PacketTransportControl;
	unsigned char				PacketType;
	struct IPXAddress			Destination;
	struct IPXAddress			Source;
} IPXPacket;

typedef struct SPXPacketStructure
{
	unsigned int				PacketCheckSum;			/* high-low */
 	unsigned int    			PacketLength;			/* high-low */
	unsigned char				PacketTransportControl;
	unsigned char				PacketType;
	struct IPXAddress			Destination;
	struct IPXAddress			Source;
	unsigned char				ConnectionControl;
	unsigned char				DatastreamType;
	unsigned int				SourceConnectionID;		/* high-low */
	unsigned int				DestinationConnectionID;	/* high-low */
	unsigned int				SequenceNumber;			/* high-low */
	unsigned int				AcknowledgeNumber; 		/* high-low */
	unsigned int				AllocationNumber;		/* high-low */
} SPXPacket;

struct	ECBFragment
{
	char far 			*Address; 
	unsigned int		Size;	 		/* low-high */
};

typedef struct ECBStructure 
{
	unsigned int				Link[2];				
	char far					*ESRAddress;			/* offset-segment */
	unsigned char				InUseFlag;
	unsigned char				CompletionCode;
	unsigned int				ECBSocket;				/* high-low */
	unsigned char				IPXWorkspace[4];		
	unsigned char				DriverWorkspace[12];	
	unsigned char				ImmediateAddress[6];	/* high-low */
	unsigned int				FragmentCount;			/* low-high */
	struct ECBFragment			FragmentDescriptor[2];
} ECB;

typedef struct SAPDataStructure
{
	unsigned int		InfoType;
	unsigned int		ServerType;
	unsigned char		ServerName[48];
	struct IPXAddress	Address;
	unsigned int 		IntermediateNetworks;
} SAPData;
