NETWORK ATTACKS FRAMEWORK  1.0.0
A NETwork Attacks framework. Making network attacks impact evaluation easier!
NA_IPv4.h
Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2013, NESG (Network Engineering and Security Group), http://nesg.ugr.es,
00003 // - Gabriel Maciá Fernández (gmacia@ugr.es)
00004 // - Leovigildo Sánchez Casado (sancale@ugr.es)
00005 // - Rafael A. Rodríguez Gómez (rodgom@ugr.es)
00006 // - Roberto Magán Carrión (rmagan@ugr.es)
00007 // - Pedro García Teodoro (pgteodor@ugr.es)
00008 // - José Camacho Páez (josecamacho@ugr.es)
00009 // - Jesús E. Díaz Verdejo (jedv@ugr.es)
00010 //
00011 // This file is part of NETA.
00012 //
00013 //    NETA is free software: you can redistribute it and/or modify
00014 //    it under the terms of the GNU General Public License as published by
00015 //    the Free Software Foundation, either version 3 of the License, or
00016 //    (at your option) any later version.
00017 //
00018 //    NETA is distributed in the hope that it will be useful,
00019 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //    GNU General Public License for more details.
00022 //
00023 //    You should have received a copy of the GNU General Public License
00024 //    along with NETA.  If not, see <http://www.gnu.org/licenses/>.
00025 //
00026 
00027 #ifndef NA_IPV4_H_
00028 #define NA_IPV4_H_
00029 
00030 #include <IPv4.h>
00031 #include <omnetpp.h>
00032 #include "common/log/NA_NesgLog.h"
00033 #include "NA_HackedModule.h"
00034 #include "NA_DroppingMessage_m.h"
00035 #include "NA_DelayMessage_m.h"
00036 
00040 #define TCP_DATA "tcp"
00041 
00045 #define UDP_DATA "UDP"
00046 
00050 #define PING_DATA "ping"
00051 
00071 class INET_API NA_IPv4 : public IPv4, public NA_HackedModule {
00072 
00073 private:
00074 
00078     NA_NesgLog log;
00079 
00080     /*----------------- DROPPING ATTACK  -------------------------*/
00084     bool droppingAttackIsActive;
00085 
00089     double droppingAttackProbability;
00090 
00094     long numDrops;
00095 
00096     /*----------------- DELAY ATTACK  -------------------------*/
00100     bool delayAttackIsActive;
00101 
00105     double delayAttackProbability;
00106 
00110     long numDelays;
00111 
00115     long totalDelayTime;
00116 
00120     ParPtr delayAttackValue;
00121 
00122     /*---------------------OTHERs-------------------------------*/
00126     long numRecvPacket;
00127 
00128 public:
00129 
00133     void handleMessageFromAttackController(cMessage *msg);
00134 
00135 protected:
00136 
00141     virtual void initialize();
00142 
00143     /*----------------- DROPPING ATTACK  -------------------------*/
00147     static simsignal_t dropSignal;
00148 
00154     virtual void handlePacketFromNetwork(IPv4Datagram *datagram, InterfaceEntry *fromIE);
00155 
00156     /*----------------- DELAY ATTACK  -------------------------*/
00162     virtual simtime_t startService(cPacket *msg);
00163 
00167     static simsignal_t delaySignal;
00168 
00169     /*------------------OTHERs ---------------------------------*/
00173     static simsignal_t rcvdPktSignal;
00174 
00175 };
00176 
00177 #endif /* NA_IPV4_H_ */
 All Classes Files Functions Variables Typedefs Enumerator Defines