diff -cr ns-3.24.orig/dce/source/ns-3-dce/helper/linux-stack-helper.h b/dce/source/ns-3-dce/helper/linux-stack-helper.h *** ns-3.24.orig/dce/source/ns-3-dce/helper/linux-stack-helper.h 2015-09-22 10:00:39.000000000 -0500 --- ns-3.24.patched/dce/source/ns-3-dce/helper/linux-stack-helper.h 2015-09-26 09:25:37.463703026 -0500 *************** *** 112,117 **** --- 112,130 ---- void (*callback)(std::string, std::string)); /** + * Obtain Linux kernel state with traditional 'sysctl' interface. + * (this method uses the ns3 Callback "closure" mechanism.) + * + * \param node The node pointer Ptr that will ask the status. + * \param at the delta from the begining of simulation to ask this query. + * \param path a string value for sysctl parameter. it starts from '.' following the name of parameter. + * e.g., ".net.ipv4.conf.default.forwarding" + * \param a Callback + */ + static void SysctlGet (Ptr node, Time at, std::string path, + Callback callback); + + /** * Populate routing information to all the nodes in network from GlobalRoutingTable. * * Limitation: *************** *** 137,142 **** --- 150,157 ---- static void SysctlGetCallback (Ptr node, std::string path, void (*callback)(std::string, std::string)); + static void SysctlGetCallback2 (Ptr node, std::string path, + Callback callback); }; diff -cr ns-3.24.orig/dce/source/ns-3-dce/helper/linux-stack-helper.cc ns-3.24.patched/dce/source/ns-3-dce/helper/linux-stack-helper.cc *** ns-3.24.orig/dce/source/ns-3-dce/helper/linux-stack-helper.cc 2015-09-22 10:00:39.000000000 -0500 --- ns-3.24.patched/dce/source/ns-3-dce/helper/linux-stack-helper.cc 2015-09-26 09:23:03.766004465 -0500 *************** *** 172,177 **** --- 180,227 ---- return; #endif } + + void + LinuxStackHelper::SysctlGetCallback2 (Ptr node, std::string path, + Callback callback) + { + #ifdef KERNEL_STACK + Ptr sock = node->GetObject (); + if (!sock) + { + callback ("error", "no socket factory"); + NS_ASSERT_MSG (0, "No LinuxSocketFdFactory is installed. " + "You may need to do it via DceManagerHelper::Install ()"); + return; + } + + std::string value = sock->Get (path); + callback (path, value); + return; + #endif + } + + void + LinuxStackHelper::SysctlGet (Ptr node, Time at, std::string path, + Callback callback) + { + #ifdef KERNEL_STACK + Ptr sock = node->GetObject (); + if (!sock) + { + callback ("error", "no socket factory"); + NS_ASSERT_MSG (0, "No LinuxSocketFdFactory is installed. " + "You may need to do it via DceManagerHelper::Install ()"); + return; + } + Simulator::ScheduleWithContext (node->GetId (), at, + &LinuxSocketFdFactory::ScheduleTask, sock, + MakeEvent (&LinuxStackHelper::SysctlGetCallback2, + node, path, callback)); + return; + #endif + } + void LinuxStackHelper::SysctlSet (NodeContainer c, std::string path, std::string value) {