Kea  2.1.7-git
isc::dhcp::OptionDescriptor Class Reference

Option descriptor. More...

#include <cfg_option.h>

+ Inheritance diagram for isc::dhcp::OptionDescriptor:

Public Member Functions

 OptionDescriptor (const OptionPtr &opt, bool persist, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr())
 Constructor. More...
 
 OptionDescriptor (bool persist)
 Constructor. More...
 
 OptionDescriptor (const OptionDescriptor &desc)
 Copy constructor. More...
 
bool equals (const OptionDescriptor &other) const
 Checks if the one descriptor is equal to another. More...
 
bool operator!= (const OptionDescriptor &other) const
 Inequality operator. More...
 
OptionDescriptoroperator= (const OptionDescriptor &other)
 Assignment operator. More...
 
bool operator== (const OptionDescriptor &other) const
 Equality operator. More...
 
- Public Member Functions inherited from isc::data::StampedElement
 StampedElement ()
 Constructor. More...
 
void delServerTag (const std::string &server_tag)
 Deletes server tag. More...
 
isc::data::ElementPtr getMetadata () const
 Returns an object representing metadata to be returned with objects from the configuration backend. More...
 
std::set< ServerTaggetServerTags () const
 Returns server tags. More...
 
bool hasAllServerTag () const
 Checks if the element has 'all' server tag. More...
 
bool hasServerTag (const ServerTag &server_tag) const
 Checks if the element has the given server tag. More...
 
void setServerTag (const std::string &server_tag)
 Adds new server tag. More...
 
- Public Member Functions inherited from isc::data::BaseStampedElement
 BaseStampedElement ()
 Constructor. More...
 
uint64_t getId () const
 Returns element's database identifier. More...
 
boost::posix_time::ptime getModificationTime () const
 Returns timestamp. More...
 
void setId (const uint64_t id)
 Sets element's database identifier. More...
 
void setModificationTime (const boost::posix_time::ptime &timestamp)
 Sets timestamp to the explicitly provided value. More...
 
void updateModificationTime ()
 Sets timestamp to the current time. More...
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object. More...
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context. More...
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context. More...
 

Static Public Member Functions

static OptionDescriptorPtr create (const OptionPtr &opt, bool persist, const std::string &formatted_value="", data::ConstElementPtr user_context=data::ConstElementPtr())
 Factory function creating an instance of the OptionDescriptor. More...
 
static OptionDescriptorPtr create (bool persist)
 Factory function creating an instance of the OptionDescriptor. More...
 
static OptionDescriptorPtr create (const OptionDescriptor &desc)
 Factory function creating an instance of the OptionDescriptor. More...
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map. More...
 

Public Attributes

std::string formatted_value_
 Option value in textual (CSV) format. More...
 
OptionPtr option_
 Option instance. More...
 
bool persistent_
 Persistence flag. More...
 
std::string space_name_
 Option space name. More...
 

Additional Inherited Members

- Protected Attributes inherited from isc::data::BaseStampedElement
uint64_t id_
 Database identifier of the configuration element. More...
 
boost::posix_time::ptime timestamp_
 Holds timestamp value. More...
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 

Detailed Description

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).

Definition at line 42 of file cfg_option.h.

Constructor & Destructor Documentation

◆ OptionDescriptor() [1/3]

isc::dhcp::OptionDescriptor::OptionDescriptor ( const OptionPtr opt,
bool  persist,
const std::string &  formatted_value = "",
data::ConstElementPtr  user_context = data::ConstElementPtr() 
)
inline

Constructor.

Parameters
optoption instance.
persistif true, option is always sent.
formatted_valueoption value in the textual format (optional).
user_contextuser context (optional).

Definition at line 85 of file cfg_option.h.

References isc::data::UserContext::setContext().

Referenced by isc::dhcp::CfgOption::get(), isc::dhcp::CfgOption::getVendorIds(), and operator!=().

+ Here is the call graph for this function:

◆ OptionDescriptor() [2/3]

isc::dhcp::OptionDescriptor::OptionDescriptor ( bool  persist)
inline

Constructor.

Parameters
persistif true option is always sent.

Definition at line 97 of file cfg_option.h.

◆ OptionDescriptor() [3/3]

isc::dhcp::OptionDescriptor::OptionDescriptor ( const OptionDescriptor desc)
inline

Copy constructor.

Parameters
descoption descriptor to be copied.

Definition at line 104 of file cfg_option.h.

References isc::data::UserContext::getContext(), and isc::data::UserContext::setContext().

+ Here is the call graph for this function:

Member Function Documentation

◆ create() [1/3]

OptionDescriptorPtr isc::dhcp::OptionDescriptor::create ( const OptionPtr opt,
bool  persist,
const std::string &  formatted_value = "",
data::ConstElementPtr  user_context = data::ConstElementPtr() 
)
static

Factory function creating an instance of the OptionDescriptor.

Parameters
optoption instance.
persistif true, option is always sent.
formatted_valueoption value in the textual format (optional).
user_contextuser context (optional).
Returns
Pointer to the OptionDescriptor instance.

Definition at line 27 of file cfg_option.cc.

Referenced by operator=().

◆ create() [2/3]

OptionDescriptorPtr isc::dhcp::OptionDescriptor::create ( bool  persist)
static

Factory function creating an instance of the OptionDescriptor.

Parameters
persistif true option is always sent.
Returns
Pointer to the OptionDescriptor instance.

Definition at line 35 of file cfg_option.cc.

◆ create() [3/3]

OptionDescriptorPtr isc::dhcp::OptionDescriptor::create ( const OptionDescriptor desc)
static

Factory function creating an instance of the OptionDescriptor.

Parameters
descoption descriptor to be copied.
Returns
Pointer to the OptionDescriptor instance.

Definition at line 40 of file cfg_option.cc.

◆ equals()

bool isc::dhcp::OptionDescriptor::equals ( const OptionDescriptor other) const

Checks if the one descriptor is equal to another.

Parameters
otherOther option descriptor to compare to.
Returns
true if descriptors equal, false otherwise.

Definition at line 45 of file cfg_option.cc.

References formatted_value_, option_, persistent_, and space_name_.

Referenced by operator!=(), isc::dhcp::CfgOption::operator!=(), operator=(), operator==(), and isc::dhcp::CfgOption::operator==().

◆ operator!=()

bool isc::dhcp::OptionDescriptor::operator!= ( const OptionDescriptor other) const
inline

Inequality operator.

Parameters
otherOther option descriptor to compare to.
Returns
true if descriptors unequal, false otherwise.

Definition at line 178 of file cfg_option.h.

References equals(), isc::data::BaseStampedElement::getId(), isc::data::BaseStampedElement::getModificationTime(), isc::dhcp::Option::getType(), option_, OptionDescriptor(), and persistent_.

+ Here is the call graph for this function:

◆ operator=()

OptionDescriptor& isc::dhcp::OptionDescriptor::operator= ( const OptionDescriptor other)
inline

Assignment operator.

Parameters
otheroption descriptor to be assigned from.

Definition at line 116 of file cfg_option.h.

References create(), equals(), formatted_value_, isc::data::UserContext::getContext(), option_, persistent_, isc::data::UserContext::setContext(), and space_name_.

+ Here is the call graph for this function:

◆ operator==()

bool isc::dhcp::OptionDescriptor::operator== ( const OptionDescriptor other) const
inline

Equality operator.

Parameters
otherOther option descriptor to compare to.
Returns
true if descriptors equal, false otherwise.

Definition at line 169 of file cfg_option.h.

References equals().

+ Here is the call graph for this function:

Member Data Documentation

◆ formatted_value_

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 66 of file cfg_option.h.

Referenced by isc::dhcp::CfgOption::createDescriptorOption(), isc::dhcp::OptionDataParser::createOption(), equals(), and operator=().

◆ option_

◆ persistent_

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 51 of file cfg_option.h.

Referenced by isc::dhcp::OptionDataParser::createOption(), equals(), operator!=(), and operator=().

◆ space_name_

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 77 of file cfg_option.h.

Referenced by equals(), and operator=().


The documentation for this class was generated from the following files: