📄 lwres_gethostent.docbook
字号:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [<!ENTITY mdash "—">]><!-- - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001 Internet Software Consortium. - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE.--><!-- $Id: lwres_gethostent.docbook,v 1.6.18.4 2007/01/29 23:57:21 marka Exp $ --><refentry> <refentryinfo> <date>Jun 30, 2000</date> </refentryinfo> <refmeta> <refentrytitle>lwres_gethostent</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>BIND9</refmiscinfo> </refmeta> <docinfo> <copyright> <year>2004</year> <year>2005</year> <year>2007</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> <year>2001</year> <holder>Internet Software Consortium.</holder> </copyright> </docinfo> <refnamediv> <refname>lwres_gethostbyname</refname> <refname>lwres_gethostbyname2</refname> <refname>lwres_gethostbyaddr</refname> <refname>lwres_gethostent</refname> <refname>lwres_sethostent</refname> <refname>lwres_endhostent</refname> <refname>lwres_gethostbyname_r</refname> <refname>lwres_gethostbyaddr_r</refname> <refname>lwres_gethostent_r</refname> <refname>lwres_sethostent_r</refname> <refname>lwres_endhostent_r</refname> <refpurpose>lightweight resolver get network host entry</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis><funcsynopsisinfo>#include <lwres/netdb.h></funcsynopsisinfo><funcprototype> <funcdef>struct hostent *<function>lwres_gethostbyname</function></funcdef> <paramdef>const char *<parameter>name</parameter></paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostbyname2</function></funcdef> <paramdef>const char *<parameter>name</parameter></paramdef> <paramdef>int <parameter>af</parameter></paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostbyaddr</function></funcdef> <paramdef>const char *<parameter>addr</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> <paramdef>int <parameter>type</parameter></paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostent</function></funcdef> <paramdef>void</paramdef> </funcprototype><funcprototype> <funcdef>void<function>lwres_sethostent</function></funcdef> <paramdef>int <parameter>stayopen</parameter></paramdef> </funcprototype><funcprototype> <funcdef>void<function>lwres_endhostent</function></funcdef> <paramdef>void</paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostbyname_r</function></funcdef> <paramdef>const char *<parameter>name</parameter></paramdef> <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef> <paramdef>char *<parameter>buf</parameter></paramdef> <paramdef>int <parameter>buflen</parameter></paramdef> <paramdef>int *<parameter>error</parameter></paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostbyaddr_r</function></funcdef> <paramdef>const char *<parameter>addr</parameter></paramdef> <paramdef>int <parameter>len</parameter></paramdef> <paramdef>int <parameter>type</parameter></paramdef> <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef> <paramdef>char *<parameter>buf</parameter></paramdef> <paramdef>int <parameter>buflen</parameter></paramdef> <paramdef>int *<parameter>error</parameter></paramdef> </funcprototype><funcprototype> <funcdef>struct hostent *<function>lwres_gethostent_r</function></funcdef> <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef> <paramdef>char *<parameter>buf</parameter></paramdef> <paramdef>int <parameter>buflen</parameter></paramdef> <paramdef>int *<parameter>error</parameter></paramdef> </funcprototype><funcprototype> <funcdef>void<function>lwres_sethostent_r</function></funcdef> <paramdef>int <parameter>stayopen</parameter></paramdef> </funcprototype><funcprototype> <funcdef>void<function>lwres_endhostent_r</function></funcdef> <paramdef>void</paramdef> </funcprototype></funcsynopsis> </refsynopsisdiv> <refsect1> <title>DESCRIPTION</title> <para> These functions provide hostname-to-address and address-to-hostname lookups by means of the lightweight resolver. They are similar to the standard <citerefentry> <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum> </citerefentry> functions provided by most operating systems. They use a <type>struct hostent</type> which is usually defined in <filename><namedb.h></filename>. </para> <para><programlisting>struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses from name server */};#define h_addr h_addr_list[0] /* address, for backward compatibility */</programlisting> </para> <para> The members of this structure are: <variablelist> <varlistentry> <term><constant>h_name</constant></term> <listitem> <para> The official (canonical) name of the host. </para> </listitem> </varlistentry> <varlistentry> <term><constant>h_aliases</constant></term> <listitem> <para> A NULL-terminated array of alternate names (nicknames) for the host. </para> </listitem> </varlistentry> <varlistentry> <term><constant>h_addrtype</constant></term> <listitem> <para> The type of address being returned — <type>PF_INET</type> or <type>PF_INET6</type>. </para> </listitem> </varlistentry> <varlistentry> <term><constant>h_length</constant></term> <listitem> <para> The length of the address in bytes. </para> </listitem> </varlistentry> <varlistentry> <term><constant>h_addr_list</constant></term> <listitem> <para> A <type>NULL</type> terminated array of network addresses for the host. Host addresses are returned in network byte order.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -