A Discrete-Event Network Simulator
API
dhcp-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 UPB
4  * Copyright (c) 2017 NITK Surathkal
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Radu Lupu <rlupu@elcom.pub.ro>
20  * Ankit Deepak <adadeepak8@gmail.com>
21  * Deepti Rajagopal <deeptir96@gmail.com>
22  *
23  */
24 
25 #ifndef DHCP_HELPER_H
26 #define DHCP_HELPER_H
27 
28 #include <stdint.h>
29 #include "ns3/application-container.h"
30 #include "ns3/net-device-container.h"
31 #include "ns3/object-factory.h"
32 #include "ns3/ipv4-address.h"
33 #include "ns3/ipv4-interface-container.h"
34 
35 namespace ns3 {
36 
44 {
45 public:
46  DhcpHelper ();
47 
53  void SetClientAttribute (std::string name, const AttributeValue &value);
54 
60  void SetServerAttribute (std::string name, const AttributeValue &value);
61 
68 
75 
92  Ipv4Address poolAddr, Ipv4Mask poolMask,
93  Ipv4Address minAddr, Ipv4Address maxAddr,
94  Ipv4Address gateway = Ipv4Address ());
103 
104 private:
113  std::list<Ipv4Address> m_fixedAddresses;
114  std::list< std::pair <Ipv4Address, Ipv4Address> > m_addressPools;
115 };
116 
117 } // namespace ns3
118 
119 #endif /* DHCP_HELPER_H */
holds a vector of ns3::Application pointers.
void SetServerAttribute(std::string name, const AttributeValue &value)
Set DHCP server attributes.
Definition: dhcp-helper.cc:54
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.
Definition: dhcp-helper.cc:124
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void SetClientAttribute(std::string name, const AttributeValue &value)
Set DHCP client attributes.
Definition: dhcp-helper.cc:47
holds a vector of std::pair of Ptr<Ipv4> and interface index.
std::list< Ipv4Address > m_fixedAddresses
list of fixed addresses already allocated.
Definition: dhcp-helper.h:113
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
The helper class used to configure and install DHCP applications on nodes.
Definition: dhcp-helper.h:43
Hold a value for an Attribute.
Definition: attribute.h:68
std::list< std::pair< Ipv4Address, Ipv4Address > > m_addressPools
list of address pools.
Definition: dhcp-helper.h:114
Ipv4InterfaceContainer InstallFixedAddress(Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask)
Assign a fixed IP addresses to a net device.
Definition: dhcp-helper.cc:192
ObjectFactory m_serverFactory
DHCP server factory.
Definition: dhcp-helper.h:112
holds a vector of ns3::NetDevice pointers
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< Application > InstallDhcpClientPriv(Ptr< NetDevice > netDevice) const
Function to install DHCP client on a node.
Definition: dhcp-helper.cc:76
ObjectFactory m_clientFactory
DHCP client factory.
Definition: dhcp-helper.h:111
Instantiate subclasses of ns3::Object.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice.
Definition: dhcp-helper.cc:61