.th TcpStatus III 4/21/86
.sh "NAME"
TcpStatus - obtain the status of a TCP connection
.sh "C SYNOPSIS"
.nf
/*
 * TCP Connection State Definition
 */
#define	CLOSED		-1	/* non-existent TCB (=> no state)	*/
#define	LISTEN		1	/* waiting for a connection 		*/
#define	SYNSENT		2	/* sent connection request; need match	*/
#define	SYNRECEIVED	3	/* send & recv'd requests; need ack	*/
#define	ESTABLISHED	4	/* open connection ... ready		*/
#define	FINWAIT1	5	/* waiting for connection termination	*/
#define	FINWAIT2	6	/* waiting for connection termination	*/
#define	TIMEWAIT	7	/* waiting for time lapse on closing	*/
#define	CLOSEWAIT	8	/* waiting for user to terminate	*/
#define	CLOSING		9	/* waiting for termination ack		*/

/*
 * TCP Status Request (Parameter Block Structure)
 */
typedef	struct
{
	int	s_state;	/* state of the connection	*/
	seid	s_nss;		/* Seid of network segment 	*/
	seid	s_owner;	/* Seid of process (creator)	*/
	seid	s_writer;	/* Seid of process (writer)	*/
	seid	s_reader;	/* Seid of process (reader)	*/

	int	s_prec;		/* type of service (precedence)	*/
	int	s_sectcc;	/* connection's security & tcc	*/
	Socket	s_locskt;	/* local socket			*/
	Socket	s_forskt;	/* foreign socket		*/

	Seqno	s_snduna;	/* seqno: unacknowledged octet	*/
	Seqno	s_sndnxt;	/* seqno: next octet to send	*/
	Seqno	s_sndup;	/* seqno: urgent pointer	*/
	Seqno	s_sndiss;	/* seqno: initial send sequence	*/
	Seqno	s_sndfss;	/* seqno: final send sequence	*/
	int	s_sndwnd;	/* current window offset	*/
	int	s_sndbs;	/* send buffer size		*/

	Seqno	s_rcvnxt;	/* seqno: next octet to receive	*/
	Seqno	s_rcvup;	/* seqno: urgent pointer	*/
	Seqno	s_rcvirs;	/* seqno: initial rcvr sequence	*/
	int	s_rcvwnd;	/* current window offset	*/
	int	s_rcvbs;	/* receive buffer size		*/

	int	s_srcnt;	/* number of bytes to send	*/
	int	s_rrcnt;	/* number of bytes to receive	*/

	int	s_nsnd;		/* number of segments sent	*/
	int	s_nrcv;		/* number of segments received	*/
	int	s_ndup;		/* number of duplicate segments	*/
	int	s_ndis;		/* number of discarded segments	*/
	int	s_retxm;	/* number of retransmissions	*/
} Tcp_Status;
 . . .
 int         Loc_Name;
 Tcp_Status  *Stat_Buf;
 int         stat;
 . . .
 stat = TcpStatus (Loc_Name, Stat_Buf);
.fi
.sh "DESCRIPTION"
The TcpStatus primitive is used to obtain the current status of a TCP
connection.
.s3
The Loc_Name parameter is the local connection name associated with a
specific TCP connection.  This identifier was returned from a
previously successful TcpOpen primitive call to establish the
connection.
.s3
The Stat_Buf parameter is a pointer to a data structure which will
contain the TCP connection status if this request can be satisfied.
This data structure must conform to the Tcp_Status structure definition
specified in the TCP Interface Definitions for C file (tcp.h).
.s3
This request will not alter the existing state of the connection.
.sh "EXCEPTIONS"
TcpStatus
returns the following error codes:
.lp 10 0
.nf
XtcpOK    (0)      Successful
XtcpNoX   (3)      Non-existent TCP Daemon
XtcpNoNSS (6)      Non-existent TCP Connection
.fi
.i0
.sh "FILES"
.nf
/ksb/include/tcp.h     TCP Interface Definitions for C
/ksb/lib/TCP.a   TCP Interface Library for C
.fi
.sh "SEE ALSO"
TcpOpen (III)

