1: /*
2: * Copyright (c) 1984, 1985, 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)ns.h 7.1 (Berkeley) 6/5/86
7: */
8:
9: /*
10: * Constants and Structures defined by the Xerox Network Software
11: * per "Internet Transport Protocols", XSIS 028112, December 1981
12: */
13:
14: /*
15: * Protocols
16: */
17: #define NSPROTO_RI 1 /* Routing Information */
18: #define NSPROTO_ECHO 2 /* Echo Protocol */
19: #define NSPROTO_ERROR 3 /* Error Protocol */
20: #define NSPROTO_PE 4 /* Packet Exchange */
21: #define NSPROTO_SPP 5 /* Sequenced Packet */
22: #define NSPROTO_RAW 255 /* Placemarker*/
23: #define NSPROTO_MAX 256 /* Placemarker*/
24:
25:
26: /*
27: * Port/Socket numbers: network standard functions
28: */
29:
30: #define NSPORT_RI 1 /* Routing Information */
31: #define NSPORT_ECHO 2 /* Echo */
32: #define NSPORT_RE 3 /* Router Error */
33:
34: /*
35: * Ports < NSPORT_RESERVED are reserved for priveleged
36: * processes (e.g. root).
37: */
38: #define NSPORT_RESERVED 3000
39:
40: /* flags passed to ns_output as last parameter */
41:
42: #define NS_FORWARDING 0x1 /* most of idp header exists */
43: #define NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
44: #define NS_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
45:
46: #define NS_MAXHOPS 15
47:
48: /* flags passed to get/set socket option */
49: #define 1
50: #define 2
51: #define 3
52: #define 4
53: #define SO_NSIP_ROUTE 5
54: #define SO_SEQNO 6
55: #define SO_ALL_PACKETS 7
56: #define SO_MTU 8
57:
58:
59: /*
60: * NS addressing
61: */
62: union ns_host {
63: u_char c_host[6];
64: u_short s_host[3];
65: };
66:
67: union ns_net {
68: u_char c_net[4];
69: u_short s_net[2];
70: };
71:
72: union ns_net_u {
73: union ns_net net_e;
74: u_long long_e;
75: };
76:
77: struct ns_addr {
78: union ns_net x_net;
79: union ns_host x_host;
80: u_short x_port;
81: };
82:
83: /*
84: * Socket address, Xerox style
85: */
86: struct sockaddr_ns {
87: u_short sns_family;
88: struct ns_addr sns_addr;
89: char sns_zero[2];
90: };
91: #define sns_port sns_addr.x_port
92:
93: #ifdef vax
94: #define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
95: #endif
96: #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
97: ((a).s_net[1]==(b).s_net[1]))
98: #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
99: #define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
100: #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
101: (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
102: #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
103: #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
104: ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
105:
106: #if !defined(vax) && !defined(ntohl) && !defined(lint)
107: /*
108: * Macros for number representation conversion.
109: */
110: #define ntohl(x) (x)
111: #define ntohs(x) (x)
112: #define htonl(x) (x)
113: #define htons(x) (x)
114: #endif
115:
116: #if !defined(ntohl) && (defined(vax) || defined(lint))
117: u_short ntohs(), htons();
118: u_long ntohl(), htonl();
119: #endif
120:
121: #ifdef KERNEL
122: extern struct domain nsdomain;
123: union ns_host ns_thishost;
124: union ns_host ns_zerohost;
125: union ns_host ns_broadhost;
126: union ns_net ns_zeronet;
127: union ns_net ns_broadnet;
128: u_short ns_cksum();
129: #endif
Defined variables
Defined struct's
sockaddr_ns
defined in line
86; used 78 times
- in /usr/src/sys/netns/idp_usrreq.c line
33(2)
- in /usr/src/sys/netns/ns.c line
32(2),
50(2),
155(2),
171-173(4)
- in /usr/src/sys/netns/ns_input.c line
241-246(4),
406-409(4)
- in /usr/src/sys/netns/ns_ip.c line
285(4)
- in /usr/src/sys/netns/ns_output.c line
40(2),
56(2),
90(2)
- in /usr/src/sys/netns/ns_pcb.c line
47(2),
54(2),
97(4),
211-214(6),
224-227(6)
- in /usr/src/sys/netns/spp_usrreq.c line
119(2),
134-135(4),
387(2),
403(2),
1032-1034(6)
- in /usr/src/sys/vaxif/if_de.c line
622(2)
- in /usr/src/sys/vaxif/if_ec.c line
590(2)
- in /usr/src/sys/vaxif/if_en.c line
566(2)
- in /usr/src/sys/vaxif/if_ex.c line
709(2)
- in /usr/src/sys/vaxif/if_il.c line
572(2)
- in /usr/src/sys/vaxif/if_qe.c line
727(2)
Defined union's
ns_net
defined in line
67; used 20 times
Defined macros
defined in line
51;
never used
defined in line
49;
never used
defined in line
50;
never used
defined in line
52;
never used
htons
defined in line
113; used 31 times
- in line 117
- in /usr/src/sys/netns/idp_usrreq.c line
178
- in /usr/src/sys/netns/ns_error.c line
57,
98-103(3),
260-262(2)
- in /usr/src/sys/netns/ns_output.c line
109
- in /usr/src/sys/netns/ns_pcb.c line
80
- in /usr/src/sys/netns/spp_usrreq.c line
607,
711,
755-757(3),
1148
- in /usr/src/sys/vaxif/if_de.c line
611-612(2),
673
- in /usr/src/sys/vaxif/if_ec.c line
655
- in /usr/src/sys/vaxif/if_en.c line
552,
630
- in /usr/src/sys/vaxif/if_ex.c line
698-699(2),
760
- in /usr/src/sys/vaxif/if_il.c line
561-562(2),
623
- in /usr/src/sys/vaxif/if_qe.c line
716-717(2),
779
ntohs
defined in line
111; used 51 times
- in line 117
- in /usr/src/sys/netns/ns_error.c line
152,
162-163(2),
271
- in /usr/src/sys/netns/ns_input.c line
105,
256,
314,
359
- in /usr/src/sys/netns/ns_ip.c line
163,
238
- in /usr/src/sys/netns/ns_pcb.c line
67
- in /usr/src/sys/netns/spp_debug.c line
90-93(4)
- in /usr/src/sys/netns/spp_usrreq.c line
75-77(3),
217-219(3),
413,
761
- in /usr/src/sys/vaxif/if_de.c line
505,
512-513(2),
605
- in /usr/src/sys/vaxif/if_ec.c line
463,
470-471(2),
573,
580-581(2)
- in /usr/src/sys/vaxif/if_en.c line
414,
421-422(2),
544,
553
- in /usr/src/sys/vaxif/if_ex.c line
574,
581-582(2),
692
- in /usr/src/sys/vaxif/if_il.c line
438,
445-446(2),
555
- in /usr/src/sys/vaxif/if_qe.c line
710,
950,
957-958(2)
Usage of this include