|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
- Copyright (C) 2000, 2001, 2003-2005, 2007, 2014-2016, 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
|
Packit |
5ce601 |
-
|
|
Packit |
5ce601 |
- This Source Code Form is subject to the terms of the Mozilla Public
|
|
Packit |
5ce601 |
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
Packit |
5ce601 |
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
Packit |
5ce601 |
-->
|
|
Packit |
5ce601 |
<html lang="en">
|
|
Packit |
5ce601 |
<head>
|
|
Packit |
5ce601 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
Packit |
5ce601 |
<title>lwres_getipnode</title>
|
|
Packit Service |
704ed8 |
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
|
Packit |
5ce601 |
</head>
|
|
Packit |
5ce601 |
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
Name
|
|
Packit Service |
704ed8 |
lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent — lightweight resolver nodename / address translation API
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
Synopsis
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
#include <lwres/netdb.h>
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
struct hostent *
|
|
Packit |
5ce601 |
lwres_getipnodebyname(
|
|
Packit |
5ce601 |
const char *name,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
int af,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
int flags,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
int *error_num) ;
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
struct hostent *
|
|
Packit |
5ce601 |
lwres_getipnodebyaddr(
|
|
Packit |
5ce601 |
const void *src,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
size_t len,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
int af,
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
int *error_num) ;
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
void
|
|
Packit |
5ce601 |
lwres_freehostent(
|
|
Packit |
5ce601 |
struct hostent *he) ;
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
DESCRIPTION
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
These functions perform thread safe, protocol independent
|
|
Packit |
5ce601 |
nodename-to-address and address-to-nodename
|
|
Packit |
5ce601 |
translation as defined in RFC2553.
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
They use a
|
|
Packit |
5ce601 |
struct hostent
|
|
Packit |
5ce601 |
which is defined in
|
|
Packit |
5ce601 |
namedb.h :
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
struct hostent {
|
|
Packit |
5ce601 |
char *h_name; /* official name of host */
|
|
Packit |
5ce601 |
char **h_aliases; /* alias list */
|
|
Packit |
5ce601 |
int h_addrtype; /* host address type */
|
|
Packit |
5ce601 |
int h_length; /* length of address */
|
|
Packit |
5ce601 |
char **h_addr_list; /* list of addresses from name server */
|
|
Packit |
5ce601 |
};
|
|
Packit |
5ce601 |
#define h_addr h_addr_list[0] /* address, for backward compatibility */
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
The members of this structure are:
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
h_name
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
The official (canonical) name of the host.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
h_aliases
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
A NULL-terminated array of alternate names (nicknames) for the
|
|
Packit |
5ce601 |
host.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
h_addrtype
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
The type of address being returned - usually
|
|
Packit |
5ce601 |
PF_INET
|
|
Packit |
5ce601 |
or
|
|
Packit |
5ce601 |
PF_INET6.
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
h_length
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
The length of the address in bytes.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
h_addr_list
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
A
|
|
Packit |
5ce601 |
NULL
|
|
Packit |
5ce601 |
terminated array of network addresses for the host.
|
|
Packit |
5ce601 |
Host addresses are returned in network byte order.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_getipnodebyname()
|
|
Packit |
5ce601 |
looks up addresses of protocol family af
|
|
Packit |
5ce601 |
for the hostname name . The
|
|
Packit |
5ce601 |
flags parameter contains ORed flag bits
|
|
Packit |
5ce601 |
to specify the types of addresses that are searched for, and the
|
|
Packit |
5ce601 |
types of addresses that are returned. The flag bits are:
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
AI_V4MAPPED
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
This is used with an
|
|
Packit |
5ce601 |
af
|
|
Packit |
5ce601 |
of AF_INET6, and causes IPv4 addresses to be returned as
|
|
Packit |
5ce601 |
IPv4-mapped
|
|
Packit |
5ce601 |
IPv6 addresses.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
AI_ALL
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
This is used with an
|
|
Packit |
5ce601 |
af
|
|
Packit |
5ce601 |
of AF_INET6, and causes all known addresses (IPv6 and IPv4) to
|
|
Packit |
5ce601 |
be returned.
|
|
Packit |
5ce601 |
If AI_V4MAPPED is also set, the IPv4 addresses are return as
|
|
Packit |
5ce601 |
mapped
|
|
Packit |
5ce601 |
IPv6 addresses.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
AI_ADDRCONFIG
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
Only return an IPv6 or IPv4 address if here is an active network
|
|
Packit |
5ce601 |
interface of that type. This is not currently implemented
|
|
Packit |
5ce601 |
in the BIND 9 lightweight resolver, and the flag is ignored.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
AI_DEFAULT
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
This default sets the
|
|
Packit |
5ce601 |
AI_V4MAPPED
|
|
Packit |
5ce601 |
and
|
|
Packit |
5ce601 |
AI_ADDRCONFIG
|
|
Packit |
5ce601 |
flag bits.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_getipnodebyaddr()
|
|
Packit |
5ce601 |
performs a reverse lookup of address src
|
|
Packit |
5ce601 |
which is len bytes long.
|
|
Packit |
5ce601 |
af denotes the protocol family, typically
|
|
Packit |
5ce601 |
PF_INET or PF_INET6.
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_freehostent()
|
|
Packit |
5ce601 |
releases all the memory associated with the struct
|
|
Packit |
5ce601 |
hostent pointer he . Any memory
|
|
Packit |
5ce601 |
allocated for the h_name ,
|
|
Packit |
5ce601 |
h_addr_list and
|
|
Packit |
5ce601 |
h_aliases is freed, as is the memory for
|
|
Packit |
5ce601 |
the hostent structure itself.
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
RETURN VALUES
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
If an error occurs,
|
|
Packit |
5ce601 |
lwres_getipnodebyname()
|
|
Packit |
5ce601 |
and
|
|
Packit |
5ce601 |
lwres_getipnodebyaddr()
|
|
Packit |
5ce601 |
set
|
|
Packit |
5ce601 |
*error_num
|
|
Packit |
5ce601 |
to an appropriate error code and the function returns a
|
|
Packit |
5ce601 |
NULL
|
|
Packit |
5ce601 |
pointer.
|
|
Packit |
5ce601 |
The error codes and their meanings are defined in
|
|
Packit |
5ce601 |
<lwres/netdb.h> :
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
HOST_NOT_FOUND
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
No such host is known.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
NO_ADDRESS
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
The server recognised the request and the name but no address is
|
|
Packit |
5ce601 |
available. Another type of request to the name server for the
|
|
Packit |
5ce601 |
domain might return an answer.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
TRY_AGAIN
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
A temporary and possibly transient error occurred, such as a
|
|
Packit |
5ce601 |
failure of a server to respond. The request may succeed if
|
|
Packit |
5ce601 |
retried.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
NO_RECOVERY
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
An unexpected failure occurred, and retrying the request
|
|
Packit |
5ce601 |
is pointless.
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_hstrerror(3)
|
|
Packit |
5ce601 |
translates these error codes to suitable error messages.
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
SEE ALSO
|
|
Packit Service |
704ed8 |
RFC2553,
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres(3),
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_gethostent(3),
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_getaddrinfo(3),
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_getnameinfo(3),
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
lwres_hstrerror(3).
|
|
Packit |
5ce601 |
|
|
Packit Service |
704ed8 |
|
|
Packit |
5ce601 |
</body>
|
|
Packit |
5ce601 |
</html>
|