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