src/internet-stack/ipv4-interface.h
author Raj Bhattacharjea <raj.b@gatech.edu>
Fri, 13 Jun 2008 16:47:07 -0400
changeset 3266 1ae7df5cf87b
parent 3260 8c0ab08144e6
child 4373 e493e80274bd
permissions -rw-r--r--
Update the internet-stack documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005,2006,2007 INRIA
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Authors: 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 *  Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 *  Tom Henderson <tomh@tomh.org>
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
 */
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#ifndef IPV4_INTERFACE_H
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#define IPV4_INTERFACE_H
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <list>
524
082ffdd8fbd7 move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 474
diff changeset
    26
#include "ns3/ipv4-address.h"
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 551
diff changeset
    27
#include "ns3/ptr.h"
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
    28
#include "ns3/object.h"
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
class NetDevice;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
class Packet;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
/**
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
 * \brief The IPv4 representation of a network interface
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
 * This class roughly corresponds to the struct in_device
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
 * of Linux; the main purpose is to provide address-family
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
 * specific information (addresses) about an interface.
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
 *
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
 * This class defines two APIs:
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
 *  - the public API which is expected to be used by both 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
 *    the IPv4 layer and the user during forwarding and 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
 *    configuration.
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
 *  - the private API which is expected to be implemented
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
 *    by subclasses of this base class. One such subclass 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
 *    will be a Loopback interface which loops every
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
 *    packet sent back to the ipv4 layer. Another such 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
 *    subclass typically contains the Ipv4 <-> MAC address
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
 *    translation logic which will use most of the time the
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
 *    ARP/RARP protocols.
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    53
 *
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    54
 * By default, Ipv4 interface are created in the "down" state
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    55
 * with ip address 192.168.0.1 and a matching mask. Before
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    56
 * becoming useable, the user must invoke SetUp on them
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    57
 * once the final Ipv4 address and mask has been set.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    58
 *
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    59
 * Subclasses must implement the two methods:
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    60
 *   - Ipv4Interface::SendTo
3266
1ae7df5cf87b Update the internet-stack documentation
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 3260
diff changeset
    61
 *   - Ipv4Interface::GetDevice
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
 */
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
    63
class Ipv4Interface  : public Object
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
{
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
public:
2936
d108e5f0bd3e define a TypeId for ns3::Ipv4Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    66
  static TypeId GetTypeId (void);
d108e5f0bd3e define a TypeId for ns3::Ipv4Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
    67
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2542
diff changeset
    68
  Ipv4Interface ();
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  virtual ~Ipv4Interface();
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    71
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    72
   * \returns the underlying NetDevice. This method can return
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    73
   *          zero if this interface has no associated NetDevice.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    74
   */
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2542
diff changeset
    75
  virtual Ptr<NetDevice> GetDevice (void) const = 0;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    77
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    78
   * \param a set the ipv4 address of this interface.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    79
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
  void SetAddress (Ipv4Address a);
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    81
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    82
   * \param mask set the ipv4 netmask of this interface.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    83
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
  void SetNetworkMask (Ipv4Mask mask);
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    86
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    87
   * \returns the broadcast ipv4 address associated to this interface
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    88
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
  Ipv4Address GetBroadcast (void) const;
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    90
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    91
   * \returns the ipv4 netmask of this interface
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    92
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  Ipv4Mask GetNetworkMask (void) const;
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    94
  /**
1795
820cc1254290 get rid of doxygen warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1776
diff changeset
    95
   * \param metric configured routing metric (cost) of this interface
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: 1341
diff changeset
    96
   */
1795
820cc1254290 get rid of doxygen warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1776
diff changeset
    97
  void SetMetric (uint16_t metric);
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: 1341
diff changeset
    98
  /**
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: 1341
diff changeset
    99
   * \returns configured routing metric (cost) of this interface
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: 1341
diff changeset
   100
   */
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: 1341
diff changeset
   101
  uint16_t GetMetric (void) const;
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: 1341
diff changeset
   102
  /**
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   103
   * \returns the ipv4 address of this interface
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   104
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
  Ipv4Address GetAddress (void) const;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
  /**
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
   * This function a pass-through to NetDevice GetMtu, modulo
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
   * the  LLC/SNAP header i.e., ipv4MTU = NetDeviceMtu - LLCSNAPSIZE
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   110
   * \returns the Maximum Transmission Unit associated to this interface.
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
   */
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
  uint16_t GetMtu (void) const;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
  /**
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
   * These are IP interface states and may be distinct from 
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
   * NetDevice states, such as found in real implementations
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
   * (where the device may be down but IP interface state is still up).
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
   */
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   119
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   120
   * \returns true if this interface is enabled, false otherwise.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   121
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
  bool IsUp (void) const;
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   123
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   124
   * \returns true if this interface is disabled, false otherwise.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   125
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
  bool IsDown (void) const;
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   127
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   128
   * Enable this interface
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   129
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
  void SetUp (void);
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   131
  /**
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   132
   * Disable this interface
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   133
   */
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
  void SetDown (void);
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
  /**
404
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   137
   * \param p packet to send
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   138
   * \param dest next hop address of packet.
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   139
   *
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   140
   * This method will eventually call the private
03d3d3d4eacc document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   141
   * SendTo method which must be implemented by subclasses.
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
   */ 
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1341
diff changeset
   143
  void Send(Ptr<Packet> p, Ipv4Address dest);
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   145
protected:
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   146
  virtual void DoDispose (void);
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   147
private:
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1341
diff changeset
   148
  virtual void SendTo (Ptr<Packet> p, Ipv4Address dest) = 0;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
  bool m_ifup;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  Ipv4Address m_address;
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  Ipv4Mask m_netmask;
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: 1341
diff changeset
   152
  uint16_t m_metric;
236
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
};
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
}; // namespace ns3
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
5673656dc2e7 a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
#endif