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

📄 resolvlibdoc.c

📁 vxworks source code, used for develop vxworks system.
💻 C
📖 第 1 页 / 共 2 页
字号:
/********************************************************************************* resolvParamsGet - get the parameters which control the resolver library** This routine copies the resolver parameters to the RESOLV_PARAMS_S* structure referenced in the <pResolvParms> parameter.  The RESOLV_PARAMS_S* structure is defined in resolvLib.h as follows: * .CS*     typedef struct*        {*        char   queryOrder;*        char   domainName [MAXDNAME];*        char   nameServersAddr [MAXNS][MAXIPADDRLEN];*        } RESOLV_PARAMS_S;* .CE* Typically, you call this function just before calling resolvParamsSet().* The resolvParamsGet() call populates the RESOLV_PARAMS_S structure. * You can then modify the default values just before calling * resolvParamsSet().  ** RETURNS: N/A** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvDNExpand(),* resolvDNComp(), resolvSend(), resolvParamsSet(), resolvInit(),* resolvMkQuery(), resolvQuery()*/void resolvParamsGet     (    RESOLV_PARAMS_S *     pResolvParams  /* ptr to resolver parameter struct */    )    {    ...    }/********************************************************************************* resolvHostLibGetByName - query the DNS server in behalf of hostGetByName** When the resolver library is installed, the routine hostGetByName() in the * hostLib library invokes this routine.  When the host name is not found by* hostGetByName in the static host table.  This feature allows existing * applications to take advantage of the resolver without any changes.** NOMANUAL** ERRNO:*  S_resolvLib_TRY_AGAIN*  S_resolvLib_HOST_NOT_FOUND*  S_resolvLib_NO_DATA*  S_resolvLib_NO_RECOVERY** RETURNS: IP address of host, or ERROR if the host was not found.*/LOCAL int resolvHostLibGetByName     (    char * pHostName       /* Pointer to host name */    )    {    ...    }/********************************************************************************* resolvHostLibGetByAddr - query the DNS server in behalf of hostGetByAddr()** When the resolver library is installed the routine hostGetByAddr() in the * hostLib library invokes this routine.  When the IP address is not found by* hostGetByAddr() in the static host table.  This feature allows existing * applications to take advantage of the resolver without any changes.  The* <addr> paramter specifies the IP address and <pHostName> points to the* official name of the host when the query is successful.** NOMANUAL** ERRNO:*  S_resolvLib_TRY_AGAIN*  S_resolvLib_HOST_NOT_FOUND*  S_resolvLib_NO_DATA*  S_resolvLib_NO_RECOVERY** RETURNS: OK, or ERROR if the host name was not found.*/LOCAL STATUS resolvHostLibGetByAddr    (    int   addr,			/* IP address of requested host name */    char * pHostName		/* host name output by this routine */    )    {    ...    }/********************************************************************************* resolvDNExpand - expand a DNS compressed name from a DNS packet** This functions expands a compressed DNS name from a DNS packet.  The <msg>* parameter points to that start of the DNS packet.  The <eomorig> parameter* points to the last location of the DNS packet plus 1.  The <comp_dn> * parameter points to the compress domain name, and <exp_dn> parameter * expects a pointer to a buffer.  Upon function completion, this buffer * contains the expanded domain name.  Use the <length> parameter to pass in* the size of the buffer referenced by the <exp_dn> parameter.  ** RETURNS: The length of the expanded domain name, or ERROR on failure.** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvInit(),* resolvDNComp(), resolvSend(), resolvParamsSet(), resolvParamsGet(),* resolvMkQuery(), resolvQuery()*/int resolvDNExpand     (    const u_char * msg,     /* ptr to the start of the DNS packet */    const u_char * eomorig, /* ptr to the last location +1 of the DNS packet */    const u_char * comp_dn, /* ptr to the compressed domain name */          u_char * exp_dn,  /* ptr to where the expanded DN is output */          int      length   /* length of the buffer pointed by <expd_dn> */    )    {    ...    }/********************************************************************************* resolvDNComp - compress a DNS name in a DNS packet** This routine takes the expanded domain name referenced in the <exp_dn> * parameter, compresses it, and stores the compressed name in the location* pointed to by the <comp_dn> parameter.  The <length> parameter passes in * the length of the buffer starting at <comp_dn>.  The <dnptrs> parameter * is a pointer to a list of pointers to previously compressed names.  The * <lastdnptr> parameter points to the last entry in the <dnptrs> array.** RETURNS: The size of the compressed name, or ERROR.** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvDNExpand(),* resolvInit(), resolvSend(), resolvParamsSet(), resolvParamsGet(),* resolvMkQuery(), resolvQuery()*/int resolvDNComp     (    const u_char *  exp_dn,   /* ptr to the expanded domain name */          u_char *  comp_dn,  /* ptr to where to output the compressed name */            int       length,   /* length of the buffer pointed by <comp_dn> */          u_char ** dnptrs,   /* ptr to a ptr list of compressed names */           u_char ** lastdnptr /* ptr to the last entry pointed by <dnptrs> */    )    {    ...    }/********************************************************************************* resolvQuery - construct a query, send it, wait for a response** This routine constructs a query for the domain specified in the <name> * parameter.  The <class> parameter specifies the class of the query. * The <type> parameter specifies the type of query. The routine then sends* the query to the DNS server.  When the server responds, the response is * validated and copied to the buffer you supplied in the <answer> parameter.* Use the <anslen> parameter to pass in the size of the buffer referenced* in <answer>.** RETURNS: The length of the response or ERROR.** ERRNO:*  S_resolvLib_TRY_AGAIN*  S_resolvLib_HOST_NOT_FOUND*  S_resolvLib_NO_DATA*  S_resolvLib_NO_RECOVERY** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvDNExpand(),* resolvDNComp(), resolvInit(), resolvParamsSet(), resolvParamsGet(),* resolvMkQuery()*/int resolvQuery     (    char   *name,       /* domain name */    int    class,       /* query class for IP is C_IN */    int    type,        /* type is T_A, T_PTR, ... */    u_char *answer,     /* buffer to put answer */    int    anslen       /* length of answer buffer */    )    {    ...    }/********************************************************************************* resolvMkQuery - create all types of DNS queries** This routine uses the input parameters to create a domain name query.* You can set the <op> parameter to QUERY or IQUERY.  Specify the domain * name in <dname>, the class in <class>, the query type in <type>.  Valid* values for type include T_A, T_PTR, and so on.  Use <data> to add Resource * Record data to the query.  Use <datalen> to pass in the length of the * data buffer.  Set <newrr_in> to NULL.  This parameter is reserved for * future use.  The <buf> parameter expects a pointer to the output buffer * for the constructed query.  Use <buflen> to pass in the length of the * buffer referenced in <buf>.** RETURNS: The length of the constructed query or ERROR.** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvDNExpand(),* resolvDNComp(), resolvSend(), resolvParamsSet(), resolvParamsGet(),* resolvInit(), resolvQuery()*/int resolvMkQuery     (          int     op,	       /* set to desire query QUERY or IQUERY */    const char *  dname,       /* domain name to be use in the query */    int           class,       /* query class for IP is C_IN */    int           type,        /* type is T_A, T_PTR, ... */    const char *  data,        /* resource Record (RR) data */    int           datalen,     /* length of the RR */    const char *  newrr_in,    /* not used always set to NULL */          char *  buf,         /* out of the constructed query */          int     buflen       /* length of the buffer for the query */    )    {    ...    }/********************************************************************************* resolvSend - send a pre-formatted query and return the answer** This routine takes a pre-formatted DNS query and sends it to the domain* server.  Use <buf> to pass in a pointer to the query.  Use <buflen> to * pass in the size of the buffer referenced in <buf>.  The <answer> parameter* expects a pointer to a buffer into which this routine can write the * answer retrieved from the server.  Use <anslen> to pass in the size of* the buffer you have provided in <anslen>.** RETURNS: The length of the response or ERROR.** ERRNO:*  S_resolvLib_TRY_AGAIN*  ECONNREFUSE*  ETIMEDOU** SEE ALSO:* resolvGetHostByName(), resolvGetHostByAddr(), resolvDNExpand(),* resolvDNComp(), resolvInit(), resolvParamsSet(), resolvParamsGet(),* resolvMkQuery(), resolvQuery()*/int resolvSend     (    const char * buf,		/* pre-formatted query */          int    buflen,	/* length of query */          char * answer,	/* buffer for answer */          int    anslen		/* length of answer */    )    {    ...    }

⌨️ 快捷键说明

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