src/internet-node/ipv4-impl.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 27 Feb 2008 19:44:22 +0100
changeset 2498 e01570293b98
parent 1776 0d5be0c3d229
child 2592 3ebf97150166
permissions -rw-r--r--
convert InternetNode to Attributes.
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
 */
745
221fda1d30f8 IIpv4Impl -> Ipv4Impl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 737
diff changeset
    21
#ifndef IPV4_IMPL_H
221fda1d30f8 IIpv4Impl -> Ipv4Impl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 737
diff changeset
    22
#define IPV4_IMPL_H
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
751
0d407cf6862c i-ipv4.h -> ipv4.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 745
diff changeset
    24
#include "ns3/ipv4.h"
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    25
#include "ns3/ptr.h"
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
namespace ns3 {
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
734
039fb338b6e9 Ipv4 -> Ipv4L3Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 593
diff changeset
    29
class Ipv4L3Protocol;
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
752
a4febfb8416f IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 751
diff changeset
    31
class Ipv4Impl : public Ipv4
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
{
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
public:
745
221fda1d30f8 IIpv4Impl -> Ipv4Impl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 737
diff changeset
    34
  Ipv4Impl (Ptr<Ipv4L3Protocol> ipv4);
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
745
221fda1d30f8 IIpv4Impl -> Ipv4Impl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 737
diff changeset
    36
  virtual ~Ipv4Impl ();
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
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
    38
  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
    39
                                   int16_t priority);
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
    40
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
  virtual void AddHostRouteTo (Ipv4Address dest, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
			       Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
			       uint32_t interface);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  virtual void AddHostRouteTo (Ipv4Address dest, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
			       uint32_t interface);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
  virtual void AddNetworkRouteTo (Ipv4Address network, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
				  Ipv4Mask networkMask, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
				  Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
				  uint32_t interface);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
  virtual void AddNetworkRouteTo (Ipv4Address network, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
				  Ipv4Mask networkMask, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
				  uint32_t interface);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
  virtual void SetDefaultRoute (Ipv4Address nextHop, 
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
				uint32_t interface);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
  virtual uint32_t GetNRoutes (void);
757
f4a677b1f753 fix bug 28
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 752
diff changeset
    56
  virtual Ipv4Route GetRoute (uint32_t i);
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
  virtual void RemoveRoute (uint32_t i);
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    58
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    59
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    60
  virtual void AddMulticastRoute (Ipv4Address origin,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    61
                                  Ipv4Address group,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    62
                                  uint32_t inputInterface,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    63
                                  std::vector<uint32_t> outputInterfaces);
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    64
1444
7c81b4e2617d piles of doxygen, changes to SetDefaultMulticastRoute plumbing
Craig Dowell <craigdo@ee.washington.edu>
parents: 1442
diff changeset
    65
  virtual void SetDefaultMulticastRoute (uint32_t outputInterface);
1442
bb5cf98c0c64 real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents: 1440
diff changeset
    66
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    67
  virtual uint32_t GetNMulticastRoutes (void) const;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    68
  virtual Ipv4MulticastRoute GetMulticastRoute (uint32_t i) const;
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    69
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    70
  virtual void RemoveMulticastRoute (Ipv4Address origin,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    71
                                     Ipv4Address group,
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    72
                                     uint32_t inputInterface);
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    73
  virtual void RemoveMulticastRoute (uint32_t i);
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    74
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 524
diff changeset
    75
  virtual uint32_t AddInterface (Ptr<NetDevice> device);
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
  virtual uint32_t GetNInterfaces (void);  
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
    77
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
    78
  virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const;
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
    79
  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
    80
    Ipv4Mask mask) const;
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
    81
593
90cf12cb4ab7 merge with trunk
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568 540
diff changeset
    82
  virtual Ptr<NetDevice> GetNetDevice(uint32_t i);
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
1428
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    84
  virtual void JoinMulticastGroup (Ipv4Address origin, Ipv4Address group);
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    85
  virtual void LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group);
a8f3d01d4a2c untested multicast support
Craig Dowell <craigdo@ee.washington.edu>
parents: 985
diff changeset
    86
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  virtual void SetAddress (uint32_t i, Ipv4Address address);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
  virtual void SetNetworkMask (uint32_t i, Ipv4Mask mask);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
  virtual Ipv4Mask GetNetworkMask (uint32_t t) const;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
  virtual Ipv4Address GetAddress (uint32_t i) const;
1776
0d5be0c3d229 Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents: 1452
diff changeset
    91
  virtual void SetMetric (uint32_t i, uint16_t metric);
0d5be0c3d229 Add support for non-unit-cost metrics for Ipv4Interfaces (for use in routing); add example script simple-alternate-routing.cc
Tom Henderson <tomh@tomh.org>
parents: 1452
diff changeset
    92
  virtual uint16_t GetMetric (uint32_t i) const;
1434
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
    93
  virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const;
1452
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1444
diff changeset
    94
  virtual bool GetIfIndexForDestination (Ipv4Address dest, 
973c456d3684 socket update broke multicast
Craig Dowell <craigdo@ee.washington.edu>
parents: 1444
diff changeset
    95
    uint32_t &ifIndex) const;
1434
2b63aafb050b set source address in socket
Craig Dowell <craigdo@ee.washington.edu>
parents: 1428
diff changeset
    96
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
  virtual uint16_t GetMtu (uint32_t i) const;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
  virtual bool IsUp (uint32_t i) const;
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
  virtual void SetUp (uint32_t i);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
  virtual void SetDown (uint32_t i);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
protected:
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
  virtual void DoDispose (void);
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
private:
734
039fb338b6e9 Ipv4 -> Ipv4L3Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 593
diff changeset
   104
  Ptr<Ipv4L3Protocol> m_ipv4;
522
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
};
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
} // namespace ns3
d5039448597a remove Node::GetIpv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
745
221fda1d30f8 IIpv4Impl -> Ipv4Impl
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 737
diff changeset
   109
#endif /* IPV4_IMPL_H */