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 * 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 *
18 * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
19 * Pavel Boyko <boyko@iitp.ru>
20 */
21
22#ifndef AODV_DPD_H
23#define AODV_DPD_H
24
25#include "aodv-id-cache.h"
26
27#include "ns3/ipv4-header.h"
28#include "ns3/nstime.h"
29#include "ns3/packet.h"
30
31namespace ns3
32{
33namespace aodv
34{
35/**
36 * \ingroup aodv
37 *
38 * \brief Helper class used to remember already seen packets and detect duplicates.
39 *
40 * Currently duplicate detection is based on unique packet ID given by Packet::GetUid ()
41 * This approach is known to be weak (ns3::Packet UID is an internal identifier and not intended for
42 * logical uniqueness in models) and should be changed.
43 */
45{
46 public:
47 /**
48 * Constructor
49 * \param lifetime the lifetime for added entries
50 */
52 : m_idCache(lifetime)
53 {
54 }
55
56 /**
57 * Check if the packet is a duplicate. If not, save information about this packet.
58 * \param p the packet to check
59 * \param header the IP header to check
60 * \returns true if duplicate
61 */
62 bool IsDuplicate(Ptr<const Packet> p, const Ipv4Header& header);
63 /**
64 * Set duplicate record lifetime
65 * \param lifetime the lifetime for duplicate records
66 */
67 void SetLifetime(Time lifetime);
68 /**
69 * Get duplicate record lifetime
70 * \returns the duplicate record lifetime
71 */
72 Time GetLifetime() const;
73
74 private:
75 /// Impl
77};
78
79} // namespace aodv
80} // namespace ns3
81
82#endif /* AODV_DPD_H */
Packet header for IPv4.
Definition: ipv4-header.h:34
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Helper class used to remember already seen packets and detect duplicates.
Definition: aodv-dpd.h:45
DuplicatePacketDetection(Time lifetime)
Constructor.
Definition: aodv-dpd.h:51
Time GetLifetime() const
Get duplicate record lifetime.
Definition: aodv-dpd.cc:42
bool IsDuplicate(Ptr< const Packet > p, const Ipv4Header &header)
Check if the packet is a duplicate.
Definition: aodv-dpd.cc:30
void SetLifetime(Time lifetime)
Set duplicate record lifetime.
Definition: aodv-dpd.cc:36
Unique packets identification cache used for simple duplicate detection.
Definition: aodv-id-cache.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.