NETWORK ATTACKS FRAMEWORK
1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
|
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 #include <stdlib.h> 00023 00024 #include "NA_list.h" 00025 00026 static inline int listelm_detach(list_t * prev, list_t * next) 00027 { 00028 next->prev = prev; 00029 prev->next = next; 00030 00031 return LIST_SUCCESS; 00032 } 00033 00034 static inline int listelm_add(list_t * le, list_t * prev, list_t * next) 00035 { 00036 prev->next = le; 00037 le->prev = prev; 00038 le->next = next; 00039 next->prev = le; 00040 00041 return LIST_SUCCESS; 00042 } 00043 00044 00045 int list_add(list_t * head, list_t * le) 00046 { 00047 00048 if (!head || !le) 00049 return LIST_NULL; 00050 00051 listelm_add(le, head, head->next); 00052 00053 return LIST_SUCCESS; 00054 } 00055 00056 int list_add_tail(list_t * head, list_t * le) 00057 { 00058 00059 if (!head || !le) 00060 return LIST_NULL; 00061 00062 listelm_add(le, head->prev, head); 00063 00064 return LIST_SUCCESS; 00065 } 00066 00067 int list_detach(list_t * le) 00068 { 00069 if (!le) 00070 return LIST_NULL; 00071 00072 listelm_detach(le->prev, le->next); 00073 00074 le->next = le->prev = NULL; 00075 00076 return LIST_SUCCESS; 00077 }; 00078 00079 00080 int list_empty (list_t *head) 00081 { 00082 if (head == head->next) 00083 return 1; 00084 return 0; 00085 } 00086 00087 list_t* list_first(list_t* head) 00088 { 00089 return head->next; 00090 } 00091 00092 int list_unattached(list_t *le) 00093 { 00094 if (le->next == NULL && le->prev == NULL) 00095 return 1; 00096 return 0; 00097 } 00098