Blame lib/lwres/man/lwres_getipnode.3

Packit Service ae04f2
.\" Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
Packit Service ae04f2
.\" 
Packit Service ae04f2
.\" This Source Code Form is subject to the terms of the Mozilla Public
Packit Service ae04f2
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
Packit Service ae04f2
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
Packit Service ae04f2
.\"
Packit Service ae04f2
.hy 0
Packit Service ae04f2
.ad l
Packit Service ae04f2
'\" t
Packit Service ae04f2
.\"     Title: lwres_getipnode
Packit Service ae04f2
.\"    Author: 
Packit Service ae04f2
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
Packit Service ae04f2
.\"      Date: 2007-06-18
Packit Service ae04f2
.\"    Manual: BIND9
Packit Service ae04f2
.\"    Source: ISC
Packit Service ae04f2
.\"  Language: English
Packit Service ae04f2
.\"
Packit Service ae04f2
.TH "LWRES_GETIPNODE" "3" "2007\-06\-18" "ISC" "BIND9"
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.\" * Define some portability stuff
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service ae04f2
.\" http://bugs.debian.org/507673
Packit Service ae04f2
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
Packit Service ae04f2
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Packit Service ae04f2
.ie \n(.g .ds Aq \(aq
Packit Service ae04f2
.el       .ds Aq '
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.\" * set default formatting
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.\" disable hyphenation
Packit Service ae04f2
.nh
Packit Service ae04f2
.\" disable justification (adjust text to left margin only)
Packit Service ae04f2
.ad l
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.\" * MAIN CONTENT STARTS HERE *
Packit Service ae04f2
.\" -----------------------------------------------------------------
Packit Service ae04f2
.SH "NAME"
Packit Service ae04f2
lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API
Packit Service ae04f2
.SH "SYNOPSIS"
Packit Service ae04f2
.sp
Packit Service ae04f2
.ft B
Packit Service ae04f2
.nf
Packit Service ae04f2
#include <lwres/netdb\&.h>
Packit Service ae04f2
.fi
Packit Service ae04f2
.ft
Packit Service ae04f2
.HP \w'struct\ hostent\ *\ lwres_getipnodebyname('u
Packit Service ae04f2
.BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");"
Packit Service ae04f2
.HP \w'struct\ hostent\ *\ lwres_getipnodebyaddr('u
Packit Service ae04f2
.BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");"
Packit Service ae04f2
.HP \w'void\ lwres_freehostent('u
Packit Service ae04f2
.BI "void lwres_freehostent(struct\ hostent\ *" "he" ");"
Packit Service ae04f2
.SH "DESCRIPTION"
Packit Service ae04f2
.PP
Packit Service ae04f2
These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553\&.
Packit Service ae04f2
.PP
Packit Service ae04f2
They use a
Packit Service ae04f2
\fBstruct hostent\fR
Packit Service ae04f2
which is defined in
Packit Service ae04f2
namedb\&.h:
Packit Service ae04f2
.PP
Packit Service ae04f2
.if n \{\
Packit Service ae04f2
.RS 4
Packit Service ae04f2
.\}
Packit Service ae04f2
.nf
Packit Service ae04f2
struct  hostent {
Packit Service ae04f2
        char    *h_name;        /* official name of host */
Packit Service ae04f2
        char    **h_aliases;    /* alias list */
Packit Service ae04f2
        int     h_addrtype;     /* host address type */
Packit Service ae04f2
        int     h_length;       /* length of address */
Packit Service ae04f2
        char    **h_addr_list;  /* list of addresses from name server */
Packit Service ae04f2
};
Packit Service ae04f2
#define h_addr  h_addr_list[0]  /* address, for backward compatibility */
Packit Service ae04f2
.fi
Packit Service ae04f2
.if n \{\
Packit Service ae04f2
.RE
Packit Service ae04f2
.\}
Packit Service ae04f2
.PP
Packit Service ae04f2
The members of this structure are:
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBh_name\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
The official (canonical) name of the host\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBh_aliases\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
A NULL\-terminated array of alternate names (nicknames) for the host\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBh_addrtype\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
The type of address being returned \- usually
Packit Service ae04f2
\fBPF_INET\fR
Packit Service ae04f2
or
Packit Service ae04f2
\fBPF_INET6\fR\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBh_length\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
The length of the address in bytes\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBh_addr_list\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
A
Packit Service ae04f2
\fBNULL\fR
Packit Service ae04f2
terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBlwres_getipnodebyname()\fR
Packit Service ae04f2
looks up addresses of protocol family
Packit Service ae04f2
\fIaf\fR
Packit Service ae04f2
for the hostname
Packit Service ae04f2
\fIname\fR\&. The
Packit Service ae04f2
\fIflags\fR
Packit Service ae04f2
parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned\&. The flag bits are:
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBAI_V4MAPPED\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
This is used with an
Packit Service ae04f2
\fIaf\fR
Packit Service ae04f2
of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBAI_ALL\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
This is used with an
Packit Service ae04f2
\fIaf\fR
Packit Service ae04f2
of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned\&. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBAI_ADDRCONFIG\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
Only return an IPv6 or IPv4 address if here is an active network interface of that type\&. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBAI_DEFAULT\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
This default sets the
Packit Service ae04f2
\fBAI_V4MAPPED\fR
Packit Service ae04f2
and
Packit Service ae04f2
\fBAI_ADDRCONFIG\fR
Packit Service ae04f2
flag bits\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBlwres_getipnodebyaddr()\fR
Packit Service ae04f2
performs a reverse lookup of address
Packit Service ae04f2
\fIsrc\fR
Packit Service ae04f2
which is
Packit Service ae04f2
\fIlen\fR
Packit Service ae04f2
bytes long\&.
Packit Service ae04f2
\fIaf\fR
Packit Service ae04f2
denotes the protocol family, typically
Packit Service ae04f2
\fBPF_INET\fR
Packit Service ae04f2
or
Packit Service ae04f2
\fBPF_INET6\fR\&.
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBlwres_freehostent()\fR
Packit Service ae04f2
releases all the memory associated with the
Packit Service ae04f2
\fBstruct hostent\fR
Packit Service ae04f2
pointer
Packit Service ae04f2
\fIhe\fR\&. Any memory allocated for the
Packit Service ae04f2
\fBh_name\fR,
Packit Service ae04f2
\fBh_addr_list\fR
Packit Service ae04f2
and
Packit Service ae04f2
\fBh_aliases\fR
Packit Service ae04f2
is freed, as is the memory for the
Packit Service ae04f2
\fBhostent\fR
Packit Service ae04f2
structure itself\&.
Packit Service ae04f2
.SH "RETURN VALUES"
Packit Service ae04f2
.PP
Packit Service ae04f2
If an error occurs,
Packit Service ae04f2
\fBlwres_getipnodebyname()\fR
Packit Service ae04f2
and
Packit Service ae04f2
\fBlwres_getipnodebyaddr()\fR
Packit Service ae04f2
set
Packit Service ae04f2
\fI*error_num\fR
Packit Service ae04f2
to an appropriate error code and the function returns a
Packit Service ae04f2
\fBNULL\fR
Packit Service ae04f2
pointer\&. The error codes and their meanings are defined in
Packit Service ae04f2
<lwres/netdb\&.h>:
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBHOST_NOT_FOUND\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
No such host is known\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBNO_ADDRESS\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
The server recognised the request and the name but no address is available\&. Another type of request to the name server for the domain might return an answer\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBTRY_AGAIN\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
A temporary and possibly transient error occurred, such as a failure of a server to respond\&. The request may succeed if retried\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBNO_RECOVERY\fR
Packit Service ae04f2
.RS 4
Packit Service ae04f2
An unexpected failure occurred, and retrying the request is pointless\&.
Packit Service ae04f2
.RE
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBlwres_hstrerror\fR(3)
Packit Service ae04f2
translates these error codes to suitable error messages\&.
Packit Service ae04f2
.SH "SEE ALSO"
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBRFC2553\fR(),
Packit Service ae04f2
\fBlwres\fR(3),
Packit Service ae04f2
\fBlwres_gethostent\fR(3),
Packit Service ae04f2
\fBlwres_getaddrinfo\fR(3),
Packit Service ae04f2
\fBlwres_getnameinfo\fR(3),
Packit Service ae04f2
\fBlwres_hstrerror\fR(3)\&.
Packit Service ae04f2
.SH "AUTHOR"
Packit Service ae04f2
.PP
Packit Service ae04f2
\fBInternet Systems Consortium, Inc\&.\fR
Packit Service ae04f2
.SH "COPYRIGHT"
Packit Service ae04f2
.br
Packit Service ae04f2
Copyright \(co 2000, 2001, 2003-2005, 2007, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
Packit Service ae04f2
.br