1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 12:24:58 +00:00
serenity/Userland/Libraries/LibC/arpa/inet.h
Peter Elliott db92e66902 LibC: Make <netinet/in.h> more POSIX compliant
1. Move htonl() etc. from <arpa/inet.h> to <netinet/in.h> (which
   <arpa/inet.h> includes).

   The htonl(), htons(), ntohl(), and ntohs() functions shall be
   available as described in <arpa/inet.h>.  Inclusion of the
   <netinet/in.h> header may also make visible all symbols from
   <arpa/inet.h>.

   - POSIX

2. Define IN6_IS_ADDR_LOOPBACK() and IN6_IS_ADDR_V4MAPPED()
2021-08-22 10:29:06 +02:00

29 lines
574 B
C

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <inttypes.h>
#include <netinet/in.h>
#include <sys/cdefs.h>
#include <sys/socket.h>
__BEGIN_DECLS
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
const char* inet_ntop(int af, const void* src, char* dst, socklen_t);
int inet_pton(int af, const char* src, void* dst);
static inline int inet_aton(const char* cp, struct in_addr* inp)
{
return inet_pton(AF_INET, cp, inp);
}
char* inet_ntoa(struct in_addr);
__END_DECLS