define SET_REQUEST							1
define SET_RQ_HOSTNAME_TO_IP_ADDRESS		1
define SET_RQ_IP_ADDRESS_TO_HOSTNAME		1
define SET_RQ_OPEN_TCP_CONNECTION			1
define SET_RQ_OPEN_TCP_CONNECTION_NO_WAIT	1
define SET_RQ_GET_TCB						1
define SET_RQ_SEND_TCP_MESSAGE				1
define SET_RQ_RECEIVE_TCP_MESSAGE			1
define SET_RQ_CLOSE_TCP_CONNECTION			1
define SET_RQ_ABORT_TCP_CONNECTION			1
define SET_RQ_GET_SETUP					1

include std.h
include internetct.h

*======================.============<  >===================================*
unsigned iphostnametoaddress( name, sname, address)
char					* name;
unsigned				sname;
long					* address;
{
	RQ_HOSTNAME_TO_IP_ADDRESS	rq;

	rq.rq.scntinfo		= 0;
	rq.rq.nreqpbcb		= 1;
	rq.rq.nresppbcb		= 1;
	rq.rq.rqcode		= HOSTNAME_TO_IP_ADDRESS;

	rq.name				= name;
	rq.sname			= sname;
	rq.address			= address;
	rq.saddress			= 4;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned ipaddresstohostname( address, name, snamemax, sname)
long					address;
char					* name;
unsigned				snamemax;
unsigned				* sname;
{
	RQ_IP_ADDRESS_TO_HOSTNAME	rq;

	rq.rq.scntinfo		= 4;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 2;
	rq.rq.rqcode		= IP_ADDRESS_TO_HOSTNAME;

	rq.address			= address;
	rq.name				= name;
	rq.snamemax			= snamemax;
	rq.sname			= sname;
	rq.ssname			= 2;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpopenconnection( localport, remotehost, sremotehost, remoteport,
							active, timeout, precedence, security,
							options, soptions, handle)
unsigned				localport;
char					* remotehost;
unsigned				sremotehost;
unsigned				remoteport;
unsigned char			active;
unsigned				timeout;
unsigned				precedence;
unsigned				security;
char					* options;
unsigned				soptions;
unsigned				* handle;
{
	RQ_OPEN_TCP_CONNECTION	rq;

	rq.rq.scntinfo		= 14;
	rq.rq.nreqpbcb		= 2;
	rq.rq.nresppbcb		= 1;
	rq.rq.rqcode		= OPEN_TCP_CONNECTION;

	rq.index			= 0;
	rq.localport		= localport;
	rq.remoteport		= remoteport;
	rq.timeout			= timeout;
	rq.precedence		= precedence;
	rq.security			= security;
	rq.active			= active;
	rq.reserved			= 0;
	rq.remotehost		= remotehost;
	rq.sremotehost		= sremotehost;
	rq.options			= options;
	rq.soptions			= soptions;
	rq.handle			= handle;
	rq.shandle			= 2;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpopenconnectionnowait( localport, remotehost, sremotehost,
							remoteport,
							active, timeout, precedence, security,
							options, soptions, handle)
unsigned				localport;
char					* remotehost;
unsigned				sremotehost;
unsigned				remoteport;
unsigned char			active;
unsigned				timeout;
unsigned				precedence;
unsigned				security;
char					* options;
unsigned				soptions;
unsigned				* handle;
{
	RQ_OPEN_TCP_CONNECTION_NO_WAIT	rq;

	rq.rq.scntinfo		= 14;
	rq.rq.nreqpbcb		= 2;
	rq.rq.nresppbcb		= 1;
	rq.rq.rqcode		= OPEN_TCP_CONNECTION_NO_WAIT;

	rq.index			= 0;
	rq.localport		= localport;
	rq.remoteport		= remoteport;
	rq.timeout			= timeout;
	rq.precedence		= precedence;
	rq.security			= security;
	rq.active			= active;
	rq.reserved			= 0;
	rq.remotehost		= remotehost;
	rq.sremotehost		= sremotehost;
	rq.options			= options;
	rq.soptions			= soptions;
	rq.handle			= handle;
	rq.shandle			= 2;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpgettcb( handle, tcb, stcbmax, stcb)
unsigned				handle;
TCB_RETURNED			* tcb;
unsigned				stcbmax;
unsigned				* stcb;
{
	RQ_GET_TCB			rq;

	rq.rq.scntinfo		= 4;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 2;
	rq.rq.rqcode		= GET_TCB;

	rq.index			= 0;
	rq.handle			= handle;
	rq.tcb				= tcb;
	rq.stcbmax			= stcbmax;
	rq.stcb				= stcb;
	rq.sstcb			= 2;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpsend( handle, push, urgent, message, smessage)
unsigned				handle;
unsigned char			push;
unsigned char			urgent;
char					* message;
unsigned				smessage;
{
	RQ_SEND_TCP_MESSAGE	rq;

	rq.rq.scntinfo		= 6;
	rq.rq.nreqpbcb		= 1;
	rq.rq.nresppbcb		= 0;
	rq.rq.rqcode		= SEND_TCP_MESSAGE;

	rq.index			= 0;
	rq.handle			= handle;
	rq.push				= push;
	rq.urgent			= urgent;
	rq.message			= message;
	rq.smessage			= smessage;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpreceive( handle, push, urgent, message, smessagemax, smessage)
unsigned				handle;
unsigned char			* push;
unsigned char			* urgent;
char					* message;
unsigned				smessagemax;
unsigned				* smessage;
{
	RQ_RECEIVE_TCP_MESSAGE	rq;

	rq.rq.scntinfo		= 4;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 4;
	rq.rq.rqcode		= RECEIVE_TCP_MESSAGE;

	rq.index			= 0;
	rq.handle			= handle;
	rq.push				= push;
	rq.spush			= 1;
	rq.urgent			= urgent;
	rq.surgent			= 1;
	rq.message			= message;
	rq.smessagemax		= smessagemax;
	rq.smessage			= smessage;
	rq.ssmessage		= 2;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpcloseconnection( handle)
unsigned				handle;
{
	RQ_CLOSE_TCP_CONNECTION	rq;

	rq.rq.scntinfo		= 4;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 0;
	rq.rq.rqcode		= CLOSE_TCP_CONNECTION;

	rq.index			= 0;
	rq.handle			= handle;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned tcpabortconnection( handle)
unsigned				handle;
{
	RQ_ABORT_TCP_CONNECTION	rq;

	rq.rq.scntinfo		= 4;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 0;
	rq.rq.rqcode		= ABORT_TCP_CONNECTION;

	rq.index			= 0;
	rq.handle			= handle;

	return( rq_issue( rq));
}

*======================.============<  >===================================*
unsigned inetctgetsetup( address, mss, window, ttl, name, snamemax, sname)
unsigned long			* address;
unsigned				* mss;
unsigned				* window;
unsigned				* ttl;
char					* name;
unsigned				snamemax;
unsigned				* sname;
{
	RQ_GET_SETUP	rq;

	rq.rq.scntinfo		= 0;
	rq.rq.nreqpbcb		= 0;
	rq.rq.nresppbcb		= 6;
	rq.rq.rqcode		= GET_SETUP;

	rq.address			= address;
	rq.saddress			= 4;
	rq.mss				= mss;
	rq.smss				= 2;
	rq.window			= window;
	rq.swindow			= 2;
	rq.ttl				= ttl;
	rq.sttl				= 2;
	rq.name				= name;
	rq.snamemax			= snamemax;
	rq.sname			= sname;
	rq.ssname			= 2;
	
	return( rq_issue( rq));
}

===============.============<  >===================================*
unsigned tcpopenconnection( localport, remotehost, sre