1: /*
2: * Copyright (c) 1982, 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: * @(#)in.h 7.1 (Berkeley) 6/5/86
7: */
8:
9: /*
10: * Constants and structures defined by the internet system,
11: * Per RFC 790, September 1981.
12: */
13:
14: /*
15: * Protocols
16: */
17: #define IPPROTO_IP 0 /* dummy for IP */
18: #define IPPROTO_ICMP 1 /* control message protocol */
19: #define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
20: #define IPPROTO_TCP 6 /* tcp */
21: #define IPPROTO_EGP 8 /* exterior gateway protocol */
22: #define IPPROTO_PUP 12 /* pup */
23: #define IPPROTO_UDP 17 /* user datagram protocol */
24: #define IPPROTO_IDP 22 /* xns idp */
25:
26: #define IPPROTO_RAW 255 /* raw IP packet */
27: #define IPPROTO_MAX 256
28:
29:
30: /*
31: * Ports < IPPORT_RESERVED are reserved for
32: * privileged processes (e.g. root).
33: * Ports > IPPORT_USERRESERVED are reserved
34: * for servers, not necessarily privileged.
35: */
36: #define IPPORT_RESERVED 1024
37: #define IPPORT_USERRESERVED 5000
38:
39: /*
40: * Link numbers
41: */
42: #define IMPLINK_IP 155
43: #define IMPLINK_LOWEXPER 156
44: #define IMPLINK_HIGHEXPER 158
45:
46: /*
47: * Internet address (a structure for historical reasons)
48: */
49: struct in_addr {
50: u_long s_addr;
51: };
52:
53: /*
54: * Definitions of bits in internet address integers.
55: * On subnets, the decomposition of addresses to host and net parts
56: * is done according to subnet mask, not the masks here.
57: */
58: #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
59: #define IN_CLASSA_NET 0xff000000
60: #define IN_CLASSA_NSHIFT 24
61: #define IN_CLASSA_HOST 0x00ffffff
62: #define IN_CLASSA_MAX 128
63:
64: #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
65: #define IN_CLASSB_NET 0xffff0000
66: #define IN_CLASSB_NSHIFT 16
67: #define IN_CLASSB_HOST 0x0000ffff
68: #define IN_CLASSB_MAX 65536
69:
70: #define IN_CLASSC(i) (((long)(i) & 0xc0000000) == 0xc0000000)
71: #define IN_CLASSC_NET 0xffffff00
72: #define IN_CLASSC_NSHIFT 8
73: #define IN_CLASSC_HOST 0x000000ff
74:
75: #define INADDR_ANY (u_long)0x00000000
76: #define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */
77:
78: /*
79: * Socket address, internet style.
80: */
81: struct sockaddr_in {
82: short sin_family;
83: u_short sin_port;
84: struct in_addr sin_addr;
85: char sin_zero[8];
86: };
87:
88: /*
89: * Options for use with [gs]etsockopt at the IP level.
90: */
91: #define IP_OPTIONS 1 /* set/get IP per-packet options */
92:
93: #if !defined(vax) && !defined(ntohl) && !defined(lint)
94: /*
95: * Macros for number representation conversion.
96: */
97: #define ntohl(x) (x)
98: #define ntohs(x) (x)
99: #define htonl(x) (x)
100: #define htons(x) (x)
101: #endif
102:
103: #if !defined(ntohl) && (defined(vax) || defined(lint))
104: u_short ntohs(), htons();
105: u_long ntohl(), htonl();
106: #endif
107:
108: #ifdef KERNEL
109: extern struct domain inetdomain;
110: extern struct protosw inetsw[];
111: struct in_addr in_makeaddr();
112: u_long in_netof(), in_lnaof();
113: #endif
Defined struct's
in_addr
defined in line
49; used 164 times
- in line 84(2),
111(2)
- in /usr/src/sys/netimp/if_imp.c line
171(2),
278(2),
563(2),
727(2)
- in /usr/src/sys/netimp/if_imphost.c line
40(2),
63(2)
- in /usr/src/sys/netinet/if_ether.c line
88(2),
136(2),
270(2),
277-278(4),
415(2)
- in /usr/src/sys/netinet/in.c line
50(2),
70(2),
78(2),
106(2),
144(2),
415(2)
- in /usr/src/sys/netinet/in_pcb.c line
25(2),
262(2),
327(2)
- in /usr/src/sys/netinet/ip_icmp.c line
45(2),
138(2),
336(2)
- in /usr/src/sys/netinet/ip_input.c line
46(2),
506(2),
560(2),
581-582(4),
594(2),
607-608(4),
621(2),
629-634(4),
640-646(6),
669(2),
703(2),
715(2),
727(2),
733(2),
739(2),
745-748(6),
825(2)
- in /usr/src/sys/netinet/ip_output.c line
390-400(10),
428-432(8),
438(2),
444-446(4)
- in /usr/src/sys/netinet/tcp_input.c line
176(2)
- in /usr/src/sys/netinet/udp_usrreq.c line
320(2)
- in /usr/src/sys/netns/ns_ip.c line
44-45(4),
401(2)
- in /usr/src/sys/vaxif/if_ddn.c line
224(2),
242(2),
797(2),
859-864(4),
937(2),
1660(2)
- in /usr/src/sys/vaxif/if_de.c line
587(2)
- in /usr/src/sys/vaxif/if_ec.c line
551(2)
- in /usr/src/sys/vaxif/if_en.c line
532(2)
- in /usr/src/sys/vaxif/if_ex.c line
674(2)
- in /usr/src/sys/vaxif/if_hy.c line
144(2),
622(2)
- in /usr/src/sys/vaxif/if_il.c line
537(2)
- in /usr/src/sys/vaxif/if_qe.c line
691(2)
sockaddr_in
defined in line
81; used 168 times
- in /usr/src/sys/net/raw_cb.c line
117(2)
- in /usr/src/sys/netimp/if_imp.c line
173(2),
276(2),
411-412(4),
529(2),
732-735(4)
- in /usr/src/sys/netimp/raw_imp.c line
43(2),
85(2)
- in /usr/src/sys/netinet/if_ether.c line
142(2),
268(2),
453(2),
459(2)
- in /usr/src/sys/netinet/in.c line
27(2),
41(2),
317-321(4),
372(2),
424(2)
- in /usr/src/sys/netinet/in_pcb.c line
51(2),
60(2),
113-114(6),
158(2),
183(2),
231-234(6),
245-248(6)
- in /usr/src/sys/netinet/ip_icmp.c line
119-121(6)
- in /usr/src/sys/netinet/ip_input.c line
75(2),
671-674(4),
823(2),
854(2)
- in /usr/src/sys/netinet/ip_output.c line
47(2),
70(2),
109(2)
- in /usr/src/sys/netinet/raw_ip.c line
29-30(4),
61(2),
87(2),
95(2)
- in /usr/src/sys/netinet/tcp_input.c line
353(2),
366-367(4),
1047(2)
- in /usr/src/sys/netinet/tcp_subr.c line
238(2),
245(2)
- in /usr/src/sys/netinet/tcp_usrreq.c line
193-195(6)
- in /usr/src/sys/netinet/udp_usrreq.c line
47(2),
154(2),
161(2),
239(2)
- in /usr/src/sys/netns/ns_ip.c line
286-289(6),
323(2),
377(2),
384(2)
- in /usr/src/sys/vaxif/if_ddn.c line
466(2)
- in /usr/src/sys/vaxif/if_de.c line
602(2)
- in /usr/src/sys/vaxif/if_ec.c line
567(2)
- in /usr/src/sys/vaxif/if_en.c line
534(2)
- in /usr/src/sys/vaxif/if_ex.c line
689(2)
- in /usr/src/sys/vaxif/if_hy.c line
618(2),
1092-1093(4)
- in /usr/src/sys/vaxif/if_il.c line
552(2)
- in /usr/src/sys/vaxif/if_pcl.c line
210-213(4)
- in /usr/src/sys/vaxif/if_qe.c line
707(2)
- in /usr/src/sys/vaxif/if_vv.c line
847-850(4)
- in /usr/src/sys/vaxif/raw_hy.c line
48(2),
62(2)
Defined macros
INADDR_ANY
defined in line
75; used 26 times
- in /usr/src/sys/netinet/in.c line
351,
388
- in /usr/src/sys/netinet/in_pcb.c line
56,
63,
131,
137,
192,
206,
338-348(5),
354
- in /usr/src/sys/netinet/ip_icmp.c line
288
- in /usr/src/sys/netinet/ip_input.c line
216
- in /usr/src/sys/netinet/ip_output.c line
116
- in /usr/src/sys/netinet/tcp_input.c line
372,
1045
- in /usr/src/sys/netinet/tcp_subr.c line
246
- in /usr/src/sys/netinet/udp_usrreq.c line
162,
289,
307,
325,
339
- in /usr/src/sys/netns/ns_ip.c line
385
htonl
defined in line
99; used 11 times
htons
defined in line
100; used 36 times
- in line 104
- in /usr/src/sys/netimp/if_imp.c line
530,
772
- in /usr/src/sys/netimp/raw_imp.c line
84
- in /usr/src/sys/netinet/if_ether.c line
105-109(3),
360,
369,
381
- in /usr/src/sys/netinet/in_pcb.c line
95
- in /usr/src/sys/netinet/ip_icmp.c line
97
- in /usr/src/sys/netinet/ip_input.c line
831
- in /usr/src/sys/netinet/ip_output.c line
58,
151-152(2),
206,
213
- in /usr/src/sys/netinet/tcp_input.c line
204
- in /usr/src/sys/netinet/tcp_output.c line
250,
285-287(2),
310
- in /usr/src/sys/netinet/tcp_subr.c line
70,
136,
142
- in /usr/src/sys/netinet/udp_usrreq.c line
217
- in /usr/src/sys/stand/imptst.c line
73
- in /usr/src/sys/vaxif/if_dmc.c line
742-743(2),
795
- in /usr/src/sys/vaxif/if_hy.c line
660,
740
- in /usr/src/sys/vaxif/if_vv.c line
870-871(2),
919
ntohl
defined in line
97; used 22 times
- in line 93,
103-105(2)
- in /usr/src/sys/netimp/if_imp.c line
283,
736,
758
- in /usr/src/sys/netimp/if_imphost.c line
222
- in /usr/src/sys/netinet/if_ether.c line
286
- in /usr/src/sys/netinet/in.c line
37,
80,
108,
146,
287,
299,
319
- in /usr/src/sys/netinet/ip_input.c line
207,
876-877(2)
- in /usr/src/sys/netinet/tcp_debug.c line
84-85(2)
- in /usr/src/sys/netinet/tcp_input.c line
256-257(2)
ntohs
defined in line
98; used 31 times
- in line 104
- in /usr/src/sys/netimp/if_imp.c line
285,
488,
687-692(2),
733
- in /usr/src/sys/netinet/if_ether.c line
227-232(2),
275-276(2)
- in /usr/src/sys/netinet/in_pcb.c line
73
- in /usr/src/sys/netinet/ip_icmp.c line
209
- in /usr/src/sys/netinet/ip_input.c line
138-144(3)
- in /usr/src/sys/netinet/tcp_debug.c line
86
- in /usr/src/sys/netinet/tcp_input.c line
258-259(2),
978
- in /usr/src/sys/netinet/udp_usrreq.c line
76
- in /usr/src/sys/stand/imptst.c line
86,
278-283(2)
- in /usr/src/sys/vaxif/if_dmc.c line
566,
573-574(2),
735
- in /usr/src/sys/vaxif/if_vv.c line
712,
718-719(2),
859
Usage of this include