整体功能分析
client.c 主要是负责DNS 服务器与用户接口的设置,可以分成三个模块:
1.数据包传送模块
2.用户的创建模块
3.用户管理器的创建模块
用户的创建模块是为用户管理器的创建模块建立的,对于同一用户,他每次建立连接,只要连接不断开和超时,他的用户创建模块不会被再次激发。因此,这两个模块仅是一次性的,在用户创建以后再发送数据包,它们将不会有任何影响。数据包传送模块则是关于数据传输的,每次传送数据包它都会参与其中。
client.h说明
/* This module defines two objects, ns_client_t and ns_clientmgr_t.
*
* An ns_client_t object handles incoming DNS requests from clients
* on a given network interface.
*
* Each ns_client_t object can handle only one TCP connection or UDP
* request at a time. Therefore, several ns_client_t objects are
* typically created to serve each network interface, e.g., one
* for handling TCP requests and a few (one per CPU) for handling
* UDP requests.
*
* Incoming requests are classified as queries, zone transfer
* requests, update requests, notify requests, etc, and handed off
* to the appropriate request handler. When the request has been
* fully handled (which can be much later), the ns_client_t must be
* notified of this by calling one of the following functions
* exactly once in the context of its task:
* \code
* ns_client_send() (sending a non-error<