.\" ** You probably do not want to edit this file directly ** .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "NE_IADDR_MAKE" "3" "23 May 2006" "neon 0.26.1" "neon API reference" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" ne_iaddr_make, ne_iaddr_cmp, ne_iaddr_print, ne_iaddr_typeof, ne_iaddr_free \- functions to manipulate and compare network addresses .SH "SYNOPSIS" .PP \fB#include typedef enum { ne_iaddr_ipv4 = 0, ne_iaddr_ipv6 } \fR\fB\fBne_iaddr_type\fR\fR\fB;\fR .HP 28 \fBne_inet_addr\ *\fBne_iaddr_make\fR\fR\fB(\fR\fBne_iaddr_type\ \fR\fB\fItype\fR\fR\fB, \fR\fBconst\ unsigned\ char\ *\fR\fB\fIraw\fR\fR\fB);\fR .HP 17 \fBint\ \fBne_iaddr_cmp\fR\fR\fB(\fR\fBconst\ ne_inet_addr\ *\fR\fB\fIia1\fR\fR\fB, \fR\fBconst\ ne_inet_addr\ *\fR\fB\fIia2\fR\fR\fB);\fR .HP 21 \fBchar\ *\fBne_iaddr_print\fR\fR\fB(\fR\fBconst\ ne_inet_addr\ *\fR\fB\fIia\fR\fR\fB, \fR\fBchar\ *\fR\fB\fIbuffer\fR\fR\fB, \fR\fBsize_t\ \fR\fB\fIbufsiz\fR\fR\fB);\fR .HP 30 \fBne_iaddr_type\ \fBne_iaddr_typeof\fR\fR\fB(\fR\fBconst\ ne_inet_addr\ *\fR\fB\fIia\fR\fR\fB);\fR .HP 19 \fBvoid\ \fBne_iaddr_free\fR\fR\fB(\fR\fBconst\ ne_inet_addr\ *\fR\fB\fIia\fR\fR\fB);\fR .SH "DESCRIPTION" .PP \fBne_iaddr_make\fR creates an \fBne_inet_addr\fR object from a raw binary network address; for instance the four bytes 0x7f 0x00 0x00 0x01 represent the IPv4 address 127.0.0.1. The object returned is suitable for passing to \fBne_sock_connect\fR. A binary IPv4 address contains four bytes; a binary IPv6 address contains sixteen bytes; addresses passed must be in network byte order. .PP \fBne_iaddr_cmp\fR can be used to compare two network addresses; returning zero only if they are identical. The addresses need not be of the same address type; if the addresses are not of the same type, the return value is guaranteed to be non\-zero. .PP \fBne_iaddr_print\fR can be used to print the human\-readable string representation of a network address into a buffer, for instance the string "127.0.0.1". .PP \fBne_iaddr_typeof\fR returns the type of the given network address. .PP \fBne_iaddr_free\fR releases the memory associated with a network address object. .SH "RETURN VALUE" .PP \fBne_iaddr_make\fR returns NULL if the address type passed is not supported (for instance on a platform which does not support IPv6). .PP \fBne_iaddr_print\fR returns the \fIbuffer\fR pointer, and never NULL. .SH "EXAMPLES" .PP The following example connects a socket to port 80 at the address 127.0.0.1. .sp .nf 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 { /* ... */ } .fi .SH "SEE ALSO" .PP ne_addr_resolve