|
NETWORK ATTACKS FRAMEWORK
1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
|
Go to the source code of this file.
Classes | |
| struct | timer |
Typedefs | |
| typedef void(NA_AODVUU::* | timeout_func_t )(void *) |
Functions | |
| void | timer_queue_init () |
| int | timer_remove (struct timer *t) |
| void | timer_set_timeout (struct timer *t, long msec) |
| int | timer_timeout_now (struct timer *t) |
| struct timeval * | timer_age_queue () |
| int | timer_init (struct timer *t, timeout_func_t f, void *data) |
| void | timer_add (struct timer *t) |
| void | timer_timeout (struct timeval *now) |
| typedef void(NA_AODVUU::* timeout_func_t)(void *) |
Definition at line 35 of file NA_timer_queue_aodv.h.
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;
}
| struct timeval* 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 timer_init | ( | struct timer * | t, |
| timeout_func_t | f, | ||
| void * | data | ||
| ) |
| void timer_queue_init | ( | ) |
| int 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 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 timer_timeout | ( | struct timeval * | now | ) |
| int 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;
}