xref: /csrg-svn/sys/netns/spp_var.h (revision 26056)
1 /*
2  * Copyright (c) 1984, 1985 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)spp_var.h	6.4 (Berkeley) 02/03/86
7  */
8 
9 /*
10  * Sp control block, one per connection
11  */
12 struct sppcb {
13 	struct	spidp_q	s_q;		/* queue for out-of-order receipt */
14 	struct	nspcb	*s_nspcb;	/* backpointer to internet pcb */
15 	u_char	s_state;
16 	u_char	s_flags;
17 #define SF_AK	0x01			/* Acknowledgement requested */
18 #define SF_DELACK 0x02			/* Ak, waiting to see if we xmit*/
19 #define SF_HI	0x04			/* Show headers on input */
20 #define SF_HO	0x08			/* Show headers on output */
21 #define SF_PI	0x10			/* Packet (datagram) interface */
22 	u_short s_mtu;			/* Max packet size for this stream */
23 /* use sequence fields in headers to store sequence numbers for this
24    connection */
25 	struct	spidp s_shdr;		/* prototype header to transmit */
26 #define s_cc s_shdr.si_cc		/* connection control (for EM bit) */
27 #define s_dt s_shdr.si_dt		/* datastream type */
28 #define s_sid s_shdr.si_sid		/* source connection identifier */
29 #define s_did s_shdr.si_did		/* destination connection identifier */
30 #define s_seq s_shdr.si_seq		/* sequence number */
31 #define s_ack s_shdr.si_ack		/* acknowledge number */
32 #define s_alo s_shdr.si_alo		/* allocation number */
33 #define s_dport s_shdr.si_dna.x_port	/* where we are sending */
34 	struct sphdr s_rhdr;		/* last received header (in effect!)*/
35 	u_short s_rack;			/* their acknowledge number */
36 	u_short s_ralo;			/* their allocation number */
37 	u_short s_snt;			/* highest packet # we have sent */
38 
39 /* timeout stuff */
40 	short	s_idle;			/* time idle */
41 	short	s_timer[TCPT_NTIMERS];	/* timers */
42 	short	s_rxtshift;		/* log(2) of rexmt exp. backoff */
43 	u_short	s_rtseq;		/* packet being timed */
44 	short	s_rtt;			/* timer for round trips */
45 	short	s_srtt;			/* averaged timer */
46 	char	s_force;		/* which timer expired */
47 
48 /* out of band data */
49 	char	s_oobflags;
50 #define SF_SOOB	0x08			/* sending out of band data */
51 #define SF_IOOB 0x10			/* receiving out of band data */
52 	char	s_iobc;			/* input characters */
53 /* debug stuff */
54 	u_short	s_want;			/* Last candidate for sending */
55 };
56 
57 #define	nstosppcb(np)	((struct sppcb *)(np)->nsp_pcb)
58 #define	sotosppcb(so)	(nstosppcb(sotonspcb(so)))
59 
60 struct	spp_istat {
61 	short	hdrops;
62 	short	badsum;
63 	short	badlen;
64 	short	slotim;
65 	short	fastim;
66 	short	nonucn;
67 	short	noconn;
68 	short	notme;
69 	short	wrncon;
70 	short	bdreas;
71 	short	gonawy;
72 	short	notyet;
73 	short	lstdup;
74 };
75 
76 #ifdef KERNEL
77 struct spp_istat spp_istat;
78 u_short spp_iss;
79 extern struct sppcb *spp_close(), *spp_disconnect(),
80 	*spp_usrclosed(), *spp_timers(), *spp_drop();
81 #endif
82 
83 #define	SPP_ISSINCR	128
84 /*
85  * SPP sequence numbers are 16 bit integers operated
86  * on with modular arithmetic.  These macros can be
87  * used to compare such integers.
88  */
89 #define	SSEQ_LT(a,b)	(((short)((a)-(b))) < 0)
90 #define	SSEQ_LEQ(a,b)	(((short)((a)-(b))) <= 0)
91 #define	SSEQ_GT(a,b)	(((short)((a)-(b))) > 0)
92 #define	SSEQ_GEQ(a,b)	(((short)((a)-(b))) >= 0)
93