static_datasrc.h 2.8 KB

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