Kea 2.7.5
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.
 
void add (uint32_t source)
 Adds additional MAC/hardware address acquisition.
 
void clear ()
 Removes any configured MAC/Hardware address sources.
 
const CfgMACSourcesget () const
 Provides access to the configure MAC/Hardware address sources.
 
virtual isc::data::ElementPtr toElement () const
 Unparse a configuration object.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Static Public Member Functions

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

Protected Attributes

CfgMACSources mac_sources_
 Actual MAC sources storage.
 

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.

References isc::dhcp::HWAddr::HWADDR_SOURCE_ANY, and mac_sources_.

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, and mac_sources_.

◆ 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_.

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

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

◆ 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 67 of file cfg_mac_source.cc.

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

Referenced by isc::dhcp::SrvConfig::toElement().

+ 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 CfgMACSource(), add(), clear(), get(), and toElement().


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