equal
deleted
inserted
replaced
5 programming idiom used throughout the code: the ``ns-3 callback''. This |
5 programming idiom used throughout the code: the ``ns-3 callback''. This |
6 chapter provides some motivation on the callback, guidance on how to use |
6 chapter provides some motivation on the callback, guidance on how to use |
7 it, and details on its implementation. |
7 it, and details on its implementation. |
8 |
8 |
9 @menu |
9 @menu |
10 * Motivation:: |
10 * Callbacks Motivation:: |
11 * Background:: |
11 * Callbacks Background:: |
12 * Using the Callback API:: |
12 * Using the Callback API:: |
13 * Bound Callbacks:: |
13 * Bound Callbacks:: |
14 * Callback locations in ns-3:: |
14 * Callback locations in ns-3:: |
15 * Implementation details:: |
15 * Implementation details:: |
16 @end menu |
16 @end menu |
17 |
17 |
18 @node Motivation |
18 @node Callbacks Motivation |
19 @section Motivation |
19 @section Motivation |
20 |
20 |
21 Consider that you have two simulation models A and B, and you wish |
21 Consider that you have two simulation models A and B, and you wish |
22 to have them pass information between them during the simulation. One |
22 to have them pass information between them during the simulation. One |
23 way that you can do that is that you can make A and B each explicitly |
23 way that you can do that is that you can make A and B each explicitly |
89 made assumptions, and hard coded into the code, that IP always talks |
89 made assumptions, and hard coded into the code, that IP always talks |
90 to a transport protocol above, the user may be forced to hack the |
90 to a transport protocol above, the user may be forced to hack the |
91 system to get the desired interconnections, This is clearly not an |
91 system to get the desired interconnections, This is clearly not an |
92 optimal way to design a generic simulator. |
92 optimal way to design a generic simulator. |
93 |
93 |
94 @node Background |
94 @node Callbacks Background |
95 @section Background |
95 @section Background |
96 |
96 |
97 The basic mechanism that allows one to address the problem above is known as |
97 The basic mechanism that allows one to address the problem above is known as |
98 a @emph{callback}. The ultimate goal is to allow one piece of code to call |
98 a @emph{callback}. The ultimate goal is to allow one piece of code to call |
99 a function (or method in C++) without any specific inter-module dependency. |
99 a function (or method in C++) without any specific inter-module dependency. |