next up previous contents index
Next: 31.2.5 An example Up: 31.2 The transport agent Previous: 31.2.3 Using transport agents

   
31.2.4 Agent upcalls to applications

Since presently in  there is no actual data being passed between applications, agents can instead announce to applications the occurence 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 int the transport agents:

The default behavior is as follows: Depending on whether the application has been implemented in C++ or OTcl, these C++ functions call a similarly named (recv, resume) function in the application, if such methods have been defined.

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 HTTP 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.


next up previous contents index
Next: 31.2.5 An example Up: 31.2 The transport agent Previous: 31.2.3 Using transport agents

2000-08-24