Skip to content

Commit ffb5831

Browse files
authored
[libc] add various macros relate to *ADDR* (#164830)
This patch adds 4 macros in the `netinet/in.h` header, as specified by POSIX standards.
1 parent 3226a5f commit ffb5831

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libc/include/llvm-libc-macros/netinet-in-macros.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#ifndef LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
1010
#define LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
1111

12+
#include "../llvm-libc-types/in_addr_t.h"
13+
#include "__llvm-libc-common.h"
14+
1215
#define IPPROTO_IP 0
1316
#define IPPROTO_ICMP 1
1417
#define IPPROTO_TCP 6
@@ -24,4 +27,10 @@
2427
#define IPV6_LEAVE_GROUP 21
2528
#define IPV6_V6ONLY 26
2629

30+
#define INADDR_ANY __LLVM_LIBC_CAST(static_cast, in_addr_t, 0x00000000)
31+
#define INADDR_BROADCAST __LLVM_LIBC_CAST(static_cast, in_addr_t, 0xffffffff)
32+
33+
#define INET_ADDRSTRLEN 16
34+
#define INET6_ADDRSTRLEN 46
35+
2736
#endif // LLVM_LIBC_MACROS_NETINET_IN_MACROS_H

0 commit comments

Comments
 (0)