NETWORK ATTACKS FRAMEWORK
1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
|
00001 /***************************************************************************** 00002 * 00003 * Copyright (C) 2001 Uppsala University & 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 *****************************************************************************/ 00023 #ifndef NA_AODV_RERR_H 00024 #define NA_AODV_RERR_H 00025 00026 #ifndef NS_NO_GLOBALS 00027 00028 #ifndef OMNETPP 00029 #ifndef _WIN32 00030 #include <endian.h> 00031 #else 00032 #ifndef __LITTLE_ENDIAN 00033 #define __LITTLE_ENDIAN 00034 #endif 00035 #endif 00036 #endif 00037 00038 #include "NA_defs_aodv.h" 00039 #include "NA_routing_table.h" 00040 00041 00042 /* RERR Flags: */ 00043 #define RERR_NODELETE 0x1 00044 00045 #ifndef OMNETPP 00046 /* Extra unreachable destinations... */ 00047 typedef struct 00048 { 00049 u_int32_t dest_addr; 00050 u_int32_t dest_seqno; 00051 } RERR_udest; 00052 #define RERR_UDEST_SIZE sizeof(RERR_udest) 00053 00054 typedef struct 00055 { 00056 u_int8_t type; 00057 #if defined(__LITTLE_ENDIAN) 00058 u_int8_t res1:7; 00059 u_int8_t n:1; 00060 #elif defined(__BIG_ENDIAN) 00061 u_int8_t n:1; 00062 u_int8_t res1:7; 00063 #else 00064 #error "Adjust your <bits/endian.h> defines" 00065 #endif 00066 u_int8_t res2; 00067 u_int8_t dest_count; 00068 u_int32_t dest_addr; 00069 u_int32_t dest_seqno; 00070 } RERR; 00071 #define RERR_SIZE sizeof(RERR) 00072 /* Given the total number of unreachable destination this macro 00073 returns the RERR size */ 00074 #define RERR_CALC_SIZE(rerr) (RERR_SIZE + (rerr->dest_count-1)*RERR_UDEST_SIZE) 00075 #define RERR_UDEST_FIRST(rerr) ((RERR_udest *)&rerr->dest_addr) 00076 #define RERR_UDEST_NEXT(udest) ((RERR_udest *)((char *)udest + RERR_UDEST_SIZE)) 00077 00078 #endif /* OMNET++ */ 00079 #endif /* NS_NO_GLOBALS */ 00080 00081 #ifndef NS_NO_DECLARATIONS 00082 RERR *rerr_create(u_int8_t flags, struct in_addr dest_addr, 00083 u_int32_t dest_seqno); 00084 void rerr_add_udest(RERR * rerr,struct in_addr udest, u_int32_t udest_seqno); 00085 void rerr_process(RERR * rerr, int rerrlen,struct in_addr ip_src, 00086 struct in_addr ip_dst); 00087 #endif /* NS_NO_DECLARATIONS */ 00088 00089 #endif /* AODV_RERR_H */ 00090