Kea: option_space.h Source File

| Kea 1.5.0

option_space.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 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 OPTION_SPACE_H
8 #define OPTION_SPACE_H
9
10 #include <exceptions/exceptions.h>
11 #include <boost/shared_ptr.hpp>
12 #include <map>
13 #include <stdint.h>
14 #include <string>
15
16 #define DHCP4_OPTION_SPACE "dhcp4"
17 #define DHCP6_OPTION_SPACE "dhcp6"
18 #define MAPE_V6_OPTION_SPACE "s46-cont-mape-options"
19 #define MAPT_V6_OPTION_SPACE "s46-cont-mapt-options"
20 #define LW_V6_OPTION_SPACE "s46-cont-lw-options"
21 #define V4V6_RULE_OPTION_SPACE "s46-rule-options"
22 #define V4V6_BIND_OPTION_SPACE "s46-v4v6bind-options"
23
24 namespace isc {
25 namespace dhcp {
26
29 class InvalidOptionSpace : public Exception {
30 public:
31 InvalidOptionSpace(const char* file, size_t line, const char* what) :
32 isc::Exception(file, line, what) { };
33 };
34
36 class OptionSpace;
38 typedef boost::shared_ptr<OptionSpace> OptionSpacePtr;
40 typedef std::map<std::string, OptionSpacePtr> OptionSpaceCollection;
41
72 class OptionSpace {
73 public:
74
85 OptionSpace(const std::string& name, const bool vendor_space = false);
86
90 const std::string& getName() const { return (name_); }
91
93 void clearVendorSpace() {
94 vendor_space_ = false;
95 }
96
101 bool isVendorSpace() const { return (vendor_space_); }
102
104 void setVendorSpace() {
105 vendor_space_ = true;
106 }
107
118 static bool validateName(const std::string& name);
119
120 private:
121 std::string name_;
122
123 bool vendor_space_;
124
125 };
126
142 class OptionSpace6 : public OptionSpace {
143 public:
144
155 OptionSpace6(const std::string& name);
156
169 OptionSpace6(const std::string& name, const uint32_t enterprise_number);
170
174 uint32_t getEnterpriseNumber() const { return (enterprise_number_); }
175
179 void setVendorSpace(const uint32_t enterprise_number);
180
181 private:
182
183 uint32_t enterprise_number_;
184 };
185
186 } // namespace isc::dhcp
187 } // namespace isc
188
189 #endif // OPTION_SPACE_H
isc::dhcp::OptionSpace
DHCP option space.
Definition: option_space.h:72
isc::dhcp::OptionSpacePtr
boost::shared_ptr< OptionSpace > OptionSpacePtr
A pointer to OptionSpace object.
Definition: option_space.h:36
isc::dhcp::OptionSpaceCollection
std::map< std::string, OptionSpacePtr > OptionSpaceCollection
A collection of option spaces.
Definition: option_space.h:40
isc::dhcp::OptionSpace::clearVendorSpace
void clearVendorSpace()
Mark option space as non-vendor space.
Definition: option_space.h:93
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc::dhcp::OptionSpace6::getEnterpriseNumber
uint32_t getEnterpriseNumber() const
Return enterprise number for the option space.
Definition: option_space.h:174
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::dhcp::OptionSpace::getName
const std::string & getName() const
Return option space name.
Definition: option_space.h:90
isc::dhcp::InvalidOptionSpace::InvalidOptionSpace
InvalidOptionSpace(const char *file, size_t line, const char *what)
Definition: option_space.h:31
isc::dhcp::OptionSpace6
DHCPv6 option space with enterprise number assigned.
Definition: option_space.h:142
isc::dhcp::OptionSpace::OptionSpace
OptionSpace(const std::string &name, const bool vendor_space=false)
Constructor.
Definition: option_space.cc:16
isc::dhcp::InvalidOptionSpace
Exception to be thrown when invalid option space is specified.
Definition: option_space.h:29
isc::dhcp::OptionSpace::isVendorSpace
bool isVendorSpace() const
Check if option space is vendor specific.
Definition: option_space.h:101
exceptions.h
isc::dhcp::OptionSpace::setVendorSpace
void setVendorSpace()
Mark option space as vendor specific.
Definition: option_space.h:104
isc::dhcp::OptionSpace::validateName
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
Definition: option_space.cc:26
isc::dhcp::OptionSpace6::OptionSpace6
OptionSpace6(const std::string &name)
Constructor for non-vendor-specific options.
Definition: option_space.cc:47