static_datasrc.h 2.79 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

// $Id$

//
// Sample Datasource implementation; this datasource only returns
// static content for the queries
// CH TXT version.bind
// and
// CH TXT authors.bind
//

#ifndef __STATIC_DATA_SOURCE_H
#define __STATIC_DATA_SOURCE_H

28
#include <datasrc/data_source.h>
29 30

namespace isc {
31 32 33 34 35 36 37 38 39

namespace dns {
class Name;
class RRClass;
class RRType;
class RRType;
class RRsetList;
}

Evan Hunt's avatar
Evan Hunt committed
40
namespace datasrc {
41

42
struct StaticDataSrcImpl;
43

44
class StaticDataSrc : public DataSrc {
45 46 47 48 49 50 51 52 53
private:
    ///
    /// \name Constructors, Assignment Operator and Destructor.
    ///
    /// Note: The copy constructor and the assignment operator are intentionally
    /// defined as private.
    //@{
    StaticDataSrc(const StaticDataSrc& source);
    StaticDataSrc& operator=(const StaticDataSrc& source);
54 55
public:
    StaticDataSrc();
56
    ~StaticDataSrc();
57
    //@}
58

Evan Hunt's avatar
Evan Hunt committed
59
    void findClosestEnclosure(DataSrcMatch& match) const;
60

61
    Result findRRset(const isc::dns::Name& qname,
62 63 64
                     const isc::dns::RRClass& qclass,
                     const isc::dns::RRType& qtype,
                     isc::dns::RRsetList& target,
65
                     uint32_t& flags,
66
                     const isc::dns::Name* zonename) const;
67

68
    Result findExactRRset(const isc::dns::Name& qname,
69 70 71 72
                          const isc::dns::RRClass& qclass,
                          const isc::dns::RRType& qtype,
                          isc::dns::RRsetList& target,
                          uint32_t& flags,
73
                          const isc::dns::Name* zonename) const;
74

75
    Result findPreviousName(const isc::dns::Name& qname,
76
                            isc::dns::Name& target,
77
                            const isc::dns::Name* zonename) const;
78

79
   Result findCoveringNSEC3(const isc::dns::Name& zonename,
80
                            std::string& hash,
Evan Hunt's avatar
Evan Hunt committed
81 82
                            isc::dns::RRsetList& target) const;

83
    Result init();
84
    Result init(const isc::data::ElementPtr config);
85
    Result close();
86 87
private:
    StaticDataSrcImpl* impl_;
88 89 90 91 92 93 94 95 96 97
};

}
}

#endif

// Local Variables: 
// mode: c++
// End: