
******************************************************

            PROPRIETARY PROGRAM MATERIAL

THIS MATERIAL IS PROPRIETARY TO UNISYS CORPORATION
AND IS NOT TO BE REPRODUCED, USED OR DISCLOSED EXCEPT 
IN ACCORDANCE WITH PROGRAM LICENSE OR UPON WRITTEN
AUTHORIZATION OF UNISYS CORPORATION.

COPYRIGHT  (C)  1991 Unisys CORPORATION

******************************************************

ifndef NFDS
define	NFDS	20
endif 

define NODEMAX   24

struct io_ops {
	int		(*read)();	* read data from resource *
	int		(*write)();	* write data to resource *
	int		(*close)();	* close this io resource *
	long	(*seek)();	* positions the io cursor *
	int		(*ioctl)();	* all other io functions *
};

struct	filedesc {
	enum file_type {
		NOT_USED, DISK, SOCKET, PIPE
	} type;
	struct io_ops *op;		
	char          *private;	
	unsigned       handle;	
	int            prev;	
	int            next;	
};

define UNLINKED 1


struct req_hdrTYPE
{
 unsigned char sCntlInfo;
 unsigned char rtCode;
 unsigned char nReqPbCb;
 unsigned char nRespPbCb;
 unsigned int UserNum;
 unsigned int exchResp;
 unsigned int ercRet;
 unsigned int rqCode;
};


typedef struct tcp_read
{
	char  		sCntlInfo;
	char  		rtCode;
	char  		nReqPbCb;
	char  		nRespPbCb;
	int 		UserNum;
	int 		exchResp;
	int 		ercRet;
	int 		rqCode;
	int         cHandle;
	int         Index;
	char        *pfPush;
	int         sfPush;
	char        *pfUrgent;
	int         sfUrgent;
	char        *pMessageRet;
	int         sMessageRetMax;
	int        *psMessageRet;
	int         sMessageRet;
} TCPBLK;



typedef struct tcp_openconn
{
	char  		sCntlInfo;
	char  		rtCode;
	char  		nReqPbCb;
	char  		nRespPbCb;
	int 		UserNum;
	int 		exchResp;
	int 		ercRet;
	int 		rqCode;
	int         Index;
	int			localPort;
	int			remotePort;
	int			timeout;
	int			precedence;
	int			security;
	char		fActive;
	char		reserved;			
	char        *pTCPnode;
	int         sTCPnode;
	char        *pRemoteHost;
	int         sRemoteHost;
	char		*pOptions;
	int			sOptions;
	char        *pcHandleRet;
	int         scHandleRet;
} TCPOPENBLK;

typedef struct SceAddr_record
{
 unsigned int			LocalPort;
 unsigned char			MessageType;
 unsigned long int		SourceAddr;
 unsigned int			SourcePort;
} SceAddr_type;

typedef struct RcvResp_record
{
 unsigned char			Response;
 unsigned int			DatagramSz;
 unsigned long int		SourceAddr;
 unsigned int			SourcePort;
 unsigned int			LocalPort;
} RcvResp_type;


typedef struct RecvFromUDP_record
{
 struct req_hdrTYPE 	req_hdr;
 unsigned int			Timeout;
 struct RecvFromUDP_record *reservd;
 unsigned char	*far 	pbNodeName;
 unsigned    			cbNodeName;
 SceAddr_type	*far 	pbSourceAddr;
 unsigned    			cbSourceAddr;
 unsigned char	*far 	pbBuff;
 unsigned    			cbBuff;
 RcvResp_type	*far 	pbResp;
 unsigned    			cbResp;
} RecvFromUDP_type;


define UDPBLK RecvFromUDP_type

union Rq_blk
{
	TCPBLK TCP;
	UDPBLK UDP;
	TCPOPENBLK TCPOPEN;
};


static  struct SockDesc {
	int     State;				
	int     sMsgRet;
	char  * pBuff;				
	union Rq_blk  * pReq;		
	int     Exch;				
	int     LPort;				
	char    fPush;				
	char    fUrgent;			
	char	pNode[NODEMAX];		
	char	sNode;				
	int     Timeout;			
	char  * pOptions;
	int     sOptions;
	union Rq_blk ReadReqBlk;	
	SceAddr_type Address;
	RcvResp_type Response;
	char  * readbuf;			
	int     olastdata;			
	short   buff_alloc_flag;	
	short   exch_alloc_flag;	
	short	socket_req_flag;	
								
};

struct disk_data {
	unsigned long loc;	
	unsigned long eof;
	unsigned      mode;
};

