Skip to content

Commit 8e627f3

Browse files
committed
[#1415] Moved address_range.h to ip_range.h
1 parent 2a7070c commit 8e627f3

File tree

8 files changed

+71
-41
lines changed

8 files changed

+71
-41
lines changed

src/lib/dhcpsrv/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ CLEANFILES += *.csv
6363

6464
lib_LTLIBRARIES = libkea-dhcpsrv.la
6565
libkea_dhcpsrv_la_SOURCES =
66-
libkea_dhcpsrv_la_SOURCES += address_range.h address_range.cc
6766
libkea_dhcpsrv_la_SOURCES += address_range_permutation.h address_range_permutation.cc
6867
libkea_dhcpsrv_la_SOURCES += alloc_engine.cc alloc_engine.h
6968
libkea_dhcpsrv_la_SOURCES += alloc_engine_log.cc alloc_engine_log.h
@@ -115,6 +114,7 @@ libkea_dhcpsrv_la_SOURCES += host_data_source_factory.cc host_data_source_factor
115114
libkea_dhcpsrv_la_SOURCES += host_mgr.cc host_mgr.h
116115
libkea_dhcpsrv_la_SOURCES += hosts_log.cc hosts_log.h
117116
libkea_dhcpsrv_la_SOURCES += hosts_messages.h hosts_messages.cc
117+
libkea_dhcpsrv_la_SOURCES += ip_range.h ip_range.cc
118118
libkea_dhcpsrv_la_SOURCES += key_from_key.h
119119
libkea_dhcpsrv_la_SOURCES += lease.cc lease.h
120120
libkea_dhcpsrv_la_SOURCES += lease_file_loader.h
@@ -300,7 +300,6 @@ EXTRA_DIST += database_backends.dox libdhcpsrv.dox
300300
# Specify the headers for copying into the installation directory tree.
301301
libkea_dhcpsrv_includedir = $(pkgincludedir)/dhcpsrv
302302
libkea_dhcpsrv_include_HEADERS = \
303-
address_range.h \
304303
address_range_permutation.h \
305304
alloc_engine.h \
306305
alloc_engine_log.h \
@@ -352,6 +351,7 @@ libkea_dhcpsrv_include_HEADERS = \
352351
hosts_messages.h \
353352
host_mgr.h \
354353
hosts_log.h \
354+
ip_range.h \
355355
key_from_key.h \
356356
lease.h \
357357
lease_file_loader.h \

src/lib/dhcpsrv/address_range.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/lib/dhcpsrv/address_range_permutation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define ADDRESS_RANGE_PERMUTATION_H
99

1010
#include <asiolink/io_address.h>
11-
#include <dhcpsrv/address_range.h>
11+
#include <dhcpsrv/ip_range.h>
1212

1313
#include <boost/shared_ptr.hpp>
1414

src/lib/dhcpsrv/free_lease_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define FREE_LEASE_QUEUE_H
99

1010
#include <asiolink/io_address.h>
11-
#include <dhcpsrv/address_range.h>
11+
#include <dhcpsrv/ip_range.h>
1212
#include <exceptions/exceptions.h>
1313

1414
#include <boost/multi_index_container.hpp>

src/lib/dhcpsrv/address_range.cc renamed to src/lib/dhcpsrv/ip_range.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <config.h>
88
#include <asiolink/addr_utilities.h>
99
#include <asiolink/io_address.h>
10-
#include <dhcpsrv/address_range.h>
10+
#include <dhcpsrv/ip_range.h>
1111
#include <exceptions/exceptions.h>
1212

1313
using namespace isc::asiolink;

src/lib/dhcpsrv/ip_range.h

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

src/lib/dhcpsrv/tests/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ libco3_la_LDFLAGS = -avoid-version -export-dynamic -module -rpath /nowhere
5757
TESTS += libdhcpsrv_unittests
5858

5959
libdhcpsrv_unittests_SOURCES = run_unittests.cc
60-
libdhcpsrv_unittests_SOURCES += address_range_unittest.cc
6160
libdhcpsrv_unittests_SOURCES += address_range_permutation_unittest.cc
6261
libdhcpsrv_unittests_SOURCES += alloc_engine_utils.cc alloc_engine_utils.h
6362
libdhcpsrv_unittests_SOURCES += alloc_engine_expiration_unittest.cc
@@ -100,6 +99,7 @@ libdhcpsrv_unittests_SOURCES += host_unittest.cc
10099
libdhcpsrv_unittests_SOURCES += host_reservation_parser_unittest.cc
101100
libdhcpsrv_unittests_SOURCES += host_reservations_list_parser_unittest.cc
102101
libdhcpsrv_unittests_SOURCES += ifaces_config_parser_unittest.cc
102+
libdhcpsrv_unittests_SOURCES += ip_range_unittest.cc
103103
libdhcpsrv_unittests_SOURCES += lease_file_loader_unittest.cc
104104
libdhcpsrv_unittests_SOURCES += lease_unittest.cc
105105
libdhcpsrv_unittests_SOURCES += lease_mgr_factory_unittest.cc

src/lib/dhcpsrv/tests/address_range_unittest.cc renamed to src/lib/dhcpsrv/tests/ip_range_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

77
#include <config.h>
8-
#include <dhcpsrv/address_range.h>
8+
#include <dhcpsrv/ip_range.h>
99
#include <boost/scoped_ptr.hpp>
1010
#include <gtest/gtest.h>
1111

0 commit comments

Comments
 (0)