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