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
25
26#include "ns3/arp-cache.h"
27#include "ns3/arp-header.h"
28#include "ns3/arp-l3-protocol.h"
29#include "ns3/channel.h"
30#include "ns3/icmpv6-l4-protocol.h"
31#include "ns3/ipv4-address.h"
32#include "ns3/ipv4-interface.h"
33#include "ns3/ipv4-l3-protocol.h"
34#include "ns3/ipv6-interface.h"
35#include "ns3/ipv6-l3-protocol.h"
36#include "ns3/net-device-container.h"
37#include "ns3/node-list.h"
38
39namespace ns3
40{
41
51{
52 public:
58
64
70 void PopulateNeighborCache(Ptr<Channel> channel) const;
71
77 void PopulateNeighborCache(const NetDeviceContainer& c) const;
78
85
92
96 void FlushAutoGenerated() const;
97
105 void SetDynamicNeighborCache(bool enable);
106
107 private:
114 Ptr<Ipv4Interface> neighborDeviceInterface) const;
115
122 Ptr<Ipv6Interface> neighborDeviceInterface) const;
123
130 void AddEntry(Ptr<Ipv4Interface> netDeviceInterface,
131 Ipv4Address ipv4Address,
132 Address macAddress) const;
133
140 void AddEntry(Ptr<Ipv6Interface> netDeviceInterface,
141 Ipv6Address ipv6Address,
142 Address macAddress) const;
143
151 const Ipv4InterfaceAddress ifAddr) const;
152
160 const Ipv4InterfaceAddress ifAddr) const;
161
169 const Ipv6InterfaceAddress ifAddr) const;
170
178 const Ipv6InterfaceAddress ifAddr) const;
179
181 false};
182
184 false};
185};
186
187} // namespace ns3
188
189#endif /* NEIGHBOR_CACHE_HELPER_H */
a polymophic address class
Definition: address.h:101
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:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.