LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 IITP RAS | 3 * Copyright (c) 2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 25 matching lines...) Expand all Loading... |
36 namespace ns3 { | 36 namespace ns3 { |
37 namespace aodv { | 37 namespace aodv { |
38 /** | 38 /** |
39 * \ingroup aodv | 39 * \ingroup aodv |
40 * | 40 * |
41 * \brief Unique packets identification cache used for simple duplicate detectio
n. | 41 * \brief Unique packets identification cache used for simple duplicate detectio
n. |
42 */ | 42 */ |
43 class IdCache | 43 class IdCache |
44 { | 44 { |
45 public: | 45 public: |
46 /// c-tor | 46 /** |
| 47 * c-tor |
| 48 * \param lifetime the lifetime for added entries |
| 49 */ |
47 IdCache (Time lifetime) : m_lifetime (lifetime) | 50 IdCache (Time lifetime) : m_lifetime (lifetime) |
48 { | 51 { |
49 } | 52 } |
50 /// Check that entry (addr, id) exists in cache. Add entry, if it doesn't exis
t. | 53 /** |
| 54 * Check that entry (addr, id) exists in cache. Add entry, if it doesn't exist
. |
| 55 * \param addr the IP address |
| 56 * \param id the cache entry ID |
| 57 * \returns true if the pair exists |
| 58 */· |
51 bool IsDuplicate (Ipv4Address addr, uint32_t id); | 59 bool IsDuplicate (Ipv4Address addr, uint32_t id); |
52 /// Remove all expired entries | 60 /// Remove all expired entries |
53 void Purge (); | 61 void Purge (); |
54 /// Return number of entries in cache | 62 /** |
| 63 * \returns number of entries in cache |
| 64 */ |
55 uint32_t GetSize (); | 65 uint32_t GetSize (); |
56 /// Set lifetime for future added entries. | 66 /** |
| 67 * Set lifetime for future added entries. |
| 68 * \param lifetime the lifetime for entries |
| 69 */ |
57 void SetLifetime (Time lifetime) | 70 void SetLifetime (Time lifetime) |
58 { | 71 { |
59 m_lifetime = lifetime; | 72 m_lifetime = lifetime; |
60 } | 73 } |
61 /// Return lifetime for existing entries in cache | 74 /** |
| 75 * Return lifetime for existing entries in cache |
| 76 * \returns thhe lifetime |
| 77 */ |
62 Time GetLifeTime () const | 78 Time GetLifeTime () const |
63 { | 79 { |
64 return m_lifetime; | 80 return m_lifetime; |
65 } | 81 } |
66 private: | 82 private: |
67 /// Unique packet ID | 83 /// Unique packet ID |
68 struct UniqueId | 84 struct UniqueId |
69 { | 85 { |
70 /// ID is supposed to be unique in single address context (e.g. sender addre
ss) | 86 /// ID is supposed to be unique in single address context (e.g. sender addre
ss) |
71 Ipv4Address m_context; | 87 Ipv4Address m_context; |
(...skipping 21 matching lines...) Expand all Loading... |
93 /// Already seen IDs | 109 /// Already seen IDs |
94 std::vector<UniqueId> m_idCache; | 110 std::vector<UniqueId> m_idCache; |
95 /// Default lifetime for ID records | 111 /// Default lifetime for ID records |
96 Time m_lifetime; | 112 Time m_lifetime; |
97 }; | 113 }; |
98 | 114 |
99 } // namespace aodv | 115 } // namespace aodv |
100 } // namespace ns3 | 116 } // namespace ns3 |
101 | 117 |
102 #endif /* AODV_ID_CACHE_H */ | 118 #endif /* AODV_ID_CACHE_H */ |
LEFT | RIGHT |