1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _LINUX_IN_H
19 #define _LINUX_IN_H
20
21 #include <linux/types.h>
22
23
24 enum {
25 IPPROTO_IP = 0,
26 IPPROTO_ICMP = 1,
27 IPPROTO_IGMP = 2,
28 IPPROTO_IPIP = 4,
29 IPPROTO_TCP = 6,
30 IPPROTO_EGP = 8,
31 IPPROTO_PUP = 12,
32 IPPROTO_UDP = 17,
33 IPPROTO_IDP = 22,
34
35 IPPROTO_RAW = 255,
36 IPPROTO_MAX
37 };
38
39
40
41 struct in_addr {
42 __u32 s_addr;
43 };
44
45
46
47 struct ip_mreq
48 {
49 struct in_addr imr_multiaddr;
50 struct in_addr imr_interface;
51 };
52
53
54
55 #define __SOCK_SIZE__ 16
56 struct sockaddr_in {
57 short int sin_family;
58 unsigned short int sin_port;
59 struct in_addr sin_addr;
60
61
62 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
63 sizeof(unsigned short int) - sizeof(struct in_addr)];
64 };
65 #define sin_zero __pad
66
67
68
69
70
71
72
73 #define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
74 #define IN_CLASSA_NET 0xff000000
75 #define IN_CLASSA_NSHIFT 24
76 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
77 #define IN_CLASSA_MAX 128
78
79 #define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
80 #define IN_CLASSB_NET 0xffff0000
81 #define IN_CLASSB_NSHIFT 16
82 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
83 #define IN_CLASSB_MAX 65536
84
85 #define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
86 #define IN_CLASSC_NET 0xffffff00
87 #define IN_CLASSC_NSHIFT 8
88 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
89
90 #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
91 #define IN_MULTICAST(a) IN_CLASSD(a)
92 #define IN_MULTICAST_NET 0xF0000000
93
94 #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000)
95 #define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
96
97
98 #define INADDR_ANY ((unsigned long int) 0x00000000)
99
100
101 #define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
102
103
104 #define INADDR_NONE 0xffffffff
105
106
107 #define IN_LOOPBACKNET 127
108
109
110 #define INADDR_LOOPBACK 0x7f000001
111
112
113 #define INADDR_UNSPEC_GROUP 0xe0000000
114 #define INADDR_ALLHOSTS_GROUP 0xe0000001
115 #define INADDR_MAX_LOCAL_GROUP 0xe00000ff
116
117
118
119 #include <asm/byteorder.h>
120
121
122 #ifdef __KERNEL__
123
124 #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))
125 #define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
126
127 #endif
128
129 #endif