I have planned to do some congestion control tunning on the existing transport layer protocol. In this case, I have chosen TCP New Reno. Mainly I have two problems regarding that.
1) The main problem is how I can find the source code of TCP New Reno.
2) Another thing is even if I found the source code how I can use it inside NS3 between two nodes (in seventh.cc, they have not specified the protocol. It takes the default one. I need to use the TCP New Reno)
I tried searching but there is very little information relating to the problem. I found some kind of source code from NS3 documentation. But I don't think that is the real source code for the TCP New Reno.
tcp-newreno.h >> taken from https://www.nsnam.org/docs/release/3.18/doxygen/tcp-newreno_8h_source.html
tcp-newreno.cc >> taken from https://www.nsnam.org/docs/release/3.18/doxygen/tcp-newreno_8cc_source.html#l00247
The links you provide have the actual source code for TcpNewReno, but they are from version 3.18. The current version is 3.30.1. So, the code you found is out of date. If you are using the latest version of ns-3 (which I recommend), then TcpNewReno
is implemented in ./src/internet/model/tcp-congestion-ops.cc
. If you look at the API documentation of TcpNewReno
, you will find links to the source code for each member/function. The API documentation is indispensable.
The default protocol is TcpNewReno
, so there is no need to set it. You can verify the default in two ways:
The TCP model documentation says "several congestion control algorithms are supported, with NewReno the default" under the ns-3 TCP section.
You can verify that the default TCP SocketType
is set as TcpNewReno
in ./src/internet/model/tcp-l4-protocol.cc
in the GetTypeId
function.
That being said, if you want to change the default, you can do so by calling Config::SetDefault
in your script's main function like so
Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNewReno"));
If I need to edit the CWND calculation algorithm in TCPNewReno, where do I need to do the changes?
If you want to create a new Congestion Control algorithm, I suggest that you do NOT change the existing TcpNewReno
code. Instead, make a subclass of TcpNewReno. Define and declare this subclass in new files, ./src/internet/model/tcp-placeholder.{h,cc}
. Then, you need to add these new files in ./src/internet/wscript
. After that, these new files should compile when you build with ./waf
. Again, to actually use this new Congestion Control algorithm, you need to make the Config::SetDefault
call above.
Because later on after the developments, I need to get the changed source code of the TCPNewReno and put it inside an actual device. How Can I do that?
This is probably not happening. While ns-3 tries to mimic real world implementations in how they work, the code you write in ns-3 will almost certainly not work as-is on any operating system. If you want to test a new congestion control algorithm on real devices, you will need to learn how to program that device specifically.
Depending on what you're doing, you may find using the Network Simulation Cradle helpful.