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 *****************************************************************************/ 00023 #ifndef NA_AODV_RREQ_H 00024 #define NA_AODV_RREQ_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_seek_list.h" 00040 #include "NA_routing_table.h" 00041 00042 /* RREQ Flags: */ 00043 #define RREQ_JOIN 0x1 00044 #define RREQ_REPAIR 0x2 00045 #define RREQ_GRATUITOUS 0x4 00046 #define RREQ_DEST_ONLY 0x8 00047 00048 #ifndef OMNETPP 00049 typedef struct 00050 { 00051 u_int8_t type; 00052 #if defined(__LITTLE_ENDIAN) 00053 u_int8_t res1:4; 00054 u_int8_t d:1; 00055 u_int8_t g:1; 00056 u_int8_t r:1; 00057 u_int8_t j:1; 00058 #elif defined(__BIG_ENDIAN) 00059 u_int8_t j:1; /* Join flag (multicast) */ 00060 u_int8_t r:1; /* Repair flag */ 00061 u_int8_t g:1; /* Gratuitous RREP flag */ 00062 u_int8_t d:1; /* Destination only respond */ 00063 u_int8_t res1:4; 00064 #else 00065 #error "Adjust your <bits/endian.h> defines" 00066 #endif 00067 u_int8_t res2; 00068 u_int8_t hcnt; 00069 u_int32_t rreq_id; 00070 u_int32_t dest_addr; 00071 u_int32_t dest_seqno; 00072 u_int32_t orig_addr; 00073 u_int32_t orig_seqno; 00074 } RREQ; 00075 00076 #define RREQ_SIZE sizeof(RREQ) 00077 #endif 00078 /* A data structure to buffer information about received RREQ's */ 00079 struct rreq_record 00080 { 00081 list_t l; 00082 struct in_addr orig_addr; /* Source of the RREQ */ 00083 u_int32_t rreq_id; /* RREQ's broadcast ID */ 00084 struct timer rec_timer; 00085 }; 00086 00087 struct blacklist 00088 { 00089 list_t l; 00090 struct in_addr dest_addr; 00091 struct timer bl_timer; 00092 }; 00093 #endif /* NS_NO_GLOBALS */ 00094 00095 #ifndef NS_NO_DECLARATIONS 00096 RREQ *rreq_create(u_int8_t flags, struct in_addr dest_addr, 00097 u_int32_t dest_seqno, struct in_addr orig_addr); 00098 void rreq_send(struct in_addr dest_addr, u_int32_t dest_seqno, int ttl, 00099 u_int8_t flags); 00100 void rreq_forward(RREQ * rreq, int size, int ttl); 00101 void rreq_process(RREQ * rreq, int rreqlen, struct in_addr ip_src, 00102 struct in_addr ip_dst, int ip_ttl, unsigned int ifindex); 00103 void rreq_route_discovery(struct in_addr dest_addr, u_int8_t flags, 00104 struct ip_data *ipd); 00105 void rreq_record_timeout(void *arg); 00106 struct blacklist *rreq_blacklist_insert(struct in_addr dest_addr); 00107 void rreq_blacklist_timeout(void *arg); 00108 void rreq_local_repair(rt_table_t * rt, struct in_addr src_addr, 00109 struct ip_data *ipd); 00110 void rreq_proactive (void *arg); 00111 00112 #ifdef NS_PORT 00113 struct rreq_record *rreq_record_insert(struct in_addr orig_addr, 00114 u_int32_t rreq_id); 00115 struct rreq_record *rreq_record_find(struct in_addr orig_addr, 00116 u_int32_t rreq_id); 00117 struct blacklist *rreq_blacklist_find(struct in_addr dest_addr); 00118 #endif /* NS_PORT */ 00119 00120 #endif /* NS_NO_DECLARATIONS */ 00121 00122 #endif /* AODV_RREQ_H */