blob: 75dee523c1420c26d93943cf87c43762e6fadd54 (
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
|
// Copyright (C) 2018-2022 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 ISC_ADAPTOR_HOST_H
#define ISC_ADAPTOR_HOST_H 1
#include <yang/adaptor.h>
namespace isc {
namespace yang {
/// @brief JSON adaptor for host reservations quoting identifiers.
///
/// The identifier type and identifier value are used as keys in YANG
/// host reservation lists so some constraints were put on their contents.
/// For instance a quoted flex-id identifier raises an error (keys
/// are between quotes in setItem commands).
class AdaptorHost {
public:
/// @brief The string of standard (vs special or not printable)
/// characters (digit, letters, -, ., @, _).
static const std::string STD_CHARACTERS;
/// @brief Destructor.
virtual ~AdaptorHost() = default;
/// @brief Quote when needed a host identifier.
///
/// Check if the flex-id identifier includes a special (including quote)
/// or not printable character. When it is the case produce and replace
/// by a hexadecimal identifier trying first for a quoted identifier.
///
/// @param host The host.
static void quoteIdentifier(isc::data::ElementPtr host);
}; // AdaptorHost
} // namespace yang
} // namespace isc
#endif // ISC_ADAPTOR_HOST_H
|