📄 hostlib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/hostLib.html - generated by refgen from hostLib.c --> <title> hostLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>hostLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostLib</strong> - host table subroutine library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./hostLib.html#hostTblInit">hostTblInit</a>( )</b> - initialize the network host table<br><b><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b> - add a host to the host table<br><b><a href="./hostLib.html#hostDelete">hostDelete</a>( )</b> - delete a host from the host table<br><b><a href="./hostLib.html#hostGetByName">hostGetByName</a>( )</b> - look up a host in the host table by its name<br><b><a href="./hostLib.html#hostGetByAddr">hostGetByAddr</a>( )</b> - look up a host in the host table by its Internet address<br><b><a href="./hostLib.html#sethostname">sethostname</a>( )</b> - set the symbolic name of this machine<br><b><a href="./hostLib.html#gethostname">gethostname</a>( )</b> - get the symbolic name of this machine<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides routines to store and access the network host database.The host table contains information regarding the known hosts on thelocal network. The host table (displayed with <b><a href="./netShow.html#hostShow">hostShow</a>( )</b>) containsthe Internet address, the official host name, and aliases.<p>By convention, network addresses are specified in dotted (".") decimal notation. The library <b><a href="./inetLib.html#top">inetLib</a></b> contains Internet address manipulation routines. Host names and aliases may contain any printable character.<p>Before any of the routines in this module can be used, the library must beinitialized by <b><a href="./hostLib.html#hostTblInit">hostTblInit</a>( )</b>. This is done automatically if <b>INCLUDE_HOST_TBL</b>is defined.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>hostLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./inetLib.html#top">inetLib</a></b><hr><a name="hostTblInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>hostTblInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostTblInit( )</strong> - initialize the network host table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void hostTblInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the host list data structure used by routinesthroughout this module. It should be called before any other routines inthis module. This is done automatically if <b>INCLUDE_HOST_TBL</b> is defined.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b>, <b><a href="./usrConfig.html#top">usrConfig</a></b><hr><a name="hostAdd"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>hostAdd( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostAdd( )</strong> - add a host to the host table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS hostAdd ( char * hostName, /* host name */ char * hostAddr /* host addr in standard Internet format */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine adds a host name to the local host table.This must be called before sockets on the remote host are opened,or before files on the remote host are accessed via <b><a href="./netDrv.html#top">netDrv</a></b> or <b><a href="./nfsDrv.html#top">nfsDrv</a></b>.<p>The host table has one entry per Internet address.More than one name may be used for an address.Additional host names are added as aliases.<p></blockquote><h4>EXAMPLE</h4><blockquote><p><pre> -> hostAdd "wrs", "90.2" -> hostShow hostname inet address aliases -------- ------------ ------- localhost 127.0.0.1 yuba 90.0.0.3 wrs 90.0.0.2 value = 12288 = 0x3000 = _bzero + 0x18</pre></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the host table is full, the host name/inet address pairis already entered, the Internet address is invalid, or memory is insufficient.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b>, <b><a href="./netDrv.html#top">netDrv</a></b>, <b><a href="./nfsDrv.html#top">nfsDrv</a></b><hr><a name="hostDelete"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>hostDelete( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostDelete( )</strong> - delete a host from the host table</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS hostDelete ( char * name, /* host name or alias */ char * addr /* host addr in standard Internet format */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a host name from the local host table. If <i>name</i> isa host name, the host entry is deleted. If <i>name</i> is a host name alias,the alias is deleted.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if the parameters are invalid or the host is unknown.<p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_hostLib_INVALID_PARAMETER</b>, <b>S_hostLib_UNKNOWN_HOST</b></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b><hr><a name="hostGetByName"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>hostGetByName( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostGetByName( )</strong> - look up a host in the host table by its name</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int hostGetByName ( char * name /* name of host */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the Internet address of a host that hasbeen added to the host table by <b><a href="./hostLib.html#hostAdd">hostAdd</a>( )</b>. If the DNS resolver library<b><a href="./resolvLib.html#top">resolvLib</a></b> has been configured in the vxWorks image, a query for the hostIP address is sent to the DNS server, if the name was not found in the localhost table.<p></blockquote><h4>RETURNS</h4><blockquote><p>The Internet address (as an integer), or ERROR if the host is<br> unknown.<p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_hostLib_INVALID_PARAMETER</b>, <b>S_hostLib_UNKNOWN_HOST</b></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b><hr><a name="hostGetByAddr"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>hostGetByAddr( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>hostGetByAddr( )</strong> - look up a host in the host table by its Internet address</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS hostGetByAddr ( int addr, /* inet address of host */ char * name /* buffer to hold name */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine finds the host name by its Internet address and copies it to<i>name</i>. The buffer <i>name</i> should be preallocated with (MAXHOSTNAMELEN + 1)bytes of memory and is NULL-terminated unless insufficient space isprovided. If the DNS resolver library <b><a href="./resolvLib.html#top">resolvLib</a></b> has been configured in thevxWorks image, a query for the host name is sent to the DNS server, if thename was not found in the local host table.<p></blockquote><h4>WARNING</h4><blockquote><p>This routine does not look for aliases. Host names are limited toMAXHOSTNAMELEN (from <b>hostLib.h</b>) characters.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if buffer is invalid or the host is unknown.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b>, <b><a href="./hostLib.html#hostGetByName">hostGetByName</a>( )</b><hr><a name="sethostname"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>sethostname( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>sethostname( )</strong> - set the symbolic name of this machine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int sethostname ( char * name, /* machine name */ int nameLen /* length of name */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the target machine's symbolic name, which can be usedfor identification.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b><hr><a name="gethostname"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>gethostname( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>gethostname( )</strong> - get the symbolic name of this machine</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int gethostname ( char * name, /* machine name */ int nameLen /* length of name */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the target machine's symbolic name, which can be usedfor identification.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./hostLib.html#top">hostLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -