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

Wrapper class that holds MAC/hardware address sources. More...

#include <cfg_mac_source.h>

+ Inheritance diagram for isc::dhcp::CfgMACSource:

Public Member Functions

 CfgMACSource ()
 Default constructor. More...
 
void add (uint32_t source)
 Adds additional MAC/hardware address acquisition. More...
 
void clear ()
 Removes any configured MAC/Hardware address sources. More...
 
const CfgMACSourcesget () const
 Provides access to the configure MAC/Hardware address sources. More...
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object. More...
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor. More...
 

Static Public Member Functions

static uint32_t MACSourceFromText (const std::string &name)
 Attempts to convert known hardware address sources to uint32_t. More...
 

Protected Attributes

CfgMACSources mac_sources_
 Actual MAC sources storage. More...
 

Detailed Description

Wrapper class that holds MAC/hardware address sources.

It's a simple wrapper around a vector of uint32_t, with each entry holding one MAC source.

Definition at line 25 of file cfg_mac_source.h.

Constructor & Destructor Documentation

◆ CfgMACSource()

isc::dhcp::CfgMACSource::CfgMACSource ( )

Default constructor.

Sets source to 'any'.

Definition at line 41 of file cfg_mac_source.cc.

Member Function Documentation

◆ add()

void isc::dhcp::CfgMACSource::add ( uint32_t  source)

Adds additional MAC/hardware address acquisition.

Parameters
sourceMAC source (see constants in Pkt::HWADDR_SOURCE_*)

Specified source is being added to the mac_sources_ array.

Exceptions
InvalidParameterif such a source is already defined.

Definition at line 57 of file cfg_mac_source.cc.

References isc_throw.

Referenced by isc::dhcp::MACSourcesListConfigParser::parse().

◆ clear()

void isc::dhcp::CfgMACSource::clear ( )
inline

Removes any configured MAC/Hardware address sources.

Definition at line 68 of file cfg_mac_source.h.

References mac_sources_, and toElement().

Referenced by isc::dhcp::MACSourcesListConfigParser::parse().

+ Here is the call graph for this function:

◆ get()

const CfgMACSources& isc::dhcp::CfgMACSource::get ( ) const
inline

Provides access to the configure MAC/Hardware address sources.

Note
The const reference returned is only valid as long as the object that returned it.

Definition at line 63 of file cfg_mac_source.h.

References mac_sources_.

◆ MACSourceFromText()

uint32_t isc::dhcp::CfgMACSource::MACSourceFromText ( const std::string &  name)
static

Attempts to convert known hardware address sources to uint32_t.

Supported strings are:

  • any => 0xffffffff
  • raw => 0x00000001
  • duid => 0x00000002
  • ipv6-link-local 0x00000004
  • client-link-addr-option, rfc6939 => 0x00000008
  • remote-id, rfc4649 => 0x00000010
  • subscriber-id, rfc4580 => 0x00000020
  • docsis => 0x00000040

For specific constants, see isc::dhcp::HWAddr class.

Exceptions
BadValueif specified string is unknown
Returns
bitmask version of a given method

Definition at line 47 of file cfg_mac_source.cc.

References isc_throw.

◆ toElement()

ElementPtr isc::dhcp::CfgMACSource::toElement ( ) const
virtual

Unparse a configuration object.

Returns
a pointer to unparsed configuration

Implements isc::data::CfgToElement.

Definition at line 68 of file cfg_mac_source.cc.

References isc::data::Element::create(), isc::data::Element::createList(), and isc_throw.

Referenced by clear().

+ Here is the call graph for this function:

Member Data Documentation

◆ mac_sources_

CfgMACSources isc::dhcp::CfgMACSource::mac_sources_
protected

Actual MAC sources storage.

Definition at line 79 of file cfg_mac_source.h.

Referenced by clear(), and get().


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