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