A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
dhcp-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 UPB
3
* Copyright (c) 2017 NITK Surathkal
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Radu Lupu <rlupu@elcom.pub.ro>
8
* Ankit Deepak <adadeepak8@gmail.com>
9
* Deepti Rajagopal <deeptir96@gmail.com>
10
*
11
*/
12
13
#ifndef DHCP_HELPER_H
14
#define DHCP_HELPER_H
15
16
#include "ns3/application-container.h"
17
#include "ns3/ipv4-address.h"
18
#include "ns3/ipv4-interface-container.h"
19
#include "ns3/net-device-container.h"
20
#include "ns3/object-factory.h"
21
22
#include <stdint.h>
23
24
namespace
ns3
25
{
26
27
/**
28
* \ingroup dhcp
29
*
30
* \class DhcpHelper
31
* \brief The helper class used to configure and install DHCP applications on nodes
32
*/
33
class
DhcpHelper
34
{
35
public
:
36
DhcpHelper
();
37
38
/**
39
* \brief Set DHCP client attributes
40
* \param name Name of the attribute
41
* \param value Value to be set
42
*/
43
void
SetClientAttribute
(std::string name,
const
AttributeValue
& value);
44
45
/**
46
* \brief Set DHCP server attributes
47
* \param name Name of the attribute
48
* \param value Value to be set
49
*/
50
void
SetServerAttribute
(std::string name,
const
AttributeValue
& value);
51
52
/**
53
* \brief Install DHCP client of a nodes / NetDevice
54
* \param netDevice The NetDevice that the DHCP client will use
55
* \return The application container with DHCP client installed
56
*/
57
ApplicationContainer
InstallDhcpClient
(
Ptr<NetDevice>
netDevice)
const
;
58
59
/**
60
* \brief Install DHCP client of a set of nodes / NetDevices
61
* \param netDevices The NetDevices that the DHCP client will use
62
* \return The application container with DHCP client installed
63
*/
64
ApplicationContainer
InstallDhcpClient
(
NetDeviceContainer
netDevices)
const
;
65
66
/**
67
* \brief Install DHCP server of a node / NetDevice
68
*
69
* Note: the server address must be coherent with the pool address, because
70
* DHCP relays are not yet supported.
71
*
72
* \param netDevice The NetDevice on which DHCP server application has to be installed
73
* \param serverAddr The Ipv4Address of the server
74
* \param poolAddr The Ipv4Address (network part) of the allocated pool
75
* \param poolMask The mask of the allocated pool
76
* \param minAddr The lower bound of the Ipv4Address pool
77
* \param maxAddr The upper bound of the Ipv4Address pool
78
* \param gateway The Ipv4Address of default gateway (optional)
79
* \return The application container with DHCP server installed
80
*/
81
ApplicationContainer
InstallDhcpServer
(
Ptr<NetDevice>
netDevice,
82
Ipv4Address
serverAddr,
83
Ipv4Address
poolAddr,
84
Ipv4Mask
poolMask,
85
Ipv4Address
minAddr,
86
Ipv4Address
maxAddr,
87
Ipv4Address
gateway =
Ipv4Address
());
88
/**
89
* \brief Assign a fixed IP addresses to a net device.
90
* \param netDevice The NetDevice on which the address has to be installed
91
* \param addr The Ipv4Address
92
* \param mask The network mask
93
* \return the Ipv4 interface container
94
*/
95
Ipv4InterfaceContainer
InstallFixedAddress
(
Ptr<NetDevice>
netDevice,
96
Ipv4Address
addr,
97
Ipv4Mask
mask);
98
99
private
:
100
/**
101
* \brief Function to install DHCP client on a node
102
* \param netDevice The NetDevice on which DHCP client application has to be installed
103
* \return The pointer to the installed DHCP client
104
*/
105
Ptr<Application>
InstallDhcpClientPriv
(
Ptr<NetDevice>
netDevice)
const
;
106
ObjectFactory
m_clientFactory
;
//!< DHCP client factory
107
ObjectFactory
m_serverFactory
;
//!< DHCP server factory
108
std::list<Ipv4Address>
m_fixedAddresses
;
//!< list of fixed addresses already allocated.
109
std::list<std::pair<Ipv4Address, Ipv4Address>>
m_addressPools
;
//!< list of address pools.
110
};
111
112
}
// namespace ns3
113
114
#endif
/* DHCP_HELPER_H */
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition
application-container.h:33
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::DhcpHelper
The helper class used to configure and install DHCP applications on nodes.
Definition
dhcp-helper.h:34
ns3::DhcpHelper::DhcpHelper
DhcpHelper()
Definition
dhcp-helper.cc:31
ns3::DhcpHelper::m_serverFactory
ObjectFactory m_serverFactory
DHCP server factory.
Definition
dhcp-helper.h:107
ns3::DhcpHelper::m_addressPools
std::list< std::pair< Ipv4Address, Ipv4Address > > m_addressPools
list of address pools.
Definition
dhcp-helper.h:109
ns3::DhcpHelper::m_fixedAddresses
std::list< Ipv4Address > m_fixedAddresses
list of fixed addresses already allocated.
Definition
dhcp-helper.h:108
ns3::DhcpHelper::InstallFixedAddress
Ipv4InterfaceContainer InstallFixedAddress(Ptr< NetDevice > netDevice, Ipv4Address addr, Ipv4Mask mask)
Assign a fixed IP addresses to a net device.
Definition
dhcp-helper.cc:192
ns3::DhcpHelper::InstallDhcpServer
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:118
ns3::DhcpHelper::InstallDhcpClient
ApplicationContainer InstallDhcpClient(Ptr< NetDevice > netDevice) const
Install DHCP client of a nodes / NetDevice.
Definition
dhcp-helper.cc:50
ns3::DhcpHelper::SetClientAttribute
void SetClientAttribute(std::string name, const AttributeValue &value)
Set DHCP client attributes.
Definition
dhcp-helper.cc:38
ns3::DhcpHelper::SetServerAttribute
void SetServerAttribute(std::string name, const AttributeValue &value)
Set DHCP server attributes.
Definition
dhcp-helper.cc:44
ns3::DhcpHelper::InstallDhcpClientPriv
Ptr< Application > InstallDhcpClientPriv(Ptr< NetDevice > netDevice) const
Function to install DHCP client on a node.
Definition
dhcp-helper.cc:67
ns3::DhcpHelper::m_clientFactory
ObjectFactory m_clientFactory
DHCP client factory.
Definition
dhcp-helper.h:106
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition
ipv4-interface-container.h:45
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition
ipv4-address.h:246
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet-apps
helper
dhcp-helper.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0