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
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
24namespace isc {
25namespace dhcp {
26
30public:
31 InvalidOptionSpace(const char* file, size_t line, const char* what) :
32 isc::Exception(file, line, what) { };
33};
34
36class OptionSpace;
38typedef boost::shared_ptr<OptionSpace> OptionSpacePtr;
40typedef std::map<std::string, OptionSpacePtr> OptionSpaceCollection;
41
73public:
74
85 OptionSpace(const std::string& name, const bool vendor_space = false);
86
90 const std::string& getName() const { return (name_); }
91
94 vendor_space_ = false;
95 }
96
101 bool isVendorSpace() const { return (vendor_space_); }
102
105 vendor_space_ = true;
106 }
107
118 static bool validateName(const std::string& name);
119
120private:
121 std::string name_;
122
123 bool vendor_space_;
124
125};
126
142class OptionSpace6 : public OptionSpace {
143public:
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
181private:
182
183 uint32_t enterprise_number_;
184};
185
186} // namespace isc::dhcp
187} // namespace isc
188
189#endif // OPTION_SPACE_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception to be thrown when invalid option space is specified.
Definition: option_space.h:29
InvalidOptionSpace(const char *file, size_t line, const char *what)
Definition: option_space.h:31
DHCPv6 option space with enterprise number assigned.
Definition: option_space.h:142
uint32_t getEnterpriseNumber() const
Return enterprise number for the option space.
Definition: option_space.h:174
DHCP option space.
Definition: option_space.h:72
void setVendorSpace()
Mark option space as vendor specific.
Definition: option_space.h:104
const std::string & getName() const
Return option space name.
Definition: option_space.h:90
bool isVendorSpace() const
Check if option space is vendor specific.
Definition: option_space.h:101
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
Definition: option_space.cc:26
void clearVendorSpace()
Mark option space as non-vendor space.
Definition: option_space.h:93
boost::shared_ptr< OptionSpace > OptionSpacePtr
A pointer to OptionSpace object.
Definition: option_space.h:38
std::map< std::string, OptionSpacePtr > OptionSpaceCollection
A collection of option spaces.
Definition: option_space.h:40
Defines the logger used by the top-level component of kea-dhcp-ddns.