rrset_collection.h 2.7 KB

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