[libc] add various macros relate to *ADDR* (#164830)

This patch adds 4 macros in the `netinet/in.h` header, as specified by
POSIX standards.
This commit is contained in:
Connector Switch 2025-11-08 20:39:26 +08:00 committed by GitHub
parent 3226a5f982
commit ffb5831fce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,9 @@
#ifndef LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
#define LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
#include "../llvm-libc-types/in_addr_t.h"
#include "__llvm-libc-common.h"
#define IPPROTO_IP 0
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
@ -24,4 +27,10 @@
#define IPV6_LEAVE_GROUP 21
#define IPV6_V6ONLY 26
#define INADDR_ANY __LLVM_LIBC_CAST(static_cast, in_addr_t, 0x00000000)
#define INADDR_BROADCAST __LLVM_LIBC_CAST(static_cast, in_addr_t, 0xffffffff)
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
#endif // LLVM_LIBC_MACROS_NETINET_IN_MACROS_H