32 #include <IRoutingTable.h>
33 #include <IInterfaceTable.h>
34 #include <IPAddressResolver.h>
35 #include <IPv4InterfaceData.h>
36 #include <NotificationBoard.h>
67 Enter_Method_Silent();
69 std::string nameStr =
"overlayTerminal";
71 nameStr +=
"-" + convertToString<int32_t>(type.
typeID);
74 cModuleType* moduleType = cModuleType::get(type.
terminalType.c_str());
75 cModule* node = moduleType->create(nameStr.c_str(), accessNet.
edge->
Router->getParentModule(),
79 throw cRuntimeError(
"ReaSEUnderlayConfigurator::createNode(): Setting "
80 "channel types via the churn generator is not allowed "
81 "with the ReaSEUnderlay. Use **.accessNet.channelTypes instead!");
84 node->setGateSize(
"pppg", 1);
86 std::string displayString;
89 ((displayString +=
"i=device/wifilaptop_l,")
91 +=
",40;i2=block/circle_s";
93 displayString =
"i=device/wifilaptop_l;i2=block/circle_s";
96 node->finalizeParameters();
97 node->setDisplayString(displayString.c_str());
100 node->scheduleStart(simTime());
117 node->callInitialize(i);
127 IPAddressResolver().addressOf(node));
138 Enter_Method_Silent();
150 std::cout <<
"all nodes are already prekilled" << std::endl;
162 opp_error(
"IPv4UnderlayConfigurator: Trying to pre kill node "
163 "with nonexistant TransportAddress!");
166 uint32_t effectiveType = info->
getTypeID();
176 killList.push_front(IPAddressResolver().addressOf(node));
188 NotificationBoard* nb = check_and_cast<NotificationBoard*>(
189 node->getSubmodule(
"notificationBoard"));
190 nb->fireChangeNotification(NF_OVERLAY_NODE_LEAVE);
192 double random = uniform(0, 1);
195 nb->fireChangeNotification(NF_OVERLAY_NODE_GRACEFUL_LEAVE);
198 cMessage* msg =
new cMessage();
205 Enter_Method_Silent();
223 opp_error(
"ReaSEUnderlayConfigurator: Trying to pre kill node with nonexistant TransportAddress!");
233 opp_error(
"ReaSEUnderlayConfigurator: Trying to remove node which is not an overlay node in network!");
238 node->bubble(
"I am migrating!");
245 newAccessModule.terminal = node;
253 NotificationBoard* nb = check_and_cast<NotificationBoard*>(node->getSubmodule(
"notificationBoard"));
254 nb->fireChangeNotification(NF_OVERLAY_TRANSPORTADDRESS_CHANGED);
259 Enter_Method_Silent();
273 opp_error(
"IPv4UnderlayConfigurator: Trying to kill node with nonexistant TransportAddress!");
282 opp_error(
"IPv4UnderlayConfigurator: Trying to remove node which is nonexistant in AccessNet!");
285 node->deleteModule();
293 sprintf(buf,
"%i overlay terminals",
295 getDisplayString().setTagArg(
"t", 0, buf);
302 recordScalar(
"Terminals removed",
numKilled);
305 struct timeval now, diff;
306 gettimeofday(&now, NULL);
308 printf(
"Simulation time: %li.%06li\n", diff.tv_sec, diff.tv_usec);