A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
neighbor-cache-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 ZHIHENG DONG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Zhiheng Dong <dzh2077@gmail.com>
18 */
19
20#ifndef NEIGHBOR_CACHE_HELPER_H
21#define NEIGHBOR_CACHE_HELPER_H
22
23#include "ns3/arp-cache.h"
24#include "ns3/arp-header.h"
25#include "ns3/arp-l3-protocol.h"
26#include "ns3/channel.h"
27#include "ns3/icmpv6-l4-protocol.h"
28#include "ns3/ipv4-address.h"
29#include "ns3/ipv4-interface-container.h"
30#include "ns3/ipv4-interface.h"
31#include "ns3/ipv4-l3-protocol.h"
32#include "ns3/ipv6-interface-container.h"
33#include "ns3/ipv6-interface.h"
34#include "ns3/ipv6-l3-protocol.h"
35#include "ns3/net-device-container.h"
36#include "ns3/node-list.h"
37
38namespace ns3
39{
40
50{
51 public:
57
63
69 void PopulateNeighborCache(Ptr<Channel> channel) const;
70
76 void PopulateNeighborCache(const NetDeviceContainer& c) const;
77
84
91
95 void FlushAutoGenerated() const;
96
104 void SetDynamicNeighborCache(bool enable);
105
106 private:
113 Ptr<Ipv4Interface> neighborDeviceInterface) const;
114
121 Ptr<Ipv6Interface> neighborDeviceInterface) const;
122
129 void AddEntry(Ptr<Ipv4Interface> netDeviceInterface,
130 Ipv4Address ipv4Address,
131 Address macAddress) const;
132
139 void AddEntry(Ptr<Ipv6Interface> netDeviceInterface,
140 Ipv6Address ipv6Address,
141 Address macAddress) const;
142
150 const Ipv4InterfaceAddress ifAddr) const;
151
159 const Ipv4InterfaceAddress ifAddr) const;
160
168 const Ipv6InterfaceAddress ifAddr) const;
169
177 const Ipv6InterfaceAddress ifAddr) const;
178
180 false};
181
183 false};
184};
185
186} // namespace ns3
187
188#endif /* NEIGHBOR_CACHE_HELPER_H */
a polymophic address class
Definition: address.h:100
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
a class to store IPv4 address information on an interface
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Describes an IPv6 address.
Definition: ipv6-address.h:49
IPv6 address associated with an interface.
Keep track of a set of IPv6 interfaces.
A helper class to populate neighbor cache.
bool m_globalNeighborCache
flag will set true if neighbor caches were generated for all devices
void UpdateCacheByIpv6AddressAdded(const Ptr< Ipv6Interface > interface, const Ipv6InterfaceAddress ifAddr) const
Update neighbor cache when an address is added to a Ipv6Interface with auto generated neighbor cache.
void AddEntry(Ptr< Ipv4Interface > netDeviceInterface, Ipv4Address ipv4Address, Address macAddress) const
Add an auto_generated entry to the ARP cache of an interface.
void PopulateNeighborCache()
Populate neighbor ARP and NDISC caches for all devices.
bool m_dynamicNeighborCache
flag will set true if dynamic neighbor cache is enabled.
NeighborCacheHelper()
Construct a helper class to make life easier while creating neighbor cache.
void PopulateNeighborEntriesIpv4(Ptr< Ipv4Interface > ipv4Interface, Ptr< Ipv4Interface > neighborDeviceInterface) const
Populate neighbor ARP entries for given IPv4 interface.
void SetDynamicNeighborCache(bool enable)
Enable/disable dynamic neighbor cache, auto-generated neighbor cache will update by IP addresses chan...
void PopulateNeighborEntriesIpv6(Ptr< Ipv6Interface > ipv6Interface, Ptr< Ipv6Interface > neighborDeviceInterface) const
Populate neighbor NDISC entries for given IPv6 interface.
void UpdateCacheByIpv6AddressRemoved(const Ptr< Ipv6Interface > interface, const Ipv6InterfaceAddress ifAddr) const
Update neighbor caches when an address is removed from a Ipv6Interface with auto generated neighbor c...
void FlushAutoGenerated() const
Remove entries generated from NeighborCacheHelper from ARP cache and NDISC cache.
void UpdateCacheByIpv4AddressAdded(const Ptr< Ipv4Interface > interface, const Ipv4InterfaceAddress ifAddr) const
Update neighbor caches when an address is added to a Ipv4Interface with auto generated neighbor cache...
void UpdateCacheByIpv4AddressRemoved(const Ptr< Ipv4Interface > interface, const Ipv4InterfaceAddress ifAddr) const
Update neighbor caches when an address is removed from a Ipv4Interface with auto generated neighbor c...
holds a vector of ns3::NetDevice pointers
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.