rrset_collection.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright (C) 2013 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. ///
  26. /// No reference (count via \c shared_ptr) to the ZoneUpdater is
  27. /// acquired. As long as the collection object is alive, the
  28. /// corresponding \c ZoneUpdater should be kept alive.
  29. ///
  30. /// \param updater The ZoneUpdater to wrap around.
  31. /// \param rrclass The RRClass of the records in the zone.
  32. RRsetCollection(ZoneUpdater& updater, const isc::dns::RRClass& rrclass) :
  33. updater_(updater),
  34. rrclass_(rrclass)
  35. {}
  36. /// \brief Destructor
  37. virtual ~RRsetCollection() {}
  38. /// \brief Find a matching RRset in the collection.
  39. ///
  40. /// Returns the RRset in the collection that exactly matches the
  41. /// given \c name, \c rrclass and \c rrtype. If no matching RRset
  42. /// is found, \c NULL is returned.
  43. ///
  44. /// \throw FindError if find() results in some underlying datasrc error.
  45. /// \param name The name of the RRset to search for.
  46. /// \param rrclass The class of the RRset to search for.
  47. /// \param rrtype The type of the RRset to search for.
  48. /// \returns The RRset if found, \c NULL otherwise.
  49. virtual isc::dns::ConstRRsetPtr find(const isc::dns::Name& name,
  50. const isc::dns::RRClass& rrclass,
  51. const isc::dns::RRType& rrtype) const;
  52. private:
  53. ZoneUpdater& updater_;
  54. isc::dns::RRClass rrclass_;
  55. protected:
  56. // TODO: RRsetCollectionBase::Iter is not implemented and the
  57. // following two methods just throw.
  58. virtual RRsetCollectionBase::IterPtr getBeginning();
  59. virtual RRsetCollectionBase::IterPtr getEnd();
  60. };
  61. } // end of namespace datasrc
  62. } // end of namespace isc
  63. #endif // RRSET_COLLECTION_DATASRC_H
  64. // Local Variables:
  65. // mode: c++
  66. // End: