免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1341 | 回复: 0
打印 上一主题 下一主题

res_mkquery [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-26 16:37 |只看该作者 |倒序浏览

res_mkquery Subroutine
Purpose
Makes query messages for name servers.
Library
Standard C Library (libc.a)
Syntax#include
#include
#include
#include int res_mkquery (Operation, DomName, Class, Type, Data, DataLength)
int res_mkquery (Reserved, Buffer, BufferLength)
int
Operation
;
char *
DomName
;
int
Class
,
Type
;
char *
Data
;
int
DataLength
;
struct rrec *
Reserved
;
char *
Buffer
;
int
BufferLength
;
Description
The res_mkquery subroutine creates packets for name servers in the Internet domain. The subroutine also creates a standard query message. The Buffer parameter determines the location of this message.
The res_mkquery subroutine is one of a set of subroutines that form the
resolver
, a set of functions that resolve domain names. Global information used by the resolver subroutines is kept in the _res data structure. The /usr/include/resolv.h file contains the _res structure definition.
Parameters
Operation
Specifies a query type. The usual type is QUERY, but the parameter can be set to any of the query types defined in the arpa/nameser.h file.
DomName
Points to the name of the domain. If the DomName parameter points to a single label and the
RES_DEFNAMES
structure is set, as it is by default, the subroutine appends the DomName parameter to the current domain name. The current domain name is defined by the name server in use or in the
/etc/resolv.conf
file.
Class
Specifies one of the following parameters:
C_IN
Specifies the ARPA Internet.
C_CHAOS
Specifies the Chaos network at MIT.
Type
Requires one of the following values:
T_A
Host address
T_NS
Authoritative server
T_MD
Mail destination
T_MF
Mail forwarder
T_CNAME
Canonical name
T_SOA
Start-of-authority zone
T_MB
Mailbox-domain name
T_MG
Mail-group member
T_MR
Mail-rename name
T_NULL
Null resource record
T_WKS
Well-known service
T_PTR
Domain name pointer
T_HINFO
Host information
T_MINFO
Mailbox information
T_MX
Mail-routing information
T_UINFO
User (
finger
command) information
T_UID
User ID
T_GID
Group ID
Data
Points to the data that is sent to the name server as a search key. The data is stored as a character array.
DataLength
Defines the size of the array pointed to by the Data parameter.
Reserved
Specifies a reserved and currently unused parameter.
Buffer
Points to a location containing the query message.
BufferLength
Specifies the length of the message pointed to by the Buffer parameter.
Return Values
Upon successful completion, the res_mkquery subroutine returns the size of the query. If the query is larger than the value of the BufferLength parameter, the subroutine is unsuccessful and returns a value of -1.
Implementation Specifics
The res_mkquery subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the res_mkquery subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31842/showart_390450.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP