RINASim  October 2016
Documentation of framework for OMNeT++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AESInt.h
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #ifndef __RINA_AESInt_H_
17 #define __RINA_AESInt_H_
18 
19 //Standard libraries
20 #include <omnetpp.h>
21 //RINASim libraries
22 #include "AE.h"
23 
24 
25 #include <map>
26 
27 
28 class _AESInt_self : public cMessage {
29 public:
30  _AESInt_self();
31 };
32 
33 class _PingMsg : public CDAP_M_Read {
34 public:
35  _PingMsg();
36  simtime_t pingAt;
37 };
38 
39 class _PongMsg : public CDAP_M_Read_R {
40 public:
41  _PongMsg(simtime_t pingAt);
42  simtime_t pingAt, pongAt;
43 };
44 
45 double minMaxNormal (double a, double b, int rng=0);
46 
47 class AESInt : public AE {
48 
49 public:
50  AESInt();
51  virtual ~AESInt();
52 
53 protected:
54  bool inTime;
55  int maxSize;
56 
57  virtual void doIni() = 0;
58  virtual void doFin() = 0;
59  virtual void iniCom() = 0;
60 
61  virtual void processMsg(_AESInt_self *);
62  virtual void processMsg(_PingMsg *);
63  virtual void processMsg(_PongMsg *);
64 
65  void sendMsg(_PingMsg *, int);
66  void sendMsg(_PongMsg *, int);
67 
68 private:
69  std::string dstApName;
70  std::string dstApInstance;
71  std::string dstAeName;
72  std::string dstAeInstance;
73 
74  simtime_t startAt;
75  simtime_t stopAt;
76  simtime_t sendDuring;
77  simtime_t sendAfter;
78 
79  long send;
80  long received;
81  long sendSize;
83 
84  double recTimes;
85  std::map<double, int> times;
86 
87  simtime_t maxDelay;
88  simtime_t sumDelay;
89 
90  virtual void initialize();
91  virtual void finish();
92  virtual void handleMessage(cMessage *msg);
93  void handleSelfMessage(cMessage* msg);
94 
95  virtual void processMRead(CDAPMessage* msg);
96  virtual void processMReadR(CDAPMessage* msg);
97 
98  double dround(double a, int ndigits);
99 };
100 
101 #endif
virtual ~AESInt()
Definition: AESInt.cc:39
double recTimes
Definition: AESInt.h:84
simtime_t sumDelay
Definition: AESInt.h:88
virtual void processMsg(_AESInt_self *)
Definition: AESInt.cc:209
std::string dstApName
Definition: AESInt.h:69
long send
Definition: AESInt.h:79
Definition: AE.h:44
virtual void doFin()=0
virtual void processMReadR(CDAPMessage *msg)
Definition: AESInt.cc:175
std::map< double, int > times
Definition: AESInt.h:85
Definition: AESInt.h:47
virtual void finish()
Definition: AESInt.cc:113
simtime_t maxDelay
Definition: AESInt.h:87
long receivedSize
Definition: AESInt.h:82
void sendMsg(_PingMsg *, int)
Definition: AESInt.cc:196
simtime_t sendAfter
Definition: AESInt.h:77
double minMaxNormal(double a, double b, int rng=0)
Definition: AESInt.cc:30
std::string dstApInstance
Definition: AESInt.h:70
long received
Definition: AESInt.h:80
simtime_t startAt
Definition: AESInt.h:74
std::string dstAeInstance
Definition: AESInt.h:72
void handleSelfMessage(cMessage *msg)
Definition: AESInt.cc:139
std::string dstAeName
Definition: AESInt.h:71
virtual void handleMessage(cMessage *msg)
Definition: AESInt.cc:159
virtual void iniCom()=0
virtual void doIni()=0
simtime_t sendDuring
Definition: AESInt.h:76
bool inTime
Definition: AESInt.h:54
virtual void initialize()
Definition: AESInt.cc:46
int maxSize
Definition: AESInt.h:55
simtime_t stopAt
Definition: AESInt.h:75
simtime_t pingAt
Definition: AESInt.h:36
virtual void processMRead(CDAPMessage *msg)
Definition: AESInt.cc:169
double dround(double a, int ndigits)
Definition: AESInt.cc:219
AESInt()
Definition: AESInt.cc:37
simtime_t pongAt
Definition: AESInt.h:42
_PingMsg()
Definition: AESInt.cc:20
simtime_t pingAt
Definition: AESInt.h:42
_PongMsg(simtime_t pingAt)
Definition: AESInt.cc:24
long sendSize
Definition: AESInt.h:81
_AESInt_self()
Definition: AESInt.cc:18