|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. All advertising materials mentioning features or use of this software
14: * must display the following acknowledgement:
15: * This product includes software developed by the University of
16: * California, Berkeley and its contributors.
17: * 4. Neither the name of the University nor the names of its contributors
18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: *
33: * @(#)if_imp.h 7.7 (Berkeley) 6/28/90
34: */
35:
36: /*
37: * Structure of IMP 1822 long leader.
38: */
39: struct control_leader {
40: u_char dl_format; /* 1-8 leader format */
41: u_char dl_network; /* 9-16 src/dest network */
42: u_char dl_flags; /* 17-24 leader flags */
43: u_char dl_mtype; /* 25-32 message type */
44: u_char dl_htype; /* 33-40 handling type */
45: u_char dl_host; /* 41-48 host number */
46: u_short dl_imp; /* 49-64 imp field */
47: u_char dl_link; /* 65-72 link number */
48: u_char dl_subtype; /* 73-80 message subtype */
49: };
50:
51: struct imp_leader {
52: struct control_leader il_dl;
53: #define il_format il_dl.dl_format
54: #define il_network il_dl.dl_network
55: #define il_flags il_dl.dl_flags
56: #define il_mtype il_dl.dl_mtype
57: #define il_htype il_dl.dl_htype
58: #define il_host il_dl.dl_host
59: #define il_imp il_dl.dl_imp
60: #define il_link il_dl.dl_link
61: #define il_subtype il_dl.dl_subtype
62: u_short il_length; /* message length */
63: };
64:
65: #define IMP_MAXHOSTMSG 8 /* max messages in flight to a host */
66: #define IMP_NOOPCNT 3 /* # of noops to send imp on reset */
67: /* insure things are even... */
68: #define IMPMTU ((8159 / NBBY) & ~01)
69: #define IMP_RCVBUF ((8159 / NBBY + 2) & ~01)
70:
71: /*
72: * IMP-host flags
73: */
74: #define IMP_1822L_H2I 0xd /* 1822L host-to-imp, 96-bit format */
75: #define IMP_1822L_I2H 0xe /* 1822L imp-to-host, 96-bit format */
76: #define IMP_NFF 0xf /* 96-bit (new) format */
77: #define IMP_TRACE 0x8 /* trace message route */
78:
79: /*
80: * IMP-host message types.
81: */
82: #define IMPTYPE_DATA 0 /* data for protocol */
83: #define IMPTYPE_BADLEADER 1 /* leader error */
84: #define IMPTYPE_DOWN 2 /* imp going down */
85: #define IMPTYPE_NOOP 4 /* noop seen during initialization */
86: #define IMPTYPE_RFNM 5 /* request for new messages */
87: #define IMPTYPE_HOSTDEAD 6 /* host doesn't respond */
88: #define IMPTYPE_HOSTUNREACH 7 /* host unreachable */
89: #define IMPTYPE_BADDATA 8 /* data error */
90: #define IMPTYPE_INCOMPLETE 9 /* incomplete message, send rest */
91: #define IMPTYPE_RESET 10 /* reset complete */
92: /* non-blocking IMP interface */
93: #define IMPTYPE_RETRY 11 /* IMP refused, try again */
94: #define IMPTYPE_NOTIFY 12 /* IMP refused, will notify */
95: #define IMPTYPE_TRYING 13 /* IMP refused, still rexmt'ng */
96: #define IMPTYPE_READY 14 /* ready for next message */
97:
98: /*
99: * Link numbers
100: */
101: #define IMPLINK_IP 155
102: #define IMPLINK_LOWEXPER 156
103: #define IMPLINK_HIGHEXPER 158
104:
105: /*
106: * IMPTYPE_DOWN subtypes, in link number field.
107: */
108: #define IMP_DMASK 0x3 /* host going down mask */
109: #define IMPDOWN_GOING 0 /* 30 secs */
110: #define IMPDOWN_PM 1 /* hardware PM */
111: #define IMPDOWN_RELOAD 2 /* software reload */
112: #define IMPDOWN_RESTART 3 /* emergency restart */
113: #define IMPDOWN_WHENMASK 0x3c /* mask for "how soon" */
114: #define IMPDOWN_WHENSHIFT 2 /* shift for "how soon" */
115: #define IMPDOWN_WHENUNIT 5 /* unit for "how soon", 5 min. */
116:
117: #define IMPTV_DOWN 30 /* going down timer 30 secs */
118:
119: #ifdef IMPMESSAGES
120: /*
121: * Messages from IMP regarding why
122: * it's going down.
123: */
124: char *impmessage[] = {
125: "in 30 seconds",
126: "for hardware PM",
127: "to reload software",
128: "for emergency reset"
129: };
130: #endif
131:
132: /*
133: * IMPTYPE_BADLEADER subtypes.
134: */
135: #define IMPLEADER_ERR 0 /* error flip-flop set */
136: #define IMPLEADER_SHORT 1 /* leader < 80 bits */
137: #define IMPLEADER_TYPE 2 /* illegal type field */
138: #define IMPLEADER_OPPOSITE 3 /* opposite leader type */
139:
140: /*
141: * IMPTYPE_HOSTDEAD subtypes.
142: */
143: #define IMPHOST_NORDY 1 /* ready-line negated */
144: #define IMPHOST_TARDY 2 /* tardy receiving mesgs */
145: #define IMPHOST_NOEXIST 3 /* NCC doesn't know host */
146: #define IMPHOST_IMPSOFT 4 /* IMP software won't allow mesgs */
147: #define IMPHOST_PM 5 /* host down for scheduled PM */
148: #define IMPHOST_HARDSCHED 6 /* " " " " hardware work */
149: #define IMPHOST_SOFTSCHED 7 /* " " " " software work */
150: #define IMPHOST_RESTART 8 /* host down for emergency restart */
151: #define IMPHOST_POWER 9 /* down because of power outage */
152: #define IMPHOST_BREAKPOINT 10 /* host stopped at a breakpoint */
153: #define IMPHOST_HARDWARE 11 /* hardware failure */
154: #define IMPHOST_NOTUP 12 /* host not scheduled to be up */
155: /* 13-14 currently unused */
156: #define IMPHOST_COMINGUP 15 /* host in process of coming up */
157:
158: /*
159: * IMPTYPE_HOSTUNREACH subtypes.
160: */
161: #define IMPREACH_IMP 0 /* destination IMP can't be reached */
162: #define IMPREACH_HOSTUP 1 /* destination host isn't up */
163: #define IMPREACH_LEADER 2 /* host doesn't support long leader */
164: #define IMPREACH_PROHIBITED 3 /* communication is prohibited */
165:
166: /*
167: * IMPTYPE_INCOMPLETE subtypes.
168: */
169: #define IMPCOMPLETE_SLOW 0 /* host didn't take data fast enough */
170: #define IMPCOMPLETE_TOOLONG 1 /* message was too long */
171: #define IMPCOMPLETE_TIMEOUT 2 /* mesg transmission time > 15 sec. */
172: #define IMPCOMPLETE_FAILURE 3 /* IMP/circuit failure */
173: #define IMPCOMPLETE_NOSPACE 4 /* no resources within 15 sec. */
174: #define IMPCOMPLETE_IMPIO 5 /* src IMP I/O failure during receipt */
175:
176: /*
177: * IMPTYPE_RETRY subtypes.
178: */
179: #define IMPRETRY_BUFFER 0 /* IMP buffer wasn't available */
180: #define IMPRETRY_BLOCK 1 /* connection block unavailable */
181:
182: #define RFNMTIMER (120*PR_SLOWHZ) /* time to wait for RFNM for msg. */
183: #define IMP_OTIMER (5*IFNET_SLOWHZ) /* max output time unless blocked */
184:
185: /*
186: * Data structure shared between IMP protocol module and hardware
187: * interface driver. Used to allow layering of IMP routines on top
188: * of varying device drivers.
189: */
190: struct impcb {
191: int ic_hwunit; /* H/W unit number */
192: char *ic_hwname; /* H/W type name */
193: char ic_oactive; /* output in progress */
194: int (*ic_init)(); /* hardware init routine */
195: int (*ic_output)(); /* hardware output routine */
196: int (*ic_down)(); /* hardware "drop ready" routine */
197: };
198:
199: /*
200: * IMP software status per interface.
201: * (partially shared with the hardware specific module)
202: *
203: * Each interface is referenced by a network interface structure,
204: * imp_if, which the routing code uses to locate the interface.
205: * This structure contains the output queue for the interface, its
206: * address, ... IMP specific structures used in connecting the
207: * IMP software modules to the hardware specific interface routines
208: * are stored here. The common structures are made visible to the
209: * interface driver by passing a pointer to the hardware routine
210: * at "attach" time.
211: */
212: struct imp_softc {
213: struct ifnet imp_if; /* network visible interface */
214: struct impcb imp_cb; /* hooks to hardware module */
215: int imp_state; /* current state of IMP */
216: int imp_dropcnt; /* used during initialization */
217: struct mbuf *imp_hosts; /* Head of host table hash chains. */
218: struct mbuf *imp_hostq; /* current round-robin-output mark */
219: u_int imp_hostent; /* current round-robin-output mark */
220: int imp_msgready; /* number of messages ready to send */
221: u_long imp_block; /* times imp blocked output */
222: u_long imp_lostrfnm; /* rfnm's timed out */
223: u_long imp_badrfnm; /* rfnm/incompl after timeout/bogus */
224: u_long imp_incomplete; /* incomplete's received */
225: u_long imp_garbage; /* bad messages received */
226: };
227:
228: struct imp_softc *impattach();
229:
230: /*
231: * State of an IMP.
232: */
233: #define IMPS_DOWN 0 /* unavailable, host not ready */
234: #define IMPS_WINIT 1 /* imp not ready, waiting for init */
235: #define IMPS_INIT 2 /* coming up */
236: #define IMPS_UP 3 /* ready to go */
237: #define IMPS_GOINGDOWN 4 /* been told we go down soon */
238:
239: #define IMPS_RUNNING(s) ((s) >= IMPS_UP) /* ready for messages */
240: #define IMPS_IMPREADY(s) ((s) >= IMPS_INIT) /* IMP ready line on */
241:
242: #ifdef IMPLEADERS
243: char *impleaders[IMPTYPE_READY+1] = {
244: "DATA", "BADLEADER", "DOWN", "bad", "NOOP", "RFNM", "HOSTDEAD",
245: "HOSTUNREACH", "BADDATA", "INCOMPLETE", "RESET", "RETRY",
246: "NOTIFY", "TRYING", "READY"
247: };
248: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.