LibC: Fix netinet/in.h and arpa/inet.h definitions
This commit is contained in:
parent
6be3b1d7f2
commit
ddcf414107
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
uint32_t htonl(uint32_t hostlong)
|
uint32_t htonl(uint32_t hostlong)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _INET_H
|
#ifndef _ARPA_INET_H
|
||||||
#define _INET_H 1
|
#define _ARPA_INET_H 1
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html
|
||||||
|
|
||||||
|
@ -7,13 +7,8 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <bits/inet_common.h>
|
||||||
#include <inttypes.h>
|
#include <bits/types/socklen_t.h>
|
||||||
|
|
||||||
uint32_t htonl(uint32_t);
|
|
||||||
uint16_t htons(uint16_t);
|
|
||||||
uint32_t ntohl(uint32_t);
|
|
||||||
uint16_t ntohs(uint16_t);
|
|
||||||
|
|
||||||
in_addr_t inet_addr(const char* cp);
|
in_addr_t inet_addr(const char* cp);
|
||||||
char* inet_ntoa(struct in_addr in);
|
char* inet_ntoa(struct in_addr in);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef _BITS_INET_COMMON_H
|
||||||
|
#define _BITS_INET_COMMON_H 1
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#define INET_ADDRSTRLEN 16
|
||||||
|
#define INET6_ADDRSTRLEN 46
|
||||||
|
|
||||||
|
typedef uint16_t in_port_t;
|
||||||
|
typedef uint32_t in_addr_t;
|
||||||
|
|
||||||
|
struct in_addr
|
||||||
|
{
|
||||||
|
in_addr_t s_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t htonl(uint32_t);
|
||||||
|
uint16_t htons(uint16_t);
|
||||||
|
uint32_t ntohl(uint32_t);
|
||||||
|
uint16_t ntohs(uint16_t);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _BITS_TYPES_SOCKLEN_T_H
|
||||||
|
#define _BITS_TYPES_SOCKLEN_T_H 1
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef long socklen_t;
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <bits/inet_common.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#define IPPROTO_IP 1
|
#define IPPROTO_IP 1
|
||||||
|
@ -30,9 +30,6 @@ __BEGIN_DECLS
|
||||||
#define INADDR_BROADCAST 0xFFFFFFFF
|
#define INADDR_BROADCAST 0xFFFFFFFF
|
||||||
#define INADDR_LOOPBACK 0x7F000001
|
#define INADDR_LOOPBACK 0x7F000001
|
||||||
|
|
||||||
#define INET_ADDRSTRLEN 16
|
|
||||||
#define INET6_ADDRSTRLEN 46
|
|
||||||
|
|
||||||
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
||||||
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
||||||
|
|
||||||
|
@ -51,14 +48,6 @@ __BEGIN_DECLS
|
||||||
#define IN6_IS_ADDR_MC_GLOBAL(addr)
|
#define IN6_IS_ADDR_MC_GLOBAL(addr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef uint16_t in_port_t;
|
|
||||||
typedef uint32_t in_addr_t;
|
|
||||||
|
|
||||||
struct in_addr
|
|
||||||
{
|
|
||||||
in_addr_t s_addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sockaddr_in
|
struct sockaddr_in
|
||||||
{
|
{
|
||||||
sa_family_t sin_family; /* AF_INET. */
|
sa_family_t sin_family; /* AF_INET. */
|
||||||
|
|
|
@ -14,7 +14,7 @@ __BEGIN_DECLS
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
|
||||||
#include <bits/types/sa_family_t.h>
|
#include <bits/types/sa_family_t.h>
|
||||||
typedef long socklen_t;
|
#include <bits/types/socklen_t.h>
|
||||||
|
|
||||||
#if !defined(FILENAME_MAX)
|
#if !defined(FILENAME_MAX)
|
||||||
#define FILENAME_MAX 256
|
#define FILENAME_MAX 256
|
||||||
|
|
Loading…
Reference in New Issue