Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

pos_srvresolver Class Reference

Posadis server resolver. More...

Inheritance diagram for pos_srvresolver:

pos_resolver List of all members.

Public Member Functions

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


Detailed Description

Posadis server resolver.

This is the resolver implementation for Posadis server applications. It sends all UDP queries through the same socket, thus saving valuable resources. This does mean though that the Posadis server thread should be running before any pos_srvresolver function is used.

The TCP client implementation of pos_srvresolver is the same as that of the client resolver.

Definition at line 52 of file srvresolver.h.


Member Function Documentation

void pos_srvresolver::query DnsMessage q,
DnsMessage *&  a,
stl_slist(_addr)&  servers,
int  flags = Q_DFL
[virtual]
 

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.

Parameters:
servers  List of servers to query
See also:
query()

Reimplemented from pos_resolver.

void pos_srvresolver::query DnsMessage q,
DnsMessage *&  a,
_addr server,
int  flags = Q_DFL
[virtual]
 

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).

Parameters:
q  The DNS query message
a  Variable to put the answer in
server  The server to query
flags  Flags controlling query behavior.

Reimplemented from pos_resolver.

void pos_srvresolver::sendmessage DnsMessage msg,
_addr res,
int  sockid = -1
[virtual]
 

low-level resolver function for sending a message

This function sends a DNS message to a specified server using UDP.

Parameters:
msg  The DNS message to send
res  The host to send the message to
sockid  This field has no meaning in the server implementation.

Reimplemented from pos_resolver.

bool pos_srvresolver::waitanswer DnsMessage *&  ans,
stl_slist(WaitAnswerData)&  wait,
int  timeout,
stl_slist(WaitAnswerData)::iterator &  it,
int  sockid = -1
[virtual]
 

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.

Parameters:
ans  If an answer is received, it will be put in this variable
wait  List of sent queries we might get an answer to
timeout  Number of milliseconds to wait at most
it  If an answer is received, this iterator will point to the message this was an answer to.
sockid  This field has no meaning in the server implementation.

Reimplemented from pos_resolver.


The documentation for this class was generated from the following file:
Generated on Fri Dec 24 19:55:16 2004 for Poslib by doxygen 1.3.7