1: /* in.h 6.4 85/03/18 */
2:
3: /*
4: * Constants and structures defined by the internet system,
5: * Per RFC 790, September 1981.
6: */
7:
8: /*
9: * Protocols
10: */
11: #define IPPROTO_ICMP 1 /* control message protocol */
12: #define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
13: #define IPPROTO_TCP 6 /* tcp */
14: #define IPPROTO_EGP 8 /* exterior gateway protocol */
15: #define IPPROTO_PUP 12 /* pup */
16: #define IPPROTO_UDP 17 /* user datagram protocol */
17:
18: #define IPPROTO_RAW 255 /* raw IP packet */
19: #define IPPROTO_MAX 256
20:
21:
22: /*
23: * Ports < IPPORT_RESERVED are reserved for
24: * privileged processes (e.g. root).
25: */
26: #define IPPORT_RESERVED 1024
27:
28: /*
29: * Link numbers
30: */
31: #define IMPLINK_IP 155
32: #define IMPLINK_LOWEXPER 156
33: #define IMPLINK_HIGHEXPER 158
34:
35: /*
36: * Internet address (a structure for historical reasons)
37: */
38: struct in_addr {
39: u_long s_addr;
40: };
41:
42: /*
43: * Definitions of bits in internet address integers.
44: */
45: #define IN_CLASSA(i) ((((long)(i))&0x80000000)==0)
46: #define IN_CLASSA_NET 0xff000000
47: #define IN_CLASSA_NSHIFT 24
48: #define IN_CLASSA_HOST 0x00ffffff
49: #define IN_CLASSA_MAX 128
50:
51: #define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000)
52: #define IN_CLASSB_NET 0xffff0000
53: #define IN_CLASSB_NSHIFT 16
54: #define IN_CLASSB_HOST 0x0000ffff
55: #define IN_CLASSB_MAX 65536
56:
57: #define IN_CLASSC(i) ((((long)(i))&0xc0000000)==0xc0000000)
58: #define IN_CLASSC_NET 0xffffff00
59: #define IN_CLASSC_NSHIFT 8
60: #define IN_CLASSC_HOST 0x000000ff
61:
62: #define INADDR_ANY 0x00000000
63: #define INADDR_BROADCAST 0xffffffff
64:
65: /*
66: * Macros for subnetworks. A subnet is distinguished by
67: * (1) the network number is a `local' network number, and
68: * (2) the most significant bit of the host part is set.
69: * Such addresses include one additional byte in the network number,
70: * and use one less byte in the host part (i.e., a subnet of a Class A
71: * network uses the rules for Class B net/host number extraction,
72: * a Class B subnet is dealt with as if it were a Class C net).
73: * Subnets of Class C nets are not supported.
74: */
75: #define SUBNETSHIFT 8 /* used to get main net number from subnet */
76:
77: #define IN_SUBNETA(i) ((((long)(i))&0x80800000)==0x00800000)
78: #define IN_CLASSA_SUBNET 0xffff0000
79: #define IN_CLASSA_SUBNSHIFT (IN_CLASSA_NSHIFT - SUBNETSHIFT)
80: #define IN_CLASSA_SUBHOST 0x0000ffff
81:
82: #define IN_SUBNETB(i) ((((long)(i))&0xc0008000)==0x80008000)
83: #define IN_CLASSB_SUBNET 0xffffff00
84: #define IN_CLASSB_SUBNSHIFT (IN_CLASSB_NSHIFT - SUBNETSHIFT)
85: #define IN_CLASSA_SUBHOST 0x0000ffff
86: #define IN_CLASSB_SUBHOST 0x000000ff
87:
88: /*
89: * Socket address, internet style.
90: */
91: struct sockaddr_in {
92: short sin_family;
93: u_short sin_port;
94: struct in_addr sin_addr;
95: char sin_zero[8];
96: };
97:
98: #if !defined(vax)
99: /*
100: * Macros for number representation conversion.
101: */
102: #define ntohl(x) (x)
103: #define ntohs(x) (x)
104: #define htonl(x) (x)
105: #define htons(x) (x)
106: #endif
107:
108: #ifdef KERNEL
109: extern struct domain inetdomain;
110: extern struct protosw inetsw[];
111: struct in_addr in_makeaddr();
112: #endif
Defined struct's
Defined macros