static_datasrc.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright (C) 2009 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. // $Id$
  15. //
  16. // Sample Datasource implementation; this datasource only returns
  17. // static content for the queries
  18. // CH TXT version.bind
  19. // and
  20. // CH TXT authors.bind
  21. //
  22. #ifndef __STATIC_DATA_SOURCE_H
  23. #define __STATIC_DATA_SOURCE_H
  24. #include "data_source.h"
  25. namespace isc {
  26. namespace dns {
  27. class Name;
  28. class RRClass;
  29. class RRType;
  30. class RRType;
  31. class RRsetList;
  32. }
  33. namespace auth {
  34. class Query;
  35. class NameMatch;
  36. struct StaticDataSrcImpl;
  37. class StaticDataSrc : public DataSrc {
  38. private:
  39. ///
  40. /// \name Constructors, Assignment Operator and Destructor.
  41. ///
  42. /// Note: The copy constructor and the assignment operator are intentionally
  43. /// defined as private.
  44. //@{
  45. StaticDataSrc(const StaticDataSrc& source);
  46. StaticDataSrc& operator=(const StaticDataSrc& source);
  47. public:
  48. StaticDataSrc();
  49. ~StaticDataSrc();
  50. //@}
  51. void findClosestEnclosure(NameMatch& match,
  52. const isc::dns::RRClass& qclass) const;
  53. Result findRRset(const isc::dns::Name& qname,
  54. const isc::dns::RRClass& qclass,
  55. const isc::dns::RRType& qtype,
  56. isc::dns::RRsetList& target,
  57. uint32_t& flags,
  58. const isc::dns::Name* zonename) const;
  59. Result findExactRRset(const isc::dns::Name& qname,
  60. const isc::dns::RRClass& qclass,
  61. const isc::dns::RRType& qtype,
  62. isc::dns::RRsetList& target,
  63. uint32_t& flags,
  64. const isc::dns::Name* zonename) const;
  65. Result findPreviousName(const isc::dns::Name& qname,
  66. isc::dns::Name& target,
  67. const isc::dns::Name* zonename) const;
  68. Result findCoveringNSEC3(const isc::dns::Name& zonename,
  69. std::string& hash,
  70. isc::dns::RRsetList& target) const;
  71. Result init();
  72. Result init(const isc::data::ElementPtr config);
  73. Result close();
  74. private:
  75. StaticDataSrcImpl* impl_;
  76. };
  77. }
  78. }
  79. #endif
  80. // Local Variables:
  81. // mode: c++
  82. // End: