NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_list.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * Copyright (C) 2001 Uppsala University and Ericsson AB.
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors: Erik Nordstr�m, <erik.nordstrom@it.uu.se>
00020  *
00021  *****************************************************************************/
00022 #ifndef NA_LIST_AODV_H
00023 #define NA_LIST_AODV_H
00024 #define NS_PORT
00025 #define OMNETPP
00026 
00027 /* Simple linked list inspired from the Linux kernel list implementation */
00028 typedef struct list_t
00029 {
00030     struct list_t *prev, *next;
00031 } list_t;
00032 
00033 #define LIST_NULL -1
00034 #define LIST_SUCCESS 1
00035 
00036 #define LIST(name) list_t name = { &(name), &(name) }
00037 
00038 #define INIT_LIST_HEAD(h) do { \
00039     (h)->next = (h); (h)->prev = (h); \
00040 } while (0)
00041 
00042 #define INIT_LIST_ELM(le) do { \
00043     (le)->next = NULL; (le)->prev = NULL; \
00044 } while (0)
00045 
00046 int list_detach(list_t * le);
00047 int list_add_tail(list_t * head, list_t * le);
00048 int list_add(list_t * head, list_t * le);
00049 
00050 
00051 #define list_foreach(curr, head) \
00052         for (curr = (head)->next; curr != (head); curr = curr->next)
00053 
00054 #define list_foreach_safe(pos, tmp, head) \
00055         for (pos = (head)->next, tmp = pos->next; pos != (head); \
00056                 pos = tmp, tmp = pos->next)
00057 #ifndef OMNETPP
00058 #define list_empty(head) ((head) == (head)->next)
00059 
00060 #define list_first(head) ((head)->next)
00061 
00062 #define list_unattached(le) ((le)->next == NULL && (le)->prev == NULL)
00063 #else
00064 
00065 int list_empty(list_t*);
00066 list_t* list_first(list_t*);
00067 int list_unattached(list_t*);
00068 
00069 #endif
00070 #endif
 All Classes Files Functions Variables Typedefs Enumerator Defines