Kea 2.2.0
isc::dhcp::IfaceCollection Class Reference

Collection of pointers to network interfaces. More...

#include <iface_mgr.h>

Public Types

typedef boost::multi_index_container< IfacePtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun< Iface, int, &Iface::getIndex > >, boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun< Iface, std::string, &Iface::getName > > > > IfaceContainer
 Multi index container for network interfaces. More...
 

Public Member Functions

IfaceContainer::const_iterator begin () const
 Begin iterator. More...
 
void clear ()
 Clear the collection. More...
 
bool empty () const
 Empty predicate. More...
 
IfaceContainer::const_iterator end () const
 End iterator. More...
 
IfacePtr getIface (const std::string &ifname)
 Lookup by interface name. More...
 
IfacePtr getIface (uint32_t ifindex)
 Lookup by interface index. More...
 
void push_back (const IfacePtr &iface)
 Adds an interface to the collection. More...
 
size_t size () const
 Return the number of interfaces. More...
 

Detailed Description

Collection of pointers to network interfaces.

Definition at line 490 of file iface_mgr.h.

Member Typedef Documentation

◆ IfaceContainer

typedef boost::multi_index_container< IfacePtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun< Iface, int, &Iface::getIndex > >, boost::multi_index::hashed_unique< boost::multi_index::const_mem_fun< Iface, std::string, &Iface::getName > > > > isc::dhcp::IfaceCollection::IfaceContainer

Multi index container for network interfaces.

This container allows to search for a network interfaces using three indexes:

  • sequenced: used to access elements in the order they have been added to the container.
  • interface index: used to access an interface using its index.
  • interface name: used to access an interface using its name. Note that indexes and names are unique.

Definition at line 525 of file iface_mgr.h.

Member Function Documentation

◆ begin()

IfaceContainer::const_iterator isc::dhcp::IfaceCollection::begin ( ) const
inline

Begin iterator.

Returns
The container sequence begin iterator.

Definition at line 530 of file iface_mgr.h.

◆ clear()

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

Clear the collection.

Definition at line 556 of file iface_mgr.h.

Referenced by isc::dhcp::IfaceMgr::clearIfaces().

◆ empty()

bool isc::dhcp::IfaceCollection::empty ( ) const
inline

Empty predicate.

Returns
If the container is empty true else false.

Definition at line 544 of file iface_mgr.h.

◆ end()

IfaceContainer::const_iterator isc::dhcp::IfaceCollection::end ( ) const
inline

End iterator.

Returns
The container sequence end iterator.

Definition at line 537 of file iface_mgr.h.

◆ getIface() [1/2]

IfacePtr isc::dhcp::IfaceCollection::getIface ( const std::string &  ifname)

Lookup by interface name.

Parameters
ifnameThe name of the interface to find.
Returns
The interface with the name or null.

Definition at line 841 of file iface_mgr.cc.

◆ getIface() [2/2]

IfacePtr isc::dhcp::IfaceCollection::getIface ( uint32_t  ifindex)

Lookup by interface index.

Parameters
ifindexThe index of the interface to find.
Returns
The interface with the index or null.

Definition at line 835 of file iface_mgr.cc.

Referenced by isc::dhcp::IfaceMgr::getIface().

◆ push_back()

void isc::dhcp::IfaceCollection::push_back ( const IfacePtr &  iface)
inline

Adds an interface to the collection.

The interface is added at the end of sequence.

Parameters
ifacereference to Iface object.

Definition at line 566 of file iface_mgr.h.

Referenced by isc::dhcp::IfaceMgr::addInterface().

◆ size()

size_t isc::dhcp::IfaceCollection::size ( ) const
inline

Return the number of interfaces.

Returns
The container size.

Definition at line 551 of file iface_mgr.h.

Referenced by isc::dhcp::IfaceMgr::countIfaces().


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