Inheritance diagram for pos_cliresolver:
Public Member Functions |
|
pos_cliresolver () | |
resolver constructor |
|
virtual | ~pos_cliresolver () |
destructor |
|
void | query (DnsMessage *q, DnsMessage *&a, _addr *server, int flags=Q_DFL) |
high-level query function |
|
void | query (DnsMessage *q, DnsMessage *&a, stl_slist(_addr)&servers, int flags=Q_DFL) |
high-level query function using multiple servers |
|
void | sendmessage (DnsMessage *msg, _addr *res, int sockid=-1) |
low-level resolver function for sending a message |
|
bool | waitanswer (DnsMessage *&ans, stl_slist(WaitAnswerData)&wait, int timeout, stl_slist(WaitAnswerData)::iterator &it, int sockid=-1) |
low-level resolver function for waiting for an answer |
|
void | stop () |
stops the resolving process asap |
This is an implementation of the pos_resolver class meant for client applications. It does not maintain a centralized query database like pos_srvresolver. Instead, it will open up a new socket for each query it attempts. The advantage is that it does not require the multi-thread architecture pos_srvresolver depends on.
pos_cliresolver implements the pos_resolver query(), sendmessage() and waitanswer() functions.
Definition at line 270 of file resolver.h.
|
resolver constructor Resolver for the client resolver. |
|
destructor Destructor for the client resolver |
|
high-level query function using multiple servers This function generally behaves the same as the query() function, except it takes a list of servers instead of one. The query algorithm differs in that for each timeout value from udp_tries, all servers will be queried. Also, if the answer is truncated, _only_ the server that returned the truncated answer will be tried using TCP. This function will start querying at a random place in the servers list; after that, it will run through all servers listed in the order in which you specify them.
Reimplemented from pos_resolver. |
|
high-level query function This function will query the given DNS server for the information identified by the DNS query message q. If it succeeds, it will return and put the answer from the server in a, which need not be initialized previously (in fact, this will result in a memory leak). If not, it will raise a PException. If the query() function does not receive an answer in time, it will retry for n_udp_tries times, using the timeout values from the udp_tries array. If the answer it receives is truncated, it will retry using TCP, unless instructed not to by the flags parameter. The behavior of the query function can be changed by the flags parameter. Currently, this can only be Q_DFL (default flags) or Q_NOTCP (do not retry using UDP).
Reimplemented from pos_resolver. |
|
low-level resolver function for sending a message This function sends a DNS message to a specified server using UDP.
Reimplemented from pos_resolver. |
|
stops the resolving process asap This function will try to stop the resolving process as soon as possible. Thus, it will need to be called asynchronously (since the query functions block), either from another thread or from a signal handler. It will tease the query functions a bit by closing their sockets, and urge them to quit. |
|
low-level resolver function for waiting for an answer This function waits for at most the amount of milliseconds specified by timeout until an answer to our query arrives. Since multiple messages for the same query might have been sent out, it asks for a list of sent queries. If no answer is received in time, this function will raise an exception.
Reimplemented from pos_resolver. |