1: /*
2: * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that this notice is preserved and that due credit is given
7: * to the University of California at Berkeley. The name of the University
8: * may not be used to endorse or promote products derived from this
9: * software without specific prior written permission. This software
10: * is provided ``as is'' without express or implied warranty.
11: *
12: * @(#)ns.h 7.3.1 (2.11BSD GTE) 12/31/93
13: */
14:
15: /*
16: * Constants and Structures defined by the Xerox Network Software
17: * per "Internet Transport Protocols", XSIS 028112, December 1981
18: */
19:
20: /*
21: * Protocols
22: */
23: #define NSPROTO_RI 1 /* Routing Information */
24: #define NSPROTO_ECHO 2 /* Echo Protocol */
25: #define NSPROTO_ERROR 3 /* Error Protocol */
26: #define NSPROTO_PE 4 /* Packet Exchange */
27: #define NSPROTO_SPP 5 /* Sequenced Packet */
28: #define NSPROTO_RAW 255 /* Placemarker*/
29: #define NSPROTO_MAX 256 /* Placemarker*/
30:
31:
32: /*
33: * Port/Socket numbers: network standard functions
34: */
35:
36: #define NSPORT_RI 1 /* Routing Information */
37: #define NSPORT_ECHO 2 /* Echo */
38: #define NSPORT_RE 3 /* Router Error */
39:
40: /*
41: * Ports < NSPORT_RESERVED are reserved for priveleged
42: * processes (e.g. root).
43: */
44: #define NSPORT_RESERVED 3000
45:
46: /* flags passed to ns_output as last parameter */
47:
48: #define NS_FORWARDING 0x1 /* most of idp header exists */
49: #define NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
50: #define NS_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
51:
52: #define NS_MAXHOPS 15
53:
54: /* flags passed to get/set socket option */
55: #define 1
56: #define 2
57: #define 3
58: #define 4
59: #define SO_NSIP_ROUTE 5
60: #define SO_SEQNO 6
61: #define SO_ALL_PACKETS 7
62: #define SO_MTU 8
63:
64:
65: /*
66: * NS addressing
67: */
68: union ns_host {
69: u_char c_host[6];
70: u_short s_host[3];
71: };
72:
73: union ns_net {
74: u_char c_net[4];
75: u_short s_net[2];
76: };
77:
78: union ns_net_u {
79: union ns_net net_e;
80: u_long long_e;
81: };
82:
83: struct ns_addr {
84: union ns_net x_net;
85: union ns_host x_host;
86: u_short x_port;
87: };
88:
89: /*
90: * Socket address, Xerox style
91: */
92: struct sockaddr_ns {
93: u_short sns_family;
94: struct ns_addr sns_addr;
95: char sns_zero[2];
96: };
97: #define sns_port sns_addr.x_port
98:
99: #ifdef vax
100: #define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
101: #endif
102: #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
103: ((a).s_net[1]==(b).s_net[1]))
104: #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
105: #define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
106: #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
107: (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
108: #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
109: #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
110: ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
111:
112: /*
113: * Routines for number representation conversion.
114: */
115: u_short ntohs(), htons();
116: u_long ntohl(), htonl();
117:
118: #ifdef SUPERVISOR
119: extern struct domain nsdomain;
120: union ns_host ns_thishost;
121: union ns_host ns_zerohost;
122: union ns_host ns_broadhost;
123: union ns_net ns_zeronet;
124: union ns_net ns_broadnet;
125: u_short ns_cksum();
126: #endif
Defined variables
Defined struct's
sockaddr_ns
defined in line
92; used 130 times
- in /usr/src/new/crash/if.c line
127-128(4)
- in /usr/src/new/crash/route.c line
98(2),
119(2),
144-146(4),
332(2),
377-379(4)
- in /usr/src/sbin/ifconfig/ifconfig.c line
365(2),
384(2),
394(2),
492(4)
- in /usr/src/sbin/route/route.c line
254(2),
338(2),
529(2)
- in /usr/src/sys/netns/idp_usrreq.c line
39(2)
- in /usr/src/sys/netns/ns.c line
35(2),
53(2),
158(2),
174-176(4)
- in /usr/src/sys/netns/ns_input.c line
248-253(4),
413-416(4)
- in /usr/src/sys/netns/ns_ip.c line
291(4)
- in /usr/src/sys/netns/ns_output.c line
47(2),
63(2),
97(2)
- in /usr/src/sys/netns/ns_pcb.c line
53(2),
60(2),
103-104(6),
205-208(6),
218-221(6)
- in /usr/src/sys/netns/spp_usrreq.c line
134(2),
149-150(4),
530(2),
545(2),
1330-1332(6)
- in /usr/src/sys/pdpif/if_de.c line
798(2)
- in /usr/src/sys/pdpif/if_ec.c line
520(2)
- in /usr/src/sys/pdpif/if_il.c line
595(2)
- in /usr/src/sys/pdpif/if_qe.c line
606(2)
- in /usr/src/sys/pdpif/if_qt.c line
635(2)
- in /usr/src/ucb/netstat/if.c line
137-138(4)
- in /usr/src/ucb/netstat/ns.c line
319(2),
325(2)
- in /usr/src/ucb/netstat/route.c line
123-125(4),
298(2),
343-345(4)
Defined union's
ns_net
defined in line
73; used 36 times
Defined macros
defined in line
57;
never used
defined in line
55;
never used
defined in line
56;
never used
defined in line
58;
never used
Usage of this include