📄 ne_iaddr_make.3
字号:
.\"Generated by db2man.xsl. Don't modify this, modify the source..de Sh \" Subsection.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Ip \" List item.br.ie \\n(.$>=3 .ne \\$3.el .ne 3.IP "\\$1" \\$2...TH "NE_IADDR_MAKE" 3 "5 July 2004" "neon 0.24.7" "neon API reference".SH NAMEne_iaddr_make, ne_iaddr_cmp, ne_iaddr_print, ne_iaddr_free \- functions to manipulate and compare network addresses.SH "SYNOPSIS".ad l.hy 0#include <ne_socket\&.h>typedef enum { ne_iaddr_ipv4 = 0, ne_iaddr_ipv6} \fBne_iaddr_type\fR;.sp.HP 29ne_inet_addr\ *\fBne_iaddr_make\fR\ (ne_iaddr_type\ \fItype\fR, const\ unsigned\ char\ *\fIraw\fR);.HP 18int\ \fBne_iaddr_cmp\fR\ (const\ ne_inet_addr\ *\fIi1\fR, const\ ne_inet_addr\ *\fIi2\fR);.HP 22char\ *\fBne_iaddr_print\fR\ (const\ ne_inet_addr\ *\fIia\fR, char\ *\fIbuffer\fR, size_t\ \fIbufsiz\fR);.HP 20void\ \fBne_iaddr_free\fR\ (const\ ne_inet_addr\ *\fIaddr\fR);.ad.hy.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_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".PPThe following example connects a socket to port 80 at the address 127\&.0\&.0\&.1\&..nfunsigned 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\fBne_addr_resolve\fR(3).SH AUTHORJoe Orton <neon@webdav\&.org>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -