The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
inet.h
Go to the documentation of this file.
1#pragma once
2
3#include <netinet/in.h>
4
5/**
6 * @file arpa/inet.h
7 * @brief IPv4 addresses as text ("10.0.2.15") and back.
8 */
9
10/**
11 * text to an address.
12 * @param af AF_INET.
13 * @param dst receives a struct in_addr.
14 * @return 1, 0 if src is not an address, -1 (EAFNOSUPPORT) for another af.
15 */
16int inet_pton(int af, const char *src, void *dst);
17
18/**
19 * an address to text.
20 * @param size at least INET_ADDRSTRLEN for AF_INET.
21 * @return dst, or NULL (EAFNOSUPPORT, ENOSPC).
22 */
23const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
24
25/**
26 * text to an address, as inet_aton does; the address, or INADDR_NONE.
27 */
28in_addr_t inet_addr(const char *text);
29
30/**
31 * text to an address. as well as a.b.c.d this takes the older forms: a.b.c
32 * (c is 16 bits), a.b (b is 24 bits) and a (32 bits), each part in
33 * decimal, octal (0) or hex (0x).
34 * @return 1, or 0 if text is not an address.
35 */
36int inet_aton(const char *text, struct in_addr *out);
37
38/**
39 * an address to text, in a buffer of the calling thread.
40 */
41char *inet_ntoa(struct in_addr in);
IPv4 addresses and ports, and the IP protocols.
uint32_t in_addr_t
Definition in.h:18
in_addr_t inet_addr(const char *text)
text to an address, as inet_aton does; the address, or INADDR_NONE.
char * inet_ntoa(struct in_addr in)
an address to text, in a buffer of the calling thread.
const char * inet_ntop(int af, const void *src, char *dst, socklen_t size)
an address to text.
int inet_pton(int af, const char *src, void *dst)
text to an address.
int inet_aton(const char *text, struct in_addr *out)
text to an address.
unsigned int socklen_t
Definition socket.h:21
Definition in.h:22