2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-03-12 15:51:42 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-07-15 15:22:45 +02:00
|
|
|
// Includes essentially mandated by POSIX:
|
|
|
|
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html
|
2021-04-10 14:33:18 +02:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
#include <netinet/in.h>
|
2023-07-15 15:22:45 +02:00
|
|
|
|
2019-03-12 15:51:42 +01:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
2019-05-16 09:50:13 +02:00
|
|
|
#define INET_ADDRSTRLEN 16
|
2021-04-19 22:24:56 -07:00
|
|
|
#define INET6_ADDRSTRLEN 46
|
2019-05-16 09:50:13 +02:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
char const* inet_ntop(int af, void const* src, char* dst, socklen_t);
|
|
|
|
|
int inet_pton(int af, char const* src, void* dst);
|
2019-03-12 15:51:42 +01:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
static inline int inet_aton(char const* cp, struct in_addr* inp)
|
2020-05-10 23:36:59 +03:00
|
|
|
{
|
|
|
|
|
return inet_pton(AF_INET, cp, inp);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-20 06:57:47 +01:00
|
|
|
char* inet_ntoa(struct in_addr);
|
|
|
|
|
|
2019-03-12 15:51:42 +01:00
|
|
|
__END_DECLS
|