A Discrete-Event Network Simulator
API
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 
26 namespace ns3
27 {
28 namespace flame
29 {
39 class FlameHeader : public Header
40 {
41  public:
42  FlameHeader();
43  ~FlameHeader() override;
44 
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;
55  uint32_t Deserialize(Buffer::Iterator start) override;
56 
57  // Seeters/Getters for fields:
62  void AddCost(uint8_t cost);
67  uint8_t GetCost() const;
72  void SetSeqno(uint16_t seqno);
77  uint16_t GetSeqno() const;
82  void SetOrigDst(Mac48Address dst);
87  Mac48Address GetOrigDst() const;
92  void SetOrigSrc(Mac48Address OrigSrc);
97  Mac48Address GetOrigSrc() const;
102  void SetProtocol(uint16_t protocol);
107  uint16_t GetProtocol() const;
108 
109  private:
110  uint8_t m_cost;
111  uint16_t m_seqno;
114  uint16_t m_protocol;
122  friend bool operator==(const FlameHeader& a, const FlameHeader& b);
123 };
124 
125 bool 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
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
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
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.