author | Vedran Miletić <rivanvx@gmail.com> |
Tue, 02 Aug 2011 17:42:33 -0400 | |
changeset 7385 | 10beb0e53130 |
parent 7256 | b04ba6772f8c |
child 9915 | d4c2228d3c30 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7256
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
236
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" |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
27 |
#include "ns3/ipv4-interface-address.h" |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
28 |
#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
|
29 |
#include "ns3/object.h" |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
namespace ns3 { |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
class NetDevice; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
class Packet; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
35 |
class Node; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
36 |
class ArpCache; |
236
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 |
/** |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
39 |
* \brief The IPv4 representation of a network interface |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
* |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
* 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
|
42 |
* 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
|
43 |
* specific information (addresses) about an interface. |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
* |
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
45 |
* By default, Ipv4 interface are created in the "down" state |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
46 |
* no IP addresses. Before becoming useable, the user must |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
47 |
* add an address of some type and invoke Setup on them. |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
*/ |
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
|
49 |
class Ipv4Interface : public Object |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
{ |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
public: |
2936
d108e5f0bd3e
define a TypeId for ns3::Ipv4Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
52 |
static TypeId GetTypeId (void); |
d108e5f0bd3e
define a TypeId for ns3::Ipv4Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
53 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2542
diff
changeset
|
54 |
Ipv4Interface (); |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
virtual ~Ipv4Interface(); |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
57 |
void SetNode (Ptr<Node> node); |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
58 |
void SetDevice (Ptr<NetDevice> device); |
5681
795c049199c5
Includes cleanup + layer 2 link failure detection (untested)
Pavel Boyko <boyko@iitp.ru>
parents:
4607
diff
changeset
|
59 |
void SetArpCache (Ptr<ArpCache>); |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
60 |
|
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
61 |
/** |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
62 |
* \returns the underlying NetDevice. This method cannot return zero. |
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
63 |
*/ |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
64 |
Ptr<NetDevice> GetDevice (void) const; |
5681
795c049199c5
Includes cleanup + layer 2 link failure detection (untested)
Pavel Boyko <boyko@iitp.ru>
parents:
4607
diff
changeset
|
65 |
/** |
795c049199c5
Includes cleanup + layer 2 link failure detection (untested)
Pavel Boyko <boyko@iitp.ru>
parents:
4607
diff
changeset
|
66 |
* \return ARP cache used by this interface |
795c049199c5
Includes cleanup + layer 2 link failure detection (untested)
Pavel Boyko <boyko@iitp.ru>
parents:
4607
diff
changeset
|
67 |
*/ |
795c049199c5
Includes cleanup + layer 2 link failure detection (untested)
Pavel Boyko <boyko@iitp.ru>
parents:
4607
diff
changeset
|
68 |
Ptr<ArpCache> GetArpCache () const; |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
69 |
|
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
70 |
/** |
1795
820cc1254290
get rid of doxygen warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1776
diff
changeset
|
71 |
* \param metric configured routing metric (cost) of this interface |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
72 |
* |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
73 |
* Note: This is synonymous to the Metric value that ifconfig prints |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
74 |
* out. It is used by ns-3 global routing, but other routing daemons |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
75 |
* choose to ignore it. |
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
|
76 |
*/ |
1795
820cc1254290
get rid of doxygen warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1776
diff
changeset
|
77 |
void SetMetric (uint16_t metric); |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
78 |
|
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
|
79 |
/** |
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
|
80 |
* \returns configured routing metric (cost) of this interface |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
81 |
* |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
82 |
* Note: This is synonymous to the Metric value that ifconfig prints |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
83 |
* out. It is used by ns-3 global routing, but other routing daemons |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
84 |
* may choose to ignore it. |
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
|
85 |
*/ |
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
|
86 |
uint16_t GetMetric (void) const; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
/** |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
* 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
|
90 |
* NetDevice states, such as found in real implementations |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
* (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
|
92 |
*/ |
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
93 |
/** |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
94 |
* \returns true if this interface is enabled, false otherwise. |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
95 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
bool IsUp (void) const; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
97 |
|
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
98 |
/** |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
99 |
* \returns true if this interface is disabled, false otherwise. |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
100 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
bool IsDown (void) const; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
102 |
|
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
103 |
/** |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
104 |
* Enable this interface |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
105 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
void SetUp (void); |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
107 |
|
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
108 |
/** |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
109 |
* Disable this interface |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
110 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
void SetDown (void); |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
/** |
4607
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
114 |
* \returns true if this interface is enabled for IP forwarding of input datagrams |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
115 |
*/ |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
116 |
bool IsForwarding (void) const; |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
117 |
|
4607
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
118 |
/** |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
119 |
* \param val Whether to enable or disable IP forwarding for input datagrams |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
120 |
*/ |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
121 |
void SetForwarding (bool val); |
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
122 |
|
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
123 |
/** |
404
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
124 |
* \param p packet to send |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
125 |
* \param dest next hop address of packet. |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
126 |
* |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
127 |
* This method will eventually call the private |
03d3d3d4eacc
document Ipv4Interface completely
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
128 |
* 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
|
129 |
*/ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7176
diff
changeset
|
130 |
void Send (Ptr<Packet> p, Ipv4Address dest); |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
|
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
132 |
/** |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
133 |
* \param address The Ipv4InterfaceAddress to add to the interface |
4563 | 134 |
* \returns true if succeeded |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
135 |
*/ |
4563 | 136 |
bool AddAddress (Ipv4InterfaceAddress address); |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
137 |
|
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
138 |
/** |
4481 | 139 |
* \param index Index of Ipv4InterfaceAddress to return |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
140 |
* \returns The Ipv4InterfaceAddress address whose index is i |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
141 |
*/ |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
142 |
Ipv4InterfaceAddress GetAddress (uint32_t index) const; |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
143 |
|
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
144 |
/** |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
145 |
* \returns the number of Ipv4InterfaceAddresss stored on this interface |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
146 |
*/ |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
147 |
uint32_t GetNAddresses (void) const; |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
148 |
|
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
149 |
/** |
4563 | 150 |
* \param index Index of Ipv4InterfaceAddress to remove |
151 |
* \returns The Ipv4InterfaceAddress address whose index is index |
|
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
152 |
*/ |
4563 | 153 |
Ipv4InterfaceAddress RemoveAddress (uint32_t index); |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
154 |
|
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
|
155 |
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
|
156 |
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
|
157 |
private: |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
158 |
void DoSetup (void); |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
159 |
typedef std::list<Ipv4InterfaceAddress> Ipv4InterfaceAddressList; |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
160 |
typedef std::list<Ipv4InterfaceAddress>::const_iterator Ipv4InterfaceAddressListCI; |
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
161 |
typedef std::list<Ipv4InterfaceAddress>::iterator Ipv4InterfaceAddressListI; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
162 |
|
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
163 |
bool m_ifup; |
4607
0e15594f67f3
bug 63: allow enabling or disabling ip forwarding on a per-interface basis
Tom Henderson <tomh@tomh.org>
parents:
4572
diff
changeset
|
164 |
bool m_forwarding; // IN_DEV_FORWARD |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
165 |
uint16_t m_metric; |
4373
e493e80274bd
implementation and plumbing of Ipv4InterfaceAddress class
Tom Henderson <tomh@tomh.org>
parents:
3266
diff
changeset
|
166 |
Ipv4InterfaceAddressList m_ifaddrs; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
167 |
Ptr<Node> m_node; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
168 |
Ptr<NetDevice> m_device; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
169 |
Ptr<ArpCache> m_cache; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
}; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
171 |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4375
diff
changeset
|
172 |
} // namespace ns3 |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
173 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
174 |
#endif |