A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
aodv-dpd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
8 * Pavel Boyko <boyko@iitp.ru>
9 */
10
11#ifndef AODV_DPD_H
12#define AODV_DPD_H
13
14#include "aodv-id-cache.h"
15
16#include "ns3/ipv4-header.h"
17#include "ns3/nstime.h"
18#include "ns3/packet.h"
19
20namespace ns3
21{
22namespace aodv
23{
24/**
25 * \ingroup aodv
26 *
27 * \brief Helper class used to remember already seen packets and detect duplicates.
28 *
29 * Currently duplicate detection is based on unique packet ID given by Packet::GetUid ()
30 * This approach is known to be weak (ns3::Packet UID is an internal identifier and not intended for
31 * logical uniqueness in models) and should be changed.
32 */
34{
35 public:
36 /**
37 * Constructor
38 * \param lifetime the lifetime for added entries
39 */
41 : m_idCache(lifetime)
42 {
43 }
44
45 /**
46 * Check if the packet is a duplicate. If not, save information about this packet.
47 * \param p the packet to check
48 * \param header the IP header to check
49 * \returns true if duplicate
50 */
51 bool IsDuplicate(Ptr<const Packet> p, const Ipv4Header& header);
52 /**
53 * Set duplicate record lifetime
54 * \param lifetime the lifetime for duplicate records
55 */
56 void SetLifetime(Time lifetime);
57 /**
58 * Get duplicate record lifetime
59 * \returns the duplicate record lifetime
60 */
61 Time GetLifetime() const;
62
63 private:
64 /// Impl
66};
67
68} // namespace aodv
69} // namespace ns3
70
71#endif /* AODV_DPD_H */
Packet header for IPv4.
Definition ipv4-header.h:23
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Helper class used to remember already seen packets and detect duplicates.
Definition aodv-dpd.h:34
DuplicatePacketDetection(Time lifetime)
Constructor.
Definition aodv-dpd.h:40
Time GetLifetime() const
Get duplicate record lifetime.
Definition aodv-dpd.cc:31
bool IsDuplicate(Ptr< const Packet > p, const Ipv4Header &header)
Check if the packet is a duplicate.
Definition aodv-dpd.cc:19
void SetLifetime(Time lifetime)
Set duplicate record lifetime.
Definition aodv-dpd.cc:25
Unique packets identification cache used for simple duplicate detection.
Every class exported by the ns3 library is enclosed in the ns3 namespace.