src/devices/mesh/mesh-point-device.h
author Kirill Andreev <andreev@iitp.ru>
Wed, 22 Jul 2009 16:43:43 +0400
changeset 5132 aee541a30256
parent 5130 b5062e8e0da1
child 5156 5b499f25655a
permissions -rw-r--r--
Restored newline at namespace
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     2
/*
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     3
 * Copyright (c) 2008,2009 IITP RAS
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     4
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     8
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    13
 *
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    17
 *
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    18
 * Authors: Kirill Andreev <andreev@iitp.ru>
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    19
 *          Pavel Boyko <boyko@iitp.ru>
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    20
 */
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    21
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    22
#ifndef L2ROUTING_NET_DEVICE_H
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    23
#define L2ROUTING_NET_DEVICE_H
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    24
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    25
#include "ns3/net-device.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    26
#include "ns3/mac48-address.h"
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    27
#include "ns3/bridge-channel.h"
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    28
#include "ns3/mesh-l2-routing-protocol.h"
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
    29
5132
aee541a30256 Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents: 5130
diff changeset
    30
namespace ns3 {
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    31
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    32
class Node;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    33
/**
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    34
 * \ingroup mesh
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    35
 *
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    36
 * \brief Virtual net device modeling mesh point.
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    37
 *
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    38
 * Mesh point is a virtual net device which is responsible for
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    39
 *   - Aggreagating and coordinating 1..* real devices -- mesh interfaces, see MeshInterfaceDevice class.
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    40
 *   - Hosting all mesh-related level 2 protocols.
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    41
 *
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    42
 * One of hosted L2 protocols must inplement L2RoutingProtocol interface and is used for packets forwarding.
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    43
 *
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    44
 * From the level 3 point of view MeshPointDevice is similar to BridgeNetDevice, but the packets,
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    45
 * which going through may be changed (because L2 protocols may require their own headers or tags).
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    46
 *
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    47
 * Attributes: TODO
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    48
 */
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    49
class MeshPointDevice : public NetDevice
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    50
{
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    51
public:
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    52
  /// Object type ID for NS3 object system
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    53
  static TypeId GetTypeId ();
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    54
  /// C-tor create empty (without interfaces and protocols) mesh point
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    55
  MeshPointDevice ();
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    56
  /// D-tor
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    57
  virtual ~MeshPointDevice ();
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    58
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    59
  ///\name Interfaces
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    60
  //\{
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    61
  /**
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
    62
   * \brief Attach new interface to the station. Interface must support 48-bit MAC address and SendFrom method.
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    63
   *
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    64
   * \attention Only MeshPointDevice can have IP address, but not individual interfaces.
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    65
   */
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    66
  void AddInterface (Ptr<NetDevice> port);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    67
  /**
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    68
   * \return number of interfaces
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    69
   */
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    70
  uint32_t GetNInterfaces () const;
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    71
  /**
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    72
   * \return interface device by its index (aka ID)
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    73
   * \param id is interface id, 0 <= id < GetNInterfaces
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    74
   */
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    75
  Ptr<NetDevice> GetInterface (uint32_t id) const;
4888
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
    76
  /**
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
    77
   * \return vector of interfaces
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
    78
   */
dec245c213ab Attach interfaces replaced with Install. Helper is simplifyed
Kirill Andreev <andreev@iitp.ru>
parents: 4852
diff changeset
    79
  std::vector<Ptr<NetDevice> > GetInterfaces () const;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    80
  //\}
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    81
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    82
  ///\name Protocols
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    83
  //\{
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4888
diff changeset
    84
  /// Register routing protocol to be used. Protocol must be alredy installed on this mesh point.
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    85
  void SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol);
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4888
diff changeset
    86
  /// Access current routing protocol
5130
b5062e8e0da1 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5129
diff changeset
    87
  Ptr<MeshL2RoutingProtocol> GetRoutingProtocol () const;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    88
  //\}
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
    89
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    90
  ///\name NetDevice interface for upper layers
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
    91
  //\{
4852
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    92
  virtual void SetName (const std::string name);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    93
  virtual std::string GetName () const;
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    94
  virtual void SetIfIndex (const uint32_t index);
123dc54d734e Coding style changes: indentation (some fixes), spaces in operators, function
Andrey Mazo <mazo@iitp.ru>
parents: 4841
diff changeset
    95
  virtual uint32_t GetIfIndex () const;
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    96
  virtual Ptr<Channel> GetChannel () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    97
  virtual Address GetAddress () const;
5101
41589d492ca3 MeshPointDevice::SetAddress ()
Pavel Boyko <boyko@iitp.ru>
parents: 5096
diff changeset
    98
  virtual void SetAddress (Address a);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
    99
  virtual bool SetMtu (const uint16_t mtu);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   100
  virtual uint16_t GetMtu () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   101
  virtual bool IsLinkUp () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   102
  virtual void SetLinkChangeCallback (Callback<void> callback);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   103
  virtual bool IsBroadcast () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   104
  virtual Address GetBroadcast () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   105
  virtual bool IsMulticast () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   106
  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   107
  virtual bool IsPointToPoint () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   108
  virtual bool IsBridge () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   109
  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   110
  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   111
  virtual Ptr<Node> GetNode () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   112
  virtual void SetNode (Ptr<Node> node);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   113
  virtual bool NeedsArp () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   114
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   115
  virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb);
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   116
  virtual bool SupportsSendFrom () const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   117
  virtual Address GetMulticast (Ipv6Address addr) const;
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   118
  virtual void DoDispose ();
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   119
  //\}
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   120
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   121
  ///\name Statistics
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   122
  //\{
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   123
  /// Print statistics counters
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   124
  void Report (std::ostream & os) const;
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   125
  /// Reset statistics counters
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   126
  void ResetStats ();
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   127
  //\}
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   128
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   129
private:
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   130
  /// Receive packet from interface
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   131
  void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   132
                          Address const &source, Address const &destination, PacketType packetType);
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   133
  /// Forward packet down to interfaces
5070
c70964936d2e added 'const' label to packet in MeshPointDevice::Forward and
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   134
  void Forward (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet,
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   135
                uint16_t protocol, const Mac48Address src,
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   136
      const Mac48Address dst);
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   137
  /**
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   138
   * Response callback for L2 routing protocol. This will be executed when routing information is ready.
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   139
   *
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   140
   * \param success     True is route found. TODO: diagnose routing errors
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   141
   * \param packet      Packet to send
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   142
   * \param src         Source MAC address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   143
   * \param dst         Destination MAC address
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   144
   * \param protocol    Protocol ID
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   145
   * \param outIface    Interface to use (ID) for send (decided by routing protocol). All interfaces will be used if outIface = 0xffffffff
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   146
   */
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   147
  void
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   148
  DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol,
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   149
      uint32_t iface);
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   150
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   151
private:
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   152
  /// Receive action
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   153
  NetDevice::ReceiveCallback   m_rxCallback;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   154
  /// Promisc receive action
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   155
  NetDevice::PromiscReceiveCallback  m_promiscRxCallback;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   156
  /// Mesh point MAC address, supposed to be the address of the first added interface
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   157
  Mac48Address m_address;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   158
  /// Parent node
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   159
  Ptr<Node> m_node;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   160
  /// Station name
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   161
  std::string m_name;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   162
  /// List of interfaces
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   163
  std::vector< Ptr<NetDevice> > m_ifaces;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   164
  /// If index
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   165
  uint32_t m_ifIndex;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   166
  /// MTU in bytes
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   167
  uint16_t m_mtu;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   168
  /// Virtual channel for upper layers
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   169
  Ptr<BridgeChannel> m_channel;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   170
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   171
  /// Routing request callback
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   172
  Callback<bool,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   173
           uint32_t,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   174
           Mac48Address,
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   175
           Mac48Address,
5070
c70964936d2e added 'const' label to packet in MeshPointDevice::Forward and
Kirill Andreev <andreev@iitp.ru>
parents: 4928
diff changeset
   176
           Ptr<const Packet>,
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   177
           uint16_t,
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   178
           MeshL2RoutingProtocol::RouteReplyCallback>  m_requestRoute;
5083
5b154b30a8a1 Restructured L2RoutingProtocol: added cleanup function, which deletes all tags
Kirill Andreev <andreev@iitp.ru>
parents: 5070
diff changeset
   179
  Callback<bool, uint32_t, Mac48Address, Mac48Address, Ptr<Packet>, uint16_t&> m_removeRoutingStuff;
4815
4d5befafc0a5 L2RoutingNetDevice refactored to MeshPointDevice
pavlo
parents: 4813
diff changeset
   180
  /// Routing response callback, this is supplied to mesh routing protocol
4817
1257e4b82e17 L2RoutingProtocol refactored to MeshL2RoutingProtocol
Pavel Boyko <boyko@iitp.ru>
parents: 4815
diff changeset
   181
  MeshL2RoutingProtocol::RouteReplyCallback  m_myResponse;
4928
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4888
diff changeset
   182
  /// Current routing protocol, used mainly by GetRoutingProtocol
825037c2d7ab Make routing protocol attribute of mesh point to be accessable by Config::
Pavel Boyko <boyko@iitp.ru>
parents: 4888
diff changeset
   183
  Ptr<MeshL2RoutingProtocol> m_routingProtocol;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   184
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   185
  /// Device statistics counters
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   186
  struct Statistics
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   187
  {
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   188
    uint32_t unicastData;
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   189
    uint32_t unicastDataBytes;
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   190
    uint32_t broadcastData;
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   191
    uint32_t broadcastDataBytes;
5129
5688b8da4526 Fixed coding style
Kirill Andreev <andreev@iitp.ru>
parents: 5126
diff changeset
   192
5126
8e06088a785d Statistics removed from headers
Kirill Andreev <andreev@iitp.ru>
parents: 5101
diff changeset
   193
    Statistics ();
5096
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   194
  };
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   195
  /// Counters
79c84012dac7 RX/TX/FWD stats in MeshPointDevice
Pavel Boyko <boyko@iitp.ru>
parents: 5083
diff changeset
   196
  Statistics m_rxStats, m_txStats, m_fwdStats;
4812
adcb26652e1d Coding style changes: indentation, spaces.
Andrey Mazo <mazo@iitp.ru>
parents: 4810
diff changeset
   197
};
4793
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   198
} //namespace ns3
4f6a6772628e Merge 802.11s code.
Andrey Mazo <mazo@iitp.ru>
parents:
diff changeset
   199
#endif