fix examples and documentation for CalcChecksum changes
authorTom Henderson <tomh@tomh.org>
Fri, 19 Jun 2009 07:50:05 -0700
changeset 4568 8a9c81e59c92
parent 4566 b86c304c2dac
child 4569 a84925c82581
fix examples and documentation for CalcChecksum changes
CHANGES.html
doc/manual/emulation.texi
examples/emu-ping.cc
examples/tap-wifi-dumbbell.cc
--- a/CHANGES.html	Fri Jun 19 07:25:40 2009 -0700
+++ b/CHANGES.html	Fri Jun 19 07:50:05 2009 -0700
@@ -79,6 +79,23 @@
 <h2>Changes to existing API:</h2>
 <ul>
 
+<li><b>CalcChecksum attribute changes</b>
+  <p>Four IPv4 CalcChecksum attributes (which enable the computation of 
+checksums that are disabled by default) have been collapsed into one global 
+value in class Node.  These four calls: 
+<pre>
+Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
+Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true));
+Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true));
+Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true));
+</pre>
+are replaced by one call to:
+<pre>
+GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
+</pre>
+  </p>
+</li>
+
 <li><b>CreateObject changes</b>
   <p>CreateObject is now able to construct objects with a non-default constructor.
    If you used to pass attribute lists to CreateObject, you must now use CreateObjectWithAttributes.
--- a/doc/manual/emulation.texi	Fri Jun 19 07:25:40 2009 -0700
+++ b/doc/manual/emulation.texi	Fri Jun 19 07:50:05 2009 -0700
@@ -131,6 +131,14 @@
 
 @section Usage
 
+Any mixing of ns-3 objects with real objects will typically require that
+ns-3 compute checksums in its protocols.  By default, checksums are not
+computed by ns-3.  To enable checksums (e.g. UDP, TCP, IP), users must set
+the attribute @code{ChecksumEnabled} to true, such as follows:
+@verbatim
+GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
+@end verbatim
+
 @subsection Emu Net Device
 
 The usage of the @code{Emu} net device is straightforward once the network of
--- a/examples/emu-ping.cc	Fri Jun 19 07:25:40 2009 -0700
+++ b/examples/emu-ping.cc	Fri Jun 19 07:50:05 2009 -0700
@@ -102,10 +102,7 @@
   // Since we are going to be talking to real-world machines, we need to enable
   // calculation of checksums in our protocols.
   //
-  Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true)); 
+  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
 
   //
   // In such a simple topology, the use of the helper API can be a hindrance
--- a/examples/tap-wifi-dumbbell.cc	Fri Jun 19 07:25:40 2009 -0700
+++ b/examples/tap-wifi-dumbbell.cc	Fri Jun 19 07:50:05 2009 -0700
@@ -132,11 +132,7 @@
   cmd.Parse (argc, argv);
 
   GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
-
-  Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); 
-  Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true)); 
+  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
 
   //
   // The topology has a Wifi network of four nodes on the left side.  We'll make