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