Bugzilla – Full Text Bug Listing |
Summary: | Add ns3::Callback capability to DCE-Linux SysctlGet API | ||
---|---|---|---|
Product: | dce | Reporter: | Chip Webb <ns3> |
Component: | kernel | Assignee: | Hajime Tazaki <tazaki> |
Status: | NEW --- | ||
Severity: | enhancement | CC: | ns-bugs, ns3 |
Priority: | P5 | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Attachments: |
Patch to implement the described enhancement
Example code that uses proposed new API |
Created attachment 2154 [details]
Example code that uses proposed new API
There is a #define on line #141 that controls whether the original or the new (proposed) API is used.
//#define NEW_SYSCTLGET_CALLBACK_API
It is commented out and when commented out, the example code will use the original API.
If it is uncommented, and the #define takes effect, the example code will use the new (proposed) API.
|
Created attachment 2152 [details] Patch to implement the described enhancement When running a DCE-Linux simulation, the current API for LinuxStackHelper::SysctlGet requires passing a function pointer [void (*callback)(std::string,std::string)] to a callback function. This function is then called after the Sysctl Get is executed. The parameters passed to the function include "path" std::string that was queried, and the "value" std::string that the kernel returned. If the simulation has more than one DCE-Linux node that use this API, then it can be difficult to tell which node returned which value. A simple solution is to define a separate function for each node, but this is neither convenient nor good coding practice, especially as the number of nodes increases. A better and more elegant way would be to define an overloaded API call that uses an ns3::Callback instead of a function pointer. The ns3::Callback can be a Bound Callback that has extra arguments (like a functor or closure). The attached patch implements the additional API that uses a Callback.