blob: b511ca7b621d41fad0f721e306123aadb0fc1ec9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IP_RANGE_H
#define IP_RANGE_H
#include <asiolink/io_address.h>
namespace isc {
namespace dhcp {
/// @brief Structure representing IP address range.
struct AddressRange {
/// IP address denoting the start of the address range.
asiolink::IOAddress start_;
/// IP address denoting the end of the address range.
asiolink::IOAddress end_;
/// @brief Constructor.
///
/// @param start beginning of the address range.
/// @param end end of the address range.
/// @throw BadValue if the @c start is greater than the end or
/// specified boundaries do not belong to the same family.
AddressRange(const asiolink::IOAddress& start, const asiolink::IOAddress& end);
};
/// @brief Structure representing delegated prefix range.
struct PrefixRange {
/// IP address denoting the start of the prefix range.
asiolink::IOAddress start_;
/// IP address denoting the first address within the last prefix
/// in the prefix range.
asiolink::IOAddress end_;
/// Prefix length.
uint8_t prefix_length_;
/// Delegated prefix length.
uint8_t delegated_length_;
/// @brief Constructor.
///
/// @param prefix prefix from which prefixes are delegated.
/// @param length length of the prefix from which prefixes are delegated.
/// @param delegated delegated prefix length.
/// @throw BadValue if the values provided to the constructor are invalid,
/// e.g. it is not IPv6 prefix, delegated length is lower than prefix length
/// etc.
PrefixRange(const asiolink::IOAddress& prefix, const uint8_t length, const uint8_t delegated);
/// @brief Constructor.
///
/// @param start beginning of the prefix range.
/// @param end end of the prefix range.
/// @param delegated delegated prefix length.
/// @throw BadValue if the values provided to the constructor are invalid,
/// e.g. it is not IPv6 prefix.
PrefixRange(const asiolink::IOAddress& start, const asiolink::IOAddress& end,
const uint8_t delegated);
};
} // end of namespace isc::dhcp
} // end of namespace isc
#endif // IP_RANGE_H
|