5
5
#ifndef _UAPI_LINUX_IN_H
6
6
#define _UAPI_LINUX_IN_H
7
7
8
+
9
+ //#include <linux/socket.h>
10
+
8
11
/* Standard well-defined IP protocols. */
9
12
enum {
10
- IPPROTO_IP = 0 , /* Dummy protocol for TCP */
11
- #define IPPROTO_IP IPPROTO_IP
12
- IPPROTO_ICMP = 1 , /* Internet Control Message Protocol */
13
- #define IPPROTO_ICMP IPPROTO_ICMP
14
- IPPROTO_IGMP = 2 , /* Internet Group Management Protocol */
15
- #define IPPROTO_IGMP IPPROTO_IGMP
16
- IPPROTO_IPIP = 4 , /* IPIP tunnels (older KA9Q tunnels use 94) */
17
- #define IPPROTO_IPIP IPPROTO_IPIP
18
- IPPROTO_TCP = 6 , /* Transmission Control Protocol */
19
- #define IPPROTO_TCP IPPROTO_TCP
20
- IPPROTO_EGP = 8 , /* Exterior Gateway Protocol */
21
- #define IPPROTO_EGP IPPROTO_EGP
22
- IPPROTO_PUP = 12 , /* PUP protocol */
23
- #define IPPROTO_PUP IPPROTO_PUP
24
- IPPROTO_UDP = 17 , /* User Datagram Protocol */
25
- #define IPPROTO_UDP IPPROTO_UDP
26
- IPPROTO_IDP = 22 , /* XNS IDP protocol */
27
- #define IPPROTO_IDP IPPROTO_IDP
28
- IPPROTO_TP = 29 , /* SO Transport Protocol Class 4 */
29
- #define IPPROTO_TP IPPROTO_TP
30
- IPPROTO_DCCP = 33 , /* Datagram Congestion Control Protocol */
31
- #define IPPROTO_DCCP IPPROTO_DCCP
32
- IPPROTO_IPV6 = 41 , /* IPv6-in-IPv4 tunnelling */
33
- #define IPPROTO_IPV6 IPPROTO_IPV6
34
- IPPROTO_RSVP = 46 , /* RSVP Protocol */
35
- #define IPPROTO_RSVP IPPROTO_RSVP
36
- IPPROTO_GRE = 47 , /* Cisco GRE tunnels (rfc 1701,1702) */
37
- #define IPPROTO_GRE IPPROTO_GRE
38
- IPPROTO_ESP = 50 , /* Encapsulation Security Payload protocol */
39
- #define IPPROTO_ESP IPPROTO_ESP
40
- IPPROTO_AH = 51 , /* Authentication Header protocol */
41
- #define IPPROTO_AH IPPROTO_AH
42
- IPPROTO_MTP = 92 , /* Multicast Transport Protocol */
43
- #define IPPROTO_MTP IPPROTO_MTP
44
- IPPROTO_BEETPH = 94 , /* IP option pseudo header for BEET */
45
- #define IPPROTO_BEETPH IPPROTO_BEETPH
46
- IPPROTO_ENCAP = 98 , /* Encapsulation Header */
47
- #define IPPROTO_ENCAP IPPROTO_ENCAP
48
- IPPROTO_PIM = 103 , /* Protocol Independent Multicast */
49
- #define IPPROTO_PIM IPPROTO_PIM
50
- IPPROTO_COMP = 108 , /* Compression Header Protocol */
51
- #define IPPROTO_COMP IPPROTO_COMP
52
- IPPROTO_SCTP = 132 , /* Stream Control Transport Protocol */
53
- #define IPPROTO_SCTP IPPROTO_SCTP
54
- IPPROTO_UDPLITE = 136 , /* UDP-Lite (RFC 3828) */
55
- #define IPPROTO_UDPLITE IPPROTO_UDPLITE
56
- IPPROTO_MPLS = 137 , /* MPLS in IP (RFC 4023) */
57
- #define IPPROTO_MPLS IPPROTO_MPLS
58
- IPPROTO_ETHERNET = 143 , /* Ethernet-within-IPv6 Encapsulation */
59
- #define IPPROTO_ETHERNET IPPROTO_ETHERNET
60
- IPPROTO_RAW = 255 , /* Raw IP packets */
61
- #define IPPROTO_RAW IPPROTO_RAW
62
- IPPROTO_MPTCP = 262 , /* Multipath TCP connection */
63
- #define IPPROTO_MPTCP IPPROTO_MPTCP
64
- IPPROTO_MAX
13
+ IPPROTO_IP = 0 , /* Dummy protocol for TCP */
14
+ #define IPPROTO_IP IPPROTO_IP
15
+ <
F438
/span>IPPROTO_ICMP = 1 , /* Internet Control Message Protocol */
16
+ #define IPPROTO_ICMP IPPROTO_ICMP
17
+ IPPROTO_IGMP = 2 , /* Internet Group Management Protocol */
18
+ #define IPPROTO_IGMP IPPROTO_IGMP
19
+ IPPROTO_IPIP = 4 , /* IPIP tunnels (older KA9Q tunnels use 94) */
20
+ #define IPPROTO_IPIP IPPROTO_IPIP
21
+ IPPROTO_TCP = 6 , /* Transmission Control Protocol */
22
+ #define IPPROTO_TCP IPPROTO_TCP
23
+ IPPROTO_EGP = 8 , /* Exterior Gateway Protocol */
24
+ #define IPPROTO_EGP IPPROTO_EGP
25
+ IPPROTO_PUP = 12 , /* PUP protocol */
26
+ #define IPPROTO_PUP IPPROTO_PUP
27
+ IPPROTO_UDP = 17 , /* User Datagram Protocol */
28
+ #define IPPROTO_UDP IPPROTO_UDP
29
+ IPPROTO_IDP = 22 , /* XNS IDP protocol */
30
+ #define IPPROTO_IDP IPPROTO_IDP
31
+ IPPROTO_TP = 29 , /* SO Transport Protocol Class 4 */
32
+ #define IPPROTO_TP IPPROTO_TP
33
+ IPPROTO_DCCP = 33 , /* Datagram Congestion Control Protocol */
34
+ #define IPPROTO_DCCP IPPROTO_DCCP
35
+ IPPROTO_IPV6 = 41 , /* IPv6-in-IPv4 tunnelling */
36
+ #define IPPROTO_IPV6 IPPROTO_IPV6
37
+ IPPROTO_RSVP = 46 , /* RSVP Protocol */
38
+ #define IPPROTO_RSVP IPPROTO_RSVP
39
+ IPPROTO_GRE = 47 , /* Cisco GRE tunnels (rfc 1701,1702) */
40
+ #define IPPROTO_GRE IPPROTO_GRE
41
+ IPPROTO_ESP = 50 , /* Encapsulation Security Payload protocol */
42
+ #define IPPROTO_ESP IPPROTO_ESP
43
+ IPPROTO_AH = 51 , /* Authentication Header protocol */
44
+ #define IPPROTO_AH IPPROTO_AH
45
+ IPPROTO_MTP = 92 , /* Multicast Transport Protocol */
46
+ #define IPPROTO_MTP IPPROTO_MTP
47
+ IPPROTO_BEETPH = 94 , /* IP option pseudo header for BEET */
48
+ #define IPPROTO_BEETPH IPPROTO_BEETPH
49
+ IPPROTO_ENCAP = 98 , /* Encapsulation Header */
50
+ #define IPPROTO_ENCAP IPPROTO_ENCAP
51
+ IPPROTO_PIM = 103 , /* Protocol Independent Multicast */
52
+ #define IPPROTO_PIM IPPROTO_PIM
53
+ IPPROTO_COMP = 108 , /* Compression Header Protocol */
54
+ #define IPPROTO_COMP IPPROTO_COMP
55
+ IPPROTO_SCTP = 132 , /* Stream Control Transport Protocol */
56
+ #define IPPROTO_SCTP IPPROTO_SCTP
57
+ IPPROTO_UDPLITE = 136 , /* UDP-Lite (RFC 3828) */
58
+ #define IPPROTO_UDPLITE IPPROTO_UDPLITE
59
+ IPPROTO_MPLS = 137 , /* MPLS in IP (RFC 4023) */
60
+ #define IPPROTO_MPLS IPPROTO_MPLS
61
+ IPPROTO_ETHERNET = 143 , /* Ethernet-within-IPv6 Encapsulation */
62
+ #define IPPROTO_ETHERNET IPPROTO_ETHERNET
63
+ IPPROTO_RAW = 255 , /* Raw IP packets */
64
+ #define IPPROTO_RAW IPPROTO_RAW
65
+ IPPROTO_MPTCP = 262 , /* Multipath TCP connection */
66
+ #define IPPROTO_MPTCP IPPROTO_MPTCP
67
+ IPPROTO_MAX
65
68
};
66
69
70
+ #define IP_TOS 1
71
+ #define IP_TTL 2
72
+ #define IP_HDRINCL 3
73
+ #define IP_OPTIONS 4
74
+ #define IP_ROUTER_ALERT 5
75
+ #define IP_RECVOPTS 6
76
+ #define IP_RETOPTS 7
77
+ #define IP_PKTINFO 8
78
+ #define IP_PKTOPTIONS 9
79
+ #define IP_MTU_DISCOVER 10
80
+ #define IP_RECVERR 11
81
+ #define IP_RECVTTL 12
82
+ #define IP_RECVTOS 13
83
+ #define IP_MTU 14
84
+ #define IP_FREEBIND 15
85
+ #define IP_IPSEC_POLICY 16
86
+ #define IP_XFRM_POLICY 17
87
+ #define IP_PASSSEC 18
88
+ #define IP_TRANSPARENT 19
89
+
90
+ /* BSD compatibility */
91
+ #define IP_RECVRETOPTS IP_RETOPTS
92
+
93
+ /* TProxy original addresses */
94
+ #define IP_ORIGDSTADDR 20
95
+ #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
96
+
97
+ #define IP_MINTTL 21
98
+ #define IP_NODEFRAG 22
99
+ #define IP_CHECKSUM 23
100
+ #define IP_BIND_ADDRESS_NO_PORT 24
101
+ #define IP_RECVFRAGSIZE 25
102
+ #define IP_RECVERR_RFC4884 26
103
+
104
+ /* IP_MTU_DISCOVER values */
105
+ #define IP_PMTUDISC_DONT 0 /* Never send DF frames */
106
+ #define IP_PMTUDISC_WANT 1 /* Use per route hints */
107
+ #define IP_PMTUDISC_DO 2 /* Always DF */
108
+ #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
109
+ /* Always use interface mtu (ignores dst pmtu) but don't set DF flag.
110
+ * Also incoming ICMP frag_needed notifications will be ignored on
111
+ * this socket to prevent accepting spoofed ones.
112
+ */
113
+ #define IP_PMTUDISC_INTERFACE 4
114
+ /* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
115
+ * fragmented if they exeed the interface mtu
116
+ */
117
+ #define IP_PMTUDISC_OMIT 5
118
+
119
+ #define IP_MULTICAST_IF 32
120
+ #define IP_MULTICAST_TTL 33
121
+ #define IP_MULTICAST_LOOP 34
122
+ #define IP_ADD_MEMBERSHIP 35
123
+ #define IP_DROP_MEMBERSHIP 36
124
+ #define IP_UNBLOCK_SOURCE 37
125
+ #define IP_BLOCK_SOURCE 38
126
+ #define IP_ADD_SOURCE_MEMBERSHIP 39
127
+ #define IP_DROP_SOURCE_MEMBERSHIP 40
128
+ #define IP_MSFILTER 41
129
+ #define MCAST_JOIN_GROUP 42
130
+ #define MCAST_BLOCK_SOURCE 43
131
+ #define MCAST_UNBLOCK_SOURCE 44
132
+ #define MCAST_LEAVE_GROUP 45
133
+ #define MCAST_JOIN_SOURCE_GROUP 46
134
+ #define MCAST_LEAVE_SOURCE_GROUP 47
135
+ #define MCAST_MSFILTER 48
136
+ #define IP_MULTICAST_ALL 49
137
+ #define IP_UNICAST_IF 50
138
+
139
+ #define MCAST_EXCLUDE 0
140
+ #define MCAST_INCLUDE 1
141
+
142
+
143
+ // 来自于 #include <linux/socket.h>
144
+ typedef unsigned short __kernel_sa_family_t ;
145
+
146
+ // 来自于 #include <linux/in.h>
147
+ /* Internet address. */
148
+ struct in_addr {
149
+ __be32 s_addr ;
150
+ };
151
+
152
+ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
153
+ struct sockaddr_in {
154
+ __kernel_sa_family_t sin_family ; /* Address family */
155
+ __be16 sin_port ; /* Port number */
156
+ struct in_addr sin_addr ; /* Internet address */
157
+
158
+ /* Pad to size of `struct sockaddr'. */
159
+ unsigned char __pad [__SOCK_SIZE__ - sizeof (short int ) -
160
+ sizeof (unsigned short int ) - sizeof (struct in_addr )];
161
+ };
162
+ #define sin_zero __pad /* for BSD UNIX comp. -FvK */
67
163
68
- #endif
164
+ #endif
0 commit comments