NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_aodv_rrep.h
Go to the documentation of this file.
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_RREP_H
00024 #define NA_AODV_RREP_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 /* RREP Flags: */
00042 
00043 #define RREP_ACK       0x1
00044 #define RREP_REPAIR    0x2
00045 
00046 #ifndef OMNETPP
00047 typedef struct
00048 {
00049     u_int8_t type;
00050 #if defined(__LITTLE_ENDIAN)
00051     u_int16_t res1:6;
00052     u_int16_t a:1;
00053     u_int16_t r:1;
00054     u_int16_t prefix:5;
00055     u_int16_t res2:3;
00056 #elif defined(__BIG_ENDIAN)
00057     u_int16_t r:1;
00058     u_int16_t a:1;
00059     u_int16_t res1:6;
00060     u_int16_t res2:3;
00061     u_int16_t prefix:5;
00062 #else
00063 #error "Adjust your <bits/endian.h> defines"
00064 #endif
00065     u_int8_t hcnt;
00066     u_int32_t dest_addr;
00067     u_int32_t dest_seqno;
00068     u_int32_t orig_addr;
00069     u_int32_t lifetime;
00070 } RREP;
00071 
00072 #define RREP_SIZE sizeof(RREP)
00073 typedef struct
00074 {
00075     u_int8_t type;
00076     u_int8_t reserved;
00077 } RREP_ack;
00078 
00079 #define RREP_ACK_SIZE sizeof(RREP_ack)
00080 
00081 
00082 #endif
00083 
00084 
00085 #endif              /* NS_NO_GLOBALS */
00086 
00087 #ifndef NS_NO_DECLARATIONS
00088 RREP *rrep_create(u_int8_t flags,
00089                   u_int8_t prefix,
00090                   u_int8_t hcnt,
00091                   struct in_addr dest_addr,
00092                   u_int32_t dest_seqno,
00093                   struct in_addr orig_addr, u_int32_t life);
00094 
00095 RREP_ack *rrep_ack_create();
00096 AODV_ext *rrep_add_ext(RREP * rrep, int type, unsigned int offset,
00097                        int len, char *data);
00098 void rrep_send(RREP * rrep, rt_table_t * rev_rt, rt_table_t * fwd_rt, int size);
00099 void rrep_forward(RREP * rrep, int size, rt_table_t * rev_rt,
00100                   rt_table_t * fwd_rt, int ttl);
00101 void rrep_process(RREP * rrep, int rreplen, struct in_addr ip_src,
00102                   struct in_addr ip_dst, int ip_ttl, unsigned int ifindex);
00103 void rrep_ack_process(RREP_ack * rrep_ack, int rreplen, struct in_addr ip_src,
00104                       struct in_addr ip_dst);
00105 #endif              /* NS_NO_DECLARATIONS */
00106 
00107 #endif              /* AODV_RREP_H */
00108 
 All Classes Files Functions Variables Typedefs Enumerator Defines