23 #include "ns3/packet.h" 
   25 #include "ns3/pointer.h" 
   26 #include "ns3/mesh-point-device.h" 
   27 #include "ns3/wifi-net-device.h" 
   28 #include "ns3/mesh-wifi-interface-mac.h" 
   41     .SetGroupName (
"Mesh")
 
   43     .AddAttribute (
"Mtu", 
"The MAC-level Maximum Transmission Unit",
 
   47                    MakeUintegerChecker<uint16_t> ())
 
   48     .AddAttribute ( 
"RoutingProtocol",
 
   49                     "The mesh routing protocol used by this mesh point.",
 
   62   m_channel = CreateObject<BridgeChannel> ();
 
  101   uint16_t& realProtocol = protocol;
 
  110       if (
m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
 
  114           Forward (incomingPort, packet, protocol, src48, dst48);
 
  124       if (
m_routingProtocol->RemoveRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
 
  133     Forward (incomingPort, packet->
Copy (), protocol, src48, dst48);
 
  147       NS_LOG_DEBUG (
"Request to forward packet " << packet << 
" to destination " << dst << 
" failed; dropping packet");
 
  183   NS_LOG_WARN (
"Manual changing mesh point address can cause routing errors.");
 
  214   NS_LOG_WARN (
"AddLinkChangeCallback does nothing");
 
  271                            uint16_t protocolNumber)
 
  345       if ((*i)->GetIfIndex () == n)
 
  353 std::vector<Ptr<NetDevice> >
 
  366       NS_FATAL_ERROR (
"Device does not support eui 48 addresses: cannot be used as a mesh point interface.");
 
  368   if (!iface->SupportsSendFrom ())
 
  370       NS_FATAL_ERROR (
"Device does not support SendFrom: cannot be used as a mesh point interface.");
 
  381       NS_FATAL_ERROR (
"Device is not a WiFi NIC: cannot be used as a mesh point interface.");
 
  387         "WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface.");
 
  389   ifaceMac->SetMeshPointAddress (
m_address);
 
  395   m_channel->AddChannel (iface->GetChannel ());
 
  407                  "Routing protocol must be installed on mesh point to be useful.");
 
  420                          uint16_t protocol, uint32_t outIface)
 
  422   NS_LOG_FUNCTION (
this << success << packet << src << dst << protocol << outIface);
 
  444   if (outIface != 0xffffffff)
 
  446       GetInterface (outIface)->SendFrom (packet, src, dst, protocol);
 
  452           (*i)->SendFrom (packet->
Copy (), src, dst, protocol);
 
  457   unicastData (0), unicastDataBytes (0), broadcastData (0), broadcastDataBytes (0)
 
  466   os << 
"<Statistics" << std::endl <<
 
uint32_t GetNInterfaces() const 
 
static bool IsMatchingType(const Address &address)
 
Mac48Address m_address
Mesh point MAC address, supposed to be the address of the first added interface. 
 
Smart pointer class similar to boost::intrusive_ptr. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
virtual bool IsBridge() const 
Return true if the net device is acting as a bridge. 
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
NetDevice::ReceiveCallback m_rxCallback
Receive action. 
 
Ptr< AttributeChecker > MakePointerChecker(void)
Create a PointerChecker for a type. 
 
void ResetStats()
Reset statistics counters. 
 
virtual bool IsBroadcast() const 
 
uint64_t GetUid(void) const 
Returns the packet's Uid. 
 
virtual bool SetMtu(const uint16_t mtu)
 
bool IsNull(void) const 
Check for null implementation. 
 
virtual ~MeshPointDevice()
D-tor. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
PacketType
Packet types are used as they are in Linux. 
 
U * PeekPointer(const Ptr< U > &p)
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
bool IsBroadcast(void) const 
 
virtual void AddLinkChangeCallback(Callback< void > callback)
 
Statistics m_txStats
transmit statistics 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
virtual void DoDispose(void)
Destructor implementation. 
 
virtual bool IsLinkUp() const 
 
virtual bool IsMulticast() const 
 
Ptr< MeshL2RoutingProtocol > m_routingProtocol
Current routing protocol, used mainly by GetRoutingProtocol. 
 
virtual void DoDispose()
Destructor implementation. 
 
Ptr< BridgeChannel > m_channel
Virtual channel for upper layers. 
 
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
 
a polymophic address class 
 
virtual Address GetAddress() const 
 
std::vector< Ptr< NetDevice > > GetInterfaces() const 
 
virtual void SetAddress(Address a)
Set the address of this interface. 
 
Ptr< NetDevice > GetInterface(uint32_t id) const 
 
void SetRoutingProtocol(Ptr< MeshL2RoutingProtocol > protocol)
Register routing protocol to be used. Protocol must be already installed on this mesh point...
 
Statistics m_rxStats
Counters. 
 
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
 
uint32_t unicastData
unicast data 
 
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
static Mac48Address GetMulticast(Ipv4Address address)
 
void Forward(Ptr< NetDevice > incomingPort, Ptr< const Packet > packet, uint16_t protocol, const Mac48Address src, const Mac48Address dst)
Forward packet down to interfaces. 
 
Hold an unsigned integer type. 
 
Hold together all Wifi-related objects. 
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
virtual uint32_t GetIfIndex() const 
 
virtual Address GetMulticast(Ipv4Address multicastGroup) const 
Make and return a MAC multicast address using the provided multicast group. 
 
virtual Ptr< Node > GetNode() const 
 
virtual uint16_t GetMtu() const 
 
void AddInterface(Ptr< NetDevice > port)
Attach new interface to the station. 
 
uint32_t broadcastDataBytes
broadcast data bytes 
 
virtual void SetNode(Ptr< Node > node)
 
static Mac48Address ConvertFrom(const Address &address)
 
void Report(std::ostream &os) const 
Print statistics counters. 
 
Ptr< Packet > Copy(void) const 
performs a COW copy of the packet. 
 
uint16_t m_mtu
MTU in bytes. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
Hold objects of type Ptr. 
 
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 
virtual void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb)
 
Statistics m_fwdStats
forward statistics 
 
Ptr< Node > m_node
Parent node. 
 
void DoSend(bool success, Ptr< Packet > packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t iface)
Response callback for L2 routing protocol. 
 
uint32_t unicastDataBytes
unicast data bytes 
 
virtual Address GetBroadcast() const 
 
static TypeId GetTypeId()
Get the type ID. 
 
virtual Ptr< Channel > GetChannel() const 
 
Virtual net device modeling mesh point. 
 
uint32_t m_ifIndex
If index. 
 
uint32_t broadcastData
broadcast data 
 
Interface for L2 mesh routing protocol and mesh point communication. 
 
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
 
MeshPointDevice()
C-tor create empty (without interfaces and protocols) mesh point. 
 
Describes an IPv6 address. 
 
Ipv4 addresses are stored in host order in this class. 
 
Network layer to device interface. 
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
 
virtual bool NeedsArp() const 
 
virtual bool IsPointToPoint() const 
Return true if the net device is on a point-to-point link. 
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
std::vector< Ptr< NetDevice > > m_ifaces
List of interfaces. 
 
virtual void SetIfIndex(const uint32_t index)
 
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
 
void ReceiveFromDevice(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, Address const &source, Address const &destination, PacketType packetType)
Receive packet from interface. 
 
NetDevice::PromiscReceiveCallback m_promiscRxCallback
Promisc receive action. 
 
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
a unique identifier for an interface. 
 
virtual bool SupportsSendFrom() const 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
Basic MAC of mesh point Wi-Fi interface. 
 
Ptr< MeshL2RoutingProtocol > GetRoutingProtocol() const 
Access current routing protocol.