DNS and BIND 5th Edition_9
Số trang: 53
Loại file: pdf
Dung lượng: 807.95 KB
Lượt xem: 18
Lượt tải: 0
Xem trước 6 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu dns and bind 5th edition_9, công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
DNS and BIND 5th Edition_9 DNS & BINDdatalen The size of the data buffer. If data is NULL, then datalen is zero.newrr A buffer used for the dynamic update code (covered in Chapter 10, Advanced Features and Security). Unless you are playing with this feature, it is always NULL.buf A buffer in which res_mkquery makes the query packet. It should be PACKETSZ or larger, just like the answer buffer in res_search and res_query.buflen The size of the buf buffer (e.g., PACKETSZ).res_mkquery returns the size of the query packet, or −1 if there was an error. int res_send(const u_char *msg, int msglen, u_char *answer, int anslen)res_send implements the retry algorithm. It sends the query packet, msg, in a UDP packet, but it can also sendit over a TCP stream. The response packet is stored in answer. This routine, of all the resolver routines, is theonly one to use black magic (unless you know all about connected datagram sockets). Youve seen thesearguments before in the other resolver routines:msg The buffer containing the DNS query packetmsglen The size of the msganswer The buffer in which to store the DNS response packetanslen The size of the answer bufferres_send returns the size of the response, or −1 if there was an error. If this routine returns −1 and errno isECONNREFUSED, then there is no name server running on the target name server host.You can look at errno to see if it is ECONNREFUSED after calling res_search or res_ query.(res_search calls res_query, which calls res_send.) If you want to check errno after calling res_query, thenclear errno first. That way, you know the current call to res_send was the one that set errno. However, you14.2.4 The Resolver Library Routines 425 DNS & BINDdont have to clear errno before calling res_search. res_search clears errno itself before calling res_query. int res_init(void)res_init reads resolv.conf and initializes a data structure called _res (more about that later). All of thepreviously discussed routines will call res_init if they detect that it hasnt been called previously. Or you cancall it on your own; this is useful if you want to change some of the defaults before calling the first resolverlibrary routine. If there are any lines in resolv.conf that res_init doesnt understand, it ignores them.res_init always returns zero, even if the manpage reserves the right to return −1. extern int h_errno; int herror(const char *s)herror is a routine like perror, except that it prints out a string based on the value of the external variableh_errno instead of errno. The only argument is:s A string used to identify the error message. If a string s is supplied, it is printed first, followed by : and then a string based on the value of h_errno.Here are the possible values of h_errno:HOST_NOT_FOUND The domain name does not exist. The return code in the name server response was NXDOMAIN.TRY_AGAIN Either the name server is not running, or the name server returned SERVFAIL.NO_RECOVERY Either the domain name could not be compressed because it was an invalid domain name (e.g., a name missing a label − movie.edu) or the name server returned FORMERR, NOTIMP, or REFUSED.NO_DATA The domain name exists, but there are no data of the requested type.NETDB_INTERNAL There was a library error unrelated to the network or name service. Instead, see errno for the problem description.14.2.5 The _res StructureEach of the resolver routines (i.e., each routine whose name starts with res_) makes use of a common datastructure called _res. You can change the behavior of the resolver routines by changing _res. If you want tochange the number of times res_send retries a query, you can change the value of the retry field. If you want14.2.5 The _res Structure 426 DNS & BINDto turn off the resolver search algorithm, you turn off the RES_DNSRCH bit from the options mask. Youllfind the all−important _res structure in resolv.h: struct __res_state { int retrans; /* retransmission time interval */ int retry; /* number of times to retransmit */ u_long options; /* option flags − see below. */ int nscount; /* number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name ...
Nội dung trích xuất từ tài liệu:
DNS and BIND 5th Edition_9 DNS & BINDdatalen The size of the data buffer. If data is NULL, then datalen is zero.newrr A buffer used for the dynamic update code (covered in Chapter 10, Advanced Features and Security). Unless you are playing with this feature, it is always NULL.buf A buffer in which res_mkquery makes the query packet. It should be PACKETSZ or larger, just like the answer buffer in res_search and res_query.buflen The size of the buf buffer (e.g., PACKETSZ).res_mkquery returns the size of the query packet, or −1 if there was an error. int res_send(const u_char *msg, int msglen, u_char *answer, int anslen)res_send implements the retry algorithm. It sends the query packet, msg, in a UDP packet, but it can also sendit over a TCP stream. The response packet is stored in answer. This routine, of all the resolver routines, is theonly one to use black magic (unless you know all about connected datagram sockets). Youve seen thesearguments before in the other resolver routines:msg The buffer containing the DNS query packetmsglen The size of the msganswer The buffer in which to store the DNS response packetanslen The size of the answer bufferres_send returns the size of the response, or −1 if there was an error. If this routine returns −1 and errno isECONNREFUSED, then there is no name server running on the target name server host.You can look at errno to see if it is ECONNREFUSED after calling res_search or res_ query.(res_search calls res_query, which calls res_send.) If you want to check errno after calling res_query, thenclear errno first. That way, you know the current call to res_send was the one that set errno. However, you14.2.4 The Resolver Library Routines 425 DNS & BINDdont have to clear errno before calling res_search. res_search clears errno itself before calling res_query. int res_init(void)res_init reads resolv.conf and initializes a data structure called _res (more about that later). All of thepreviously discussed routines will call res_init if they detect that it hasnt been called previously. Or you cancall it on your own; this is useful if you want to change some of the defaults before calling the first resolverlibrary routine. If there are any lines in resolv.conf that res_init doesnt understand, it ignores them.res_init always returns zero, even if the manpage reserves the right to return −1. extern int h_errno; int herror(const char *s)herror is a routine like perror, except that it prints out a string based on the value of the external variableh_errno instead of errno. The only argument is:s A string used to identify the error message. If a string s is supplied, it is printed first, followed by : and then a string based on the value of h_errno.Here are the possible values of h_errno:HOST_NOT_FOUND The domain name does not exist. The return code in the name server response was NXDOMAIN.TRY_AGAIN Either the name server is not running, or the name server returned SERVFAIL.NO_RECOVERY Either the domain name could not be compressed because it was an invalid domain name (e.g., a name missing a label − movie.edu) or the name server returned FORMERR, NOTIMP, or REFUSED.NO_DATA The domain name exists, but there are no data of the requested type.NETDB_INTERNAL There was a library error unrelated to the network or name service. Instead, see errno for the problem description.14.2.5 The _res StructureEach of the resolver routines (i.e., each routine whose name starts with res_) makes use of a common datastructure called _res. You can change the behavior of the resolver routines by changing _res. If you want tochange the number of times res_send retries a query, you can change the value of the retry field. If you want14.2.5 The _res Structure 426 DNS & BINDto turn off the resolver search algorithm, you turn off the RES_DNSRCH bit from the options mask. Youllfind the all−important _res structure in resolv.h: struct __res_state { int retrans; /* retransmission time interval */ int retry; /* number of times to retransmit */ u_long options; /* option flags − see below. */ int nscount; /* number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính tài liệu công nghệ thông tin lập trình máy tính mẹo máy tính cài đặt máy tínhGợi ý tài liệu liên quan:
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 314 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 303 0 0 -
Thêm chức năng hữu dụng cho menu chuột phải trên Windows
4 trang 288 0 0 -
70 trang 250 1 0
-
Bài giảng Tin học lớp 11 bài 1: Giới thiệu ngôn ngữ lập trình C#
15 trang 237 0 0 -
Tổng hợp lỗi Win 8 và cách sửa
3 trang 232 0 0 -
Sửa lỗi các chức năng quan trọng của Win với ReEnable 2.0 Portable Edition
5 trang 213 0 0 -
Giáo trình Bảo trì hệ thống và cài đặt phần mềm
68 trang 207 0 0 -
UltraISO chương trình ghi đĩa, tạo ổ đĩa ảo nhỏ gọn
10 trang 203 0 0 -
Tổng hợp 30 lỗi thương gặp cho những bạn mới sử dụng máy tính
9 trang 202 0 0