NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_aodv_socket.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_SOCKET_H
00024 #define NA_AODV_SOCKET_H
00025 
00026 #ifndef NS_NO_GLOBALS
00027 
00028 #ifndef OMNETPP
00029 #include <netinet/ip.h>
00030 #endif
00031 
00032 #include "NA_defs_aodv.h"
00033 #include "NA_aodv_rerr.h"
00034 #include "NA_params.h"
00035 
00036 #ifndef OMNETPP
00037 #define IPHDR_SIZE sizeof(struct iphdr)
00038 #endif
00039 
00040 /* Set a maximun size for AODV msgs. The RERR is the potentially
00041    largest message, depending on how many unreachable destinations
00042    that are included. Lets limit them to 100 */
00043 #define AODV_MSG_MAX_SIZE RERR_SIZE + 100 * RERR_UDEST_SIZE
00044 #define RECV_BUF_SIZE AODV_MSG_MAX_SIZE
00045 #define SEND_BUF_SIZE RECV_BUF_SIZE
00046 #endif              /* NS_NO_GLOBALS */
00047 
00048 #ifndef NS_NO_DECLARATIONS
00049 
00050 struct timeval rreq_ratel[RREQ_RATELIMIT - 1], rerr_ratel[RERR_RATELIMIT - 1];
00051 int num_rreq;
00052 int num_rerr;
00053 
00054 void aodv_socket_init();
00055 void aodv_socket_send(AODV_msg * aodv_msg, struct in_addr dst, int len,
00056                       u_int8_t ttl, struct dev_info *dev,double delay=-1);
00057 #ifndef OMNETPP
00058 AODV_msg *aodv_socket_new_msg();
00059 AODV_msg *aodv_socket_queue_msg(AODV_msg * aodv_msg, int size);
00060 #endif
00061 void aodv_socket_cleanup(void);
00062 void aodv_socket_process_packet(AODV_msg * aodv_msg, int len,
00063                                 struct in_addr src,struct in_addr dst, int ttl,
00064                                 unsigned int ifindex);
00065 #define CMSG_NXTHDR_FIX(mhdr, cmsg) cmsg_nxthdr_fix((mhdr), (cmsg))
00066 struct cmsghdr *cmsg_nxthdr_fix(struct msghdr *__msg, struct cmsghdr *__cmsg);
00067 
00068 #ifdef NS_PORT
00069 #ifndef OMNETPP
00070 void recvAODVUUPacket(Packet * p);
00071 #endif
00072 #endif              /* NS_PORT */
00073 
00074 #endif              /* NS_NO_DECLARATIONS */
00075 
00076 #endif              /* AODV_SOCKET_H */
 All Classes Files Functions Variables Typedefs Enumerator Defines