Since presently in ns there is no actual data being passed between applications, agents can instead announce to applications the occurrence of certain events at the transport layer through ``upcalls.'' For example, applications can be notified of the arrival of a number of bytes of data; this information may aid the application in modelling real-world application behavior more closely. Two basic ``upcalls'' have been implemented in base class Application and in the transport agents:
Although strictly not a callback to applications, certain Agents have implemented a callback from C++ to OTcl-level that has been used by applications such as https simulators. This callback method, done{}, is used in TCP agents. In TCP, done{} is called when a TCP sender has received ACKs for all of its data and is now closed; it therefore can be used to simulate a blocked TCP connection. The done{} method was primarily used before this API was completed, but may still be useful for applications that do not want to use resume().
To use done{} for FullTcp, for example, you can try:
set myagent [new Agent/TCP/FullTcp] $myagent proc done { } { ... code you want ... }If you want all the FullTCP's to have the same code you could also do:
Agent/TCP/FullTcp instproc done {} { ... code you want ... }By default, done{} does nothing.
Tom Henderson 2014-12-17