src/internet/model/global-routing.h
author Pedro Silva <pmms@inesctec.pt>
Wed, 29 Oct 2014 10:12:53 -0700
changeset 11040 cd2eda848730
parent 10158 971f362648c3
permissions -rw-r--r--
bug 1791: TCP Endpoint never deallocates when closing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright 2008 University of Washington
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 * 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * GNU General Public License for more details.
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 */
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
/**
7233
be0d7443b4ff Updated the modules doxygen page
Mitch Watrous <watrous@u.washington.edu>
parents: 7176
diff changeset
    21
 * \ingroup internet
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
 * \defgroup globalrouting Global Routing
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
 * \section model Model
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
 * ns-3 global routing performs pre-simulation static route computation
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
 * on a layer-3 Ipv4 topology.  The user API from the script level is
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
 * fairly minimal; once a topology has been constructed and addresses
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
 * assigned, the user may call ns3::GlobalRouteManager::PopulateRoutingTables()
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
 * and the simulator will initialize the routing database and set up
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
 * static unicast forwarding tables for each node.
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
 * The model assumes that all nodes on an ns-3 channel are reachable to
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
 * one another, regardless of whether the nodes can use the channel
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
 * successfully (in the case of wireless).  Therefore, this model
6317
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    36
 * should typically be used only on wired topologies.  Layer-2 bridge
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    37
 * devices are supported.  API does not yet exist to control the subset 
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    38
 * of a topology to which this global static routing is applied.
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
 * 
6317
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    40
 * If the topology changes during the simulation, by default, routing
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    41
 * will not adjust.  There are two ways to make it adjust.
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    42
 * - Set the attribute Ipv4GlobalRouting::RespondToInterfaceEvents to true 
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    43
 * - Manually call the sequence of GlobalRouteManager methods to delte global
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    44
 *   routes, build global routing database, and initialize routes.
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    45
 *   There is a helper method that encapsulates this 
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    46
 *   (Ipv4GlobalRoutingHelper::RecomputeRoutingTables())
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
 * 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
 * \section api API and Usage
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
 * 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
 * Users must include ns3/global-route-manager.h header file.  After the
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
 * IPv4 topology has been built and addresses assigned, users call
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    52
 * ns3::GlobalRouteManager::PopulateRoutingTables (), prior to the 
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    53
 * ns3::Simulator::Run() call.
6317
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    54
 *
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    55
 * There are two attributes of Ipv4GlobalRouting that govern behavior.
e4a750adf12c bug 702: make global routing robust to link/device events
Tom Henderson <tomh@tomh.org>
parents: 3262
diff changeset
    56
 * - Ipv4GlobalRouting::RandomEcmpRouting
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    57
 * - Ipv4GlobalRouting::RespondToInterfaceEvents
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    58
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    59
 * \section impl Implementation
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    60
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    61
 * A singleton object, ns3::GlobalRouteManager, builds a global routing
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    62
 * database of information about the topology, and executes a Dijkstra
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    63
 * Shortest Path First (SPF) algorithm on the topology for each node, and
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    64
 * stores the computed routes in each node's IPv4 forwarding table by
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    65
 * making use of the routing API in class ns3::Ipv4.
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    66
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    67
 * The nodes that export data are those that have had an ns3::GlobalRouter
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    68
 * object aggregated to them.  The ns3::GlobalRouter can be thought of
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    69
 * as a per-node agent that exports topology information to the 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    70
 * ns3::GlobalRouteManager.  When it comes time to build the global
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    71
 * routing database, the list of nodes is iterated and each node with
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    72
 * an ns3::GlobalRouter object is asked to export routing information
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    73
 * concerning the links to which it is attached.
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    74
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    75
 * The format of the data exported conforms to the OSPFv2 standard
10158
971f362648c3 Link to RFC num with \RFC{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7233
diff changeset
    76
 * \RFC{2328}.  In particular, the
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    77
 * information is exported in the form of ns3::GlobalLSA objects that
7176
9f2663992e99 internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6834
diff changeset
    78
 * semantically match the Link State Advertisements of OSPF.
3262
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    79
 *
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    80
 * By using a standard data format for reporting topology, existing 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    81
 * OSPF route computation code can be reused, and that is what is done
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    82
 * by the ns3::GlobalRouteManager.  The main computation functions are
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    83
 * ported from the quagga routing suite (http://www.quagga.net).
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    84
 * 
15d58e28940f Doxygen for global routing
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    85
 */