author | Tom Henderson <tomh@tomh.org> |
Mon, 03 Jan 2011 15:51:55 -0800 | |
changeset 6768 | 805f5fc7f670 |
parent 6723 | fff5c512f345 |
permissions | -rw-r--r-- |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
2 |
/* |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 Georgia Tech Research Corporation |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
4 |
* |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
8 |
* |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
13 |
* |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
17 |
* |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
18 |
* Author: Raj Bhattacharjea <raj.b@gatech.edu> |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
19 |
*/ |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
20 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
21 |
#include "ns3/assert.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
22 |
#include "ns3/log.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
23 |
#include "ns3/nstime.h" |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
24 |
#include "ns3/boolean.h" |
4283
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
25 |
#include "ns3/object-vector.h" |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
26 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
27 |
#include "ns3/packet.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
28 |
#include "ns3/node.h" |
5887 | 29 |
#include "ns3/simulator.h" |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
30 |
#include "ns3/ipv4-route.h" |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
31 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
32 |
#include "tcp-l4-protocol.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
33 |
#include "tcp-header.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
34 |
#include "ipv4-end-point-demux.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
35 |
#include "ipv4-end-point.h" |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
36 |
#include "ipv4-l3-protocol.h" |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
37 |
#include "tcp-socket-factory-impl.h" |
6694 | 38 |
#include "tcp-newreno.h" |
4740
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
39 |
#include "rtt-estimator.h" |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
40 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
41 |
#include <vector> |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
42 |
#include <sstream> |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
43 |
#include <iomanip> |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
44 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
45 |
NS_LOG_COMPONENT_DEFINE ("TcpL4Protocol"); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
46 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
47 |
namespace ns3 { |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
48 |
|
2501
3eaeac1dd5ed
add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
49 |
NS_OBJECT_ENSURE_REGISTERED (TcpL4Protocol); |
3eaeac1dd5ed
add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2498
diff
changeset
|
50 |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
51 |
//TcpL4Protocol stuff---------------------------------------------------------- |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
52 |
|
5887 | 53 |
#undef NS_LOG_APPEND_CONTEXT |
54 |
#define NS_LOG_APPEND_CONTEXT \ |
|
55 |
if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
56 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
57 |
/* see http://www.iana.org/assignments/protocol-numbers */ |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
58 |
const uint8_t TcpL4Protocol::PROT_NUMBER = 6; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
59 |
|
2498
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
60 |
TypeId |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
61 |
TcpL4Protocol::GetTypeId (void) |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
62 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
63 |
static TypeId tid = TypeId ("ns3::TcpL4Protocol") |
2498
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
64 |
.SetParent<Ipv4L4Protocol> () |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
65 |
.AddConstructor<TcpL4Protocol> () |
6694 | 66 |
.AddAttribute ("RttEstimatorType", |
67 |
"Type of RttEstimator objects.", |
|
68 |
TypeIdValue (RttMeanDeviation::GetTypeId()), |
|
69 |
MakeTypeIdAccessor (&TcpL4Protocol::m_rttTypeId), |
|
70 |
MakeTypeIdChecker ()) |
|
71 |
.AddAttribute ("SocketType", |
|
72 |
"Socket type of TCP objects.", |
|
73 |
TypeIdValue (TcpNewReno::GetTypeId()), |
|
74 |
MakeTypeIdAccessor (&TcpL4Protocol::m_socketTypeId), |
|
75 |
MakeTypeIdChecker ()) |
|
4283
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
76 |
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.", |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
77 |
ObjectVectorValue (), |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
78 |
MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets), |
6694 | 79 |
MakeObjectVectorChecker<TcpSocketBase> ()) |
2498
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
80 |
; |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
81 |
return tid; |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
82 |
} |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
83 |
|
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
84 |
TcpL4Protocol::TcpL4Protocol () |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
85 |
: m_endPoints (new Ipv4EndPointDemux ()) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
86 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
87 |
NS_LOG_FUNCTION_NOARGS (); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
88 |
NS_LOG_LOGIC("Made a TcpL4Protocol "<<this); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
89 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
90 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
91 |
TcpL4Protocol::~TcpL4Protocol () |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
92 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
93 |
NS_LOG_FUNCTION_NOARGS (); |
2498
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
94 |
} |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
95 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
96 |
void |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
97 |
TcpL4Protocol::SetNode (Ptr<Node> node) |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
98 |
{ |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
99 |
m_node = node; |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
100 |
} |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
101 |
|
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
102 |
/* |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
103 |
* This method is called by AddAgregate and completes the aggregation |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
104 |
* by setting the node in the TCP stack, link it to the ipv4 stack and |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
105 |
* adding TCP socket factory to the node. |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
106 |
*/ |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
107 |
void |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
108 |
TcpL4Protocol::NotifyNewAggregate () |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
109 |
{ |
4669
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
110 |
if (m_node == 0) |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
111 |
{ |
4669
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
112 |
Ptr<Node> node = this->GetObject<Node> (); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
113 |
if (node != 0) |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
114 |
{ |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
115 |
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> (); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
116 |
if (ipv4 != 0) |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
117 |
{ |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
118 |
this->SetNode (node); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
119 |
ipv4->Insert (this); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
120 |
Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> (); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
121 |
tcpFactory->SetTcp (this); |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
122 |
node->AggregateObject (tcpFactory); |
6723
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
123 |
this->SetDownTarget (MakeCallback(&Ipv4L3Protocol::Send, ipv4)); |
4669
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
124 |
} |
8aaa5e83939e
avoid excessive calls to GetObject during topology construction
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4603
diff
changeset
|
125 |
} |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
126 |
} |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
127 |
Object::NotifyNewAggregate (); |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
128 |
} |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
129 |
|
2498
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
130 |
int |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
131 |
TcpL4Protocol::GetProtocolNumber (void) const |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
132 |
{ |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
133 |
return PROT_NUMBER; |
e01570293b98
convert InternetNode to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2257
diff
changeset
|
134 |
} |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
135 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
136 |
void |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
137 |
TcpL4Protocol::DoDispose (void) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
138 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
139 |
NS_LOG_FUNCTION_NOARGS (); |
6694 | 140 |
for (std::vector<Ptr<TcpSocketBase> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++) |
4283
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
141 |
{ |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
142 |
*i = 0; |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
143 |
} |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
144 |
m_sockets.clear (); |
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
145 |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
146 |
if (m_endPoints != 0) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
147 |
{ |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
148 |
delete m_endPoints; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
149 |
m_endPoints = 0; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
150 |
} |
4283
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
151 |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
152 |
m_node = 0; |
6723
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
153 |
m_downTarget.Nullify (); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
154 |
Ipv4L4Protocol::DoDispose (); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
155 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
156 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
157 |
Ptr<Socket> |
6694 | 158 |
TcpL4Protocol::CreateSocket (TypeId socketTypeId) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
159 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
160 |
NS_LOG_FUNCTION_NOARGS (); |
6694 | 161 |
ObjectFactory rttFactory; |
162 |
ObjectFactory socketFactory; |
|
163 |
rttFactory.SetTypeId(m_rttTypeId); |
|
164 |
socketFactory.SetTypeId(socketTypeId); |
|
165 |
Ptr<RttEstimator> rtt = rttFactory.Create<RttEstimator> (); |
|
166 |
Ptr<TcpSocketBase> socket = socketFactory.Create<TcpSocketBase> (); |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
167 |
socket->SetNode (m_node); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
168 |
socket->SetTcp (this); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2564
diff
changeset
|
169 |
socket->SetRtt (rtt); |
4283
5854cddf4493
Bugs 458, swap 2 LOC for 526
Craig Dowell <craigdo@ee.washington.edu>
parents:
3976
diff
changeset
|
170 |
m_sockets.push_back (socket); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
171 |
return socket; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
172 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
173 |
|
6694 | 174 |
Ptr<Socket> |
175 |
TcpL4Protocol::CreateSocket (void) |
|
176 |
{ |
|
177 |
return CreateSocket (m_socketTypeId); |
|
178 |
} |
|
179 |
||
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
180 |
Ipv4EndPoint * |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
181 |
TcpL4Protocol::Allocate (void) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
182 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
183 |
NS_LOG_FUNCTION_NOARGS (); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
184 |
return m_endPoints->Allocate (); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
185 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
186 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
187 |
Ipv4EndPoint * |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
188 |
TcpL4Protocol::Allocate (Ipv4Address address) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
189 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
190 |
NS_LOG_FUNCTION (this << address); |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
191 |
return m_endPoints->Allocate (address); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
192 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
193 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
194 |
Ipv4EndPoint * |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
195 |
TcpL4Protocol::Allocate (uint16_t port) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
196 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
197 |
NS_LOG_FUNCTION (this << port); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
198 |
return m_endPoints->Allocate (port); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
199 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
200 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
201 |
Ipv4EndPoint * |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
202 |
TcpL4Protocol::Allocate (Ipv4Address address, uint16_t port) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
203 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
204 |
NS_LOG_FUNCTION (this << address << port); |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
205 |
return m_endPoints->Allocate (address, port); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
206 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
207 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
208 |
Ipv4EndPoint * |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
209 |
TcpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort, |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
210 |
Ipv4Address peerAddress, uint16_t peerPort) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
211 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
212 |
NS_LOG_FUNCTION (this << localAddress << localPort << peerAddress << peerPort); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
213 |
return m_endPoints->Allocate (localAddress, localPort, |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
214 |
peerAddress, peerPort); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
215 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
216 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
217 |
void |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
218 |
TcpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
219 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2608
diff
changeset
|
220 |
NS_LOG_FUNCTION (this << endPoint); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
221 |
m_endPoints->DeAllocate (endPoint); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
222 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
223 |
|
3820 | 224 |
enum Ipv4L4Protocol::RxStatus |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
225 |
TcpL4Protocol::Receive (Ptr<Packet> packet, |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
226 |
Ipv4Header const &ipHeader, |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
227 |
Ptr<Ipv4Interface> incomingInterface) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
228 |
{ |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
229 |
NS_LOG_FUNCTION (this << packet << ipHeader << incomingInterface); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
230 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
231 |
TcpHeader tcpHeader; |
4558
31e9053749bb
bug 491: It is painful to enable all checksums
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4472
diff
changeset
|
232 |
if(Node::ChecksumEnabled ()) |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
233 |
{ |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
234 |
tcpHeader.EnableChecksums(); |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
235 |
tcpHeader.InitializeChecksum (ipHeader.GetSource (), ipHeader.GetDestination (), PROT_NUMBER); |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
236 |
} |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
237 |
|
3364
8e6ac6061680
implement Packet::PeekHeader and Packet::PeekTrailer to avoid evil workarounds when receiving tcp packets.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3363
diff
changeset
|
238 |
packet->PeekHeader (tcpHeader); |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
239 |
|
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
240 |
NS_LOG_LOGIC("TcpL4Protocol " << this |
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
241 |
<< " receiving seq " << tcpHeader.GetSequenceNumber() |
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
242 |
<< " ack " << tcpHeader.GetAckNumber() |
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
243 |
<< " flags "<< std::hex << (int)tcpHeader.GetFlags() << std::dec |
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
244 |
<< " data size " << packet->GetSize()); |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
245 |
|
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
246 |
if(!tcpHeader.IsChecksumOk ()) |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
247 |
{ |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
248 |
NS_LOG_INFO("Bad checksum, dropping packet!"); |
3820 | 249 |
return Ipv4L4Protocol::RX_CSUM_FAILED; |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
250 |
} |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
251 |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
252 |
NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" received a packet"); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
253 |
Ipv4EndPointDemux::EndPoints endPoints = |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
254 |
m_endPoints->Lookup (ipHeader.GetDestination (), tcpHeader.GetDestinationPort (), |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
255 |
ipHeader.GetSource (), tcpHeader.GetSourcePort (),incomingInterface); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
256 |
if (endPoints.empty ()) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
257 |
{ |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
258 |
NS_LOG_LOGIC (" No endpoints matched on TcpL4Protocol "<<this); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
259 |
std::ostringstream oss; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
260 |
oss<<" destination IP: "; |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
261 |
ipHeader.GetDestination ().Print (oss); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
262 |
oss<<" destination port: "<< tcpHeader.GetDestinationPort ()<<" source IP: "; |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
263 |
ipHeader.GetSource ().Print (oss); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
264 |
oss<<" source port: "<<tcpHeader.GetSourcePort (); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
265 |
NS_LOG_LOGIC (oss.str ()); |
5380 | 266 |
|
267 |
if (!(tcpHeader.GetFlags () & TcpHeader::RST)) |
|
268 |
{ |
|
269 |
// build a RST packet and send |
|
270 |
Ptr<Packet> rstPacket = Create<Packet> (); |
|
271 |
TcpHeader header; |
|
272 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
|
273 |
{ |
|
274 |
// ACK bit was set |
|
275 |
header.SetFlags (TcpHeader::RST); |
|
276 |
header.SetSequenceNumber (header.GetAckNumber ()); |
|
277 |
} |
|
278 |
else |
|
279 |
{ |
|
280 |
header.SetFlags (TcpHeader::RST | TcpHeader::ACK); |
|
6434
ac8b4bf77e50
Bug 385 - Add a generic "sequence number" class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6255
diff
changeset
|
281 |
header.SetSequenceNumber (SequenceNumber32 (0)); |
ac8b4bf77e50
Bug 385 - Add a generic "sequence number" class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6255
diff
changeset
|
282 |
header.SetAckNumber (header.GetSequenceNumber () + SequenceNumber32 (1)); |
5380 | 283 |
} |
284 |
header.SetSourcePort (tcpHeader.GetDestinationPort ()); |
|
285 |
header.SetDestinationPort (tcpHeader.GetSourcePort ()); |
|
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
286 |
SendPacket (rstPacket, header, ipHeader.GetDestination (), ipHeader.GetSource ()); |
5380 | 287 |
return Ipv4L4Protocol::RX_ENDPOINT_CLOSED; |
288 |
} |
|
289 |
else |
|
290 |
{ |
|
291 |
return Ipv4L4Protocol::RX_ENDPOINT_CLOSED; |
|
292 |
} |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
293 |
} |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
294 |
NS_ASSERT_MSG (endPoints.size() == 1 , "Demux returned more than one endpoint"); |
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
295 |
NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket"); |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
296 |
(*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort (), |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6434
diff
changeset
|
297 |
incomingInterface); |
3820 | 298 |
return Ipv4L4Protocol::RX_OK; |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
299 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
300 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
301 |
void |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
302 |
TcpL4Protocol::Send (Ptr<Packet> packet, |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
303 |
Ipv4Address saddr, Ipv4Address daddr, |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5715
diff
changeset
|
304 |
uint16_t sport, uint16_t dport, Ptr<NetDevice> oif) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
305 |
{ |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5715
diff
changeset
|
306 |
NS_LOG_FUNCTION (this << packet << saddr << daddr << sport << dport << oif); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
307 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
308 |
TcpHeader tcpHeader; |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
309 |
tcpHeader.SetDestinationPort (dport); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
310 |
tcpHeader.SetSourcePort (sport); |
4558
31e9053749bb
bug 491: It is painful to enable all checksums
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4472
diff
changeset
|
311 |
if(Node::ChecksumEnabled ()) |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
312 |
{ |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
313 |
tcpHeader.EnableChecksums(); |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
314 |
} |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
315 |
tcpHeader.InitializeChecksum (saddr, |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
316 |
daddr, |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
317 |
PROT_NUMBER); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
318 |
tcpHeader.SetFlags (TcpHeader::ACK); |
6434
ac8b4bf77e50
Bug 385 - Add a generic "sequence number" class.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6255
diff
changeset
|
319 |
tcpHeader.SetAckNumber (SequenceNumber32 (0)); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
320 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
321 |
packet->AddHeader (tcpHeader); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
322 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
323 |
Ptr<Ipv4L3Protocol> ipv4 = |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2255
diff
changeset
|
324 |
m_node->GetObject<Ipv4L3Protocol> (); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
325 |
if (ipv4 != 0) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
326 |
{ |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
327 |
Ipv4Header header; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
328 |
header.SetDestination (daddr); |
5680
25c3039f4144
problem with protocol number fixed
Borovkova Elena <borovkovaes@iitp.ru>
parents:
4669
diff
changeset
|
329 |
header.SetProtocol (PROT_NUMBER); |
4567
32ca321e4fe7
Bug 597: Ns-3 doesn't compile under MingWin
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
4558
diff
changeset
|
330 |
Socket::SocketErrno errno_; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
331 |
Ptr<Ipv4Route> route; |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5715
diff
changeset
|
332 |
Ptr<NetDevice> oif (0); //specify non-zero if bound to a source address |
5984
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
333 |
if (ipv4->GetRoutingProtocol () != 0) |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
334 |
{ |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
335 |
route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
336 |
} |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
337 |
else |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
338 |
{ |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
339 |
NS_LOG_ERROR ("No IPV4 Routing Protocol"); |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
340 |
route = 0; |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
341 |
} |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
342 |
ipv4->Send (packet, saddr, daddr, PROT_NUMBER, route); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
343 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
344 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
345 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
346 |
void |
4740
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
347 |
TcpL4Protocol::SendPacket (Ptr<Packet> packet, const TcpHeader &outgoing, |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5715
diff
changeset
|
348 |
Ipv4Address saddr, Ipv4Address daddr, Ptr<NetDevice> oif) |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
349 |
{ |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
350 |
NS_LOG_LOGIC("TcpL4Protocol " << this |
4740
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
351 |
<< " sending seq " << outgoing.GetSequenceNumber() |
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
352 |
<< " ack " << outgoing.GetAckNumber() |
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
353 |
<< " flags " << std::hex << (int)outgoing.GetFlags() << std::dec |
2608
408589d1dfff
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
354 |
<< " data size " << packet->GetSize()); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti M?kel? <zarhan@cc.hut.fi>
parents:
5715
diff
changeset
|
355 |
NS_LOG_FUNCTION (this << packet << saddr << daddr << oif); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
356 |
// XXX outgoingHeader cannot be logged |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
357 |
|
4740
34acfd7ad508
export headers from internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4669
diff
changeset
|
358 |
TcpHeader outgoingHeader = outgoing; |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
359 |
outgoingHeader.SetLength (5); //header length in units of 32bit words |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
360 |
/* outgoingHeader.SetUrgentPointer (0); //XXX */ |
4558
31e9053749bb
bug 491: It is painful to enable all checksums
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4472
diff
changeset
|
361 |
if(Node::ChecksumEnabled ()) |
3363
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
362 |
{ |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
363 |
outgoingHeader.EnableChecksums(); |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
364 |
} |
33d1ca2e4ba4
bug 236: add optional support for tcp and udp checksum.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents:
3260
diff
changeset
|
365 |
outgoingHeader.InitializeChecksum(saddr, daddr, PROT_NUMBER); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
366 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
367 |
packet->AddHeader (outgoingHeader); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
368 |
|
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
369 |
Ptr<Ipv4L3Protocol> ipv4 = |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2255
diff
changeset
|
370 |
m_node->GetObject<Ipv4L3Protocol> (); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
371 |
if (ipv4 != 0) |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
372 |
{ |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
373 |
Ipv4Header header; |
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
374 |
header.SetDestination (daddr); |
5680
25c3039f4144
problem with protocol number fixed
Borovkova Elena <borovkovaes@iitp.ru>
parents:
4669
diff
changeset
|
375 |
header.SetProtocol (PROT_NUMBER); |
4567
32ca321e4fe7
Bug 597: Ns-3 doesn't compile under MingWin
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
4558
diff
changeset
|
376 |
Socket::SocketErrno errno_; |
4472
e20a31541404
src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents:
4283
diff
changeset
|
377 |
Ptr<Ipv4Route> route; |
5984
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
378 |
if (ipv4->GetRoutingProtocol () != 0) |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
379 |
{ |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
380 |
route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, oif, errno_); |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
381 |
} |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
382 |
else |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
383 |
{ |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
384 |
NS_LOG_ERROR ("No IPV4 Routing Protocol"); |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
385 |
route = 0; |
7a60b058e7b4
[bug 804] null pointer references in internet-stack
Bill Roome <wdr@bell-labs.com>
parents:
5971
diff
changeset
|
386 |
} |
6723
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
387 |
m_downTarget (packet, saddr, daddr, PROT_NUMBER, route); |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
388 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
389 |
else |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
390 |
NS_FATAL_ERROR("Trying to use Tcp on a node without an Ipv4 interface"); |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
391 |
} |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
392 |
|
6723
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
393 |
void |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
394 |
TcpL4Protocol::SetDownTarget (Ipv4L4Protocol::DownTargetCallback callback) |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
395 |
{ |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
396 |
m_downTarget = callback; |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
397 |
} |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
398 |
|
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
399 |
Ipv4L4Protocol::DownTargetCallback |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
400 |
TcpL4Protocol::GetDownTarget (void) const |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
401 |
{ |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
402 |
return m_downTarget; |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
403 |
} |
fff5c512f345
bug 967: decouple Ipv4L4Protocols from Ipv4L3Protocol::Send() via a new callback
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
404 |
|
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
405 |
}; // namespace ns3 |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
diff
changeset
|
406 |