[Ns-developers] ns-3 tcp implementation

Tom Henderson tomh at tomh.org
Fri Jan 18 13:58:51 PST 2008


Unless there are further comments, we'd like to proceed with merging the 
raj/ns-3-tcp branch early next week (Tuesday).  As noted before, 
ns-3-tcp provides a TCP stream service but not all features of TCP are 
presently working.  The plan is to merge the current code and try to 
resolve the remaining issues as tracker items, in the next month or so.

The current status of the code, and several scripts, can be found in the 
examples/README.tcp file in the raj/ns-3-tcp repository.

We'd like to try to resolve the below issue that still lingers:


> 2) On the API in src/node/tcp.h
> --------------------------------
> 
> The way you use DefaultValues is a bit on the edge I think: you seem to
> be using them to initialize each Socket when it is created. This means
> that, while the simulation is running, if someone creates a new Socket,
> this Socket will be influenced by the state of the DefaultValues.
> 
> Instead, what we have tried to do so far in the current codebase is to
> limit the impact of DefaultValues to the topology construction phase of
> a simulation. If you wanted to do this (that is, limit the impact of
> DefaultValues), you would need to write code like this:
> 
> in tcp.h:
> 
> class Tcp
> {
> public:
>   Tcp (void);
>   Ptr<Socket> CreateSocket (...);
> 
>   void SetDefaultSeqSize (uint32_t seqSize);
>   ...
> protected:
>   // make it available only to subclasses
>   uint32_t GetDefaultSeqSize (void);
>   ...
> private:
>   // hide the member.
>   uint32_t m_defaultSeqSize;
> };
> 
> in tcp.cc:
> 
> static NumericDefaultValue<uint32_t> g_defaultSegSize = ...;
> 
> Tcp::Tcp (void)
>   : m_defaultSeqSize (g_defaultSeqSize)
> {}
> 
> void 
> Tcp::SetDefaultSeqSize (uint32_t seqSize)
> {
>   m_defaultSeqSize = seqSize;
> }
> uint32_t 
> Tcp::GetDefaultSeqSize (void)
> {
>   return m_defaultSeqSize;
> }
> 

I believe that there are two related issues:

1) removal of the static variables from the Tcp public API (the .h file).

2) Mathieu suggests to implement the above handling of these values.  My 
understanding is that the above proposal implements the policy that the 
default values for class Tcp are not directly used when initializing 
objects of class TcpSocket.  Rather, the default values for class Tcp 
would be directly used when initializing the Tcp object (socket 
factory).  The TcpSocket objects themselves would call 
Tcp::GetDefaultSegSize() instead of directly calling the default value 
system.

i.e.:

  replace in TcpSocket constructor:
     m_segmentSize (Tcp::defaultSegSize.GetValue()),

  with
     m_segmentSize (Tcp::GetDefaultSegSize()),


Then, if we want to enable changes to these defaults during run-time, we 
provide a setter in class Tcp  (Tcp::SetDefaultSegSize()) and have the 
user change the member variable in the Tcp factory, rather than the 
default value.

Tom


More information about the Ns-developers mailing list