zone_data.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 DATASRC_MEMORY_ZONE_DATA_H
  15. #define DATASRC_MEMORY_ZONE_DATA_H 1
  16. #include <util/memory_segment.h>
  17. #include <dns/name.h>
  18. #include <datasrc/memory/domaintree.h>
  19. #include <datasrc/memory/rdataset.h>
  20. #include <boost/interprocess/offset_ptr.hpp>
  21. #include <boost/noncopyable.hpp>
  22. namespace isc {
  23. namespace datasrc {
  24. namespace memory {
  25. class ZoneData : boost::noncopyable {
  26. struct RdataSetDeleter {
  27. public:
  28. RdataSetDeleter() {}
  29. void operator()(util::MemorySegment& /*mem_sgmt*/,
  30. RdataSet* /*rdataset_head*/) const
  31. {}
  32. };
  33. typedef DomainTree<RdataSet, RdataSetDeleter> ZoneTree;
  34. typedef DomainTreeNode<RdataSet, RdataSetDeleter> ZoneNode;
  35. ZoneData(ZoneTree* zone_tree, ZoneNode* origin_node) :
  36. zone_tree_(zone_tree), origin_node_(origin_node)
  37. {}
  38. public:
  39. static ZoneData* create(util::MemorySegment& mem_sgmt,
  40. const dns::Name& zone_name);
  41. static void destroy(util::MemorySegment& mem_sgmt, ZoneData* zone_data);
  42. const ZoneNode* getOriginNode() const {
  43. return (origin_node_.get());
  44. }
  45. private:
  46. const boost::interprocess::offset_ptr<ZoneTree> zone_tree_;
  47. const boost::interprocess::offset_ptr<ZoneNode> origin_node_;
  48. };
  49. } // namespace memory
  50. } // namespace datasrc
  51. } // namespace isc
  52. #endif // DATASRC_MEMORY_ZONE_DATA_H
  53. // Local Variables:
  54. // mode: c++
  55. // End: