The helper class used to configure and install DHCP applications on nodes. More...
#include "dhcp-helper.h"
Public Member Functions | |
DhcpHelper () | |
ApplicationContainer | InstallDhcpClient (NetDeviceContainer netDevices) const |
Install DHCP client of a set of nodes / NetDevices. | |
ApplicationContainer | InstallDhcpClient (Ptr< NetDevice > netDevice) const |
Install DHCP client of a nodes / NetDevice. | |
ApplicationContainer | InstallDhcpServer (Ptr< NetDevice > netDevice, Ipv4Address serverAddr, Ipv4Address poolAddr, Ipv4Mask poolMask, Ipv4Address minAddr, Ipv4Address maxAddr, Ipv4Address gateway=Ipv4Address()) |
Install DHCP server of a node / NetDevice. | |
Ipv4InterfaceContainer | InstallFixedAddress (Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask) |
Assign a fixed IP addresses to a net device. | |
void | SetClientAttribute (std::string name, const AttributeValue &value) |
Set DHCP client attributes. | |
void | SetServerAttribute (std::string name, const AttributeValue &value) |
Set DHCP server attributes. | |
Private Member Functions | |
Ptr< Application > | InstallDhcpClientPriv (Ptr< NetDevice > netDevice) const |
Function to install DHCP client on a node. | |
Private Attributes | |
std::list< std::pair< Ipv4Address, Ipv4Address > > | m_addressPools |
list of address pools. | |
ObjectFactory | m_clientFactory |
DHCP client factory. | |
std::list< Ipv4Address > | m_fixedAddresses |
list of fixed addresses already allocated. | |
ObjectFactory | m_serverFactory |
DHCP server factory. | |
The helper class used to configure and install DHCP applications on nodes.
Definition at line 33 of file dhcp-helper.h.
ns3::DhcpHelper::DhcpHelper | ( | ) |
Definition at line 31 of file dhcp-helper.cc.
References ns3::DhcpClient::GetTypeId(), ns3::DhcpServer::GetTypeId(), m_clientFactory, m_serverFactory, and ns3::ObjectFactory::SetTypeId().
ApplicationContainer ns3::DhcpHelper::InstallDhcpClient | ( | NetDeviceContainer | netDevices | ) | const |
Install DHCP client of a set of nodes / NetDevices.
netDevices | The NetDevices that the DHCP client will use |
Definition at line 56 of file dhcp-helper.cc.
References ns3::ApplicationContainer::Add(), ns3::NetDeviceContainer::Begin(), ns3::NetDeviceContainer::End(), and InstallDhcpClientPriv().
ApplicationContainer ns3::DhcpHelper::InstallDhcpClient | ( | Ptr< NetDevice > | netDevice | ) | const |
Install DHCP client of a nodes / NetDevice.
netDevice | The NetDevice that the DHCP client will use |
Definition at line 50 of file dhcp-helper.cc.
References InstallDhcpClientPriv().
Referenced by DhcpTestCase::DoRun().
|
private |
Function to install DHCP client on a node.
netDevice | The NetDevice on which DHCP client application has to be installed |
Definition at line 67 of file dhcp-helper.cc.
References ns3::ObjectFactory::Create(), ns3::TrafficControlHelper::Default(), ns3::DynamicCast(), ns3::TrafficControlHelper::Install(), m_clientFactory, NS_ASSERT_MSG, and NS_LOG_LOGIC.
Referenced by InstallDhcpClient(), and InstallDhcpClient().
ApplicationContainer ns3::DhcpHelper::InstallDhcpServer | ( | Ptr< NetDevice > | netDevice, |
Ipv4Address | serverAddr, | ||
Ipv4Address | poolAddr, | ||
Ipv4Mask | poolMask, | ||
Ipv4Address | minAddr, | ||
Ipv4Address | maxAddr, | ||
Ipv4Address | gateway = Ipv4Address() ) |
Install DHCP server of a node / NetDevice.
Note: the server address must be coherent with the pool address, because DHCP relays are not yet supported.
netDevice | The NetDevice on which DHCP server application has to be installed |
serverAddr | The Ipv4Address of the server |
poolAddr | The Ipv4Address (network part) of the allocated pool |
poolMask | The mask of the allocated pool |
minAddr | The lower bound of the Ipv4Address pool |
maxAddr | The upper bound of the Ipv4Address pool |
gateway | The Ipv4Address of default gateway (optional) |
Definition at line 118 of file dhcp-helper.cc.
References ns3::ObjectFactory::Create(), ns3::TrafficControlHelper::Default(), ns3::DynamicCast(), ns3::Ipv4Address::Get(), ns3::TrafficControlHelper::Install(), m_addressPools, m_fixedAddresses, m_serverFactory, NS_ABORT_MSG, NS_ASSERT_MSG, NS_LOG_LOGIC, and ns3::ObjectFactory::Set().
Referenced by DhcpTestCase::DoRun().
Ipv4InterfaceContainer ns3::DhcpHelper::InstallFixedAddress | ( | Ptr< NetDevice > | netDevice, |
Ipv4Address | addr, | ||
Ipv4Mask | mask ) |
Assign a fixed IP addresses to a net device.
netDevice | The NetDevice on which the address has to be installed |
addr | The Ipv4Address |
mask | The network mask |
Definition at line 192 of file dhcp-helper.cc.
References ns3::Ipv4InterfaceContainer::Add(), ns3::TrafficControlHelper::Default(), ns3::DynamicCast(), ns3::Ipv4Address::Get(), ns3::TrafficControlHelper::Install(), m_addressPools, m_fixedAddresses, NS_ABORT_MSG, NS_ASSERT_MSG, and NS_LOG_LOGIC.
void ns3::DhcpHelper::SetClientAttribute | ( | std::string | name, |
const AttributeValue & | value ) |
Set DHCP client attributes.
name | Name of the attribute |
value | Value to be set |
Definition at line 38 of file dhcp-helper.cc.
References m_clientFactory, and ns3::ObjectFactory::Set().
void ns3::DhcpHelper::SetServerAttribute | ( | std::string | name, |
const AttributeValue & | value ) |
Set DHCP server attributes.
name | Name of the attribute |
value | Value to be set |
Definition at line 44 of file dhcp-helper.cc.
References m_serverFactory, and ns3::ObjectFactory::Set().
|
private |
list of address pools.
Definition at line 109 of file dhcp-helper.h.
Referenced by InstallDhcpServer(), and InstallFixedAddress().
|
private |
DHCP client factory.
Definition at line 106 of file dhcp-helper.h.
Referenced by DhcpHelper(), InstallDhcpClientPriv(), and SetClientAttribute().
|
private |
list of fixed addresses already allocated.
Definition at line 108 of file dhcp-helper.h.
Referenced by InstallDhcpServer(), and InstallFixedAddress().
|
private |
DHCP server factory.
Definition at line 107 of file dhcp-helper.h.
Referenced by DhcpHelper(), InstallDhcpServer(), and SetServerAttribute().