'ODTONE - Open Dot Twenty One'

PrevUpHomeNext

Class resolver

odtone::dns::resolver

Synopsis

// In header: </home/carlos/Projectos/odtone/inc/odtone/net/dns/resolver.hpp>


class resolver {
public:
  // construct/copy/destruct
  resolver(boost::asio::io_service &);
  ~resolver();

  // public member functions
  void queue(std::string, enum dns_query_type, dns_callback_t);

  // private member functions
  void receive_handler(buffer< uint8 > &, size_t, 
                       const boost::system::error_code &);
  void send_handler(const boost::system::error_code &, std::size_t);
  void callback(struct query, enum dns_status);
  void dns_queue(void *, std::string, enum dns_query_type, std::string, 
                 dns_callback_t);
  void dns_cancel(const void *);
  boost::optional< struct query > 
  find_cached_query(std::string, enum dns_query_type);
  boost::optional< struct query > find_active_query(uint16);
  void cleanup();
};

Description

resolver public construct/copy/destruct

  1. resolver(boost::asio::io_service & io);

    Construct the DNS resolver.

    Parameters:

    io

    The io_service object that the resolver will use to dispatch handlers for any asynchronous operations performed on the socket.

  2. ~resolver();

    Destruct the DNS resolver.

resolver public member functions

  1. void queue(std::string host, enum dns_query_type type, 
               dns_callback_t app_callback);

    Queries the DNS server.

    Parameters:

    app_callback

    The application callback function.

    host

    The query to be performed.

    type

    The query type.

resolver private member functions

  1. void receive_handler(buffer< uint8 > & buff, size_t rbytes, 
                         const boost::system::error_code & error);

    Handle the reception of an asynchronous message.

    Parameters:

    buff

    The input message bytes.

    error

    The error code.

    rbytes

    The number of bytes of the input message.

  2. void send_handler(const boost::system::error_code & ec, 
                      std::size_t bytes_transferred);

    Handle of sending procedure.

    Parameters:

    bytes_transferred

    Bytes transferred.

    ec

    The error code.

  3. void callback(struct query query, enum dns_status status);

    Find out if a given query is active.

    Parameters:

    query

    The query information.

    status

    The query status.

  4. void dns_queue(void * ctx, std::string name, enum dns_query_type qtype, 
                   std::string dns_ip, dns_callback_t app_callback);

    Queue the resolution.

    Parameters:

    app_callback

    The application callback function.

    ctx

    The query context.

    dns_ip

    The DNS server IP address.

    name

    The query to be performed.

    qtype

    The query type.

  5. void dns_cancel(const void * context);

    Cancel the query.

    Parameters:

    context

    The query context.

  6. boost::optional< struct query > 
    find_cached_query(std::string name, enum dns_query_type qtype);

    Find a given query in cache.

    Parameters:

    name

    The domain name.

    qtype

    The query type.

    Returns:

    The query information.

  7. boost::optional< struct query > find_active_query(uint16 tid);

    Find out if a given query is active.

    Parameters:

    tid

    The transaction identifier.

    Returns:

    The query information if found.

  8. void cleanup();

    Cleanup expired queries.


PrevUpHomeNext