src/olsr/model/olsr-routing-protocol.h
author Josh Pelkey <jpelkey@gatech.edu>
Fri, 13 May 2011 14:58:13 -0400
changeset 7184 a15feb312428
parent 6976 3fa6c7e16411
child 7276 c360ed25ae69
permissions -rw-r--r--
olsr coding style changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
1752
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     2
/*
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
     3
 * Copyright (c) 2004 Francisco J. Ros
1752
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     4
 * Copyright (c) 2007 INESC Porto
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     5
 *
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     8
 * published by the Free Software Foundation;
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
     9
 *
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    13
 * GNU General Public License for more details.
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    14
 *
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    15
 * You should have received a copy of the GNU General Public License
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    16
 * along with this program; if not, write to the Free Software
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    18
 *
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    19
 * Authors: Francisco J. Ros  <fjrm@dif.um.es>
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    20
 *          Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
d9115729b7d6 Cleanup copyright headers and some unused includes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1750
diff changeset
    21
 */
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    22
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    23
1731
f7ca15d60e5b Reorganize source tree and rename classes in a more sensible way; Olsr becomes OlsrAgent, olsr::Olsr becomes OlsrAgentImpl.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1723
diff changeset
    24
#ifndef __OLSR_AGENT_IMPL_H__
f7ca15d60e5b Reorganize source tree and rename classes in a more sensible way; Olsr becomes OlsrAgent, olsr::Olsr becomes OlsrAgentImpl.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1723
diff changeset
    25
#define __OLSR_AGENT_IMPL_H__
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    26
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    27
#include "olsr-header.h"
5509
33d52e78605a [Bug 740] OLSR MprCompute () works wrong: fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4616
diff changeset
    28
#include "ns3/test.h"
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    29
#include "olsr-state.h"
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    30
#include "olsr-repositories.h"
1731
f7ca15d60e5b Reorganize source tree and rename classes in a more sensible way; Olsr becomes OlsrAgent, olsr::Olsr becomes OlsrAgentImpl.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1723
diff changeset
    31
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
#include "ns3/object.h"
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    33
#include "ns3/packet.h"
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    34
#include "ns3/node.h"
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    35
#include "ns3/socket.h"
1878
f947cd18f0bb Create a new contrib module; move event-garbage-collector.{h,cc} to the contrib module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1869
diff changeset
    36
#include "ns3/event-garbage-collector.h"
1765
763f8d1bb058 Adapt the OLSR agent code to use the new Timer class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1755
diff changeset
    37
#include "ns3/timer.h"
2484
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
    38
#include "ns3/traced-callback.h"
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    39
#include "ns3/ipv4.h"
4560
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
    40
#include "ns3/ipv4-routing-protocol.h"
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
    41
#include "ns3/ipv4-static-routing.h"
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    42
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    43
#include <vector>
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    44
#include <map>
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    45
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    46
1731
f7ca15d60e5b Reorganize source tree and rename classes in a more sensible way; Olsr becomes OlsrAgent, olsr::Olsr becomes OlsrAgentImpl.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1723
diff changeset
    47
namespace ns3 {
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
    48
namespace olsr {
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    49
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    50
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    51
/// An %OLSR's routing table entry.
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    52
struct RoutingTableEntry
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    53
{
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
    54
  Ipv4Address destAddr; ///< Address of the destination node.
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
    55
  Ipv4Address nextAddr; ///< Address of the next hop.
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    56
  uint32_t interface; ///< Interface index
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    57
  uint32_t distance; ///< Distance in hops to the destination.
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    58
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    59
  RoutingTableEntry () : // default values
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
    60
                         destAddr (), nextAddr (),
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
    61
                         interface (0), distance (0) {};
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    62
};
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    63
5509
33d52e78605a [Bug 740] OLSR MprCompute () works wrong: fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4616
diff changeset
    64
class RoutingProtocol;
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    65
5509
33d52e78605a [Bug 740] OLSR MprCompute () works wrong: fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4616
diff changeset
    66
/// Testcase for MPR computation mechanism
6976
3fa6c7e16411 Move olsr test case class declaration over to the test module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    67
class OlsrMprTestCase;
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    68
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    69
///
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    70
/// \ingroup olsr
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    71
///
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    72
/// \brief OLSR routing protocol for IPv4
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    73
///
4364
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4358
diff changeset
    74
class RoutingProtocol : public Ipv4RoutingProtocol
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    75
{
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    76
public:
5509
33d52e78605a [Bug 740] OLSR MprCompute () works wrong: fixed
Kirill Andreev <andreev@iitp.ru>
parents: 4616
diff changeset
    77
  friend class OlsrMprTestCase;
2251
04963d8cca51 iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2250
diff changeset
    78
  static TypeId GetTypeId (void);
2249
3a1da26d61dc replace ComponentManager::Create and ClassId with InterfaceId::CreateObjest and InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1878
diff changeset
    79
4364
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4358
diff changeset
    80
  RoutingProtocol ();
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4358
diff changeset
    81
  virtual ~RoutingProtocol ();
2484
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
    82
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    83
  ///
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    84
  /// \brief Set the OLSR main address to the first address on the indicated
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
    85
  ///        interface
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    86
  /// \param interface IPv4 interface index
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    87
  ///
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
    88
  void SetMainInterface (uint32_t interface);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    89
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
    90
  ///
5875
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    91
  /// Dump the neighbor table, two-hop neighbor table, and routing table
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    92
  /// to logging output (NS_LOG_DEBUG log level).  If logging is disabled,
118925913e8d Finish OLSR doxygen
Tom Henderson <tomh@tomh.org>
parents: 5867
diff changeset
    93
  /// this function does nothing.
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
    94
  ///
5867
8c65da328ae9 Fix Bug 780 (problem in RoutingTableComputation with asymetric links), while adding debugging methods to OLSR. Thanks Abdul Jabbar, Pavel Boyko, and Tom Henderson for test case and debug code.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5856
diff changeset
    95
  void Dump (void);
8c65da328ae9 Fix Bug 780 (problem in RoutingTableComputation with asymetric links), while adding debugging methods to OLSR. Thanks Abdul Jabbar, Pavel Boyko, and Tom Henderson for test case and debug code.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5856
diff changeset
    96
5985
42d6f24bd0f4 New API olsr::RoutingProtocol::GetRoutingTableEntries ()
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5875
diff changeset
    97
  /**
42d6f24bd0f4 New API olsr::RoutingProtocol::GetRoutingTableEntries ()
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5875
diff changeset
    98
   * Return the list of routing table entries discovered by OLSR
42d6f24bd0f4 New API olsr::RoutingProtocol::GetRoutingTableEntries ()
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5875
diff changeset
    99
   **/
42d6f24bd0f4 New API olsr::RoutingProtocol::GetRoutingTableEntries ()
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5875
diff changeset
   100
  std::vector<RoutingTableEntry> GetRoutingTableEntries () const;
42d6f24bd0f4 New API olsr::RoutingProtocol::GetRoutingTableEntries ()
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5875
diff changeset
   101
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   102
private:
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   103
  std::set<uint32_t> m_interfaceExclusions;
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   104
  Ptr<Ipv4StaticRouting> m_routingTableAssociation;
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   105
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   106
public:
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   107
  std::set<uint32_t> GetInterfaceExclusions () const
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   108
  {
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   109
    return m_interfaceExclusions;
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   110
  }
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   111
  void SetInterfaceExclusions (std::set<uint32_t> exceptions);
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   112
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   113
  /// Inject Association to be sent in HNA message
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   114
  void AddHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   115
  /// Removes Association sent in HNA message
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   116
  void RemoveHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   117
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   118
  /// Inject Associations from an Ipv4StaticRouting instance
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   119
  void SetRoutingTableAssociation (Ptr<Ipv4StaticRouting> routingTable);
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   120
5524
efed7493f2c1 Make applications generate traffic within their associated context/node
Guillaume Seguin <guillaume@segu.in>
parents: 5509
diff changeset
   121
protected:
efed7493f2c1 Make applications generate traffic within their associated context/node
Guillaume Seguin <guillaume@segu.in>
parents: 5509
diff changeset
   122
  virtual void DoStart (void);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   123
private:
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   124
  std::map<Ipv4Address, RoutingTableEntry> m_table; ///< Data structure for the routing table.
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   125
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   126
  Ptr<Ipv4StaticRouting> m_hnaRoutingTable;
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   127
1768
1664a9db93b9 Make EventGarbageCollector private to the olsr module; adapt olsr to Timer API changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1765
diff changeset
   128
  EventGarbageCollector m_events;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   129
	
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   130
  /// Packets sequence number counter.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   131
  uint16_t m_packetSequenceNumber;
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   132
  /// Messages sequence number counter.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   133
  uint16_t m_messageSequenceNumber;
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   134
  /// Advertised Neighbor Set sequence number.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   135
  uint16_t m_ansn;
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   136
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   137
  /// HELLO messages' emission interval.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   138
  Time m_helloInterval;
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   139
  /// TC messages' emission interval.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   140
  Time m_tcInterval;
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   141
  /// MID messages' emission interval.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   142
  Time m_midInterval;
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   143
  /// HNA messages' emission interval.
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   144
  Time m_hnaInterval;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   145
  /// Willingness for forwarding packets on behalf of other nodes.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   146
  uint8_t m_willingness;
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   147
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   148
  /// Internal state with all needed data structs.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   149
  OlsrState m_state;
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   150
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   151
  Ptr<Ipv4> m_ipv4;
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   152
4358
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   153
  void Clear ();
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   154
  uint32_t GetSize () const { return m_table.size (); }
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   155
  void RemoveEntry (const Ipv4Address &dest);
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   156
  void AddEntry (const Ipv4Address &dest,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   157
                 const Ipv4Address &next,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   158
                 uint32_t interface,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   159
                 uint32_t distance);
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   160
  void AddEntry (const Ipv4Address &dest,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   161
                 const Ipv4Address &next,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   162
                 const Ipv4Address &interfaceAddress,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   163
                 uint32_t distance);
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   164
  bool Lookup (const Ipv4Address &dest,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   165
               RoutingTableEntry &outEntry) const;
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   166
  bool FindSendEntry (const RoutingTableEntry &entry,
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   167
                      RoutingTableEntry &outEntry) const;
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   168
e63305078fe5 rework olsr
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3970
diff changeset
   169
  // From Ipv4RoutingProtocol
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   170
  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   171
                                      const Ipv4Header &header,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   172
                                      Ptr<NetDevice> oif,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   173
                                      Socket::SocketErrno &sockerr);
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   174
  virtual bool RouteInput (Ptr<const Packet> p,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   175
                           const Ipv4Header &header,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   176
                           Ptr<const NetDevice> idev,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   177
                           UnicastForwardCallback ucb,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   178
                           MulticastForwardCallback mcb,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   179
                           LocalDeliverCallback lcb,
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   180
                           ErrorCallback ecb);
4560
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   181
  virtual void NotifyInterfaceUp (uint32_t interface);
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   182
  virtual void NotifyInterfaceDown (uint32_t interface);
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   183
  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   184
  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   185
  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
6701
a590022a1536 [bug 947] Pretty-print IPv4 routing tables (patch originated by Hemanth Narra)
Tom Henderson <tomh@tomh.org>
parents: 6634
diff changeset
   186
  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
4560
2f106fd728ab Remove static routing dependencies in code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   187
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   188
  void DoDispose ();
1803
4078e5efdfc6 Add OLSR message tracing, as discussed on ns-developers list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1801
diff changeset
   189
1868
06027fd6a68c olsr gets new packet
Craig Dowell <craigdo@ee.washington.edu>
parents: 1803
diff changeset
   190
  void SendPacket (Ptr<Packet> packet, const MessageList &containedMessages);
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   191
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   192
  /// Increments packet sequence number and returns the new value.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   193
  inline uint16_t GetPacketSequenceNumber ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   194
  /// Increments message sequence number and returns the new value.
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   195
  inline uint16_t GetMessageSequenceNumber ();
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   196
3098
d384d52f8f6e Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents: 2900
diff changeset
   197
  void RecvOlsr (Ptr<Socket> socket);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   198
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   199
  void MprComputation ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   200
  void RoutingTableComputation ();
1798
7bb07f0d0e9f Make OlsrAgentImpl::GetMainAddress const
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1778
diff changeset
   201
  Ipv4Address GetMainAddress (Ipv4Address iface_addr) const;
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   202
  bool UsesNonOlsrOutgoingInterface (const Ipv4RoutingTableEntry &route);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   203
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   204
  // Timer handlers
1765
763f8d1bb058 Adapt the OLSR agent code to use the new Timer class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1755
diff changeset
   205
  Timer m_helloTimer;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   206
  void HelloTimerExpire ();
6814
17ff75a3dcbf Bug 1049 - Issues with OLSR HNA messages sent by multiple gateways
Julien Boite <juboite@gmail.com>
parents: 6812
diff changeset
   207
1765
763f8d1bb058 Adapt the OLSR agent code to use the new Timer class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1755
diff changeset
   208
  Timer m_tcTimer;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   209
  void TcTimerExpire ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   210
1765
763f8d1bb058 Adapt the OLSR agent code to use the new Timer class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1755
diff changeset
   211
  Timer m_midTimer;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   212
  void MidTimerExpire ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   213
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   214
  Timer m_hnaTimer;
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   215
  void HnaTimerExpire ();
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   216
2358
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   217
  void DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   218
  bool m_linkTupleTimerFirstTime;
2358
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   219
  void LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr);
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   220
  void Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr);
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   221
  void MprSelTupleTimerExpire (Ipv4Address mainAddr);
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   222
  void TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr);
bf0230eba16e Small OLSR memory optimisation.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2333
diff changeset
   223
  void IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr);
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   224
  void AssociationTupleTimerExpire (Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   225
2328
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   226
  void IncrementAnsn ();
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   227
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   228
  /// A list of pending messages which are buffered awaiting for being sent.
1803
4078e5efdfc6 Add OLSR message tracing, as discussed on ns-developers list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1801
diff changeset
   229
  olsr::MessageList m_queuedMessages;
1765
763f8d1bb058 Adapt the OLSR agent code to use the new Timer class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1755
diff changeset
   230
  Timer m_queuedMessagesTimer; // timer for throttling outgoing messages
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   231
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   232
  void ForwardDefault (olsr::MessageHeader olsrMessage,
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   233
                       DuplicateTuple *duplicated,
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   234
                       const Ipv4Address &localIface,
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   235
                       const Ipv4Address &senderAddress);
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   236
  void QueueMessage (const olsr::MessageHeader &message, Time delay);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   237
  void SendQueuedMessages ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   238
  void SendHello ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   239
  void SendTc ();
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   240
  void SendMid ();
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   241
  void SendHna ();
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   242
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   243
  void NeighborLoss (const LinkTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   244
  void AddDuplicateTuple (const DuplicateTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   245
  void RemoveDuplicateTuple (const DuplicateTuple &tuple);
2328
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   246
  void LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   247
  void RemoveLinkTuple (const LinkTuple &tuple);
3970
8658841e4782 Fix a couple of OLSR bugs (#415)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3853
diff changeset
   248
  void LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   249
  void AddNeighborTuple (const NeighborTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   250
  void RemoveNeighborTuple (const NeighborTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   251
  void AddTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   252
  void RemoveTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   253
  void AddMprSelectorTuple (const MprSelectorTuple  &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   254
  void RemoveMprSelectorTuple (const MprSelectorTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   255
  void AddTopologyTuple (const TopologyTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   256
  void RemoveTopologyTuple (const TopologyTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   257
  void AddIfaceAssocTuple (const IfaceAssocTuple &tuple);
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   258
  void RemoveIfaceAssocTuple (const IfaceAssocTuple &tuple);
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   259
  void AddAssociationTuple (const AssociationTuple &tuple);
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   260
  void RemoveAssociationTuple (const AssociationTuple &tuple);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   261
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   262
  void ProcessHello (const olsr::MessageHeader &msg,
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   263
                     const Ipv4Address &receiverIface,
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   264
                     const Ipv4Address &senderIface);
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   265
  void ProcessTc (const olsr::MessageHeader &msg,
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   266
                  const Ipv4Address &senderIface);
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   267
  void ProcessMid (const olsr::MessageHeader &msg,
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   268
                   const Ipv4Address &senderIface);
6140
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   269
  void ProcessHna (const olsr::MessageHeader &msg,
12bb87242796 Bug 407 - OLSR is missing HNA support
Lalith Suresh <suresh.lalith@gmail.com>
parents: 5985
diff changeset
   270
                   const Ipv4Address &senderIface);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   271
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   272
  void LinkSensing (const olsr::MessageHeader &msg,
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   273
                    const olsr::MessageHeader::Hello &hello,
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   274
                    const Ipv4Address &receiverIface,
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   275
                    const Ipv4Address &sender_iface);
1801
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   276
  void PopulateNeighborSet (const olsr::MessageHeader &msg,
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   277
                            const olsr::MessageHeader::Hello &hello);
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   278
  void PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg,
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   279
                                  const olsr::MessageHeader::Hello &hello);
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   280
  void PopulateMprSelectorSet (const olsr::MessageHeader &msg,
522029e3b8a6 Put everything OLSR into the 'olsr' C++ namespace, for consistency.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1798
diff changeset
   281
                               const olsr::MessageHeader::Hello &hello);
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   282
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   283
  int Degree (NeighborTuple const &tuple);
5761
55f21c521021 (Bug 735) Update Olsr for local delivery
Tom Henderson <tomh@tomh.org>
parents: 5524
diff changeset
   284
  /// Check that address is one of my interfaces
55f21c521021 (Bug 735) Update Olsr for local delivery
Tom Henderson <tomh@tomh.org>
parents: 5524
diff changeset
   285
  bool IsMyOwnAddress (const Ipv4Address & a) const;
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   286
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   287
  Ipv4Address m_mainAddress;
2328
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   288
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   289
  // One socket per interface, each bound to that interface's address
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   290
  // (reason: for OLSR Link Sensing we need to know on which interface
caa15068fb3b OLSR: code cleanup, more extensive logging, many bug fixes. Should also handle multiple interfaces better, now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2251
diff changeset
   291
  // HELLO messages arrive)
5761
55f21c521021 (Bug 735) Update Olsr for local delivery
Tom Henderson <tomh@tomh.org>
parents: 5524
diff changeset
   292
  std::map< Ptr<Socket>, Ipv4InterfaceAddress > m_socketAddresses;
1803
4078e5efdfc6 Add OLSR message tracing, as discussed on ns-developers list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1801
diff changeset
   293
2484
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   294
  TracedCallback <const PacketHeader &,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   295
                  const MessageList &> m_rxPacketTrace;
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   296
  TracedCallback <const PacketHeader &,
d5b05b706999 port Olsr code to attributes/helpers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   297
                  const MessageList &> m_txPacketTrace;
2503
e667dc0f350e merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2333 2484
diff changeset
   298
  TracedCallback <uint32_t> m_routingTableChanged;
1803
4078e5efdfc6 Add OLSR message tracing, as discussed on ns-developers list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1801
diff changeset
   299
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   300
};
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   301
7184
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   302
}
a15feb312428 olsr coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6976
diff changeset
   303
}  // namespace ns3
1716
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   304
9757633a85da Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   305
#endif