NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_seek_list.h File Reference
#include "NA_defs_aodv.h"
#include "NA_timer_queue_aodv.h"
#include "NA_list.h"

Go to the source code of this file.

Classes

struct  ip_data
struct  seek_list

Defines

#define IP_DATA_MAX_LEN   60 + 8 /* Max IP header + 64 bits of data */

Typedefs

typedef struct seek_list seek_list_t

Functions

seek_list_tseek_list_insert (struct in_addr dest_addr, u_int32_t dest_seqno, int ttl, u_int8_t flags, struct ip_data *ipd)
int seek_list_remove (seek_list_t *entry)
seek_list_tseek_list_find (struct in_addr dest_addr)

Define Documentation

#define IP_DATA_MAX_LEN   60 + 8 /* Max IP header + 64 bits of data */

Definition at line 31 of file NA_seek_list.h.


Typedef Documentation

typedef struct seek_list seek_list_t

Function Documentation

seek_list_t* 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* 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;
}
int seek_list_remove ( seek_list_t 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