Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: fusl/include/netinet/ip.h

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef _NETINET_IP_H 1 #ifndef _NETINET_IP_H
2 #define _NETINET_IP_H 2 #define _NETINET_IP_H
3 3
4 #ifdef __cplusplus 4 #ifdef __cplusplus
5 extern "C" { 5 extern "C" {
6 #endif 6 #endif
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <netinet/in.h> 9 #include <netinet/in.h>
10 #include <endian.h> 10 #include <endian.h>
11 11
12 struct timestamp { 12 struct timestamp {
13 » uint8_t len; 13 uint8_t len;
14 » uint8_t ptr; 14 uint8_t ptr;
15 #if __BYTE_ORDER == __LITTLE_ENDIAN 15 #if __BYTE_ORDER == __LITTLE_ENDIAN
16 » unsigned int flags:4; 16 unsigned int flags : 4;
17 » unsigned int overflow:4; 17 unsigned int overflow : 4;
18 #else 18 #else
19 » unsigned int overflow:4; 19 unsigned int overflow : 4;
20 » unsigned int flags:4; 20 unsigned int flags : 4;
21 #endif 21 #endif
22 » uint32_t data[9]; 22 uint32_t data[9];
23 }; 23 };
24 24
25 struct iphdr { 25 struct iphdr {
26 #if __BYTE_ORDER == __LITTLE_ENDIAN 26 #if __BYTE_ORDER == __LITTLE_ENDIAN
27 » unsigned int ihl:4; 27 unsigned int ihl : 4;
28 » unsigned int version:4; 28 unsigned int version : 4;
29 #else 29 #else
30 » unsigned int version:4; 30 unsigned int version : 4;
31 » unsigned int ihl:4; 31 unsigned int ihl : 4;
32 #endif 32 #endif
33 » uint8_t tos; 33 uint8_t tos;
34 » uint16_t tot_len; 34 uint16_t tot_len;
35 » uint16_t id; 35 uint16_t id;
36 » uint16_t frag_off; 36 uint16_t frag_off;
37 » uint8_t ttl; 37 uint8_t ttl;
38 » uint8_t protocol; 38 uint8_t protocol;
39 » uint16_t check; 39 uint16_t check;
40 » uint32_t saddr; 40 uint32_t saddr;
41 » uint32_t daddr; 41 uint32_t daddr;
42 }; 42 };
43 43
44 struct ip { 44 struct ip {
45 #if __BYTE_ORDER == __LITTLE_ENDIAN 45 #if __BYTE_ORDER == __LITTLE_ENDIAN
46 » unsigned int ip_hl:4; 46 unsigned int ip_hl : 4;
47 » unsigned int ip_v:4; 47 unsigned int ip_v : 4;
48 #else 48 #else
49 » unsigned int ip_v:4; 49 unsigned int ip_v : 4;
50 » unsigned int ip_hl:4; 50 unsigned int ip_hl : 4;
51 #endif 51 #endif
52 » uint8_t ip_tos; 52 uint8_t ip_tos;
53 » uint16_t ip_len; 53 uint16_t ip_len;
54 » uint16_t ip_id; 54 uint16_t ip_id;
55 » uint16_t ip_off; 55 uint16_t ip_off;
56 » uint8_t ip_ttl; 56 uint8_t ip_ttl;
57 » uint8_t ip_p; 57 uint8_t ip_p;
58 » uint16_t ip_sum; 58 uint16_t ip_sum;
59 » struct in_addr ip_src, ip_dst; 59 struct in_addr ip_src, ip_dst;
60 }; 60 };
61 61
62 #define»IP_RF 0x8000 62 #define IP_RF 0x8000
63 #define»IP_DF 0x4000 63 #define IP_DF 0x4000
64 #define»IP_MF 0x2000 64 #define IP_MF 0x2000
65 #define»IP_OFFMASK 0x1fff 65 #define IP_OFFMASK 0x1fff
66 66
67 struct ip_timestamp { 67 struct ip_timestamp {
68 » uint8_t ipt_code; 68 uint8_t ipt_code;
69 » uint8_t ipt_len; 69 uint8_t ipt_len;
70 » uint8_t ipt_ptr; 70 uint8_t ipt_ptr;
71 #if __BYTE_ORDER == __LITTLE_ENDIAN 71 #if __BYTE_ORDER == __LITTLE_ENDIAN
72 » unsigned int ipt_flg:4; 72 unsigned int ipt_flg : 4;
73 » unsigned int ipt_oflw:4; 73 unsigned int ipt_oflw : 4;
74 #else 74 #else
75 » unsigned int ipt_oflw:4; 75 unsigned int ipt_oflw : 4;
76 » unsigned int ipt_flg:4; 76 unsigned int ipt_flg : 4;
77 #endif 77 #endif
78 » uint32_t data[9]; 78 uint32_t data[9];
79 }; 79 };
80 80
81 #define»IPVERSION» 4 81 #define IPVERSION 4
82 #define»IP_MAXPACKET» 65535 82 #define IP_MAXPACKET 65535
83 83
84 #define»IPTOS_ECN_MASK» » 0x03 84 #define IPTOS_ECN_MASK 0x03
85 #define»IPTOS_ECN(x)» » ((x) & IPTOS_ECN_MASK) 85 #define IPTOS_ECN(x) ((x)&IPTOS_ECN_MASK)
86 #define»IPTOS_ECN_NOT_ECT» 0x00 86 #define IPTOS_ECN_NOT_ECT 0x00
87 #define»IPTOS_ECN_ECT1» » 0x01 87 #define IPTOS_ECN_ECT1 0x01
88 #define»IPTOS_ECN_ECT0» » 0x02 88 #define IPTOS_ECN_ECT0 0x02
89 #define»IPTOS_ECN_CE» » 0x03 89 #define IPTOS_ECN_CE 0x03
90 90
91 #define»IPTOS_DSCP_MASK»» 0xfc 91 #define IPTOS_DSCP_MASK 0xfc
92 #define»IPTOS_DSCP(x)» » ((x) & IPTOS_DSCP_MASK) 92 #define IPTOS_DSCP(x) ((x)&IPTOS_DSCP_MASK)
93 #define»IPTOS_DSCP_AF11»» 0x28 93 #define IPTOS_DSCP_AF11 0x28
94 #define»IPTOS_DSCP_AF12»» 0x30 94 #define IPTOS_DSCP_AF12 0x30
95 #define»IPTOS_DSCP_AF13»» 0x38 95 #define IPTOS_DSCP_AF13 0x38
96 #define»IPTOS_DSCP_AF21»» 0x48 96 #define IPTOS_DSCP_AF21 0x48
97 #define»IPTOS_DSCP_AF22»» 0x50 97 #define IPTOS_DSCP_AF22 0x50
98 #define»IPTOS_DSCP_AF23»» 0x58 98 #define IPTOS_DSCP_AF23 0x58
99 #define»IPTOS_DSCP_AF31»» 0x68 99 #define IPTOS_DSCP_AF31 0x68
100 #define»IPTOS_DSCP_AF32»» 0x70 100 #define IPTOS_DSCP_AF32 0x70
101 #define»IPTOS_DSCP_AF33»» 0x78 101 #define IPTOS_DSCP_AF33 0x78
102 #define»IPTOS_DSCP_AF41»» 0x88 102 #define IPTOS_DSCP_AF41 0x88
103 #define»IPTOS_DSCP_AF42»» 0x90 103 #define IPTOS_DSCP_AF42 0x90
104 #define»IPTOS_DSCP_AF43»» 0x98 104 #define IPTOS_DSCP_AF43 0x98
105 #define»IPTOS_DSCP_EF» » 0xb8 105 #define IPTOS_DSCP_EF 0xb8
106 106
107 #define»IPTOS_CLASS_MASK» 0xe0 107 #define IPTOS_CLASS_MASK 0xe0
108 #define»IPTOS_CLASS(x)» » ((x) & IPTOS_CLASS_MASK) 108 #define IPTOS_CLASS(x) ((x)&IPTOS_CLASS_MASK)
109 #define»IPTOS_CLASS_CS0»» 0x00 109 #define IPTOS_CLASS_CS0 0x00
110 #define»IPTOS_CLASS_CS1»» 0x20 110 #define IPTOS_CLASS_CS1 0x20
111 #define»IPTOS_CLASS_CS2»» 0x40 111 #define IPTOS_CLASS_CS2 0x40
112 #define»IPTOS_CLASS_CS3»» 0x60 112 #define IPTOS_CLASS_CS3 0x60
113 #define»IPTOS_CLASS_CS4»» 0x80 113 #define IPTOS_CLASS_CS4 0x80
114 #define»IPTOS_CLASS_CS5»» 0xa0 114 #define IPTOS_CLASS_CS5 0xa0
115 #define»IPTOS_CLASS_CS6»» 0xc0 115 #define IPTOS_CLASS_CS6 0xc0
116 #define»IPTOS_CLASS_CS7»» 0xe0 116 #define IPTOS_CLASS_CS7 0xe0
117 #define»IPTOS_CLASS_DEFAULT» IPTOS_CLASS_CS0 117 #define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
118 118
119 #define»IPTOS_TOS_MASK» » 0x1E 119 #define IPTOS_TOS_MASK 0x1E
120 #define»IPTOS_TOS(tos)» » ((tos) & IPTOS_TOS_MASK) 120 #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
121 #define»IPTOS_LOWDELAY» » 0x10 121 #define IPTOS_LOWDELAY 0x10
122 #define»IPTOS_THROUGHPUT» 0x08 122 #define IPTOS_THROUGHPUT 0x08
123 #define»IPTOS_RELIABILITY» 0x04 123 #define IPTOS_RELIABILITY 0x04
124 #define»IPTOS_LOWCOST» » 0x02 124 #define IPTOS_LOWCOST 0x02
125 #define»IPTOS_MINCOST» » IPTOS_LOWCOST 125 #define IPTOS_MINCOST IPTOS_LOWCOST
126 126
127 #define»IPTOS_PREC_MASK»» » 0xe0 127 #define IPTOS_PREC_MASK 0xe0
128 #define»IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) 128 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
129 #define»IPTOS_PREC_NETCONTROL» » 0xe0 129 #define IPTOS_PREC_NETCONTROL 0xe0
130 #define»IPTOS_PREC_INTERNETCONTROL» 0xc0 130 #define IPTOS_PREC_INTERNETCONTROL 0xc0
131 #define»IPTOS_PREC_CRITIC_ECP» » 0xa0 131 #define IPTOS_PREC_CRITIC_ECP 0xa0
132 #define»IPTOS_PREC_FLASHOVERRIDE» 0x80 132 #define IPTOS_PREC_FLASHOVERRIDE 0x80
133 #define»IPTOS_PREC_FLASH» » 0x60 133 #define IPTOS_PREC_FLASH 0x60
134 #define»IPTOS_PREC_IMMEDIATE» » 0x40 134 #define IPTOS_PREC_IMMEDIATE 0x40
135 #define»IPTOS_PREC_PRIORITY» » 0x20 135 #define IPTOS_PREC_PRIORITY 0x20
136 #define»IPTOS_PREC_ROUTINE» » 0x00 136 #define IPTOS_PREC_ROUTINE 0x00
137 137
138 #define»IPOPT_COPY» » 0x80 138 #define IPOPT_COPY 0x80
139 #define»IPOPT_CLASS_MASK» 0x60 139 #define IPOPT_CLASS_MASK 0x60
140 #define»IPOPT_NUMBER_MASK» 0x1f 140 #define IPOPT_NUMBER_MASK 0x1f
141 141
142 #define»IPOPT_COPIED(o)»» ((o) & IPOPT_COPY) 142 #define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
143 #define»IPOPT_CLASS(o)» » ((o) & IPOPT_CLASS_MASK) 143 #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
144 #define»IPOPT_NUMBER(o)»» ((o) & IPOPT_NUMBER_MASK) 144 #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
145 145
146 #define»IPOPT_CONTROL» » 0x00 146 #define IPOPT_CONTROL 0x00
147 #define»IPOPT_RESERVED1»» 0x20 147 #define IPOPT_RESERVED1 0x20
148 #define»IPOPT_DEBMEAS» » 0x40 148 #define IPOPT_DEBMEAS 0x40
149 #define»IPOPT_MEASUREMENT IPOPT_DEBMEAS 149 #define IPOPT_MEASUREMENT IPOPT_DEBMEAS
150 #define»IPOPT_RESERVED2»» 0x60 150 #define IPOPT_RESERVED2 0x60
151 151
152 #define»IPOPT_EOL» » 0 152 #define IPOPT_EOL 0
153 #define»IPOPT_END» » IPOPT_EOL 153 #define IPOPT_END IPOPT_EOL
154 #define»IPOPT_NOP» » 1 154 #define IPOPT_NOP 1
155 #define»IPOPT_NOOP» » IPOPT_NOP 155 #define IPOPT_NOOP IPOPT_NOP
156 156
157 #define»IPOPT_RR» » 7 157 #define IPOPT_RR 7
158 #define»IPOPT_TS» » 68 158 #define IPOPT_TS 68
159 #define»IPOPT_TIMESTAMP»» IPOPT_TS 159 #define IPOPT_TIMESTAMP IPOPT_TS
160 #define»IPOPT_SECURITY» » 130 160 #define IPOPT_SECURITY 130
161 #define»IPOPT_SEC» » IPOPT_SECURITY 161 #define IPOPT_SEC IPOPT_SECURITY
162 #define»IPOPT_LSRR» » 131 162 #define IPOPT_LSRR 131
163 #define»IPOPT_SATID» » 136 163 #define IPOPT_SATID 136
164 #define»IPOPT_SID» » IPOPT_SATID 164 #define IPOPT_SID IPOPT_SATID
165 #define»IPOPT_SSRR» » 137 165 #define IPOPT_SSRR 137
166 #define»IPOPT_RA» » 148 166 #define IPOPT_RA 148
167 167
168 #define»IPOPT_OPTVAL» » 0 168 #define IPOPT_OPTVAL 0
169 #define»IPOPT_OLEN» » 1 169 #define IPOPT_OLEN 1
170 #define»IPOPT_OFFSET» » 2 170 #define IPOPT_OFFSET 2
171 #define»IPOPT_MINOFF» » 4 171 #define IPOPT_MINOFF 4
172 172
173 #define»MAX_IPOPTLEN» » 40 173 #define MAX_IPOPTLEN 40
174 174
175 #define»IPOPT_TS_TSONLY»» 0 175 #define IPOPT_TS_TSONLY 0
176 #define»IPOPT_TS_TSANDADDR» 1 176 #define IPOPT_TS_TSANDADDR 1
177 #define»IPOPT_TS_PRESPEC» 3 177 #define IPOPT_TS_PRESPEC 3
178 178
179 #define»IPOPT_SECUR_UNCLASS» 0x0000 179 #define IPOPT_SECUR_UNCLASS 0x0000
180 #define»IPOPT_SECUR_CONFID» 0xf135 180 #define IPOPT_SECUR_CONFID 0xf135
181 #define»IPOPT_SECUR_EFTO» 0x789a 181 #define IPOPT_SECUR_EFTO 0x789a
182 #define»IPOPT_SECUR_MMMM» 0xbc4d 182 #define IPOPT_SECUR_MMMM 0xbc4d
183 #define»IPOPT_SECUR_RESTR» 0xaf13 183 #define IPOPT_SECUR_RESTR 0xaf13
184 #define»IPOPT_SECUR_SECRET» 0xd788 184 #define IPOPT_SECUR_SECRET 0xd788
185 #define»IPOPT_SECUR_TOPSECRET» 0x6bc5 185 #define IPOPT_SECUR_TOPSECRET 0x6bc5
186 186
187 #define»MAXTTL» » 255 187 #define MAXTTL 255
188 #define»IPDEFTTL» 64 188 #define IPDEFTTL 64
189 #define»IPFRAGTTL» 60 189 #define IPFRAGTTL 60
190 #define»IPTTLDEC» 1 190 #define IPTTLDEC 1
191 191
192 #define»IP_MSS» » 576 192 #define IP_MSS 576
193 193
194 #ifdef __cplusplus 194 #ifdef __cplusplus
195 } 195 }
196 #endif 196 #endif
197 197
198 #endif 198 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698