NE_IADDR_MAKE(3)
β¨ ne_iaddr_make β bestie's guide to network addresses β¨
okay so this is the neon API reference page for NE_IADDR_MAKE(3), and it's basically the whole squad of functions that let you mess with network addresses π
β ne_iaddr_make, ne_iaddr_cmp, ne_iaddr_print, ne_iaddr_typeof, ne_iaddr_parse, ne_iaddr_raw, ne_iaddr_put, ne_iaddr_reverse, and ne_iaddr_free. Yes, that's nine (9) icons. Sit down, grab a strawberry π, and let's get into it.
πΈ NAME πΈ
ne_iaddr_make, ne_iaddr_cmp, ne_iaddr_print, ne_iaddr_typeof, ne_iaddr_parse, ne_iaddr_raw, ne_iaddr_put, ne_iaddr_reverse, ne_iaddr_free β functions to manipulate network addresses π«Ά
β¨ SYNOPSIS β¨
no cap, here's the whole vibe in code form:
#include <ne_socket.h>
typedef enum {
ne_iaddr_ipv4 = 0,
ne_iaddr_ipv6
} ne_iaddr_type;
ne_inet_addr *ne_iaddr_make(ne_iaddr_type type,
const unsigned char *raw);
int ne_iaddr_cmp(const ne_inet_addr *ia1, const ne_inet_addr *ia2);
char *ne_iaddr_print(const ne_inet_addr *ia, char *buffer,
size_t bufsiz);
ne_iaddr_type ne_iaddr_typeof(const ne_inet_addr *ia);
ne_inet_addr *ne_iaddr_parse(const char *address, ne_iaddr_type type);
unsigned char *ne_iaddr_raw(const ne_inet_addr *ia,
unsigned char *buffer);
ne_inet_addr *ne_iaddr_put(ne_inet_addr *ia, ne_iaddr_type type,
const unsigned char *raw);
int ne_iaddr_reverse(const ne_inet_addr *ia, char *buffer,
size_t buflen);
void ne_iaddr_free(ne_inet_addr *ia);
π¦ DESCRIPTION π¦
ne_iaddr_make creates an ne_inet_addr object from a raw binary network address β like, the four bytes 0x7f 0x00 0x00 0x01 represent the IPv4 address 127.0.0.1. The object you get back is suitable for passing to ne_sock_connect. A binary IPv4 address contains four bytes; a binary IPv6 address contains sixteen bytes; addresses passed must be in network byte order. β¨
ne_iaddr_cmp compares two network address objects, and it returns zero only if they are identical. The objects don't even need to have the same address type β if the addresses are not of the same type, the return value is guaranteed to be non-zero. so like, they're not matching, bestie, periodt.
ne_iaddr_print prints a human-readable string representation of a network address into a buffer β for instance the string "127.0.0.1". iconic.
ne_iaddr_typeof returns the type of the given network address object. slay, just tell me what you are.
ne_iaddr_put changes an existing network address object to a new raw byte representation given by parameter type (which can be different to the current type of the object). The raw data must be of length 4 bytes for an IPv4 address, or 16 bytes for an IPv6 address. glow-up for your address object π
ne_iaddr_parse parses a string representation of a network address (such as "127.0.0.1") and creates a network address object to represent the parsed address.
ne_iaddr_raw writes the raw byte representation of a network address to the provided buffer. The bytes are written in network byte order; the buffer must be of suitable length for the type of address (4 bytes for an IPv4 address, 16 bytes for an IPv6 address).
ne_iaddr_reverse performs a reverse name lookup on the address object, writing the (first) hostname associated with the IP address to the provided buffer. If the hostname is longer than the buffer it will be silently truncated; on success the string written to the buffer is always NUL-terminated. π
ne_iaddr_free releases the memory associated with a network address object. bye bestie, you did amazing π
π RETURN VALUE π
ne_iaddr_makereturnsNULLif the address type passed is not supported (for instance on a platform which does not support IPv6).ne_iaddr_printreturns the buffer pointer, and neverNULL. reliable king.ne_iaddr_parsereturns a network address object on success, orNULLon failure to parse the address parameter.ne_iaddr_reversereturns zero on success or non-zero if no hostname is associated with the address.ne_iaddr_rawreturns the buffer parameter, and neverNULL.ne_iaddr_putreturns the passed in ia parameter, orNULLif the address type passed is not supported (for instance on a platform which does not support IPv6).
π EXAMPLES π
okay so this example connects a socket to port 80 at the address 127.0.0.1. main character energy fr fr:
unsigned char addr[] = "\0x7f\0x00\0x00\0x01";
ne_inet_addr *ia;
ia = ne_iaddr_make(ne_iaddr_ipv4, addr);
if (ia != NULL) {
ne_socket *sock = ne_sock_connect(ia, 80);
ne_iaddr_free(ia);
/* ... */
} else {
/* ... */
}
π HISTORY π
- The
ne_iaddr_rawfunction is available in neon0.29.0and later. - The
ne_iaddr_putfunction is available in neon0.37.0and later.
β SEE ALSO β
π§ COPYRIGHT π§
Copyright Β© 2001-2026 Joe Orton
and that's the whole page, bestie β neon 0.37.1, dated 15 March 2026, written up in the classic NE_IADDR_MAKE(3) manual style ππ¦β¨
π¦ where this page comes from
- epel 10: neon-devel 0.37.1-4.el10_3 Β· LGPL-2.0-or-later AND GPL-2.0-or-later
- fedora 43: neon-devel 0.37.1-1.fc43 Β· LGPL-2.0-or-later AND GPL-2.0-or-later
- fedora 43: neon-devel 0.37.1-1.fc43 Β· LGPL-2.0-or-later AND GPL-2.0-or-later
- fedora 44: neon-devel 0.37.1-1.fc44 Β· LGPL-2.0-or-later AND GPL-2.0-or-later
- fedora 44: neon-devel 0.37.1-1.fc44 Β· LGPL-2.0-or-later AND GPL-2.0-or-later
- nixos 26.05: neon 0.37.1
- nixpkgs unstable: neon 0.37.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms