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 
48  static TypeId GetTypeId (void);
49  // Inherited from Header class:
50  virtual TypeId GetInstanceTypeId (void) const;
51  virtual void Print (std::ostream &os) const;
52  virtual uint32_t GetSerializedSize (void) const;
53  virtual void Serialize (Buffer::Iterator start) const;
54  virtual uint32_t Deserialize (Buffer::Iterator start);
55 
56  // Seeters/Getters for fields:
61  void AddCost (uint8_t cost);
66  uint8_t GetCost () const;
71  void SetSeqno (uint16_t seqno);
76  uint16_t GetSeqno () const;
81  void SetOrigDst (Mac48Address dst);
86  Mac48Address GetOrigDst () const;
91  void SetOrigSrc (Mac48Address OrigSrc);
96  Mac48Address GetOrigSrc () const;
101  void SetProtocol (uint16_t protocol);
106  uint16_t GetProtocol () const;
107 
108 private:
109  uint8_t m_cost;
110  uint16_t m_seqno;
113  uint16_t m_protocol;
114 
121  friend bool operator== (const FlameHeader & a, const FlameHeader & b);
122 };
123 bool operator== (const FlameHeader & a, const FlameHeader & b);
124 } // namespace flame
125 } // namespace ns3
126 #endif /* FLAME_HEADER_H */
Protocol header serialization and deserialization.
Definition: header.h:42
Mac48Address GetOrigDst() const
Get origin destination address.
bool operator==(const FlameHeader &a, const FlameHeader &b)
void SetSeqno(uint16_t seqno)
Set sequence number value.
void SetOrigDst(Mac48Address dst)
Set origin destination address.
def start()
Definition: core.py:1844
Mac48Address m_origDst
origin destination
Definition: flame-header.h:111
uint8_t GetCost() const
Get cost value.
Definition: flame-header.cc:98
virtual uint32_t GetSerializedSize(void) const
Definition: flame-header.cc:59
static TypeId GetTypeId(void)
Get the type ID.
Definition: flame-header.cc:39
iterator in a Buffer instance
Definition: buffer.h:98
uint16_t GetSeqno() const
Get sequence number value.
void SetProtocol(uint16_t protocol)
Set protocol value.
void AddCost(uint8_t cost)
Add cost value.
Definition: flame-header.cc:93
virtual void Print(std::ostream &os) const
Definition: flame-header.cc:53
Every class exported by the ns3 library is enclosed in the ns3 namespace.
friend bool operator==(const FlameHeader &a, const FlameHeader &b)
equality operator
void SetOrigSrc(Mac48Address OrigSrc)
Set origin source function.
uint16_t GetProtocol() const
Get protocol value.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: flame-header.cc:48
an EUI-48 address
Definition: mac48-address.h:43
uint16_t m_seqno
sequence number
Definition: flame-header.h:110
virtual void Serialize(Buffer::Iterator start) const
Definition: flame-header.cc:70
uint16_t m_protocol
protocol
Definition: flame-header.h:113
Mac48Address m_origSrc
origin source
Definition: flame-header.h:112
Mac48Address GetOrigSrc() const
Get origin source address.
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: flame-header.cc:81
a unique identifier for an interface.
Definition: type-id.h:58