1*8410Swnj /*	nsp_var.h	1.3	82/10/09	*/
26831Ssam 
36831Ssam /*
46831Ssam  * Kernel variables for NSP
56831Ssam  */
66831Ssam 
76831Ssam typedef	short nsp_seq;
86831Ssam 
96831Ssam /*
106831Ssam  * NSP control block, ala Session Control Port,
116831Ssam  * p. 41-44, NSP spec.
126831Ssam  */
136831Ssam struct nspcb {
146831Ssam 	struct	nspcb *n_next, *n_prev;	/* list of all NSP cb's */
156831Ssam 	struct	nspcb *n_head;		/* pointer to head of list */
166831Ssam 	struct	nspq *nq_next, *nq_prev;	/* retransmit queue */
176831Ssam /* NEED STUFF FOR INPUT REASSEMBLY */
186831Ssam 	struct	socket *n_socket;	/* back pointer to socket */
196831Ssam 	char	n_state;	/* state of the port */
206831Ssam 	char	n_flags;	/* flags, see below */
216831Ssam 	short	n_retrans;	/* count of message retransmissions */
226831Ssam 	short	n_segsize;	/* transmit segment size */
236831Ssam 	u_short	n_node;		/* remote node address */
246831Ssam 	u_short	n_loc;		/* local link address */
256831Ssam 	u_short	n_rem;		/* remote link address */
266831Ssam /* timer variables */
276831Ssam 	u_short	nt_dat;		/* timeout for data segments */
286831Ssam 	u_short	nt_oth;		/* timeout for other data */
296831Ssam 	u_short	nt_con;		/* timeout for connect, disconnect */
306831Ssam /* sequence variables */
316831Ssam 	nsp_seq	nn_dat;		/* number of next data segment to transmit */
326831Ssam 	nsp_seq nn_oth;		/* number of next other data segment */
336831Ssam 	nsp_seq	nn_high;	/* highest numbered data segment queued */
346831Ssam /* error control variables */
356831Ssam 	nsp_seq	na_xmtdat;	/* number of last data segment we acked */
366831Ssam 	nsp_seq	na_xmtoth;	/* number of last other data we acked */
376831Ssam 	nsp_seq	na_rcvdat;	/* number of highest data segment ack rcv'ed */
386831Ssam /* flow control variables */
396831Ssam 	char	nf_locdat;	/* data request count */
406831Ssam 	char	nf_locint;	/* flow control state for receiving intr data */
416831Ssam 	char	nf_remdat;	/* data request count from remote */
426831Ssam 	char	nf_remint;	/* interrupt request count from remote */
436831Ssam /* buffers for optional data */
446831Ssam 	u_short	nb_src;		/* source node addr for rcv CI */
456831Ssam 	struct	mbuf *nb_con;	/* data for rcv or xmt CI */
466831Ssam 	struct	mbuf *nb_xmt;	/* data for xmt CC, DI, Intr */
476831Ssam 	struct	mbuf *nb_rcv;	/* data for rcv CC, DI, Intr */
486831Ssam };
496831Ssam 
506831Ssam #define	sotonspcb(so)	((struct nspcb *)(so)->so_pcb)
516831Ssam 
526831Ssam /* port states, p. 34-36 */
536831Ssam #define	NS_O		0	/* open */
546831Ssam #define	NS_CR		1	/* connect received */
556831Ssam #define	NS_DR		2	/* disconnect reject */
566831Ssam #define	NS_DRC		3	/* disconnect reject complete */
576831Ssam #define	NS_CC		4	/* connect confirm */
586831Ssam #define	NS_CI		5	/* connect initiate */
596831Ssam #define	NS_NR		6	/* no resources */
606831Ssam #define	NS_NC		7	/* no communication */
616831Ssam #define	NS_CD		8	/* connect delivered */
626831Ssam #define	NS_RJ		9	/* rejected */
636831Ssam #define	NS_RUN		10	/* running */
646831Ssam #define	NS_DI		11	/* disconnect initiate */
656831Ssam #define	NS_DIC		12	/* disconnect complete */
666831Ssam #define	NS_DN		13	/* disconnect notification */
676831Ssam #define	NS_CL		14	/* closed */
686831Ssam #define	NS_CN		15	/* closed notification */
696831Ssam #define	NS_LI		16	/* listen for connection */
706831Ssam 
716831Ssam /* flags */
726831Ssam #define	NF_DATACK	0001	/* data acknowledgement required */
736831Ssam #define	NF_OTHACK	0002	/* other data acknowledgement required */
746831Ssam #define	NF_CON		0004	/* connect data available */
756831Ssam #define	NF_INTAVAIL	0010	/* transmit interrupt data available */
766831Ssam #define	NF_OTHSENT	0020	/* other data message has been sent */
776831Ssam #define	NF_OTHINTR	0040	/* other data message was an interrupt msg */
786831Ssam #define	NF_DATOFF	0100	/* on/off switch for data flow control */
796831Ssam 
806831Ssam /* locint states */
816831Ssam /* I STILL DON'T UNDERSTAND THIS WELL ENOUGH */
826831Ssam #define	NFL_EMPTY	0
836831Ssam #define	NFL_INTR	1
846831Ssam #define	NFL_SEND	2
85