Kea 2.7.5
|
#include <cfg_option.h>
Public Member Functions | |
OptionDescriptor (bool persist, bool cancel) | |
Constructor. | |
OptionDescriptor (const OptionDescriptor &desc) | |
Copy constructor. | |
OptionDescriptor (const OptionPtr &opt, bool persist, bool cancel, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr()) | |
Constructor. | |
void | addClientClass (const std::string &class_name) |
Adds new client class for which the option is allowed. | |
bool | allowedForClientClasses (const ClientClasses &cclasses) const |
Validates an OptionDescriptor's client-classes against a list of classes. | |
bool | equals (const OptionDescriptor &other) const |
Checks if the one descriptor is equal to another. | |
bool | operator!= (const OptionDescriptor &other) const |
Inequality operator. | |
OptionDescriptor & | operator= (const OptionDescriptor &other) |
Assignment operator. | |
bool | operator== (const OptionDescriptor &other) const |
Equality operator. | |
Public Member Functions inherited from isc::data::StampedElement | |
StampedElement () | |
Constructor. | |
void | delServerTag (const std::string &server_tag) |
Deletes server tag. | |
isc::data::ElementPtr | getMetadata () const |
Returns an object representing metadata to be returned with objects from the configuration backend. | |
std::set< ServerTag > | getServerTags () const |
Returns server tags. | |
bool | hasAllServerTag () const |
Checks if the element has 'all' server tag. | |
bool | hasServerTag (const ServerTag &server_tag) const |
Checks if the element has the given server tag. | |
void | setServerTag (const std::string &server_tag) |
Adds new server tag. | |
Public Member Functions inherited from isc::data::BaseStampedElement | |
BaseStampedElement () | |
Constructor. | |
uint64_t | getId () const |
Returns element's database identifier. | |
boost::posix_time::ptime | getModificationTime () const |
Returns timestamp. | |
void | setId (const uint64_t id) |
Sets element's database identifier. | |
void | setModificationTime (const boost::posix_time::ptime ×tamp) |
Sets timestamp to the explicitly provided value. | |
void | updateModificationTime () |
Sets timestamp to the current time. | |
Public Member Functions inherited from isc::data::UserContext | |
void | contextToElement (data::ElementPtr map) const |
Merge unparse a user_context object. | |
data::ConstElementPtr | getContext () const |
Returns const pointer to the user context. | |
void | setContext (const data::ConstElementPtr &ctx) |
Sets user context. | |
Static Public Member Functions | |
static OptionDescriptorPtr | create (bool persist, bool cancel) |
Factory function creating an instance of the OptionDescriptor . | |
static OptionDescriptorPtr | create (const OptionDescriptor &desc) |
Factory function creating an instance of the OptionDescriptor . | |
static OptionDescriptorPtr | create (const OptionPtr &opt, bool persist, bool cancel, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr()) |
Factory function creating an instance of the OptionDescriptor . | |
Static Public Member Functions inherited from isc::data::UserContext | |
static data::ElementPtr | toElement (data::ConstElementPtr map) |
Copy an Element map. | |
Public Attributes | |
bool | cancelled_ |
Cancelled flag. | |
ClientClasses | client_classes_ |
Collection of classes for the which option is allowed. | |
std::string | formatted_value_ |
Option value in textual (CSV) format. | |
OptionPtr | option_ |
Option instance. | |
bool | persistent_ |
Persistence flag. | |
std::string | space_name_ |
Option space name. | |
Additional Inherited Members | |
Protected Attributes inherited from isc::data::BaseStampedElement | |
uint64_t | id_ |
Database identifier of the configuration element. | |
boost::posix_time::ptime | timestamp_ |
Holds timestamp value. | |
Protected Attributes inherited from isc::data::UserContext | |
data::ConstElementPtr | user_context_ |
Pointer to the user context (may be NULL) | |
Option descriptor.
Option descriptor holds instance of an option and additional information for this option. This information comprises whether this option is sent to DHCP client only on request (persistent = false) or always (persistent = true), or must never send (cancelled = true).
Definition at line 48 of file cfg_option.h.
|
inline |
Constructor.
opt | option instance. |
persist | if true, option is always sent. |
cancel | if true, option is never sent. |
formatted_value | option value in the textual format (optional). |
user_context | user context (optional). |
Definition at line 104 of file cfg_option.h.
References isc::data::UserContext::setContext().
|
inline |
Constructor.
persist | if true option is always sent. |
cancel | if true, option is never sent. |
Definition at line 117 of file cfg_option.h.
|
inline |
Copy constructor.
desc | option descriptor to be copied. |
Definition at line 124 of file cfg_option.h.
References isc::data::UserContext::setContext().
void isc::dhcp::OptionDescriptor::addClientClass | ( | const std::string & | class_name | ) |
Adds new client class for which the option is allowed.
class_name | Class name. |
Definition at line 55 of file cfg_option.cc.
References client_classes_, isc::dhcp::ClientClasses::insert(), and isc::util::str::trim().
bool isc::dhcp::OptionDescriptor::allowedForClientClasses | ( | const ClientClasses & | cclasses | ) | const |
Validates an OptionDescriptor's client-classes against a list of classes.
cclasses | list of ClientClasses to validate against |
Definition at line 63 of file cfg_option.cc.
References client_classes_, isc::dhcp::ClientClasses::contains(), isc::dhcp::ClientClasses::empty(), and isc::dhcp::ClientClasses::size().
|
static |
Factory function creating an instance of the OptionDescriptor
.
persist | if true option is always sent. |
cancel | if true, option is never sent. |
OptionDescriptor
instance. Definition at line 36 of file cfg_option.cc.
|
static |
Factory function creating an instance of the OptionDescriptor
.
desc | option descriptor to be copied. |
OptionDescriptor
instance. Definition at line 41 of file cfg_option.cc.
|
static |
Factory function creating an instance of the OptionDescriptor
.
opt | option instance. |
persist | if true, option is always sent. |
cancel | if true, option is never sent. |
formatted_value | option value in the textual format (optional). |
user_context | user context (optional). |
OptionDescriptor
instance. Definition at line 27 of file cfg_option.cc.
bool isc::dhcp::OptionDescriptor::equals | ( | const OptionDescriptor & | other | ) | const |
Checks if the one descriptor is equal to another.
other | Other option descriptor to compare to. |
Definition at line 46 of file cfg_option.cc.
References cancelled_, formatted_value_, option_, persistent_, and space_name_.
Referenced by operator!=(), and operator==().
|
inline |
Inequality operator.
other | Other option descriptor to compare to. |
Definition at line 205 of file cfg_option.h.
References equals().
|
inline |
Assignment operator.
other | option descriptor to be assigned from. |
Definition at line 138 of file cfg_option.h.
References cancelled_, client_classes_, formatted_value_, option_, persistent_, isc::data::UserContext::setContext(), and space_name_.
|
inline |
Equality operator.
other | Other option descriptor to compare to. |
Definition at line 196 of file cfg_option.h.
References equals().
bool isc::dhcp::OptionDescriptor::cancelled_ |
Cancelled flag.
If true, option is never sent to the client. If false, option is sent when it should.
Definition at line 65 of file cfg_option.h.
Referenced by equals(), and operator=().
ClientClasses isc::dhcp::OptionDescriptor::client_classes_ |
Collection of classes for the which option is allowed.
An empty list means no class restrictions.
Definition at line 95 of file cfg_option.h.
Referenced by addClientClass(), allowedForClientClasses(), and operator=().
std::string isc::dhcp::OptionDescriptor::formatted_value_ |
Option value in textual (CSV) format.
This field is used to convey option value in human readable format, the same as used to specify option value in the server configuration. This value is optional and can be held in the host reservations database instead of the binary format.
Note that this value is carried in the option descriptor, rather than Option
instance because it is a server specific value (same as persistence flag).
An example of the formatted value is: "2001:db8:1::1, 23, some text" for the option which carries IPv6 address, a number and a text.
Definition at line 80 of file cfg_option.h.
Referenced by equals(), and operator=().
OptionPtr isc::dhcp::OptionDescriptor::option_ |
Option instance.
Definition at line 51 of file cfg_option.h.
Referenced by equals(), and operator=().
bool isc::dhcp::OptionDescriptor::persistent_ |
Persistence flag.
If true, option is always sent to the client. If false, option is sent to the client when requested using ORO or PRL option.
Definition at line 57 of file cfg_option.h.
Referenced by equals(), and operator=().
std::string isc::dhcp::OptionDescriptor::space_name_ |
Option space name.
Options are associated with option spaces. Typically, such association is made when the option is stored in the OptionContainer
. However, in some cases it is also required to associate option with the particular option space outside of the container. In particular, when the option is fetched from a database. The database configuration backend will set option space upon return of the option. In other cases this value won't be set.
Definition at line 91 of file cfg_option.h.
Referenced by equals(), and operator=().