|
NETWORK ATTACKS FRAMEWORK
1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
|
Go to the source code of this file.
Defines | |
| #define | NS_PORT |
| #define | OMNETPP |
Functions | |
| int NS_CLASS | timer_init (struct timer *t, timeout_func_t f, void *data) |
| void NS_CLASS | timer_timeout (const simtime_t &now) |
| NS_STATIC void NS_CLASS | timer_add (struct timer *t) |
| int NS_CLASS | timer_remove (struct timer *t) |
| int NS_CLASS | timer_timeout_now (struct timer *t) |
| void NS_CLASS | timer_set_timeout (struct timer *t, long msec) |
| simtime_t NS_CLASS | timer_age_queue () |
| #define NS_PORT |
Definition at line 22 of file NA_timer_queue_aodv.cc.
| #define OMNETPP |
Definition at line 23 of file NA_timer_queue_aodv.cc.
Definition at line 85 of file NA_timer_queue_aodv.cc.
{
/* Sanity checks: */
if (!t)
{
perror("NULL timer!!!\n");
exit(-1);
}
if (!t->handler)
{
perror("NULL handler!!!\n");
exit(-1);
}
/* Make sure we remove unexpired timers before adding a new timeout... */
if (t->used)
timer_remove(t);
t->used = 1;
aodvTimerMap.insert(std::make_pair(t->timeout,t));
return;
}
| simtime_t NS_CLASS timer_age_queue | ( | ) | [read] |
Definition at line 155 of file NA_timer_queue_aodv.cc.
{
simtime_t now;
simtime_t remaining;
now = simTime();
timer_timeout(now);
if (aodvTimerMap.empty())
return remaining;
remaining = aodvTimerMap.begin()->first - now;
return remaining;
}
| int NS_CLASS timer_init | ( | struct timer * | t, |
| timeout_func_t | f, | ||
| void * | data | ||
| ) |
| int NS_CLASS timer_remove | ( | struct timer * | t | ) |
Definition at line 108 of file NA_timer_queue_aodv.cc.
{
if (!t)
return -1;
t->used = 0;
for (AodvTimerMap::iterator it = aodvTimerMap.begin();it != aodvTimerMap.end();it++)
{
if (it->second == t)
{
aodvTimerMap.erase(it);
return 1;
}
}
return 0;
}
| void NS_CLASS timer_set_timeout | ( | struct timer * | t, |
| long | msec | ||
| ) |
Definition at line 137 of file NA_timer_queue_aodv.cc.
{
if (t->used)
{
timer_remove(t);
}
if (msec < 0)
{
DEBUG(LOG_WARNING, 0, "Negative timeout!!!");
msec=0;
}
double auxtime = ((double)msec)/1000.0;
t->timeout = simTime() + auxtime;
timer_add(t);
}
| void NS_CLASS timer_timeout | ( | const simtime_t & | now | ) |
Definition at line 66 of file NA_timer_queue_aodv.cc.
| int NS_CLASS timer_timeout_now | ( | struct timer * | t | ) |
Definition at line 126 of file NA_timer_queue_aodv.cc.
{
if (timer_remove(t)>0)
{
(*this.*t->handler) (t->data);
return 1;
}
return -1;
}