author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 10 Aug 2007 15:47:13 +0200 | |
changeset 1333 | c0d66de933e9 |
parent 1325 | f3be9eed2d90 |
child 1341 | f685d4bf320f |
permissions | -rw-r--r-- |
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) 2006 Georgia Tech Research Corporation |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
// All rights reserved. |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
// |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
// 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
|
7 |
// 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
|
8 |
// published by the Free Software Foundation; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
// |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
// 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
|
11 |
// 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
|
12 |
// 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
|
13 |
// GNU General Public License for more details. |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
// |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
// 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
|
16 |
// 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
|
17 |
// 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
|
18 |
// |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
// Author: George F. Riley<riley@ece.gatech.edu> |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
// |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
|
752
a4febfb8416f
IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
734
diff
changeset
|
22 |
#ifndef IPV4_L3_PROTOCOL_H |
a4febfb8416f
IIpv4 -> Ipv4
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
734
diff
changeset
|
23 |
#define IPV4_L3_PROTOCOL_H |
236
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> |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include <stdint.h> |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
293
diff
changeset
|
27 |
#include "ns3/callback-trace-source.h" |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
28 |
#include "ns3/trace-context-element.h" |
524
082ffdd8fbd7
move code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
513
diff
changeset
|
29 |
#include "ns3/ipv4-address.h" |
555
4d3b2a77bc92
convert Node * to Ptr<Node>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
30 |
#include "ns3/ptr.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:
752
diff
changeset
|
31 |
#include "ns3/ipv4.h" |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
32 |
#include "ipv4-header.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:
752
diff
changeset
|
33 |
#include "ipv4-static-routing.h" |
236
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 |
namespace ns3 { |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
class Packet; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
38 |
class NetDevice; |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
548
diff
changeset
|
39 |
class Ipv4Interface; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
class Ipv4Address; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
class Ipv4Header; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
class Ipv4Route; |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
639
diff
changeset
|
43 |
class Node; |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
293
diff
changeset
|
44 |
class TraceResolver; |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
293
diff
changeset
|
45 |
class TraceContext; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
|
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
47 |
class Ipv4L3ProtocolTraceContextElement : public TraceContextElement |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
48 |
{ |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
49 |
public: |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
50 |
enum Type { |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
51 |
TX, |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
52 |
RX, |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
53 |
DROP, |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
54 |
}; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
55 |
Ipv4L3ProtocolTraceContextElement (); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
56 |
Ipv4L3ProtocolTraceContextElement (enum Type type); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
57 |
bool IsTx (void) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
58 |
bool IsRx (void) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
59 |
bool IsDrop (void) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
60 |
void Print (std::ostream &os) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
61 |
static uint16_t GetUid (void); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
62 |
private: |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
63 |
enum Type m_type; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
64 |
}; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
65 |
|
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
66 |
class Ipv4l3ProtocolInterfaceIndex : public TraceContextElement |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
67 |
{ |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
68 |
public: |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
69 |
Ipv4l3ProtocolInterfaceIndex (); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
70 |
Ipv4l3ProtocolInterfaceIndex (uint32_t index); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
71 |
uint32_t Get (void) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
72 |
void Print (std::ostream &os) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
73 |
static uint16_t GetUid (void); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
74 |
private: |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
75 |
uint32_t m_index; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
76 |
}; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1195
diff
changeset
|
77 |
|
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
|
1176
4894ea885c0f
implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
983
diff
changeset
|
79 |
class Ipv4L3Protocol : public Object |
293
007bc9e735f3
remove Ipv4L3Protocol class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
80 |
{ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
public: |
1176
4894ea885c0f
implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
983
diff
changeset
|
82 |
static const InterfaceId iid; |
293
007bc9e735f3
remove Ipv4L3Protocol class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
83 |
static const uint16_t PROT_NUMBER; |
007bc9e735f3
remove Ipv4L3Protocol class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
242
diff
changeset
|
84 |
|
734
039fb338b6e9
Ipv4 -> Ipv4L3Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
733
diff
changeset
|
85 |
Ipv4L3Protocol(Ptr<Node> node); |
039fb338b6e9
Ipv4 -> Ipv4L3Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
733
diff
changeset
|
86 |
virtual ~Ipv4L3Protocol (); |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
|
406
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
88 |
/** |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
89 |
* \param context the trace context to use to construct the |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
90 |
* TraceResolver to return |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
91 |
* \returns a TraceResolver which can resolve all traces |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
92 |
* performed in this object. The caller must |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
93 |
* delete the returned object. |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
94 |
*/ |
1333
c0d66de933e9
convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1325
diff
changeset
|
95 |
virtual Ptr<TraceResolver> CreateTraceResolver (void); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
293
diff
changeset
|
96 |
|
406
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
97 |
/** |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
98 |
* \param ttl default ttl to use |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
99 |
* |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
100 |
* When we need to send an ipv4 packet, we use this default |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
101 |
* ttl value. |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
102 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
void SetDefaultTtl (uint8_t ttl); |
406
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
104 |
|
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
105 |
/** |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
106 |
* \param device the device to match |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
107 |
* \returns the matching interface, zero if not found. |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
108 |
* |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
109 |
* Try to find an Ipv4Interface whose NetDevice is equal to |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
110 |
* the input NetDevice. |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
111 |
*/ |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
555
diff
changeset
|
112 |
Ipv4Interface *FindInterfaceForDevice (Ptr<const NetDevice> device); |
236
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 |
* Lower layer calls this method after calling L3Demux::Lookup |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
* The ARP subclass needs to know from which NetDevice this |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
* packet is coming to: |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
* - implement a per-NetDevice ARP cache |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
* - send back arp replies on the right device |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
*/ |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1176
diff
changeset
|
121 |
void Receive( Ptr<NetDevice> device, const Packet& p, uint16_t protocol, const Address &from); |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
|
406
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
123 |
/** |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
124 |
* \param packet packet to send |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
125 |
* \param source source address of packet |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
126 |
* \param destination address of packet |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
127 |
* \param protocol number of packet |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
128 |
* |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
129 |
* Higher-level layers call this method to send a packet |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
130 |
* down the stack to the MAC and PHY layers. |
c3f72daa6430
doxygen for Ipv4 class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
345
diff
changeset
|
131 |
*/ |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
void Send (Packet const &packet, Ipv4Address source, |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
Ipv4Address destination, uint8_t protocol); |
237
6562b2679455
make Send method public
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
236
diff
changeset
|
134 |
|
639
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
135 |
|
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
136 |
|
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
137 |
void AddHostRouteTo (Ipv4Address dest, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
138 |
Ipv4Address nextHop, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
139 |
uint32_t interface); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
140 |
void AddHostRouteTo (Ipv4Address dest, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
141 |
uint32_t interface); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
142 |
|
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
143 |
void AddNetworkRouteTo (Ipv4Address network, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
144 |
Ipv4Mask networkMask, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
145 |
Ipv4Address nextHop, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
146 |
uint32_t interface); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
147 |
void AddNetworkRouteTo (Ipv4Address network, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
148 |
Ipv4Mask networkMask, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
149 |
uint32_t interface); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
150 |
void SetDefaultRoute (Ipv4Address nextHop, |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
151 |
uint32_t interface); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
152 |
|
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:
752
diff
changeset
|
153 |
void Lookup (Ipv4Header const &ipHeader, |
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:
752
diff
changeset
|
154 |
Packet 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:
752
diff
changeset
|
155 |
Ipv4RoutingProtocol::RouteReplyCallback routeReply); |
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:
752
diff
changeset
|
156 |
|
639
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
157 |
uint32_t GetNRoutes (void); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
158 |
Ipv4Route *GetRoute (uint32_t i); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
159 |
void RemoveRoute (uint32_t i); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
160 |
|
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
161 |
uint32_t AddInterface (Ptr<NetDevice> device); |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
162 |
Ipv4Interface * GetInterface (uint32_t i) const; |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
163 |
uint32_t GetNInterfaces (void) const; |
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
164 |
|
4e3a1dc4b1e4
cleanup old dox and reorg header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
633
diff
changeset
|
165 |
|
444
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
166 |
void SetAddress (uint32_t i, Ipv4Address address); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
167 |
void SetNetworkMask (uint32_t i, Ipv4Mask mask); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
168 |
Ipv4Mask GetNetworkMask (uint32_t t) const; |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
169 |
Ipv4Address GetAddress (uint32_t i) const; |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
170 |
uint16_t GetMtu (uint32_t i) const; |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
171 |
bool IsUp (uint32_t i) const; |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
172 |
void SetUp (uint32_t i); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
173 |
void SetDown (uint32_t i); |
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
174 |
|
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:
752
diff
changeset
|
175 |
void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, |
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:
752
diff
changeset
|
176 |
int priority); |
444
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
177 |
|
513
b7c7ea629de9
make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
504
diff
changeset
|
178 |
protected: |
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:
752
diff
changeset
|
179 |
|
513
b7c7ea629de9
make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
504
diff
changeset
|
180 |
virtual void DoDispose (void); |
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:
752
diff
changeset
|
181 |
|
513
b7c7ea629de9
make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
504
diff
changeset
|
182 |
private: |
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:
752
diff
changeset
|
183 |
|
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:
752
diff
changeset
|
184 |
void SendRealOut (bool found, |
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:
752
diff
changeset
|
185 |
Ipv4Route const &route, |
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:
752
diff
changeset
|
186 |
Packet 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:
752
diff
changeset
|
187 |
Ipv4Header const &ipHeader); |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
555
diff
changeset
|
188 |
bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, Ptr<NetDevice> device); |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
void ForwardUp (Packet p, Ipv4Header const&ip); |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
548
diff
changeset
|
190 |
uint32_t AddIpv4Interface (Ipv4Interface *interface); |
444
1647ca57f19d
remove ipv4 interface from public API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
415
diff
changeset
|
191 |
void SetupLoopback (void); |
1333
c0d66de933e9
convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1325
diff
changeset
|
192 |
Ptr<TraceResolver> InterfacesCreateTraceResolver (void) const; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
193 |
|
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
548
diff
changeset
|
194 |
typedef std::list<Ipv4Interface*> Ipv4InterfaceList; |
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:
752
diff
changeset
|
195 |
typedef std::list< std::pair< int, Ptr<Ipv4RoutingProtocol> > > Ipv4RoutingProtocolList; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
196 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
197 |
Ipv4InterfaceList m_interfaces; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
198 |
uint32_t m_nInterfaces; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
199 |
uint8_t m_defaultTtl; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
200 |
uint16_t m_identification; |
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
639
diff
changeset
|
201 |
Ptr<Node> m_node; |
457
a468fac09924
add context information to tx and rx trace callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
406
diff
changeset
|
202 |
CallbackTraceSource<Packet const &, uint32_t> m_txTrace; |
a468fac09924
add context information to tx and rx trace callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
406
diff
changeset
|
203 |
CallbackTraceSource<Packet const &, uint32_t> m_rxTrace; |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
293
diff
changeset
|
204 |
CallbackTraceSource<Packet const &> m_dropTrace; |
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:
752
diff
changeset
|
205 |
|
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:
752
diff
changeset
|
206 |
Ipv4RoutingProtocolList m_routingProtocols; |
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:
752
diff
changeset
|
207 |
|
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:
752
diff
changeset
|
208 |
Ptr<Ipv4StaticRouting> m_staticRouting; |
236
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
209 |
}; |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
210 |
|
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
} // Namespace ns3 |
5673656dc2e7
a basic untested ipv4 implementation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
212 |
|
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:
752
diff
changeset
|
213 |
#endif /* IPV4_L3_PROTOCOL_H */ |