have to leave instrs.adb around, kernel uses it for kdb
[unix-history] / usr / src / sys / deprecated / bbnnet / net.h
CommitLineData
17efd7fe
MK
1#define RCSNETHDR "$Header: net.h,v 1.14 85/07/31 09:32:54 walsh Exp $"
2
3/*
4 * dummy protocol number(s) for raw input. Not real like UDPROTO/TCPROTO/...
5 */
6#define NETLOG_PROTO 62
7
8
9#define TRUE 1
10#define FALSE 0
11
12/*
13 * Software interrupt version
14 *
15 * This version of the network code runs off software interrupts rather than
16 * as a separate process. The software interrupt level for the network is
17 * higher than the software level for the clock (so you can enter the network
18 * in routines called from timeouts). User process routines switch into
19 * network code by doing splnet().
20 */
21
22/* splnet is defined in ../sys/asm.sed */
23#define setsoftnet() mtpr(SIRR, 12)
24
25#ifndef LOCORE
26
27typedef unsigned short n_short; /* short as received from the net */
28typedef u_long n_long; /* long as received from the net */
29typedef u_long sequence; /* sequence numbers in tcp */
30typedef u_long net_t; /* network number */
31
32/*
33 * This structure describes the work that the finite state machine
34 * procedure is supposed to do. At one time, these were chained
35 * together and batch processing performed on them. Code would need
36 * reworking to go back to that method since work entry has pointer
37 * to tcpcb, which may have been closed and freed.
38 */
39struct work {
40 short w_type; /* what to do with entry */
41 short w_stype; /* subtype for timer names */
42 struct tcpcb *w_tcb; /* -> tcb for entry */
43 char *w_dat; /* -> work data chain */
44};
45
46/*
47 * No need to spl when enter network via action, since network is only
48 * accessed via softare interrupt [splnet], tcp_usrreq(), and tcp_timeo()
49 * which splnet().
50 */
51#define w_alloc(type, stype, tp, m) \
52{ \
53 struct work w; \
54 \
55 w.w_type = type; w.w_stype = stype; w.w_tcb = tp; \
56 w.w_dat = (char *)m; \
57 (void) action(&w); \
58}
59
60#define NETHASH(x) ((u_long) iptonet(x))
61#define HOSTHASH(x) ((u_long) htonl((u_long) (x)))
62
63/* make an ip addr */
64#define ipaddr(w,x,y,z) ((long)(((z)<<24)|((y)<<16)|((x)<<8)|(w)))
65
66
67struct dfilter {
68 struct in_addr foreign_host;
69 struct in_addr local_host;
70 u_short foreign_port;
71 u_short local_port;
72 int matches;
73};
74
75#ifdef KERNEL
76u_long iptime();
77
78extern struct dfilter tcp_dfilter;
79
80extern struct in_addr icmp_addr();
81extern struct in_addr redir_addr();
82
83#endif KERNEL
84
85/* replace with dynamic estimate of remote send buffering */
86#define MINTCPBUF 256
87#endif LOCORE