/usr/include/ns3.27/ns3/flame-protocol.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 IITP RAS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Kirill Andreev <andreev@iitp.ru>
*/
#ifndef FLAME_PROTOCOL_H
#define FLAME_PROTOCOL_H
#include "ns3/mesh-l2-routing-protocol.h"
#include "ns3/nstime.h"
#include "ns3/tag.h"
#include <map>
/**
* \ingroup mesh
* \defgroup flame FLAME
*
* \brief Forwarding LAyer for MEshing protocol
*
* Simple L2.5 mesh routing protocol developed by
* Herman Elfrink <herman.elfrink@ti-wmc.nl> and presented in
* "Easy Wireless: broadband ad-hoc networking for emergency services"
* by Maurits de Graaf et. al. at The Sixth Annual Mediterranean Ad Hoc
* Networking WorkShop, Corfu, Greece, June 12-15, 2007
*
* see also Linux kernel mailing list discussion at
* http://lkml.org/lkml/2006/5/23/82
*/
namespace ns3 {
namespace flame {
class FlameProtocolMac;
class FlameHeader;
class FlameRtable;
/**
* \ingroup flame
* \brief Transmitter and receiver addresses
*/
class FlameTag : public Tag
{
public:
/// transmitter for incoming:
Mac48Address transmitter;
/// Receiver of the packet:
Mac48Address receiver;
/**
* Constructor
*
* \param a receiver MAC address
*/
FlameTag (Mac48Address a = Mac48Address ()) :
receiver (a){}
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId ();
// Inherited from Tag
TypeId GetInstanceTypeId () const;
uint32_t GetSerializedSize () const;
void Serialize (TagBuffer i) const;
void Deserialize (TagBuffer i);
void Print (std::ostream &os) const;
};
/**
* \ingroup flame
* \brief FLAME routing protocol
*/
class FlameProtocol : public MeshL2RoutingProtocol
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId ();
FlameProtocol ();
~FlameProtocol ();
void DoDispose ();
/**
* Route request, inherited from MeshL2RoutingProtocol
*
* \param sourceIface the source interface
* \param source the source address
* \param destination the destination address
* \param packet the packet to route
* \param protocolType the protocol type
* \param routeReply the route reply
* \returns if route exists
*/
bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
Ptr<const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply);
/**
* Cleanup flame headers!
*
* \param fromIface the from interface
* \param source the source address
* \param destination the destination address
* \param packet the packet
* \param protocolType the protocol type
* \returns if the route removed
*/
bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType);
/**
* \brief Install FLAME on given mesh point.
* \returns true if successful
*
* Installing protocol causes installation of its interface MAC plugins.
*
* Also MP aggregates all installed protocols, FLAME protocol can be accessed
* via MeshPointDevice::GetObject<flame::FlameProtocol>();
*/
bool Install (Ptr<MeshPointDevice>);
/**
* Get address of this instance
* \returns the MAC address
*/
Mac48Address GetAddress ();
/**
* Statistics
* \param os the output stream
*/
void Report (std::ostream & os) const;
/// Reset statistics function
void ResetStats ();
private:
/**
* assignment operator
*
* \param flame the object to assign
* \returns the assigned value
*/
FlameProtocol& operator= (const FlameProtocol & flame);
/// type conversion operator
FlameProtocol (const FlameProtocol &);
/// LLC protocol number reserved by flame
static const uint16_t FLAME_PROTOCOL = 0x4040;
/**
* \brief Handles a packet: adds a routing information and drops packets by TTL or Seqno
*
* \param seqno
* \param source
* \param flameHdr
* \param receiver
* \param fromIface
* \return true if packet shall be dropped
*/
bool HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface);
/**
* \name Information about MeshPointDeviceaddress, plugins
* \{
*/
typedef std::map<uint32_t, Ptr<FlameProtocolMac> > FlamePluginMap;
FlamePluginMap m_interfaces; ///< interfaces
Mac48Address m_address; ///< address
//\}
/**
* \name Broadcast timers:
* \{
*/
Time m_broadcastInterval;
Time m_lastBroadcast;
//\}
/// Max Cost value (or TTL, because cost is actually hopcount)
uint8_t m_maxCost;
/// Sequence number:
uint16_t m_myLastSeqno;
/// Routing table:
Ptr<FlameRtable> m_rtable;
/// Statistics structure
struct Statistics
{
uint16_t txUnicast; ///< transmit unicast
uint16_t txBroadcast; ///< transmit broadcast
uint32_t txBytes; ///< transmit bytes
uint16_t droppedTtl; ///< dropped TTL
uint16_t totalDropped; ///< total dropped
/**
* Print function
* \param os the output stream to print to
*/
void Print (std::ostream & os) const;
/// constructor
Statistics ();
};
Statistics m_stats; ///< statistics
};
} // namespace flame
} // namespace ns3
#endif /* FLAME_PROTOCOL_H */
|