data_source_static.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 Query& q,
  54. const isc::dns::Name& qname,
  55. const isc::dns::RRClass& qclass,
  56. const isc::dns::RRType& qtype,
  57. isc::dns::RRsetList& target,
  58. uint32_t& flags,
  59. const isc::dns::Name* zonename) const;
  60. Result findExactRRset(const Query& q,
  61. const isc::dns::Name& qname,
  62. const isc::dns::RRClass& qclass,
  63. const isc::dns::RRType& qtype,
  64. isc::dns::RRsetList& target,
  65. uint32_t& flags,
  66. const isc::dns::Name* zonename) const;
  67. Result findPreviousName(const Query& q,
  68. const isc::dns::Name& qname,
  69. isc::dns::Name& target,
  70. const isc::dns::Name* zonename) const;
  71. Result findCoveringNSEC3(const Query& q,
  72. const isc::dns::Name& zonename,
  73. std::string& hash,
  74. isc::dns::RRsetList& target) const;
  75. Result init();
  76. Result init(const isc::data::ElementPtr config) { return init(); };
  77. Result close();
  78. private:
  79. StaticDataSrcImpl* impl_;
  80. };
  81. }
  82. }
  83. #endif
  84. // Local Variables:
  85. // mode: c++
  86. // End: