24 #include <IPAddressResolver.h>
27 #include <NotificationBoard.h>
29 #include <UDPControlInfo_m.h>
47 roundTripTime(MAXTIME)
75 nodeIPAddress = IPAddressResolver().addressOf(getParentModule());
77 bindToPort(par(
"clientPort"));
81 getDisplayString().setTagArg(
"i", 0,
"i3c");
82 getParentModule()->getDisplayString().removeTag(
"i2");
84 if (
int(par(
"bootstrapTime")) >=
int(par(
"initTime"))) {
85 opp_error(
"Parameter bootstrapTime must be smaller than initTime");
129 int cacheSize = par(
"cacheSize");
130 for (
int i = 0; i < cacheSize; i++) {
136 os << myAddress <<
" sample" << i;
137 id.setName(os.str());
162 if (msg->isSelfMessage()) {
182 }
else if (msg->arrivedOn(
"udpIn")) {
215 cPacket *newMessage = smsg->decapsulate();
250 msg->removeControlInfo();
251 msg->setKind(UDP_C_DATA);
253 UDPControlInfo* udpControlInfo =
new UDPControlInfo();
255 udpControlInfo->setSrcPort(par(
"clientPort"));
257 udpControlInfo->setDestAddr(add.
getIp());
258 udpControlInfo->setDestPort(add.
getPort());
260 msg->setControlInfo(udpControlInfo);
267 map<I3Identifier, I3CachedServer>::iterator mit;
271 int serverTimeout = par(
"serverTimeout");
276 gatewayId = mit->first;
288 EV <<
"I3BaseApp::refreshTriggers()]\n"
290 <<
", time " << simTime()
291 <<
"; expired gateway is " <<
gateway <<
"(" << gatewayId <<
") "
295 for (i = 0, mit =
samplingCache.begin(); i < random; i++, mit++);
297 EV <<
"I3BaseApp::refreshTriggers()]\n"
302 EV <<
"I3BaseApp::refreshTriggers()]\n"
304 <<
" too high... marking as isolated!"
317 set<I3Trigger>::iterator it;
323 int idStoreTime = par(
"idStoreTime");
325 if (mit->second.lastReply - simTime() > idStoreTime) {
333 map<I3Identifier, I3CachedServer>::iterator mit;
335 EV <<
"I3BaseApp::refreshSamples()]\n"
336 <<
" Refresh samples!"
348 map<I3Identifier, I3CachedServer>::iterator mit;
353 if (time > mit->second.roundTripTime) {
354 time = mit->second.roundTripTime;
364 os << myAddress <<
" sample";
387 smsg->encapsulate(msg);
457 for (; it !=
insertedTriggers.end() && it->getIdentifier() == identifier; it++) {
479 Enter_Method_Silent();