View | Details | Raw Unified | Return to bug 458
Collapse All | Expand All

(-)a/examples/tcp-large-transfer.cc (-4 / +9 lines)
 Lines 57-65   void StartFlow(Ptr<Socket>, Ipv4Address, Link Here 
57
void StartFlow(Ptr<Socket>, Ipv4Address, uint16_t);
57
void StartFlow(Ptr<Socket>, Ipv4Address, uint16_t);
58
void WriteUntilBufferFull (Ptr<Socket>, uint32_t);
58
void WriteUntilBufferFull (Ptr<Socket>, uint32_t);
59
59
60
static void 
61
CwndTracer (uint32_t oldval, uint32_t newval)
62
{
63
  NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval);
64
}
65
60
int main (int argc, char *argv[])
66
int main (int argc, char *argv[])
61
{
67
{
62
63
  // Users may find it convenient to turn on explicit debugging
68
  // Users may find it convenient to turn on explicit debugging
64
  // for selected modules; the below lines suggest how to do this
69
  // for selected modules; the below lines suggest how to do this
65
  //  LogComponentEnable("TcpL4Protocol", LOG_LEVEL_ALL);
70
  //  LogComponentEnable("TcpL4Protocol", LOG_LEVEL_ALL);
 Lines 67-75   int main (int argc, char *argv[]) Link Here 
67
  //  LogComponentEnable("PacketSink", LOG_LEVEL_ALL);
72
  //  LogComponentEnable("PacketSink", LOG_LEVEL_ALL);
68
  //  LogComponentEnable("TcpLargeTransfer", LOG_LEVEL_ALL);
73
  //  LogComponentEnable("TcpLargeTransfer", LOG_LEVEL_ALL);
69
74
70
71
  // Allow the user to override any of the defaults and the above
72
  // Bind()s at run-time, via command-line arguments
73
  CommandLine cmd;
75
  CommandLine cmd;
74
  cmd.Parse (argc, argv);
76
  cmd.Parse (argc, argv);
75
77
 Lines 140-145   int main (int argc, char *argv[]) Link Here 
140
      Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
142
      Socket::CreateSocket (n0n1.Get (0), TcpSocketFactory::GetTypeId ());
141
  localSocket->Bind ();
143
  localSocket->Bind ();
142
144
145
  // Trace changes to the congestion window
146
  Config::ConnectWithoutContext ("/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeCallback (&CwndTracer));
147
143
  // ...and schedule the sending "Application"; This is similar to what an 
148
  // ...and schedule the sending "Application"; This is similar to what an 
144
  // ns3::Application subclass would do internally.
149
  // ns3::Application subclass would do internally.
145
  Simulator::ScheduleNow (&StartFlow, localSocket,
150
  Simulator::ScheduleNow (&StartFlow, localSocket,
(-)a/examples/tcp-nsc-lfn.cc (+9 lines)
 Lines 43-48   using namespace ns3; Link Here 
43
43
44
NS_LOG_COMPONENT_DEFINE ("TcpNscLfn");
44
NS_LOG_COMPONENT_DEFINE ("TcpNscLfn");
45
45
46
static void 
47
CwndTracer (uint32_t oldval, uint32_t newval)
48
{
49
  NS_LOG_INFO ("Moving cwnd from " << oldval << " to " << newval);
50
}
46
51
47
int main (int argc, char *argv[])
52
int main (int argc, char *argv[])
48
{
53
{
 Lines 133-138   int main (int argc, char *argv[]) Link Here 
133
      clientApp.Stop (Seconds (runtime + 1.0 + i));
138
      clientApp.Stop (Seconds (runtime + 1.0 + i));
134
    }
139
    }
135
140
141
  // Trace changes to the congestion window
142
  Config::ConnectWithoutContext ("/NodeList/1/$ns3::NscTcpL4Protocol/SocketList/0/CongestionWindow", 
143
                                 MakeCallback (&CwndTracer));
144
136
  // This tells ns-3 to generate pcap traces.
145
  // This tells ns-3 to generate pcap traces.
137
  PointToPointHelper::EnablePcapAll ("tcp-nsc-lfn");
146
  PointToPointHelper::EnablePcapAll ("tcp-nsc-lfn");
138
147
(-)a/src/internet-stack/internet-stack.cc (-1 / +7 lines)
 Lines 54-59   AddUdpStack(Ptr<Node> node) Link Here 
54
  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
54
  Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
55
  udp->SetNode (node);
55
  udp->SetNode (node);
56
  ipv4->Insert (udp);
56
  ipv4->Insert (udp);
57
  node->AggregateObject (udp);
58
57
  Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
59
  Ptr<UdpSocketFactoryImpl> udpFactory = CreateObject<UdpSocketFactoryImpl> ();
58
  udpFactory->SetUdp (udp);
60
  udpFactory->SetUdp (udp);
59
  node->AggregateObject (udpFactory);
61
  node->AggregateObject (udpFactory);
 Lines 66-71   AddIcmpStack (Ptr<Node> node) Link Here 
66
  Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
68
  Ptr<Icmpv4L4Protocol> icmp = CreateObject<Icmpv4L4Protocol> ();
67
  icmp->SetNode (node);
69
  icmp->SetNode (node);
68
  ipv4->Insert (icmp);
70
  ipv4->Insert (icmp);
71
  node->AggregateObject (icmp);
72
69
  Ptr<Ipv4RawSocketFactoryImpl> rawFactory = CreateObject<Ipv4RawSocketFactoryImpl> ();
73
  Ptr<Ipv4RawSocketFactoryImpl> rawFactory = CreateObject<Ipv4RawSocketFactoryImpl> ();
70
  node->AggregateObject (rawFactory);
74
  node->AggregateObject (rawFactory);
71
}
75
}
 Lines 76-83   AddTcpStack(Ptr<Node> node) Link Here 
76
  Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
80
  Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
77
  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
81
  Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
78
  tcp->SetNode (node);
82
  tcp->SetNode (node);
79
80
  ipv4->Insert (tcp);
83
  ipv4->Insert (tcp);
84
  node->AggregateObject (tcp);
81
85
82
  Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
86
  Ptr<TcpSocketFactoryImpl> tcpFactory = CreateObject<TcpSocketFactoryImpl> ();
83
  tcpFactory->SetTcp (tcp);
87
  tcpFactory->SetTcp (tcp);
 Lines 114-119   AddNscStack(Ptr<Node> node, const std::s Link Here 
114
  tcp->SetNscLibrary(soname);
118
  tcp->SetNscLibrary(soname);
115
  tcp->SetNode (node);
119
  tcp->SetNode (node);
116
  ipv4->Insert (tcp);
120
  ipv4->Insert (tcp);
121
  node->AggregateObject (tcp);
122
117
  Ptr<NscTcpSocketFactoryImpl> tcpFactory = CreateObject<NscTcpSocketFactoryImpl> ();
123
  Ptr<NscTcpSocketFactoryImpl> tcpFactory = CreateObject<NscTcpSocketFactoryImpl> ();
118
  tcpFactory->SetTcp (tcp);
124
  tcpFactory->SetTcp (tcp);
119
  node->AggregateObject (tcpFactory);
125
  node->AggregateObject (tcpFactory);
(-)a/src/internet-stack/ipv4-l3-protocol.cc (-4 / +2 lines)
 Lines 152-166   Ipv4L3Protocol::DoDispose (void) Link Here 
152
  NS_LOG_FUNCTION (this);
152
  NS_LOG_FUNCTION (this);
153
  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
153
  for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
154
    {
154
    {
155
      (*i)->Dispose ();
156
      *i = 0;
155
      *i = 0;
157
    }
156
    }
158
  m_protocols.clear ();
157
  m_protocols.clear ();
159
158
160
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
159
  for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); ++i)
161
    {
160
    {
162
      Ptr<Ipv4Interface> interface = *i;
161
      *i = 0;
163
      interface->Dispose ();
164
    }
162
    }
165
  m_interfaces.clear ();
163
  m_interfaces.clear ();
166
  m_node = 0;
164
  m_node = 0;
(-)a/src/internet-stack/nsc-tcp-l4-protocol.cc (-1 / +15 lines)
 Lines 24-35    Link Here 
24
#include "ns3/packet.h"
24
#include "ns3/packet.h"
25
#include "ns3/node.h"
25
#include "ns3/node.h"
26
26
27
#include "ns3/object-vector.h"
28
27
#include "tcp-header.h"
29
#include "tcp-header.h"
28
#include "ipv4-end-point-demux.h"
30
#include "ipv4-end-point-demux.h"
29
#include "ipv4-end-point.h"
31
#include "ipv4-end-point.h"
30
#include "ipv4-l3-protocol.h"
32
#include "ipv4-l3-protocol.h"
31
#include "nsc-tcp-l4-protocol.h"
33
#include "nsc-tcp-l4-protocol.h"
32
#include "nsc-tcp-socket-impl.h"
33
#include "nsc-sysctl.h"
34
#include "nsc-sysctl.h"
34
35
35
#include "tcp-typedefs.h"
36
#include "tcp-typedefs.h"
 Lines 70-75   NscTcpL4Protocol::GetTypeId (void) Link Here 
70
                   ObjectFactoryValue (GetDefaultRttEstimatorFactory ()),
71
                   ObjectFactoryValue (GetDefaultRttEstimatorFactory ()),
71
                   MakeObjectFactoryAccessor (&NscTcpL4Protocol::m_rttFactory),
72
                   MakeObjectFactoryAccessor (&NscTcpL4Protocol::m_rttFactory),
72
                   MakeObjectFactoryChecker ())
73
                   MakeObjectFactoryChecker ())
74
    .AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
75
                   ObjectVectorValue (),
76
                   MakeObjectVectorAccessor (&NscTcpL4Protocol::m_sockets),
77
                   MakeObjectVectorChecker<NscTcpSocketImpl> ())
73
    ;
78
    ;
74
  return tid;
79
  return tid;
75
}
80
}
 Lines 154-159   NscTcpL4Protocol::DoDispose (void) Link Here 
154
NscTcpL4Protocol::DoDispose (void)
159
NscTcpL4Protocol::DoDispose (void)
155
{
160
{
156
  NS_LOG_FUNCTION (this);
161
  NS_LOG_FUNCTION (this);
162
163
  for (std::vector<Ptr<NscTcpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
164
    {
165
      *i = 0;
166
    }
167
  m_sockets.clear ();
168
169
157
  if (m_endPoints != 0)
170
  if (m_endPoints != 0)
158
    {
171
    {
159
      delete m_endPoints;
172
      delete m_endPoints;
 Lines 173-178   NscTcpL4Protocol::CreateSocket (void) Link Here 
173
  socket->SetNode (m_node);
186
  socket->SetNode (m_node);
174
  socket->SetTcp (this);
187
  socket->SetTcp (this);
175
  socket->SetRtt (rtt);
188
  socket->SetRtt (rtt);
189
  m_sockets.push_back (socket);
176
  return socket;
190
  return socket;
177
}
191
}
178
192
(-)a/src/internet-stack/nsc-tcp-l4-protocol.h (+2 lines)
 Lines 31-36    Link Here 
31
31
32
#include "ns3/timer.h"
32
#include "ns3/timer.h"
33
#include "sim_interface.h"
33
#include "sim_interface.h"
34
#include "nsc-tcp-socket-impl.h"
34
35
35
namespace ns3 {
36
namespace ns3 {
36
37
 Lines 116-121   private: Link Here 
116
  INetStack* m_nscStack;
117
  INetStack* m_nscStack;
117
  void *m_dlopenHandle;
118
  void *m_dlopenHandle;
118
  Timer m_softTimer;
119
  Timer m_softTimer;
120
  std::vector<Ptr<NscTcpSocketImpl> > m_sockets;
119
};
121
};
120
122
121
}; // namespace ns3
123
}; // namespace ns3
(-)a/src/internet-stack/nsc-tcp-socket-factory-impl.cc (-1 / +1 lines)
 Lines 13-20    Link Here 
13
 * along with this program; if not, write to the Free Software
13
 * along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
 */
15
 */
16
#include "nsc-tcp-l4-protocol.h"
16
#include "nsc-tcp-socket-factory-impl.h"
17
#include "nsc-tcp-socket-factory-impl.h"
17
#include "nsc-tcp-l4-protocol.h"
18
#include "ns3/socket.h"
18
#include "ns3/socket.h"
19
#include "ns3/assert.h"
19
#include "ns3/assert.h"
20
20
(-)a/src/internet-stack/tcp-l4-protocol.cc (-1 / +13 lines)
 Lines 22-27    Link Here 
22
#include "ns3/log.h"
22
#include "ns3/log.h"
23
#include "ns3/nstime.h"
23
#include "ns3/nstime.h"
24
#include "ns3/boolean.h"
24
#include "ns3/boolean.h"
25
#include "ns3/object-vector.h"
25
26
26
#include "ns3/packet.h"
27
#include "ns3/packet.h"
27
#include "ns3/node.h"
28
#include "ns3/node.h"
 Lines 31-37    Link Here 
31
#include "ipv4-end-point-demux.h"
32
#include "ipv4-end-point-demux.h"
32
#include "ipv4-end-point.h"
33
#include "ipv4-end-point.h"
33
#include "ipv4-l3-protocol.h"
34
#include "ipv4-l3-protocol.h"
34
#include "tcp-socket-impl.h"
35
35
36
#include "tcp-typedefs.h"
36
#include "tcp-typedefs.h"
37
37
 Lines 334-339   TcpL4Protocol::GetTypeId (void) Link Here 
334
                   BooleanValue (false),
334
                   BooleanValue (false),
335
                   MakeBooleanAccessor (&TcpL4Protocol::m_calcChecksum),
335
                   MakeBooleanAccessor (&TcpL4Protocol::m_calcChecksum),
336
                   MakeBooleanChecker ())
336
                   MakeBooleanChecker ())
337
    .AddAttribute ("SocketList", "The list of sockets associated to this protocol.",
338
                   ObjectVectorValue (),
339
                   MakeObjectVectorAccessor (&TcpL4Protocol::m_sockets),
340
                   MakeObjectVectorChecker<TcpSocketImpl> ())
337
    ;
341
    ;
338
  return tid;
342
  return tid;
339
}
343
}
 Lines 366-376   TcpL4Protocol::DoDispose (void) Link Here 
366
TcpL4Protocol::DoDispose (void)
370
TcpL4Protocol::DoDispose (void)
367
{
371
{
368
  NS_LOG_FUNCTION_NOARGS ();
372
  NS_LOG_FUNCTION_NOARGS ();
373
  for (std::vector<Ptr<TcpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++)
374
    {
375
      *i = 0;
376
    }
377
  m_sockets.clear ();
378
369
  if (m_endPoints != 0)
379
  if (m_endPoints != 0)
370
    {
380
    {
371
      delete m_endPoints;
381
      delete m_endPoints;
372
      m_endPoints = 0;
382
      m_endPoints = 0;
373
    }
383
    }
384
374
  m_node = 0;
385
  m_node = 0;
375
  Ipv4L4Protocol::DoDispose ();
386
  Ipv4L4Protocol::DoDispose ();
376
}
387
}
 Lines 384-389   TcpL4Protocol::CreateSocket (void) Link Here 
384
  socket->SetNode (m_node);
395
  socket->SetNode (m_node);
385
  socket->SetTcp (this);
396
  socket->SetTcp (this);
386
  socket->SetRtt (rtt);
397
  socket->SetRtt (rtt);
398
  m_sockets.push_back (socket);
387
  return socket;
399
  return socket;
388
}
400
}
389
401
(-)a/src/internet-stack/tcp-l4-protocol.h (+2 lines)
 Lines 31-36    Link Here 
31
#include "ipv4-l4-protocol.h"
31
#include "ipv4-l4-protocol.h"
32
#include "ipv4-interface.h"
32
#include "ipv4-interface.h"
33
33
34
#include "tcp-socket-impl.h"
34
#include "tcp-header.h"
35
#include "tcp-header.h"
35
#include "tcp-typedefs.h"
36
#include "tcp-typedefs.h"
36
37
 Lines 120-125   private: Link Here 
120
121
121
  bool m_goodChecksum;
122
  bool m_goodChecksum;
122
  bool m_calcChecksum;
123
  bool m_calcChecksum;
124
  std::vector<Ptr<TcpSocketImpl> > m_sockets;
123
};
125
};
124
126
125
}; // namespace ns3
127
}; // namespace ns3

Return to bug 458