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