A Discrete-Event Network Simulator
API
flame-protocol.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_PROTOCOL_H
22#define FLAME_PROTOCOL_H
23
24
25#include "ns3/mesh-l2-routing-protocol.h"
26#include "ns3/nstime.h"
27#include "ns3/tag.h"
28#include <map>
29
45namespace ns3 {
46namespace flame {
47class FlameProtocolMac;
48class FlameHeader;
49class FlameRtable;
54class FlameTag : public Tag
55{
56public:
61
68 receiver (a){}
69
74 static TypeId GetTypeId ();
75 // Inherited from Tag
78 void Serialize (TagBuffer i) const;
79 void Deserialize (TagBuffer i);
80 void Print (std::ostream &os) const;
81
82};
83
89{
90public:
95 static TypeId GetTypeId ();
98 void DoDispose ();
99
111 bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
112 Ptr<const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply);
123 bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
124 const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType);
145 void Report (std::ostream & os) const;
147 void ResetStats ();
148private:
158
160 static const uint16_t FLAME_PROTOCOL = 0x4040;
171 bool HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface);
176 typedef std::map<uint32_t, Ptr<FlameProtocolMac> > FlamePluginMap;
179 //\}
186 //\}
188 uint8_t m_maxCost;
195 {
196 uint16_t txUnicast;
197 uint16_t txBroadcast;
199 uint16_t droppedTtl;
200 uint16_t totalDropped;
205 void Print (std::ostream & os) const;
207 Statistics ();
208 };
210
211};
212} // namespace flame
213} // namespace ns3
214#endif /* FLAME_PROTOCOL_H */
Callback template class.
Definition: callback.h:1279
an EUI-48 address
Definition: mac48-address.h:44
Interface for L2 mesh routing protocol and mesh point communication.
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:37
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
FLAME routing protocol.
Time m_broadcastInterval
Max Cost value (or TTL, because cost is actually hopcount)
void DoDispose()
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
static const uint16_t FLAME_PROTOCOL
LLC protocol number reserved by flame.
uint16_t m_myLastSeqno
Sequence number:
std::map< uint32_t, Ptr< FlameProtocolMac > > FlamePluginMap
interfaces
Ptr< FlameRtable > m_rtable
Routing table:
bool RequestRoute(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< const Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply)
Route request, inherited from MeshL2RoutingProtocol.
bool HandleDataFrame(uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface)
Handles a packet: adds a routing information and drops packets by TTL or Seqno.
FlameProtocol & operator=(const FlameProtocol &flame)
assignment operator
Mac48Address GetAddress()
Get address of this instance.
FlameProtocol(const FlameProtocol &)
type conversion operator
uint8_t m_maxCost
Max Cost value (or TTL, because cost is actually hopcount)
bool Install(Ptr< MeshPointDevice > mp)
Install FLAME on given mesh point.
Time m_lastBroadcast
Max Cost value (or TTL, because cost is actually hopcount)
Statistics m_stats
statistics
Mac48Address m_address
address
void ResetStats()
Reset statistics function.
void Report(std::ostream &os) const
Statistics.
bool RemoveRoutingStuff(uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType)
Cleanup flame headers!
FlamePluginMap m_interfaces
interfaces
Transmitter and receiver addresses.
void Serialize(TagBuffer i) const
void Deserialize(TagBuffer i)
static TypeId GetTypeId()
Get the type ID.
Mac48Address receiver
Receiver of the packet:
FlameTag(Mac48Address a=Mac48Address())
Constructor.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Mac48Address transmitter
transmitter for incoming:
void Print(std::ostream &os) const
uint32_t GetSerializedSize() const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t txBroadcast
transmit broadcast
uint16_t txUnicast
transmit unicast
void Print(std::ostream &os) const
Print function.