Kea: dhcp_space.h Source File

| Kea 3.0.0

dhcp_space.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 ISC_UTIL_DHCP_SPACE_H
8#define ISC_UTIL_DHCP_SPACE_H 1
9
10#include <string>
11
12#include <boost/algorithm/string/replace.hpp>
13
14namespace isc {
15namespace util {
16
17 enum DhcpSpace {
18 DHCPv4,
19 DHCPv6,
20};
21
27template <DhcpSpace D>
28 char const* cStringDhcpSpace();
29
35template <DhcpSpace D>
36std::string formatDhcpSpace(char const* const format_string) {
37 std::string result(format_string);
38 boost::replace_all(result, "{}", cStringDhcpSpace<D>());
39 return result;
40}
41
42} // namespace util
43} // namespace isc
44
45#endif // ISC_UTIL_DHCP_SPACE_H
isc::util
Definition time_utils.cc:43
isc::util::formatDhcpSpace
std::string formatDhcpSpace(char const *const format_string)
Replaces all occurrences of {} with 4 or 6 based on the templated DHCP space.
Definition dhcp_space.h:36
isc::util::cStringDhcpSpace
char const * cStringDhcpSpace()
Provides the C string representation of the DHCP space.
isc::util::DhcpSpace
DhcpSpace
Definition dhcp_space.h:17
isc::util::DHCPv6
@ DHCPv6
Definition dhcp_space.h:19
isc::util::DHCPv4
@ DHCPv4
Definition dhcp_space.h:18
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148