A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
flame-header.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 * Author: Kirill Andreev <andreev@iitp.ru>
18 */
19
20#ifndef FLAME_HEADER_H
21#define FLAME_HEADER_H
22
23#include "ns3/header.h"
24#include "ns3/mac48-address.h"
25
26namespace ns3
27{
28namespace flame
29{
30/**
31 * \ingroup flame
32 *
33 * \brief Flame header
34 *
35 * Header format: | Reserved: 1 | cost: 1 | Sequence number: 2 | OrigDst: 6 | OrigSrc: 6 | Flame
36 * port : 2 |
37 */
38
39class FlameHeader : public Header
40{
41 public:
43 ~FlameHeader() override;
44
45 /**
46 * \brief Get the type ID.
47 * \return the object TypeId
48 */
49 static TypeId GetTypeId();
50 // Inherited from Header class:
51 TypeId GetInstanceTypeId() const override;
52 void Print(std::ostream& os) const override;
53 uint32_t GetSerializedSize() const override;
54 void Serialize(Buffer::Iterator start) const override;
56
57 // Seeters/Getters for fields:
58 /**
59 * Add cost value
60 * \param cost the cost
61 */
62 void AddCost(uint8_t cost);
63 /**
64 * Get cost value
65 * \returns the cost
66 */
67 uint8_t GetCost() const;
68 /**
69 * Set sequence number value
70 * \param seqno the sequence number
71 */
72 void SetSeqno(uint16_t seqno);
73 /**
74 * Get sequence number value
75 * \returns the sequence number
76 */
77 uint16_t GetSeqno() const;
78 /**
79 * Set origin destination address
80 * \param dst the MAC address of the destination
81 */
82 void SetOrigDst(Mac48Address dst);
83 /**
84 * Get origin destination address
85 * \returns the MAC address of the destination
86 */
88 /**
89 * Set origin source function
90 * \param OrigSrc the MAC address of the origina source
91 */
92 void SetOrigSrc(Mac48Address OrigSrc);
93 /**
94 * Get origin source address
95 * \returns the MAC address of the origin source
96 */
98 /**
99 * Set protocol value
100 * \param protocol the protocol
101 */
102 void SetProtocol(uint16_t protocol);
103 /**
104 * Get protocol value
105 * \returns the protocol
106 */
107 uint16_t GetProtocol() const;
108
109 private:
110 uint8_t m_cost; ///< cost
111 uint16_t m_seqno; ///< sequence number
112 Mac48Address m_origDst; ///< origin destination
113 Mac48Address m_origSrc; ///< origin source
114 uint16_t m_protocol; ///< protocol
115 /**
116 * equality operator
117 *
118 * \param a lhs
119 * \param b rhs
120 * \returns true if equal
121 */
122 friend bool operator==(const FlameHeader& a, const FlameHeader& b);
123};
124
125bool operator==(const FlameHeader& a, const FlameHeader& b);
126} // namespace flame
127} // namespace ns3
128#endif /* FLAME_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
an EUI-48 address
Definition: mac48-address.h:46
a unique identifier for an interface.
Definition: type-id.h:59
uint32_t GetSerializedSize() const override
Definition: flame-header.cc:68
uint32_t Deserialize(Buffer::Iterator start) override
Definition: flame-header.cc:92
Mac48Address m_origDst
origin destination
Definition: flame-header.h:112
static TypeId GetTypeId()
Get the type ID.
Definition: flame-header.cc:45
uint16_t m_protocol
protocol
Definition: flame-header.h:114
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: flame-header.cc:55
uint8_t GetCost() const
Get cost value.
uint16_t m_seqno
sequence number
Definition: flame-header.h:111
Mac48Address GetOrigDst() const
Get origin destination address.
Mac48Address GetOrigSrc() const
Get origin source address.
void SetOrigSrc(Mac48Address OrigSrc)
Set origin source function.
void AddCost(uint8_t cost)
Add cost value.
void Print(std::ostream &os) const override
Definition: flame-header.cc:61
void Serialize(Buffer::Iterator start) const override
Definition: flame-header.cc:80
friend bool operator==(const FlameHeader &a, const FlameHeader &b)
equality operator
uint16_t GetSeqno() const
Get sequence number value.
void SetOrigDst(Mac48Address dst)
Set origin destination address.
void SetProtocol(uint16_t protocol)
Set protocol value.
Mac48Address m_origSrc
origin source
Definition: flame-header.h:113
uint16_t GetProtocol() const
Get protocol value.
void SetSeqno(uint16_t seqno)
Set sequence number value.
bool operator==(const FlameHeader &a, const FlameHeader &b)
Every class exported by the ns3 library is enclosed in the ns3 namespace.