xref: /original-bsd/sys/deprecated/netimp/if_imp.h (revision 8208c1e2)
1 /*	if_imp.h	4.6	82/03/19	*/
2 
3 /*
4  * Structure of IMP 1822 long leader.
5  */
6 struct control_leader {
7 	u_char	dl_format;	/* leader format */
8 	u_char	dl_network;	/* src/dest network */
9 	u_char	dl_flags;	/* leader flags */
10 	u_char	dl_mtype;	/* message type */
11 	u_char	dl_htype;	/* handling type */
12 	u_char	dl_host;	/* host number */
13 	u_short	dl_imp;		/* imp field */
14 	u_char	dl_link;	/* link number */
15 	u_char	dl_subtype;	/* message subtype */
16 };
17 
18 struct imp_leader {
19 	struct	control_leader il_dl;
20 #define	il_format	il_dl.dl_format
21 #define	il_network	il_dl.dl_network
22 #define	il_flags	il_dl.dl_flags
23 #define	il_mtype	il_dl.dl_mtype
24 #define	il_htype	il_dl.dl_htype
25 #define	il_host		il_dl.dl_host
26 #define	il_imp		il_dl.dl_imp
27 #define	il_link		il_dl.dl_link
28 #define	il_subtype	il_dl.dl_subtype
29 	u_short	il_length;	/* message length */
30 };
31 
32 #define	IMP_DROPCNT	2	/* # of noops from imp to ignore */
33 /* insure things are even... */
34 #define	IMPMTU		((8159 / NBBY) & ~01)
35 
36 /*
37  * IMP-host flags
38  */
39 #define	IMP_NFF		0xf	/* 96-bit (new) format */
40 #define	IMP_TRACE	0x8	/* trace message route */
41 
42 #define	IMP_DMASK	0x3	/* host going down mask */
43 
44 /*
45  * IMP-host message types.
46  */
47 #define	IMPTYPE_DATA		0	/* data for protocol */
48 #define	IMPTYPE_BADLEADER	1	/* leader error */
49 #define	IMPTYPE_DOWN		2	/* imp going down */
50 #define	IMPTYPE_NOOP		4	/* noop seen during initialization */
51 #define	IMPTYPE_RFNM		5	/* request for new messages */
52 #define	IMPTYPE_HOSTDEAD	6	/* host doesn't respond */
53 #define	IMPTYPE_HOSTUNREACH	7	/* host unreachable */
54 #define	IMPTYPE_BADDATA		8	/* data error */
55 #define	IMPTYPE_INCOMPLETE	9	/* incomplete message, send rest */
56 #define	IMPTYPE_RESET		10	/* reset complete */
57 /* non-blocking IMP interface */
58 #define	IMPTYPE_RETRY		11	/* IMP refused, try again */
59 #define	IMPTYPE_NOTIFY		12	/* IMP refused, will notify */
60 #define	IMPTYPE_TRYING		13	/* IMP refused, still rexmt'ng */
61 #define	IMPTYPE_READY		14	/* ready for next message */
62 
63 /*
64  * IMPTYPE_DOWN subtypes.
65  */
66 #define	IMPDOWN_GOING		0	/* 30 secs */
67 #define	IMPDOWN_PM		1	/* hardware PM */
68 #define	IMPDOWN_RELOAD		2	/* software reload */
69 #define	IMPDOWN_RESTART		3	/* emergency restart */
70 
71 /*
72  * IMPTYPE_BADLEADER subtypes.
73  */
74 #define	IMPLEADER_ERR		0	/* error flip-flop set */
75 #define	IMPLEADER_SHORT		1	/* leader < 80 bits */
76 #define	IMPLEADER_TYPE		2	/* illegal type field */
77 #define	IMPLEADER_OPPOSITE	3	/* opposite leader type */
78 
79 /*
80  * IMPTYPE_HOSTDEAD subtypes.
81  */
82 #define	IMPHOST_NORDY		1	/* ready-line negated */
83 #define	IMPHOST_TARDY		2	/* tardy receiving mesgs */
84 #define	IMPHOST_NOEXIST		3	/* NCC doesn't know host */
85 #define	IMPHOST_IMPSOFT		4	/* IMP software won't allow mesgs */
86 #define	IMPHOST_PM		5	/* host down for scheduled PM */
87 #define	IMPHOST_HARDSCHED	6	/* " " " " hardware work */
88 #define	IMPHOST_SOFTSCHED	7	/* " " " " software work */
89 #define	IMPHOST_RESTART		8	/* host down for emergency restart */
90 #define	IMPHOST_POWER		9	/* down because of power outage */
91 #define	IMPHOST_BREAKPOINT	10	/* host stopped at a breakpoint */
92 #define	IMPHOST_HARDWARE	11	/* hardware failure */
93 #define	IMPHOST_NOTUP		12	/* host not scheduled to be up */
94 /* 13-14 currently unused */
95 #define	IMPHOST_COMINGUP	15	/* host in process of coming up */
96 
97 /*
98  * IMPTYPE_HOSTUNREACH subtypes.
99  */
100 #define	IMPREACH_IMP		0	/* destination IMP can't be reached */
101 #define	IMPREACH_HOSTUP		1	/* destination host isn't up */
102 #define	IMPREACH_LEADER		2	/* host doesn't support long leader */
103 #define	IMPREACH_PROHIBITED	3	/* communication is prohibited */
104 
105 /*
106  * IMPTYPE_INCOMPLETE subtypes.
107  */
108 #define	IMPCOMPLETE_SLOW	0	/* host didn't take data fast enough */
109 #define	IMPCOMPLETE_TOOLONG	1	/* message was too long */
110 #define	IMPCOMPLETE_TIMEOUT	2	/* mesg transmission time > 15 sec. */
111 #define	IMPCOMPLETE_FAILURE	3	/* IMP/circuit failure */
112 #define	IMPCOMPLETE_NOSPACE	4	/* no resources within 15 sec. */
113 #define	IMPCOMPLETE_IMPIO	5	/* src IMP I/O failure during receipt */
114 
115 /*
116  * IMPTYPE_RETRY subtypes.
117  */
118 #define	IMPRETRY_BUFFER		0	/* IMP buffer wasn't available */
119 #define	IMPRETRY_BLOCK		1	/* connection block unavailable */
120 
121 /*
122  * Data structure shared between IMP protocol module and hardware
123  * interface driver.  Used to allow layering of IMP routines on top
124  * of varying device drivers.  NOTE: there's a possible problem
125  * with ambiguity in the ``unit'' definition which is implicitly
126  * shared by the both IMP and device code.  If we have two IMPs,
127  * with each on top of a device of the same unit, things won't work.
128  * The assumption is if you've got multiple IMPs, then they all run
129  * on top of the same type of device, or they must have different units.
130  */
131 struct impcb {
132 	char	ic_oactive;		/* output in progress */
133 	int	(*ic_init)();		/* hardware init routine */
134 	int	(*ic_start)();		/* hardware start output routine */
135 };
136 
137 /*
138  * State of an IMP.
139  */
140 #define	IMPS_DOWN	0		/* unavailable, don't use */
141 #define	IMPS_GOINGDOWN	1		/* been told we go down soon */
142 #define	IMPS_INIT	2		/* coming up */
143 #define	IMPS_UP		3		/* ready to go */
144 #define	IMPS_RESET	4		/* reset in progress */
145 
146 #define	IMPTV_DOWN	(30*60)		/* going down timer 30 secs */
147 
148 #ifdef IMPLEADERS
149 char *impleaders[IMPTYPE_READY+1] = {
150 	"DATA", "BADLEADER", "DOWN", "bad", "NOOP", "RFNM", "HOSTDEAD",
151 	"HOSTUNREACH", "BADDATA", "INCOMPLETE", "RESET", "RETRY",
152 	"NOTIFY", "TRYING", "READY"
153 };
154 #endif
155