26 #include "ns3/dhcp-server.h"    27 #include "ns3/dhcp-client.h"    28 #include "ns3/uinteger.h"    29 #include "ns3/names.h"    31 #include "ns3/loopback-net-device.h"    32 #include "ns3/traffic-control-layer.h"    33 #include "ns3/traffic-control-helper.h"    34 #include "ns3/net-device-queue-interface.h"    79   NS_ASSERT_MSG (node != 0, 
"DhcpClientHelper: NetDevice is not not associated with any node -> fail");
    83                  " with a node without IPv4 stack installed -> fail "    84                  "(maybe need to use InternetStackHelper?)");
    86   int32_t 
interface = ipv4->GetInterfaceForDevice (netDevice);
    89       interface = ipv4->AddInterface (netDevice);
    91   NS_ASSERT_MSG (interface >= 0, 
"DhcpHelper: Interface index not found");
    93   ipv4->SetMetric (interface, 1);
    94   ipv4->SetUp (interface);
   100   if (tc && DynamicCast<LoopbackNetDevice> (netDevice) == 0 && tc->GetRootQueueDiscOnDevice (netDevice) == 0)
   109           std::size_t nTxQueues = ndqi->GetNTxQueues ();
   110           NS_LOG_LOGIC (
"DhcpHelper - Installing default traffic control configuration ("   111                         << nTxQueues << 
" device queue(s))");
   118   app->SetDhcpClientNetDevice (netDevice);
   136   NS_ASSERT_MSG (node != 0, 
"DhcpHelper: NetDevice is not not associated with any node -> fail");
   140                  " with a node without IPv4 stack installed -> fail "   141                  "(maybe need to use InternetStackHelper?)");
   143   int32_t 
interface = ipv4->GetInterfaceForDevice (netDevice);
   146       interface = ipv4->AddInterface (netDevice);
   148   NS_ASSERT_MSG (interface >= 0, 
"DhcpHelper: Interface index not found");
   151   ipv4->AddAddress (interface, ipv4Addr);
   152   ipv4->SetMetric (interface, 1);
   153   ipv4->SetUp (interface);
   159   if (tc && DynamicCast<LoopbackNetDevice> (netDevice) == 0 && tc->GetRootQueueDiscOnDevice (netDevice) == 0)
   168           std::size_t nTxQueues = ndqi->GetNTxQueues ();
   169           NS_LOG_LOGIC (
"DhcpHelper - Installing default traffic control configuration ("   170                         << nTxQueues << 
" device queue(s))");
   177   std::list<Ipv4Address>::iterator iter;
   180       if (iter->Get () >= minAddr.
Get () && iter->Get () <= maxAddr.
Get ())
   182           NS_ABORT_MSG (
"DhcpHelper: Fixed address can not conflict with a pool: " << *iter << 
" is in [" << minAddr << 
",  " << maxAddr << 
"]");
   197   NS_ASSERT_MSG (node != 0, 
"DhcpHelper: NetDevice is not not associated with any node -> fail");
   201                  " with a node without IPv4 stack installed -> fail "   202                  "(maybe need to use InternetStackHelper?)");
   204   int32_t 
interface = ipv4->GetInterfaceForDevice (netDevice);
   207       interface = ipv4->AddInterface (netDevice);
   209   NS_ASSERT_MSG (interface >= 0, 
"DhcpHelper: Interface index not found");
   212   ipv4->AddAddress (interface, ipv4Addr);
   213   ipv4->SetMetric (interface, 1);
   214   ipv4->SetUp (interface);
   215   retval.
Add (ipv4, interface);
   221   if (tc && DynamicCast<LoopbackNetDevice> (netDevice) == 0 && tc->GetRootQueueDiscOnDevice (netDevice) == 0)
   230           std::size_t nTxQueues = ndqi->GetNTxQueues ();
   231           NS_LOG_LOGIC (
"DhcpHelper - Installing default traffic control configuration ("   232                         << nTxQueues << 
" device queue(s))");
   239   std::list<std::pair<Ipv4Address, Ipv4Address> >::iterator iter;
   242       if (addr.
Get () >= iter->first.Get () && addr.
Get () <= iter->second.Get ())
   244           NS_ABORT_MSG (
"DhcpHelper: Fixed address can not conflict with a pool: " << addr << 
" is in [" << iter->first << 
",  " << iter->second << 
"]");
 holds a vector of ns3::Application pointers. 
void SetServerAttribute(std::string name, const AttributeValue &value)
Set DHCP server attributes. 
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node. 
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. 
static TypeId GetTypeId(void)
Get the type ID. 
Smart pointer class similar to boost::intrusive_ptr. 
QueueDiscContainer Install(NetDeviceContainer c)
void SetClientAttribute(std::string name, const AttributeValue &value)
Set DHCP client attributes. 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message. 
holds a vector of std::pair of Ptr<Ipv4> and interface index. 
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container. 
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
  Introspection did not find any typical Config paths. 
std::list< Ipv4Address > m_fixedAddresses
list of fixed addresses already allocated. 
a class to represent an Ipv4 address mask 
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
Hold a value for an Attribute. 
std::list< std::pair< Ipv4Address, Ipv4Address > > m_addressPools
list of address pools. 
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory. 
Ipv4InterfaceContainer InstallFixedAddress(Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask)
Assign a fixed IP addresses to a net device. 
ObjectFactory m_serverFactory
DHCP server factory. 
static TypeId GetTypeId(void)
Get the type ID. 
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId. 
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container. 
holds a vector of ns3::NetDevice pointers 
Build a set of QueueDisc objects. 
Network device transmission queue interface. 
Access to the IPv4 forwarding table, interfaces, and configuration. 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
static TrafficControlHelper Default(std::size_t nTxQueues=1)
Ptr< Application > InstallDhcpClientPriv(Ptr< NetDevice > netDevice) const
Function to install DHCP client on a node. 
ObjectFactory m_clientFactory
DHCP client factory. 
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction. 
  AttributeValue implementation for Ipv4Address. 
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
Ipv4 addresses are stored in host order in this class. 
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice. 
a class to store IPv4 address information on an interface 
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator. 
  AttributeValue implementation for Ipv4Mask. 
uint32_t Get(void) const
Get the host-order 32-bit IP address.