]>
Commit | Line | Data |
---|---|---|
d7ce7006 | 1 | /*\r |
2 | * Copyright (c) 1984, 1985, 1986, 1987, 1993\r | |
3 | * The Regents of the University of California. All rights reserved.\r | |
4 | *\r | |
5 | * Redistribution and use in source and binary forms, with or without\r | |
6 | * modification, are permitted provided that the following conditions\r | |
7 | * are met:\r | |
8 | * 1. Redistributions of source code must retain the above copyright\r | |
9 | * notice, this list of conditions and the following disclaimer.\r | |
10 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
11 | * notice, this list of conditions and the following disclaimer in the\r | |
12 | * documentation and/or other materials provided with the distribution.\r | |
13 | * 3. All advertising materials mentioning features or use of this software\r | |
14 | * must display the following acknowledgement:\r | |
15 | * This product includes software developed by the University of\r | |
16 | * California, Berkeley and its contributors.\r | |
17 | * 4. Neither the name of the University nor the names of its contributors\r | |
18 | * may be used to endorse or promote products derived from this software\r | |
19 | * without specific prior written permission.\r | |
20 | *\r | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
31 | * SUCH DAMAGE.\r | |
32 | *\r | |
33 | * @(#)ns.h 8.1 (Berkeley) 6/10/93\r | |
34 | * $Id: ns.h,v 1.1.1.1 2003/11/19 01:48:56 kyu3 Exp $\r | |
35 | */\r | |
36 | \r | |
37 | #ifndef _NETNS_NS_H_\r | |
38 | #define _NETNS_NS_H_\r | |
39 | \r | |
40 | /*\r | |
41 | * Constants and Structures defined by the Xerox Network Software\r | |
42 | * per "Internet Transport Protocols", XSIS 028112, December 1981\r | |
43 | */\r | |
44 | \r | |
45 | /*\r | |
46 | * Protocols\r | |
47 | */\r | |
48 | #define NSPROTO_RI 1 /* Routing Information */\r | |
49 | #define NSPROTO_ECHO 2 /* Echo Protocol */\r | |
50 | #define NSPROTO_ERROR 3 /* Error Protocol */\r | |
51 | #define NSPROTO_PE 4 /* Packet Exchange */\r | |
52 | #define NSPROTO_SPP 5 /* Sequenced Packet */\r | |
53 | #define NSPROTO_RAW 255 /* Placemarker*/\r | |
54 | #define NSPROTO_MAX 256 /* Placemarker*/\r | |
55 | \r | |
56 | \r | |
57 | /*\r | |
58 | * Port/Socket numbers: network standard functions\r | |
59 | */\r | |
60 | \r | |
61 | #define NSPORT_RI 1 /* Routing Information */\r | |
62 | #define NSPORT_ECHO 2 /* Echo */\r | |
63 | #define NSPORT_RE 3 /* Router Error */\r | |
64 | \r | |
65 | /*\r | |
66 | * Ports < NSPORT_RESERVED are reserved for priveleged\r | |
67 | * processes (e.g. root).\r | |
68 | */\r | |
69 | #define NSPORT_RESERVED 3000\r | |
70 | \r | |
71 | /* flags passed to ns_output as last parameter */\r | |
72 | \r | |
73 | #define NS_FORWARDING 0x1 /* most of idp header exists */\r | |
74 | #define NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */\r | |
75 | #define NS_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */\r | |
76 | \r | |
77 | #define NS_MAXHOPS 15\r | |
78 | \r | |
79 | /* flags passed to get/set socket option */\r | |
80 | #define SO_HEADERS_ON_INPUT 1\r | |
81 | #define SO_HEADERS_ON_OUTPUT 2\r | |
82 | #define SO_DEFAULT_HEADERS 3\r | |
83 | #define SO_LAST_HEADER 4\r | |
84 | #define SO_NSIP_ROUTE 5\r | |
85 | #define SO_SEQNO 6\r | |
86 | #define SO_ALL_PACKETS 7\r | |
87 | #define SO_MTU 8\r | |
88 | \r | |
89 | \r | |
90 | /*\r | |
91 | * NS addressing\r | |
92 | */\r | |
93 | union ns_host {\r | |
94 | u_char c_host[6];\r | |
95 | u_short s_host[3];\r | |
96 | };\r | |
97 | \r | |
98 | union ns_net {\r | |
99 | u_char c_net[4];\r | |
100 | u_short s_net[2];\r | |
101 | };\r | |
102 | \r | |
103 | union ns_net_u {\r | |
104 | union ns_net net_e;\r | |
105 | u_long long_e;\r | |
106 | };\r | |
107 | \r | |
108 | struct ns_addr {\r | |
109 | union ns_net x_net;\r | |
110 | union ns_host x_host;\r | |
111 | u_short x_port;\r | |
112 | };\r | |
113 | \r | |
114 | /*\r | |
115 | * Socket address, Xerox style\r | |
116 | */\r | |
117 | struct sockaddr_ns {\r | |
118 | u_char sns_len;\r | |
119 | u_char sns_family;\r | |
120 | struct ns_addr sns_addr;\r | |
121 | char sns_zero[2];\r | |
122 | };\r | |
123 | #define sns_port sns_addr.x_port\r | |
124 | \r | |
125 | #ifdef vax\r | |
126 | #define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */\r | |
127 | #endif\r | |
128 | #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \\r | |
129 | ((a).s_net[1]==(b).s_net[1]))\r | |
130 | #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)\r | |
131 | #define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)\r | |
132 | #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \\r | |
133 | (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])\r | |
134 | #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))\r | |
135 | #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \\r | |
136 | ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))\r | |
137 | \r | |
138 | #ifdef KERNEL\r | |
139 | extern struct domain nsdomain;\r | |
140 | union ns_host ns_thishost;\r | |
141 | union ns_host ns_zerohost;\r | |
142 | union ns_host ns_broadhost;\r | |
143 | union ns_net ns_zeronet;\r | |
144 | union ns_net ns_broadnet;\r | |
145 | u_short ns_cksum();\r | |
146 | #else\r | |
147 | \r | |
148 | #include <sys/cdefs.h>\r | |
149 | \r | |
150 | __BEGIN_DECLS\r | |
151 | extern struct ns_addr ns_addr (const char *);\r | |
152 | extern char *ns_ntoa (struct ns_addr);\r | |
153 | __END_DECLS\r | |
154 | \r | |
155 | #endif\r | |
156 | \r | |
157 | #endif\r |