NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_seek_list.cc File Reference
#include <stdlib.h>
#include "../NA_aodv_uu_omnet.h"
#include "NA_list.h"

Go to the source code of this file.

Defines

#define NS_PORT
#define OMNETPP

Functions

seek_list_t *NS_CLASS seek_list_insert (struct in_addr dest_addr, u_int32_t dest_seqno, int ttl, u_int8_t flags, struct ip_data *ipd)
int NS_CLASS seek_list_remove (seek_list_t *entry)
seek_list_t *NS_CLASS seek_list_find (struct in_addr dest_addr)

Define Documentation

#define NS_PORT

Definition at line 23 of file NA_seek_list.cc.

#define OMNETPP

Definition at line 24 of file NA_seek_list.cc.


Function Documentation

seek_list_t* NS_CLASS seek_list_find ( struct in_addr  dest_addr)

Definition at line 184 of file NA_seek_list.cc.

{
    SeekHead::iterator it =seekhead.find(dest_addr.s_addr);
    if (it != seekhead.end())
        return it->second;
    return NULL;
}
seek_list_t* NS_CLASS seek_list_insert ( struct in_addr  dest_addr,
u_int32_t  dest_seqno,
int  ttl,
u_int8_t  flags,
struct ip_data ipd 
)

Definition at line 130 of file NA_seek_list.cc.

{
    seek_list_t *entry;

    entry = new seek_list_t;
    if (entry == NULL)
    {
        fprintf(stderr, "Failed malloc\n");
        exit(-1);
    }

    entry->dest_addr = dest_addr;
    entry->dest_seqno = dest_seqno;
    entry->flags = flags;
    entry->reqs = 0;
    entry->ttl = ttl;
    entry->ipd = ipd;

    timer_init(&entry->seek_timer, &NS_CLASS route_discovery_timeout, entry);
    seekhead.insert(std::make_pair(dest_addr.s_addr,entry));

#ifdef SEEK_LIST_DEBUG
    seek_list_print();
#endif
    return entry;
}

Definition at line 160 of file NA_seek_list.cc.

{
    if (!entry)
        return 0;

    for (SeekHead::iterator it =seekhead.begin();it != seekhead.end(); it++)
    {
        if (it->second == entry)
        {
            seekhead.erase(it);
            break;
        }
    }

    /* Make sure any timers are removed */
    timer_remove(&entry->seek_timer);

    if (entry->ipd)
        free(entry->ipd);

    delete entry;
    return 1;
}
 All Classes Files Functions Variables Typedefs Enumerator Defines