1 /*	nsp_var.h	1.3	82/10/09	*/
2 
3 /*
4  * Kernel variables for NSP
5  */
6 
7 typedef	short nsp_seq;
8 
9 /*
10  * NSP control block, ala Session Control Port,
11  * p. 41-44, NSP spec.
12  */
13 struct nspcb {
14 	struct	nspcb *n_next, *n_prev;	/* list of all NSP cb's */
15 	struct	nspcb *n_head;		/* pointer to head of list */
16 	struct	nspq *nq_next, *nq_prev;	/* retransmit queue */
17 /* NEED STUFF FOR INPUT REASSEMBLY */
18 	struct	socket *n_socket;	/* back pointer to socket */
19 	char	n_state;	/* state of the port */
20 	char	n_flags;	/* flags, see below */
21 	short	n_retrans;	/* count of message retransmissions */
22 	short	n_segsize;	/* transmit segment size */
23 	u_short	n_node;		/* remote node address */
24 	u_short	n_loc;		/* local link address */
25 	u_short	n_rem;		/* remote link address */
26 /* timer variables */
27 	u_short	nt_dat;		/* timeout for data segments */
28 	u_short	nt_oth;		/* timeout for other data */
29 	u_short	nt_con;		/* timeout for connect, disconnect */
30 /* sequence variables */
31 	nsp_seq	nn_dat;		/* number of next data segment to transmit */
32 	nsp_seq nn_oth;		/* number of next other data segment */
33 	nsp_seq	nn_high;	/* highest numbered data segment queued */
34 /* error control variables */
35 	nsp_seq	na_xmtdat;	/* number of last data segment we acked */
36 	nsp_seq	na_xmtoth;	/* number of last other data we acked */
37 	nsp_seq	na_rcvdat;	/* number of highest data segment ack rcv'ed */
38 /* flow control variables */
39 	char	nf_locdat;	/* data request count */
40 	char	nf_locint;	/* flow control state for receiving intr data */
41 	char	nf_remdat;	/* data request count from remote */
42 	char	nf_remint;	/* interrupt request count from remote */
43 /* buffers for optional data */
44 	u_short	nb_src;		/* source node addr for rcv CI */
45 	struct	mbuf *nb_con;	/* data for rcv or xmt CI */
46 	struct	mbuf *nb_xmt;	/* data for xmt CC, DI, Intr */
47 	struct	mbuf *nb_rcv;	/* data for rcv CC, DI, Intr */
48 };
49 
50 #define	sotonspcb(so)	((struct nspcb *)(so)->so_pcb)
51 
52 /* port states, p. 34-36 */
53 #define	NS_O		0	/* open */
54 #define	NS_CR		1	/* connect received */
55 #define	NS_DR		2	/* disconnect reject */
56 #define	NS_DRC		3	/* disconnect reject complete */
57 #define	NS_CC		4	/* connect confirm */
58 #define	NS_CI		5	/* connect initiate */
59 #define	NS_NR		6	/* no resources */
60 #define	NS_NC		7	/* no communication */
61 #define	NS_CD		8	/* connect delivered */
62 #define	NS_RJ		9	/* rejected */
63 #define	NS_RUN		10	/* running */
64 #define	NS_DI		11	/* disconnect initiate */
65 #define	NS_DIC		12	/* disconnect complete */
66 #define	NS_DN		13	/* disconnect notification */
67 #define	NS_CL		14	/* closed */
68 #define	NS_CN		15	/* closed notification */
69 #define	NS_LI		16	/* listen for connection */
70 
71 /* flags */
72 #define	NF_DATACK	0001	/* data acknowledgement required */
73 #define	NF_OTHACK	0002	/* other data acknowledgement required */
74 #define	NF_CON		0004	/* connect data available */
75 #define	NF_INTAVAIL	0010	/* transmit interrupt data available */
76 #define	NF_OTHSENT	0020	/* other data message has been sent */
77 #define	NF_OTHINTR	0040	/* other data message was an interrupt msg */
78 #define	NF_DATOFF	0100	/* on/off switch for data flow control */
79 
80 /* locint states */
81 /* I STILL DON'T UNDERSTAND THIS WELL ENOUGH */
82 #define	NFL_EMPTY	0
83 #define	NFL_INTR	1
84 #define	NFL_SEND	2
85