A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
hwmp-tag.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008,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 * Authors: Kirill Andreev <andreev@iitp.ru>
18 * Aleksey Kovalenko <kovalenko@iitp.ru>
19 * Pavel Boyko <boyko@iitp.ru>
20 */
21
22#ifndef HWMP_TAG_H
23#define HWMP_TAG_H
24
25#include "ns3/mac48-address.h"
26#include "ns3/object.h"
27#include "ns3/tag.h"
28
29namespace ns3
30{
31namespace dot11s
32{
33/**
34 * \ingroup dot11s
35 *
36 * \brief Hwmp tag implements interaction between HWMP
37 * protocol and MeshWifiMac
38 *
39 * Hwmp tag keeps the following:
40 * 1. When packet is passed from Hwmp to 11sMAC:
41 * - retransmitter address,
42 * - TTL value,
43 * 2. When packet is passed to Hwmp from 11sMAC:
44 * - lasthop address,
45 * - TTL value,
46 * - metric value (metric of link is recalculated
47 * at each packet, but routing table stores metric
48 * obtained during path discovery procedure)
49 */
50class HwmpTag : public Tag
51{
52 public:
53 HwmpTag();
54 ~HwmpTag() override;
55 /**
56 * Set address
57 * \param retransmitter the MAC address of the retransmitter
58 */
59 void SetAddress(Mac48Address retransmitter);
60 /**
61 * Get address from tag
62 * \return the MAC address
63 */
65 /**
66 * Set the TTL value
67 * \param ttl
68 */
69 void SetTtl(uint8_t ttl);
70 /**
71 * Get the TTL value
72 * \returns the TTL
73 */
74 uint8_t GetTtl() const;
75 /**
76 * Set the metric value
77 * \param metric the metric
78 */
79 void SetMetric(uint32_t metric);
80 /**
81 * Get the metric value
82 * \returns the metric
83 */
84 uint32_t GetMetric() const;
85 /**
86 * Set sequence number
87 * \param seqno the sequence number
88 */
89 void SetSeqno(uint32_t seqno);
90 /**
91 * Get the sequence number
92 * \returns the sequence number
93 */
94 uint32_t GetSeqno() const;
95 /// Decrement TTL
96 void DecrementTtl();
97
98 /**
99 * \brief Get the type ID.
100 * \return the object TypeId
101 */
102 static TypeId GetTypeId();
103 TypeId GetInstanceTypeId() const override;
104 uint32_t GetSerializedSize() const override;
105 void Serialize(TagBuffer i) const override;
106 void Deserialize(TagBuffer i) override;
107 void Print(std::ostream& os) const override;
108
109 private:
111 uint8_t m_ttl; ///< TTL
112 uint32_t m_metric; ///< metric
113 uint32_t m_seqno; ///< sequence no
114};
115} // namespace dot11s
116} // namespace ns3
117#endif
an EUI-48 address
Definition: mac48-address.h:46
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
Hwmp tag implements interaction between HWMP protocol and MeshWifiMac.
Definition: hwmp-tag.h:51
void SetTtl(uint8_t ttl)
Set the TTL value.
Definition: hwmp-tag.cc:55
uint32_t GetSeqno() const
Get the sequence number.
Definition: hwmp-tag.cc:85
void SetMetric(uint32_t metric)
Set the metric value.
Definition: hwmp-tag.cc:67
void SetSeqno(uint32_t seqno)
Set sequence number.
Definition: hwmp-tag.cc:79
uint8_t GetTtl() const
Get the TTL value.
Definition: hwmp-tag.cc:61
Mac48Address GetAddress()
Get address from tag.
Definition: hwmp-tag.cc:49
~HwmpTag() override
Definition: hwmp-tag.cc:38
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: hwmp-tag.cc:105
static TypeId GetTypeId()
Get the type ID.
Definition: hwmp-tag.cc:95
void Serialize(TagBuffer i) const override
Definition: hwmp-tag.cc:120
Mac48Address m_address
address
Definition: hwmp-tag.h:110
uint8_t m_ttl
TTL.
Definition: hwmp-tag.h:111
void Deserialize(TagBuffer i) override
Definition: hwmp-tag.cc:135
uint32_t m_metric
metric
Definition: hwmp-tag.h:112
uint32_t GetSerializedSize() const override
Definition: hwmp-tag.cc:111
void Print(std::ostream &os) const override
Definition: hwmp-tag.cc:150
void SetAddress(Mac48Address retransmitter)
Set address.
Definition: hwmp-tag.cc:43
uint32_t m_seqno
sequence no
Definition: hwmp-tag.h:113
uint32_t GetMetric() const
Get the metric value.
Definition: hwmp-tag.cc:73
void DecrementTtl()
Decrement TTL.
Definition: hwmp-tag.cc:159
Every class exported by the ns3 library is enclosed in the ns3 namespace.