The helper class used to configure and install DHCP applications on nodes. More...
#include "dhcp-helper.h"
Public Member Functions | |
DhcpHelper () | |
ApplicationContainer | InstallDhcpClient (Ptr< NetDevice > netDevice) const |
Install DHCP client of a nodes / NetDevice. More... | |
ApplicationContainer | InstallDhcpClient (NetDeviceContainer netDevices) const |
Install DHCP client of a set of nodes / NetDevices. More... | |
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. More... | |
Ipv4InterfaceContainer | InstallFixedAddress (Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask) |
Assign a fixed IP addresses to a net device. More... | |
void | SetClientAttribute (std::string name, const AttributeValue &value) |
Set DHCP client attributes. More... | |
void | SetServerAttribute (std::string name, const AttributeValue &value) |
Set DHCP server attributes. More... | |
Private Member Functions | |
Ptr< Application > | InstallDhcpClientPriv (Ptr< NetDevice > netDevice) const |
Function to install DHCP client on a node. More... | |
Private Attributes | |
std::list< std::pair< Ipv4Address, Ipv4Address > > | m_addressPools |
list of address pools. More... | |
ObjectFactory | m_clientFactory |
DHCP client factory. More... | |
std::list< Ipv4Address > | m_fixedAddresses |
list of fixed addresses already allocated. More... | |
ObjectFactory | m_serverFactory |
DHCP server factory. More... | |
The helper class used to configure and install DHCP applications on nodes.
Definition at line 43 of file dhcp-helper.h.
ns3::DhcpHelper::DhcpHelper | ( | ) |
Definition at line 40 of file dhcp-helper.cc.
References ns3::DhcpServer::GetTypeId(), ns3::DhcpClient::GetTypeId(), m_clientFactory, m_serverFactory, and ns3::ObjectFactory::SetTypeId().
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 60 of file dhcp-helper.cc.
References InstallDhcpClientPriv().
Referenced by DhcpTestCase::DoRun().
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 65 of file dhcp-helper.cc.
References ns3::ApplicationContainer::Add(), ns3::NetDeviceContainer::Begin(), ns3::NetDeviceContainer::End(), and InstallDhcpClientPriv().
|
private |
Function to install DHCP client on a node.
netDevice | The NetDevice on which DHCP client application has to be installed |
Definition at line 75 of file dhcp-helper.cc.
References ns3::Node::AddApplication(), ns3::ObjectFactory::Create(), ns3::TrafficControlHelper::Default(), ns3::Object::GetObject(), ns3::TrafficControlHelper::Install(), m_clientFactory, NS_ASSERT_MSG(), and NS_LOG_LOGIC().
Referenced by 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 113 of file dhcp-helper.cc.
References ns3::Node::AddApplication(), ns3::ObjectFactory::Create(), ns3::TrafficControlHelper::Default(), ns3::Ipv4Address::Get(), ns3::Object::GetObject(), 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 171 of file dhcp-helper.cc.
References ns3::Ipv4InterfaceContainer::Add(), ns3::TrafficControlHelper::Default(), ns3::Ipv4Address::Get(), ns3::Object::GetObject(), 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 46 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 53 of file dhcp-helper.cc.
References m_serverFactory, and ns3::ObjectFactory::Set().
|
private |
list of address pools.
Definition at line 114 of file dhcp-helper.h.
Referenced by InstallDhcpServer(), and InstallFixedAddress().
|
private |
DHCP client factory.
Definition at line 111 of file dhcp-helper.h.
Referenced by DhcpHelper(), InstallDhcpClientPriv(), and SetClientAttribute().
|
private |
list of fixed addresses already allocated.
Definition at line 113 of file dhcp-helper.h.
Referenced by InstallDhcpServer(), and InstallFixedAddress().
|
private |
DHCP server factory.
Definition at line 112 of file dhcp-helper.h.
Referenced by DhcpHelper(), InstallDhcpServer(), and SetServerAttribute().