⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resolvlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/resolvLib.html - generated by refgen from resolvLibDoc.c --> <title> resolvLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>resolvLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>resolvLib</strong> - DNS resolver library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./resolvLib.html#resolvInit">resolvInit</a></i>(&nbsp;)</b>  -  initialize the resolver library <br><b><i><a href="./resolvLib.html#resolvGetHostByName">resolvGetHostByName</a></i>(&nbsp;)</b>  -  query the DNS server for the IP address of a host<br><b><i><a href="./resolvLib.html#resolvGetHostByAddr">resolvGetHostByAddr</a></i>(&nbsp;)</b>  -  query the DNS server for the host name of an IP address<br><b><i><a href="./resolvLib.html#resolvParamsSet">resolvParamsSet</a></i>(&nbsp;)</b>  -  set the parameters which control the resolver library<br><b><i><a href="./resolvLib.html#resolvParamsGet">resolvParamsGet</a></i>(&nbsp;)</b>  -  get the parameters which control the resolver library<br><b><i><a href="./resolvLib.html#resolvDNExpand">resolvDNExpand</a></i>(&nbsp;)</b>  -  expand a DNS compressed name from a DNS packet<br><b><i><a href="./resolvLib.html#resolvDNComp">resolvDNComp</a></i>(&nbsp;)</b>  -  compress a DNS name in a DNS packet<br><b><i><a href="./resolvLib.html#resolvQuery">resolvQuery</a></i>(&nbsp;)</b>  -  construct a query, send it, wait for a response<br><b><i><a href="./resolvLib.html#resolvMkQuery">resolvMkQuery</a></i>(&nbsp;)</b>  -  create all types of DNS queries<br><b><i><a href="./resolvLib.html#resolvSend">resolvSend</a></i>(&nbsp;)</b>  -  send a pre-formatted query and return the answer<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides the client-side services for DNS (Domain NameService) queries.  DNS queries come from applications that requiretranslation of IP addresses to host names and back.  If you include this library in VxWorks, it extends the services of the host library.  Theinterface to this library is described in hostLib.  The <b><a href="./hostLib.html#top">hostLib</a></b> interface uses resolver services to get IP and host names. In addition, the resolvercan query multiple DNS servers, if necessary, to add redundancy for queries.  <p>There are two interfaces available for the resolver library.  One is a high-level interface suitable for most applications.  The other is also alow-level interface for more specialized applications, such as mail protocols.<p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>By default, a VxWorks build does not include the resolver code.  In addition,VxWorks is delivered with the resolver library disabled.  To include theresolver library in the VxWorks image, edit <b>config/all/configAll.h</b> and include the definition:<pre>    #define INCLUDE_DNS_RESOLVER</pre>To enable the resolver services, you need to redefine only one DNS server IP address, changing it from a place-holder value to an actual value. Additional DNS server IP addresses can be configured using <b><i><a href="./resolvLib.html#resolvParamsSet">resolvParamsSet</a></i>(&nbsp;)</b>.To do the initial configuration, edit <b>configAll.h</b>, and enter the correct IP address for your domain server in the definition:<pre>    #define RESOLVER_DOMAIN_SERVER  "90.0.0.3"</pre>If you do not provide a valid IP address, resolver initialization fails.  You also need to configure the domain to which your resolver belongs.  To do this, edit <b>configAll.h</b> and enter the correct domain name for your organization in the definition:<pre>    #define RESOLVER_DOMAIN  "wrs.com"</pre>The last and most important step is to make sure that you have a route to the configured DNS server.  If your VxWorks image includes a routing protocol, such as RIP or OSPF, the routes are created for you automatically.  Otherwise,you must use <b><i><a href="./routeLib.html#routeAdd">routeAdd</a></i>(&nbsp;)</b> or <b><i><a href="./routeLib.html#mRouteAdd">mRouteAdd</a></i>(&nbsp;)</b> to add the routes to the routing table.<p>The resolver library comes with a debug option.  To turn on debugging, edit <b>configAll.h</b> to include the define:<pre>    #define INCLUDE_DNS_DEBUG</pre>This include makes VxWorks print a log of the resolver queries to the console.This feature assumes a single task.  Thus, if you are running multiple tasks,your output to the console is a garble of messages from all the tasks.<p>The resolver library uses UDP to send queries to the DNS server and expectsthe DNS server to handle recursion.  You can change the resolver parameters at any time after the library has been initialized with <b><i><a href="./resolvLib.html#resolvInit">resolvInit</a></i>(&nbsp;)</b>.However, it is strongly recommended that you change parameters only shortly after initialization, or when there are no other tasks accessing the resolverlibrary.  <p>Your procedure for changing any of the resolver parameter should startwith a call to <b><i><a href="./resolvLib.html#resolvParamsGet">resolvParamsGet</a></i>(&nbsp;)</b> to retrieve the active parameters.  Thenyou can change the query order (defaults to query DNS server only), the domain name, or add DNS server IP addresses.  After the parameters arechanged, call <b><i><a href="./resolvLib.html#resolvParamsSet">resolvParamsSet</a></i>(&nbsp;)</b>.  For the values you can use when accessing resolver library services, see the header files <b>resolvLib.h</b>, <b>resolv/resolv.h</b>, and <b>resolv/nameser.h</b>. <p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>resolvLib.h</b> </blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./resolvLib.html#top">resolvLib</a></b>, <b><a href="./hostLib.html#top">hostLib</a></b><hr><a name="resolvInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>resolvInit</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>resolvInit</i>(&nbsp;)</strong> - initialize the resolver library </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS resolvInit    (    char *  pNameServer,        /* pointer to Name server IP address */    char *  pDefaultDomainName, /* default domain name */    FUNCPTR pdnsDebugRtn        /* function ptr to debug routine */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function initializes the resolver.  <i>pNameServer</i> is a single IP addressfor a name server in dotted decimal notation.  <i>pDefaultDomainName</i> is the default domain name to be appended to names without a dot.  The function pointer <i>pdnsDebugRtn</i> is set to the resolver debug function.  Additionalname servers can be configured using the function <b><i><a href="./resolvLib.html#resolvParamsSet">resolvParamsSet</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./resolvLib.html#top">resolvLib</a></b>, <b><i><a href="./resolvLib.html#resolvGetHostByName">resolvGetHostByName</a></i>(&nbsp;)</b>, <b><i><a href="./resolvLib.html#resolvGetHostByAddr">resolvGetHostByAddr</a></i>(&nbsp;)</b>, <b><i><a href="./resolvLib.html#resolvDNExpand">resolvDNExpand</a></i>(&nbsp;)</b>,  <b><i><a href="./resolvLib.html#resolvDNComp">resolvDNComp</a></i>(&nbsp;)</b>, <b><i><a href="./resolvLib.html#resolvSend">resolvSend</a></i>(&nbsp;)</b>, <b><i><a href="./resolvLib.html#resolvParamsSet">resolvParamsSet</a></i>(&nbsp;)</b>, <b><i><a href="./resolvLib.html#resolvParamsGet">resolvParamsGet</a></i>(&nbsp;)</b>,  <b><i><a href="./resolvLib.html#resolvQuery">resolvQuery</a></i>(&nbsp;)</b><hr><a name="resolvGetHostByName"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>resolvGetHostByName</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>resolvGetHostByName</i>(&nbsp;)</strong> - query the DNS server for the IP address of a host</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>struct hostent * resolvGetHostByName    (    char * pHostName, /* ptr to the name of the host */    char * pHostBuf,  /* ptr to the buffer used by hostent structure */    int    bufLen     /* length of the buffer */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This function returns a <b>hostent</b> structure. This structure is defined asfollows: <p><pre>    struct   hostent     {    char *   h_name;          /* official name of host */     char **  h_aliases;       /* alias list */    int      h_addrtype;      /* address type */    int      h_length;        /* length of address */     char **  h_addr_list;     /* list of addresses from name server */    unsigned int h_ttl;       /* Time to Live in Seconds for this entry */    }</pre>The <b>h_aliases</b> and <b>h_addr_type</b> vectors are NULL-terminated.<p>Specify the host you want to query in <i>pHostname</i>.  Use <i>pBuf</i> and <i>bufLen</i> to specify the location and size of a buffer to receive the <b>hostent</b> structure and its associated contents.  Host addresses are returned in network byte order.  Given the information this routine retrieves, the <i>pBuf</i> buffer should be 512 bytes or larger.<p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to a <b>hostent</b> structure if the host is found, or NULL if the parameters are invalid, the host is not found, or the buffer is too small.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;S_resolvLib_INVALID_PARAMETER<br>&nbsp;S_resolvLib_BUFFER_2_SMALL<br>&nbsp;S_resolvLib_TRY_AGAIN<br>&nbsp;S_resolvLib_HOST_NOT_FOUND<br>&nbsp;S_resolvLib_NO_DATA<br>&nbsp;S_resolvLib_NO_RECOVERY

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -