src/node/ipv4.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 01 Oct 2007 14:15:56 +0200
changeset 1866 e7dbcc4df546
parent 1452 973c456d3684
child 1867 16deaedc0380
permissions -rw-r--r--
do not use Packet objects directly. Use Ptr<Packet> instead
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 * All rights reserved.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 * GNU General Public License for more details.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 */
752
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
    21
#ifndef IPV4_H
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
    22
#define IPV4_H
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <stdint.h>
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "ns3/ipv4-address.h"
710
2a9c061219a7 port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 638
diff changeset
    26
#include "ns3/object.h"
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    27
#include "ns3/callback.h"
757
f4a677b1f753 fix bug 28
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 755
diff changeset
    28
#include "ipv4-route.h"
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
1316
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
    32
class Node;
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
class NetDevice;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
class Packet;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
class Ipv4Route;
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    36
class Ipv4Header; // FIXME: ipv4-header.h needs to move from module
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    37
                  // "internet-node" to module "node"
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    38
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    39
/**
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    40
 * \brief Base class for IPv4 routing protocols.
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    41
 *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    42
 * This class represents the interface between the IPv4 routing core
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    43
 * and a specific IPv4 routing protocol.  The interface is
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    44
 * asynchronous (callback based) in order to support reactive routing
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    45
 * protocols (e.g. AODV).
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    46
 */
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    47
class Ipv4RoutingProtocol : public Object
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    48
{
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    49
public:
1308
5c5937a4150d backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1303
diff changeset
    50
  // void (*RouteReply) (bool found, Ipv4Route route, Packet packet, Ipv4Header const &ipHeader);
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    51
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    52
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    53
  /**
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    54
   * \brief Callback to be invoked when route discovery is completed
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    55
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    56
   * \param bool flag indicating whether a route was actually found;
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    57
   * when this is false, the Ipv4Route parameter is ignored
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    58
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    59
   * \param Ipv4Route the route found
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    60
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    61
   * \param Packet the packet for which a route was requested; can be
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    62
   * modified by the routing protocol
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    63
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    64
   * \param Ipv4Header the IP header supplied to the route request
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    65
   * method (possibly modified in case a new routing header is
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    66
   * inserted and consequently the protocol type has to change).
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    67
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    68
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1452
diff changeset
    69
  typedef Callback<void, bool, const Ipv4Route&, Ptr<Packet>, const Ipv4Header&> RouteReplyCallback;
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    70
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    71
  /**
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    72
   * \brief Asynchronously requests a route for a given packet and IP header
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    73
   *
1432
3aef7d7a71c2 more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
    74
   * \param ifIndex The interface index on which the packet was received.
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    75
   * \param ipHeader IP header of the packet
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    76
   * \param packet packet that is being sent or forwarded
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    77
   * \param routeReply callback that will receive the route reply
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    78
   *
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    79
   * \returns true if the routing protocol should be able to get the
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
    80
   * route, false otherwise.
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    81
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    82
   * This method is called whenever a node's IPv4 forwarding engine
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    83
   * needs to lookup a route for a given packet and IP header.
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    84
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    85
   * The routing protocol implementation may determine immediately it
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    86
   * should not be handling this particular the route request.  For
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    87
   * instance, a routing protocol may decline to search for routes for
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    88
   * certain classes of addresses, like link-local.  In this case,
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    89
   * RequestRoute() should return false and the routeReply callback
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    90
   * must not be invoked.
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    91
   *
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    92
   * If the routing protocol implementations assumes it can provide
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    93
   * the requested route, then it should return true, and the
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    94
   * routeReply callback must be invoked, either immediately before
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    95
   * returning true (synchronously), or in the future (asynchronous).
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    96
   * The routing protocol may use any information available in the IP
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    97
   * header and packet as routing key, although most routing protocols
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    98
   * use only the destination address (as given by
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
    99
   * ipHeader.GetDestination ()).  The routing protocol is also
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   100
   * allowed to add a new header to the packet, which will appear
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   101
   * immediately after the IP header, although most routing do not
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   102
   * insert any extra header.
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   103
   */
1432
3aef7d7a71c2 more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   104
  virtual bool RequestRoute (uint32_t ifIndex,
3aef7d7a71c2 more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   105
                             const Ipv4Header &ipHeader,
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1452
diff changeset
   106
                             Ptr<Packet> packet,
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   107
                             RouteReplyCallback routeReply) = 0;
1452
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   108
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   109
/**
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   110
 * \brief Synchronously check to see if we can determine the interface index 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   111
 * that will be used if a packet is sent to this destination.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   112
 *
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   113
 * This method addresses a problem in the IP stack where a destination address
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   114
 * must be present and checksummed into the IP header before the actual 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   115
 * interface over which the packet is sent can be determined.  The answer is
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   116
 * to implement a known and intentional cross-layer violation.  This is the
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   117
 * endpoint of a call chain that started up quite high in the stack (sockets)
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   118
 * and has found its way down to the Ipv4L3Protocol which is consulting the
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   119
 * routing protocols for what they would do if presented with a packet of the
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   120
 * given destination.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   121
 *
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   122
 * Note that the a single interface index is returned.  This means that if
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   123
 * the destination address is a multicast, and an explicit route is present
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   124
 * that includeds multiple output interfaces, that route cannot be used.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   125
 * 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   126
 * If there are multiple paths out of the node, the resolution is performed
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   127
 * by Ipv4L3Protocol::GetIfIndexforDestination which has access to more 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   128
 * contextual information that is useful for making a determination.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   129
 *
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   130
 * \param destination The Ipv4Address if the destination of a hypothetical 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   131
 * packet.  This may be a multicast group address.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   132
 * \param ifIndex A reference to the interface index over which a packet
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   133
 * sent to this destination would be sent.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   134
 * \return Returns true if a route is found to the destination that involves
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   135
 * a single output interface index, otherwise false.
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   136
 *
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   137
 * \see Ipv4StaticRouting
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   138
 * \see Ipv4RoutingProtocol
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   139
 * \see Ipv4L3Protocol
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   140
 */
1434
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   141
  virtual bool RequestIfIndex (Ipv4Address destination, 
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   142
                              uint32_t& ifIndex) = 0;
1432
3aef7d7a71c2 more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   143
3aef7d7a71c2 more multicast plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
   144
  static const uint32_t IF_INDEX_ANY = 0xffffffff;
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   145
};
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   146
633
ecedbcb39fb7 Some dox additions/fixes
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 593
diff changeset
   147
/**
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   148
 * \brief Access to the Ipv4 forwarding table and to the ipv4 interfaces
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   149
 *
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   150
 * This class allows you to create ipv4 interfaces based on a NetDevice.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   151
 * Multiple interfaces can be created for a single NetDevice, hence
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   152
 * achieving multihoming.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   153
 *
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   154
 * This class also allows you to control the content of the ipv4 
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   155
 * forwarding table.
633
ecedbcb39fb7 Some dox additions/fixes
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 593
diff changeset
   156
 */
752
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
   157
class Ipv4 : public Object
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
{
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
public:
580
80f53b488bd3 rename Iid to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 579
diff changeset
   160
  static const InterfaceId iid;
752
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
   161
  Ipv4 ();
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
   162
  virtual ~Ipv4 ();
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   163
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   164
  /**
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   165
   * \brief Register a new routing protocol to be used in this IPv4 stack
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   166
   * 
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   167
   * \param routingProtocol new routing protocol implementation object
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   168
   * \param priority priority to give to this routing protocol.
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   169
   * Values may range between -32768 and +32767.  The priority 0
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   170
   * corresponds to static routing table lookups, higher values have
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   171
   * more priority.  The order by which routing protocols with the
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   172
   * same priority value are consulted is undefined.
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   173
   */
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   174
  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol,
985
b15a6fa08c14 Add documentation for the dynamic routing interfaces. Change Ipv4::AddRoutingProtocol priority parameter type from int to int16_t to make way for in the future providing stable sorting of routing protocols of the same priority.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 983
diff changeset
   175
                                   int16_t priority) = 0;
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 757
diff changeset
   176
  
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   178
   * \param dest destination address
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   179
   * \param nextHop address of next hop.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
   * \param interface interface of next hop.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
   *
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   182
   * Add route to host dest through host nextHop 
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
   * on interface.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
  virtual void AddHostRouteTo (Ipv4Address dest, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   186
			       Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   187
			       uint32_t interface) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   188
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   189
   * \param dest destination address
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   190
   * \param interface of next hop
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   191
   *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   192
   * add route to host dest on interface.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   193
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   194
  virtual void AddHostRouteTo (Ipv4Address dest, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   195
			       uint32_t interface) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   196
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   197
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   198
   * \param network destination network
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
   * \param networkMask netmask of destination network
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   200
   * \param nextHop address of next hop
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   201
   * \param interface interface of next hop
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   202
   * 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   203
   * add route to network dest with netmask 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   204
   * through host nextHop on interface
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   205
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   206
  virtual void AddNetworkRouteTo (Ipv4Address network, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   207
				  Ipv4Mask networkMask, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   208
				  Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
				  uint32_t interface) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   210
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   211
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
   * \param network destination network
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
   * \param networkMask netmask of destination network
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   214
   * \param interface interface of next hop
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   215
   *
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
   * add route to network dest with netmask 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
   * on interface
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   218
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
  virtual void AddNetworkRouteTo (Ipv4Address network, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
				  Ipv4Mask networkMask, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
				  uint32_t interface) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
   * \param nextHop address of default next hop
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
   * \param interface interface of default next hop.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
   * 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
   * set the default route to host nextHop on
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
   * interface. 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
  virtual void SetDefaultRoute (Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
				uint32_t interface) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
   * \returns the number of entries in the routing table.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
  virtual uint32_t GetNRoutes (void) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   236
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
   * \param i index of route to return
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
   * \returns the route whose index is i
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
   */
757
f4a677b1f753 fix bug 28
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 755
diff changeset
   241
  virtual Ipv4Route GetRoute (uint32_t i) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   242
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   243
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
   * \param i index of route to remove from routing table.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   245
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
  virtual void RemoveRoute (uint32_t i) = 0;
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   247
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   248
  /**
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   249
   * \brief Add a static multicast route for a given multicast source and 
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   250
   *        group.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   251
   *
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   252
   * \param origin The Ipv4 address of the multicast source.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   253
   * \param group The multicast group address.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   254
   * \param inputInterface The interface index over which the packet arrived.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   255
   * \param outputInterfaces The list of output interface indices over which 
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   256
   *        the packet should be sent (excluding the inputInterface).
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   257
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   258
  virtual void AddMulticastRoute (Ipv4Address origin,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   259
                                  Ipv4Address group,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   260
                                  uint32_t inputInterface,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   261
                                  std::vector<uint32_t> outputInterfaces) = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   262
  /**
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   263
   * \brief Remove a static multicast route for a given multicast source and
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   264
   *        group.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   265
   *
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   266
   * \param origin The Ipv4 address of the multicast source.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   267
   * \param group The multicast group address.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   268
   * \param inputInterface The interface index over which the packet arrived.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   269
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   270
  virtual void RemoveMulticastRoute (Ipv4Address origin,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   271
                                     Ipv4Address group,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   272
                                     uint32_t inputInterface) = 0;
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
  
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   274
  /**
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   275
   * \brief Set the default static multicast route.
1442
bb5cf98c0c64 real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents: 1440
diff changeset
   276
   *
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   277
   * \param outputInterface The network output interface index over which 
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   278
   *        packets without specific routes should be sent.
1442
bb5cf98c0c64 real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents: 1440
diff changeset
   279
   */
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   280
  virtual void SetDefaultMulticastRoute (uint32_t outputInterface) = 0;
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   281
1442
bb5cf98c0c64 real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents: 1440
diff changeset
   282
  /**
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   283
   * \returns the number of entries in the multicast routing table.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   284
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   285
  virtual uint32_t GetNMulticastRoutes (void) const = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   286
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   287
  /**
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   288
   * \param i index of route to return
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   289
   * \returns the route whose index is i
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   290
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   291
  virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   292
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   293
  /**
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   294
   * \param i index of route to remove from routing table.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   295
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   296
  virtual void RemoveMulticastRoute (uint32_t i) = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   297
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   298
  /**
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   299
   * \param device device to add to the list of ipv4 interfaces
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   300
   *        which can be used as output interfaces during packet forwarding.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   301
   * \returns the index of the ipv4 interface added.
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   302
   *
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   303
   * Once a device has been added, it can never be removed: if you want
755
64403472ab29 IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 752
diff changeset
   304
   * to disable it, you can invoke Ipv4::SetDown which will
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   305
   * make sure that it is never used during packet forwarding.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   306
   */
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 525
diff changeset
   307
  virtual uint32_t AddInterface (Ptr<NetDevice> device) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   308
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   309
  /**
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
   * \returns the number of interfaces added by the user.
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   311
   */
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   312
  virtual uint32_t GetNInterfaces (void) = 0;  
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
540
507eababb124 Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents: 525
diff changeset
   314
  /**
1440
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   315
   * \brief Find and return the interface ID of the interface that has been
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   316
   *        assigned the specified IP address.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   317
   * \param addr The IP address assigned to the interface of interest.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   318
   * \returns The index of the ipv4 interface with the given address.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   319
   *
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   320
   * Each IP interface has an IP address associated with it.  It is often 
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   321
   * useful to search the list of interfaces for one that corresponds to 
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   322
   * a known IP Address.  This call takes an IP address as a parameter and
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   323
   * returns the interface index of the first interface that has been assigned
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   324
   * that address.  If the address is not found, this function asserts.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   325
   */
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   326
  virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0;
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   327
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   328
  /**
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   329
   * \brief Find and return the interface ID of the interface that has been
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   330
   *        assigned the specified (masked) IP address.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   331
   * \param addr The IP address assigned to the interface of interest.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   332
   * \param mask The address mask to be used in address matching.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   333
   * \returns The index of the ipv4 interface with the given address.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   334
   *
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   335
   * Each IP interface has an IP address associated with it.  It is often 
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   336
   * useful to search the list of interfaces for one that corresponds to 
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   337
   * a known IP Address.  This call takes an IP address and an IP address
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   338
   * mask as parameters and returns the interface index of the first interface
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   339
   * that matches the masked IP address.
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   340
   */
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   341
  virtual uint32_t FindInterfaceForAddr (Ipv4Address addr, 
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   342
    Ipv4Mask mask) const = 0;
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   343
c77745b2731c add ipv4 methods, remove source multicast route requirement, fix udp socket source address prob
Craig Dowell <craigdo@ee.washington.edu>
parents: 1434
diff changeset
   344
  /**
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   345
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   346
   * \returns the NetDevice associated with the ipv4 interface index
540
507eababb124 Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents: 525
diff changeset
   347
   */
593
90cf12cb4ab7 merge with trunk
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580 540
diff changeset
   348
  virtual Ptr<NetDevice> GetNetDevice (uint32_t i) = 0;
540
507eababb124 Separate address assignment from routing in PointToPoint topology code
Tom Henderson <tomh@tomh.org>
parents: 525
diff changeset
   349
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   350
  /**
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   351
   * \brief Join a multicast group for a given multicast source and 
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   352
   *        group.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   353
   *
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   354
   * \param origin The Ipv4 address of the multicast source.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   355
   * \param group The multicast group address.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   356
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   357
  virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   358
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   359
  /**
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   360
   * \brief Leave a multicast group for a given multicast source and 
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   361
   *        group.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   362
   *
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   363
   * \param origin The Ipv4 address of the multicast source.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   364
   * \param group The multicast group address.
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   365
   */
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   366
  virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) = 0;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   367
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
   368
  /**
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   369
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   370
   * \param address address to associate to the underlying ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   371
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   372
  virtual void SetAddress (uint32_t i, Ipv4Address address) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   373
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   374
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   375
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   376
   * \param mask mask to associate to the underlying ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   377
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   378
  virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   379
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   380
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   381
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   382
   * \returns the mask associated to the underlying ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   383
   */
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   384
  virtual Ipv4Mask GetNetworkMask (uint32_t i) const = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   385
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   386
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   387
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   388
   * \returns the address associated to the underlying ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   389
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   390
  virtual Ipv4Address GetAddress (uint32_t i) const = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   391
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   392
  /**
1434
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   393
   * \param destination The IP address of a hypothetical destination.
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   394
   * \returns The IP address assigned to the interface that will be used
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   395
   * if we were to send a packet to destination.
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   396
   */
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1432
diff changeset
   397
  virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   398
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   399
  /**
1452
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   400
   * \param destination The IP address of a hypothetical destination.
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   401
   * \param ifIndex filled in with the interface index that will be used to
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   402
   *        send a packet to the hypothetical destination.
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   403
   * \returns True if a single interface can be identified, false otherwise.
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   404
   */
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   405
  virtual bool GetIfIndexForDestination (Ipv4Address dest,
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   406
    uint32_t &ifIndex) const = 0;
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   407
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   408
  /**
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   409
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   410
   * \returns the Maximum Transmission Unit (in bytes) associated
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   411
   *          to the underlying ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   412
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   413
  virtual uint16_t GetMtu (uint32_t i) const = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   414
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   415
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   416
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   417
   * \returns true if the underlying interface is in the "up" state,
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   418
   *          false otherwise.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   419
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   420
  virtual bool IsUp (uint32_t i) const = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   421
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   422
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   423
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   424
   * 
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   425
   * Set the interface into the "up" state. In this state, it is
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   426
   * considered valid during ipv4 forwarding.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   427
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   428
  virtual void SetUp (uint32_t i) = 0;
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
   429
638
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   430
  /**
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   431
   * \param i index of ipv4 interface
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   432
   *
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   433
   * Set the interface into the "down" state. In this state, it is
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   434
   * ignored during ipv4 forwarding.
e979214cc52d improve IIpv4 dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 633
diff changeset
   435
   */
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   436
  virtual void SetDown (uint32_t i) = 0;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   437
1316
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   438
/**
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   439
 * Convenience functions (Doxygen still needed)
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   440
 *
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   441
 * Return the ifIndex corresponding to the Ipv4Address provided.
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   442
 */
1452
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   443
  static uint32_t GetIfIndexByAddress (Ptr<Node> node, Ipv4Address a, 
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   444
    Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
1316
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   445
1452
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   446
  static bool GetRouteToDestination (Ptr<Node> node, Ipv4Route& route, 
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   447
    Ipv4Address a, Ipv4Mask amask = Ipv4Mask("255.255.255.255"));
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1449
diff changeset
   448
};
1316
f357c6a2bb37 Provide two new Ipv4 convenience functions: GetIfIndexByIpv4Address() and GetIpv4RouteToDestination (), and align global routing code to use the first function
Tom Henderson <tomh@tomh.org>
parents: 1308
diff changeset
   449
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   450
} // namespace ns3 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   451
752
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
   452
#endif /* IPV4_H */