File tree Expand file tree Collapse file tree 10 files changed +93
-0
lines changed Expand file tree Collapse file tree 10 files changed +93
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ set(TARGET_PUBLIC_HEADERS
18
18
libc.include.locale
19
19
libc.include.malloc
20
20
libc.include.math
21
+ libc.include.netinet_in
21
22
libc.include.poll
22
23
libc.include.pthread
23
24
libc.include.sched
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ set(TARGET_PUBLIC_HEADERS
18
18
libc.include.locale
19
19
libc.include.malloc
20
20
libc.include.math
21
+ libc.include.netinet_in
21
22
libc.include.poll
22
23
libc.include.pthread
23
24
libc.include.sched
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ set(TARGET_PUBLIC_HEADERS
18
18
libc.include.locale
19
19
libc.include.malloc
20
20
libc.include.math
21
+ libc.include.netinet_in
21
22
libc.include.poll
22
23
libc.include.pthread
23
24
libc.include.sched
Original file line number Diff line number Diff line change @@ -191,6 +191,17 @@ add_header_macro(
191
191
.inttypes
192
192
)
193
193
194
+ file (MAKE_DIRECTORY ${LIBC_INCLUDE_DIR} /netinet)
195
+
196
+ add_header_macro(
197
+ netinet_in
198
+ ../libc/include /netinet/in.yaml
199
+ netinet/in.h
200
+ DEPENDS
201
+ .llvm_libc_common_h
202
+ .llvm-libc-macros .netinet_in_macros
203
+ )
204
+
194
205
add_header_macro(
195
206
assert
196
207
../libc/include /assert.yaml
Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ add_macro_header(
152
152
.math_macros
153
153
)
154
154
155
+ add_macro_header(
156
+ netinet_in_macros
157
+ HDR
158
+ netinet-in-macros .h
159
+ )
160
+
155
161
add_macro_header(
156
162
offsetof_macro
157
163
HDR
Original file line number Diff line number Diff line change
1
+ //===-- Definition of macros from netinet/in.h ----------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
10
+ #define LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
11
+
12
+ #define IPPROTO_IP 0
13
+ #define IPPROTO_ICMP 1
14
+ #define IPPROTO_TCP 6
15
+ #define IPPROTO_UDP 17
16
+ #define IPPROTO_IPV6 41
17
+ #define IPPROTO_RAW 255
18
+
19
+ #endif // LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
Original file line number Diff line number Diff line change
1
+ //===-- C standard library header in.h ------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_LIBC_NETINET_IN_H
10
+ #define LLVM_LIBC_NETINET_IN_H
11
+
12
+ #include "__llvm-libc-common.h"
13
+
14
+ #include "../llvm-libc-macros/netinet-in-macros.h"
15
+
16
+ %%public_api()
17
+
18
+ #endif // LLVM_LIBC_NETINET_IN_H
Original file line number Diff line number Diff line change
1
+ header : netinet/in.h
2
+ header_template : in.h.def
3
+ macros : []
4
+ types : []
5
+ enums : []
6
+ objects : []
7
+ functions : []
Original file line number Diff line number Diff line change @@ -207,6 +207,16 @@ add_libc_test(
207
207
libc.include .llvm-libc-macros .math_function_macros
208
208
)
209
209
210
+ add_libc_test(
211
+ netinet_in_test
212
+ SUITE
213
+ libc_include_tests
214
+ SRCS
215
+ netinet_in_test.cpp
216
+ DEPENDS
217
+ libc.include .llvm-libc-macros .netinet_in_macros
218
+ )
219
+
210
220
add_libc_test(
211
221
signbit_test
212
222
SUITE
Original file line number Diff line number Diff line change
1
+ // ===-- Unittests for netinet/in macro ------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " include/llvm-libc-macros/netinet-in-macros.h"
10
+ #include " test/UnitTest/Test.h"
11
+
12
+ TEST (LlvmLibcNetinetInTest, IPPROTOMacro) {
13
+ EXPECT_EQ (IPPROTO_IP, 0 );
14
+ EXPECT_EQ (IPPROTO_ICMP, 1 );
15
+ EXPECT_EQ (IPPROTO_TCP, 6 );
16
+ EXPECT_EQ (IPPROTO_UDP, 17 );
17
+ EXPECT_EQ (IPPROTO_IPV6, 41 );
18
+ EXPECT_EQ (IPPROTO_RAW, 255 );
19
+ }
You can’t perform that action at this time.
0 commit comments