rrset_collection.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright (C) 2012 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. #ifndef RRSET_COLLECTION_DATASRC_H
  15. #define RRSET_COLLECTION_DATASRC_H 1
  16. #include <dns/rrset_collection_base.h>
  17. #include <dns/rrclass.h>
  18. #include <datasrc/zone.h>
  19. namespace isc {
  20. namespace datasrc {
  21. /// \brief datasrc implementation of RRsetCollectionBase.
  22. class RRsetCollection : public isc::dns::RRsetCollectionBase {
  23. public:
  24. /// \brief Constructor.
  25. /// \param updater The ZoneUpdater to wrap around.
  26. RRsetCollection(ZoneUpdaterPtr updater) :
  27. updater_(updater)
  28. {}
  29. /// \brief Destructor
  30. virtual ~RRsetCollection() {}
  31. /// \brief Find a matching RRset in the collection.
  32. ///
  33. /// Returns the RRset in the collection that exactly matches the
  34. /// given \c name, \c rrclass and \c rrtype. If no matching RRset
  35. /// is found, \c NULL is returned.
  36. ///
  37. /// \param name The name of the RRset to search for.
  38. /// \param rrclass The class of the RRset to search for.
  39. /// \param rrtype The type of the RRset to search for.
  40. /// \returns The RRset if found, \c NULL otherwise.
  41. virtual isc::dns::ConstRRsetPtr find(const isc::dns::Name& name,
  42. const isc::dns::RRClass& rrclass,
  43. const isc::dns::RRType& rrtype) const;
  44. private:
  45. ZoneUpdaterPtr updater_;
  46. protected:
  47. class DsIter : public RRsetCollectionBase::Iter {
  48. public:
  49. DsIter()
  50. {}
  51. virtual const isc::dns::AbstractRRset& getValue() {
  52. isc_throw(isc::NotImplemented, "This method is not implemented.");
  53. }
  54. virtual IterPtr getNext() {
  55. isc_throw(isc::NotImplemented, "This method is not implemented.");
  56. }
  57. virtual bool equals(Iter& other) {
  58. const DsIter* other_real = dynamic_cast<DsIter*>(&other);
  59. if (other_real == NULL) {
  60. return (false);
  61. }
  62. isc_throw(isc::NotImplemented, "This method is not implemented.");
  63. }
  64. };
  65. virtual RRsetCollectionBase::IterPtr getBeginning();
  66. virtual RRsetCollectionBase::IterPtr getEnd();
  67. };
  68. } // end of namespace datasrc
  69. } // end of namespace isc
  70. #endif // RRSET_COLLECTION_DATASRC_H
  71. // Local Variables:
  72. // mode: c++
  73. // End: