A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-pmtu-cache.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Universita' di Firenze
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7 */
8
9#ifndef IPV6_PMTU_CACHE_H
10#define IPV6_PMTU_CACHE_H
11
12#include "ns3/event-id.h"
13#include "ns3/ipv6-address.h"
14#include "ns3/nstime.h"
15#include "ns3/object.h"
16#include "ns3/type-id.h"
17
18#include <map>
19
20namespace ns3
21{
22
23/**
24 * \ingroup ipv6
25 *
26 * \brief This class implements the Path MTU cache, as defined by \RFC{1981}.
27 *
28 * The Path MTU is stored according to the destination address, and it is
29 * cleared upon expiration (default validity time is 10 minutes).
30 *
31 * The "infinite lifetime" PMTU entry type is not implemented, since it is
32 * useful only in an very limited number of cases. See the RFC for further
33 * details.
34 */
35
36class Ipv6PmtuCache : public Object
37{
38 public:
39 class Entry;
40
41 /**
42 * \brief Get the type ID
43 * \return type ID
44 */
45 static TypeId GetTypeId();
46
47 /**
48 * \brief Constructor.
49 */
51
52 /**
53 * \brief Destructor.
54 */
55 ~Ipv6PmtuCache() override;
56
57 /**
58 * \brief Dispose object.
59 */
60 void DoDispose() override;
61
62 /**
63 * \brief Gets the known Path MTU for the specific destination
64 * \param dst the destination
65 * \return the Path MTU (zero if unknown)
66 */
68
69 /**
70 * \brief Sets the Path MTU for the specific destination
71 * \param dst the destination
72 * \param pmtu the Path MTU
73 */
74 void SetPmtu(Ipv6Address dst, uint32_t pmtu);
75
76 /**
77 * \brief Gets the Path MTU validity time
78 * \return the Path MTU validity time
79 */
81
82 /**
83 * \brief Sets the Path MTU validity time (minimum is 5 minutes)
84 * \param validity the Path MTU validity time
85 * \return true if the change was successful
86 */
87 bool SetPmtuValidityTime(Time validity);
88
89 private:
90 /**
91 * \brief Clears the Path MTU for the specific destination
92 * \param dst the destination
93 */
94 void ClearPmtu(Ipv6Address dst);
95
96 /**
97 * \brief Path MTU table
98 */
99 std::map<Ipv6Address, uint32_t> m_pathMtu;
100
101 /**
102 * \brief Container of the IPv6 PMTU data (Ipv6 destination address and expiration event).
103 */
104 typedef std::map<Ipv6Address, EventId>::iterator pathMtuTimerIter;
105
106 /**
107 * \brief Path MTU Expiration table
108 */
109 std::map<Ipv6Address, EventId> m_pathMtuTimer;
110
111 /**
112 * \brief Path MTU entry validity time
113 */
115};
116
117} // namespace ns3
118
119#endif /* IPV6_PMTU_CACHE_H */
Describes an IPv6 address.
This class implements the Path MTU cache, as defined by RFC 1981 .
void DoDispose() override
Dispose object.
~Ipv6PmtuCache() override
Destructor.
std::map< Ipv6Address, uint32_t > m_pathMtu
Path MTU table.
void ClearPmtu(Ipv6Address dst)
Clears the Path MTU for the specific destination.
Ipv6PmtuCache()
Constructor.
std::map< Ipv6Address, EventId > m_pathMtuTimer
Path MTU Expiration table.
std::map< Ipv6Address, EventId >::iterator pathMtuTimerIter
Container of the IPv6 PMTU data (Ipv6 destination address and expiration event).
static TypeId GetTypeId()
Get the type ID.
Time GetPmtuValidityTime() const
Gets the Path MTU validity time.
Time m_validityTime
Path MTU entry validity time.
uint32_t GetPmtu(Ipv6Address dst)
Gets the known Path MTU for the specific destination.
bool SetPmtuValidityTime(Time validity)
Sets the Path MTU validity time (minimum is 5 minutes)
void SetPmtu(Ipv6Address dst, uint32_t pmtu)
Sets the Path MTU for the specific destination.
A base class which provides memory management and object aggregation.
Definition object.h:78
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.