LCOV - code coverage report
Current view: top level - asiodns - dns_answer.h (source / functions) Hit Total Coverage
Test: report.info Lines: 2 2 100.0 %
Date: 2012-05-15 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
       2                 :            : //
       3                 :            : // Permission to use, copy, modify, and/or distribute this software for any
       4                 :            : // purpose with or without fee is hereby granted, provided that the above
       5                 :            : // copyright notice and this permission notice appear in all copies.
       6                 :            : //
       7                 :            : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
       8                 :            : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
       9                 :            : // AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
      10                 :            : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      11                 :            : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
      12                 :            : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      13                 :            : // PERFORMANCE OF THIS SOFTWARE.
      14                 :            : 
      15                 :            : #ifndef __ASIOLINK_DNS_ANSWER_H
      16                 :            : #define __ASIOLINK_DNS_ANSWER_H 1
      17                 :            : 
      18                 :            : #include <asiolink/io_message.h>
      19                 :            : #include <util/buffer.h>
      20                 :            : #include <dns/message.h>
      21                 :            : 
      22                 :            : namespace isc {
      23                 :            : namespace asiodns {
      24                 :            : 
      25                 :            : /// \brief The \c DNSAnswer class is an abstract base class for a DNS
      26                 :            : /// Answer provider function.
      27                 :            : ///
      28                 :            : /// Specific derived class implementations are hidden within the
      29                 :            : /// implementation.  Instances of the derived classes can be called
      30                 :            : /// as functions via the operator() interface.  Pointers to these
      31                 :            : /// instances can then be provided to the \c IOService class
      32                 :            : /// via its constructor.
      33                 :            : ///
      34                 :            : /// A DNS Answer provider function takes answer data that has been obtained
      35                 :            : /// from a DNS Lookup provider functon and readies it to be sent to the
      36                 :            : /// client.  After it has run, the OutputBuffer object passed to it should
      37                 :            : /// contain the answer to the query rendered into wire format.
      38                 :            : class DNSAnswer {
      39                 :            :     ///
      40                 :            :     /// \name Constructors and Destructor
      41                 :            :     ///
      42                 :            :     /// Note: The copy constructor and the assignment operator are
      43                 :            :     /// intentionally defined as private, making this class non-copyable.
      44                 :            :     //@{
      45                 :            : private:
      46                 :            :     DNSAnswer(const DNSAnswer& source);
      47                 :            :     DNSAnswer& operator=(const DNSAnswer& source);
      48                 :            : protected:
      49                 :            :     /// \brief The default constructor.
      50                 :            :     ///
      51                 :            :     /// This is intentionally defined as \c protected as this base class
      52                 :            :     /// should never be instantiated (except as part of a derived class).
      53                 :        157 :     DNSAnswer() {}
      54                 :            : public:
      55                 :            :     /// \brief The destructor
      56                 :        157 :     virtual ~DNSAnswer() {}
      57                 :            :     //@}
      58                 :            :     /// \brief The function operator
      59                 :            :     ///
      60                 :            :     /// This makes its call indirectly via the "self" pointer, ensuring
      61                 :            :     /// that the function ultimately invoked will be the one in the derived
      62                 :            :     /// class.
      63                 :            :     ///
      64                 :            :     /// \param io_message The event message to handle
      65                 :            :     /// \param query_message The DNS MessagePtr of the original query
      66                 :            :     /// \param answer_message The DNS MessagePtr of the answer we are
      67                 :            :     /// building
      68                 :            :     /// \param buffer Intermediate data results are put here
      69                 :            :     virtual void operator()(const asiolink::IOMessage& io_message,
      70                 :            :                             isc::dns::MessagePtr query_message,
      71                 :            :                             isc::dns::MessagePtr answer_message,
      72                 :            :                             isc::util::OutputBufferPtr buffer) const = 0;
      73                 :            : };
      74                 :            : 
      75                 :            : }      // namespace asiodns
      76                 :            : }      // namespace isc
      77                 :            : #endif // __ASIOLINK_DNS_ANSWER_H

Generated by: LCOV version 1.9