zone_data_loader.h 3.02 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

#ifndef DATASRC_ZONE_DATA_LOADER_H
#define DATASRC_ZONE_DATA_LOADER_H 1

#include <datasrc/memory/zone_data.h>
19
#include <datasrc/iterator.h>
20
21
22
23
24
25
26
27
#include <dns/name.h>
#include <dns/rrclass.h>
#include <util/memory_segment.h>

namespace isc {
namespace datasrc {
namespace memory {

28
29
/// \brief Zone is empty exception.
///
Mukund Sivaraman's avatar
Mukund Sivaraman committed
30
/// This is thrown if an empty zone would be created during
31
/// \c loadZoneData().
32
33
34
35
36
37
struct EmptyZone : public InvalidParameter {
    EmptyZone(const char* file, size_t line, const char* what) :
        InvalidParameter(file, line, what)
    {}
};

Mukund Sivaraman's avatar
Mukund Sivaraman committed
38
39
40
41
42
43
44
45
46
47
48
49
/// \brief Create and return a ZoneData instance populated from the
/// \c zone_file.
///
/// Throws \c ZoneDataUpdater::AddError if invalid or inconsistent data
/// is present in the \c zone_file. Throws \c isc::Unexpected if empty
/// RRsets are passed by the master loader. Throws \c EmptyZone if an
/// empty zone would be created due to the \c loadZoneData().
///
/// \param mem_sgmt The memory segment.
/// \param rrclass The RRClass.
/// \param zone_name The name of the zone that is being loaded.
/// \param zone_file Filename which contains the zone data for \c zone_name.
50
ZoneData* loadZoneData(util::MemorySegment& mem_sgmt,
51
                       const isc::dns::RRClass& rrclass,
Mukund Sivaraman's avatar
Mukund Sivaraman committed
52
53
                       const isc::dns::Name& zone_name,
                       const std::string& zone_file);
54

Mukund Sivaraman's avatar
Mukund Sivaraman committed
55
56
57
58
59
60
61
62
63
64
65
66
/// \brief Create and return a ZoneData instance populated from the
/// \c iterator.
///
/// Throws \c ZoneDataUpdater::AddError if invalid or inconsistent data
/// is present in the \c zone_file. Throws \c isc::Unexpected if empty
/// RRsets are passed by the zone iterator. Throws \c EmptyZone if an
/// empty zone would be created due to the \c loadZoneData().
///
/// \param mem_sgmt The memory segment.
/// \param rrclass The RRClass.
/// \param zone_name The name of the zone that is being loaded.
/// \param iterator Iterator that returns RRsets to load into the zone.
67
ZoneData* loadZoneData(util::MemorySegment& mem_sgmt,
68
                       const isc::dns::RRClass& rrclass,
Mukund Sivaraman's avatar
Mukund Sivaraman committed
69
70
                       const isc::dns::Name& zone_name,
                       ZoneIterator& iterator);
71

72
73
74
75
76
77
78
79
80
} // namespace memory
} // namespace datasrc
} // namespace isc

#endif // DATASRC_ZONE_DATA_LOADER_H

// Local Variables:
// mode: c++
// End: