A Discrete-Event Network Simulator
API
flame-header.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef FLAME_HEADER_H
22 #define FLAME_HEADER_H
23 
24 #include "ns3/header.h"
25 #include "ns3/mac48-address.h"
26 
27 namespace ns3 {
28 namespace flame {
37 class FlameHeader : public Header
38 {
39 public:
40 
41  FlameHeader ();
42  ~FlameHeader ();
43 
44  // Inherited from Header class:
45  static TypeId GetTypeId (void);
46  virtual TypeId GetInstanceTypeId (void) const;
47  virtual void Print (std::ostream &os) const;
48  virtual uint32_t GetSerializedSize (void) const;
49  virtual void Serialize (Buffer::Iterator start) const;
50  virtual uint32_t Deserialize (Buffer::Iterator start);
51 
52  // Seeters/Getters for fields:
53  void AddCost (uint8_t cost);
54  uint8_t GetCost () const;
55  void SetSeqno (uint16_t seqno);
56  uint16_t GetSeqno () const;
57  void SetOrigDst (Mac48Address dst);
58  Mac48Address GetOrigDst () const;
59  void SetOrigSrc (Mac48Address OrigSrc);
60  Mac48Address GetOrigSrc () const;
61  void SetProtocol (uint16_t protocol);
62  uint16_t GetProtocol () const;
63 
64 private:
65  uint8_t m_cost;
66  uint16_t m_seqno;
69  uint16_t m_protocol;
70  friend bool operator== (const FlameHeader & a, const FlameHeader & b);
71 };
72 bool operator== (const FlameHeader & a, const FlameHeader & b);
73 } // namespace flame
74 } // namespace ns3
75 #endif /* FLAME_HEADER_H */
Protocol header serialization and deserialization.
Definition: header.h:42
bool operator==(const FlameHeader &a, const FlameHeader &b)
void SetSeqno(uint16_t seqno)
void SetOrigDst(Mac48Address dst)
def start()
Definition: core.py:1482
virtual uint32_t GetSerializedSize(void) const
Definition: flame-header.cc:59
Mac48Address m_origDst
Definition: flame-header.h:67
Mac48Address GetOrigDst() const
static TypeId GetTypeId(void)
Definition: flame-header.cc:39
iterator in a Buffer instance
Definition: buffer.h:98
void SetProtocol(uint16_t protocol)
uint16_t GetProtocol() const
uint8_t GetCost() const
Definition: flame-header.cc:98
virtual void Print(std::ostream &os) const
Definition: flame-header.cc:53
uint16_t GetSeqno() const
void AddCost(uint8_t cost)
Definition: flame-header.cc:93
Every class exported by the ns3 library is enclosed in the ns3 namespace.
friend bool operator==(const FlameHeader &a, const FlameHeader &b)
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: flame-header.cc:48
Mac48Address GetOrigSrc() const
void SetOrigSrc(Mac48Address OrigSrc)
an EUI-48 address
Definition: mac48-address.h:43
virtual void Serialize(Buffer::Iterator start) const
Definition: flame-header.cc:70
Mac48Address m_origSrc
Definition: flame-header.h:68
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: flame-header.cc:81
a unique identifier for an interface.
Definition: type-id.h:58