mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 09:48:47 +00:00
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
58 lines
1 KiB
C
58 lines
1 KiB
C
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <endian.h>
|
|
#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);
|
|
|
|
static inline uint16_t htons(uint16_t value)
|
|
{
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
return __builtin_bswap16(value);
|
|
#else
|
|
return value;
|
|
#endif
|
|
}
|
|
|
|
static inline uint16_t ntohs(uint16_t value)
|
|
{
|
|
return htons(value);
|
|
}
|
|
|
|
static inline uint32_t htonl(uint32_t value)
|
|
{
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
return __builtin_bswap32(value);
|
|
#else
|
|
return value;
|
|
#endif
|
|
}
|
|
|
|
static inline uint32_t ntohl(uint32_t value)
|
|
{
|
|
return htonl(value);
|
|
}
|
|
|
|
__END_DECLS
|