zone_data_loader.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_ZONE_DATA_LOADER_H
  15. #define DATASRC_ZONE_DATA_LOADER_H 1
  16. #include <datasrc/memory/zone_data.h>
  17. #include <datasrc/iterator.h>
  18. #include <dns/name.h>
  19. #include <dns/rrclass.h>
  20. #include <util/memory_segment.h>
  21. namespace isc {
  22. namespace datasrc {
  23. namespace memory {
  24. /// \brief Zone is empty exception.
  25. ///
  26. /// This is thrown if an empty zone would be created during
  27. /// \c loadZoneData().
  28. struct EmptyZone : public InvalidParameter {
  29. EmptyZone(const char* file, size_t line, const char* what) :
  30. InvalidParameter(file, line, what)
  31. {}
  32. };
  33. /// \brief Create and return a ZoneData instance populated from the
  34. /// \c zone_file.
  35. ///
  36. /// Throws \c ZoneDataUpdater::AddError if invalid or inconsistent data
  37. /// is present in the \c zone_file. Throws \c isc::Unexpected if empty
  38. /// RRsets are passed by the master loader. Throws \c EmptyZone if an
  39. /// empty zone would be created due to the \c loadZoneData().
  40. ///
  41. /// \param mem_sgmt The memory segment.
  42. /// \param rrclass The RRClass.
  43. /// \param zone_name The name of the zone that is being loaded.
  44. /// \param zone_file Filename which contains the zone data for \c zone_name.
  45. ZoneData* loadZoneData(util::MemorySegment& mem_sgmt,
  46. const isc::dns::RRClass& rrclass,
  47. const isc::dns::Name& zone_name,
  48. const std::string& zone_file);
  49. /// \brief Create and return a ZoneData instance populated from the
  50. /// \c iterator.
  51. ///
  52. /// Throws \c ZoneDataUpdater::AddError if invalid or inconsistent data
  53. /// is present in the \c zone_file. Throws \c isc::Unexpected if empty
  54. /// RRsets are passed by the zone iterator. Throws \c EmptyZone if an
  55. /// empty zone would be created due to the \c loadZoneData().
  56. ///
  57. /// \param mem_sgmt The memory segment.
  58. /// \param rrclass The RRClass.
  59. /// \param zone_name The name of the zone that is being loaded.
  60. /// \param iterator Iterator that returns RRsets to load into the zone.
  61. ZoneData* loadZoneData(util::MemorySegment& mem_sgmt,
  62. const isc::dns::RRClass& rrclass,
  63. const isc::dns::Name& zone_name,
  64. ZoneIterator& iterator);
  65. } // namespace memory
  66. } // namespace datasrc
  67. } // namespace isc
  68. #endif // DATASRC_ZONE_DATA_LOADER_H
  69. // Local Variables:
  70. // mode: c++
  71. // End: