Kea 2.7.5
option_space.h
Go to the documentation of this file.
1// Copyright (C) 2012-2024 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
12
13#include <boost/shared_ptr.hpp>
14#include <map>
15#include <stdint.h>
16#include <string>
17
18namespace isc {
19namespace dhcp {
20
24public:
25 InvalidOptionSpace(const char* file, size_t line, const char* what) :
26 isc::Exception(file, line, what) { }
27};
28
30class OptionSpace;
32typedef boost::shared_ptr<OptionSpace> OptionSpacePtr;
34typedef std::map<std::string, OptionSpacePtr> OptionSpaceCollection;
35
67public:
68
79 OptionSpace(const std::string& name, const bool vendor_space = false);
80
84 const std::string& getName() const { return (name_); }
85
88 vendor_space_ = false;
89 }
90
95 bool isVendorSpace() const { return (vendor_space_); }
96
99 vendor_space_ = true;
100 }
101
112 static bool validateName(const std::string& name);
113
114private:
115 std::string name_;
116
117 bool vendor_space_;
118
119};
120
136class OptionSpace6 : public OptionSpace {
137public:
138
149 OptionSpace6(const std::string& name);
150
163 OptionSpace6(const std::string& name, const uint32_t enterprise_number);
164
168 uint32_t getEnterpriseNumber() const { return (enterprise_number_); }
169
173 void setVendorSpace(const uint32_t enterprise_number);
174
175private:
176
177 uint32_t enterprise_number_;
178};
179
180} // namespace dhcp
181} // namespace isc
182
183#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.
InvalidOptionSpace(const char *file, size_t line, const char *what)
DHCPv6 option space with enterprise number assigned.
OptionSpace6(const std::string &name)
Constructor for non-vendor-specific options.
uint32_t getEnterpriseNumber() const
Return enterprise number for the option space.
DHCP option space.
void setVendorSpace()
Mark option space as vendor specific.
const std::string & getName() const
Return option space name.
bool isVendorSpace() const
Check if option space is vendor specific.
static bool validateName(const std::string &name)
Checks that the provided option space name is valid.
OptionSpace(const std::string &name, const bool vendor_space=false)
Constructor.
void clearVendorSpace()
Mark option space as non-vendor space.
boost::shared_ptr< OptionSpace > OptionSpacePtr
A pointer to OptionSpace object.
std::map< std::string, OptionSpacePtr > OptionSpaceCollection
A collection of option spaces.
Defines the logger used by the top-level component of kea-lfc.