RINASim  October 2016
Documentation of framework for OMNeT++
IListener.h
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #pragma once
24 
25 //Standard libraries
26 #include <omnetpp.h>
27 #include <iostream>
28 #include <fstream>
29 
30 #include "AEConstantMsgs.h"
31 
32 #include <set>
33 #include <map>
34 
35 namespace IListener {
36 
37  using namespace std;
38 
39  struct modQoSInfo {
40  int maxDel;
41  map<int, int> distDel;
42  int countDel;
43  int sumDel;
44 
45  int rcv, drop;
46 
47  modQoSInfo();
48  void RcvMsg();
49  void DropMsg();
50  void ServeMsg(int t);
51  };
52 
53  struct flowId {
54  string src, dst;
55  int srcCepId;
56  string qos;
57 
58  flowId(string _src, string _dst, int _srcCepId, string _qos);
59  bool operator<( const flowId & o ) const ;
60  };
61 
62  struct flowInfo {
63  simtime_t minDel, maxDel;
64  map<simtime_t, int> distDel;
65  int countDel;
66  simtime_t sumDel;
67 
68 
69  int minPST, maxPST;
70  map<int, int> distPST;
71  int countPST;
72  long sumPST;
73 
74  simtime_t lastDelay;
75  simtime_t minJitter, maxJitter;
76  map<simtime_t, int> distJit;
77  int countJit;
78  simtime_t sumJit;
79 
80 
81  int snd, rcv;
82  map<int, int> countConsDrop;
83  int lastSec, consDrop;
84 
85  flowInfo();
86 
87  void SendMsg();
88  void RcvMsg(int nSec, simtime_t h_delay, simtime_t p_delay, int pst_delay);
89  };
90 
91 
92  class IListenerModule : public cListener {
93  public:
94  set<string> QoS;
95  map<string, double> QoSDelay, QoSJitter;
96 
97  void initialize();
98  using cListener::receiveSignal;
99  virtual void receiveSignal(cComponent *source, simsignal_t signalID, cObject *obj);
100  void print(ofstream &out);
101  void printHopInfo(ofstream &out);
102  void printGHopInfo(ofstream &out);
103  void printFlowInfo(ofstream &out);
104  void printJFlowInfo(ofstream &out, ofstream &outb);
105 
106  void printPSTFlowInfo(ofstream &out);
107  void printPSTJFlowInfo(ofstream &out);
108 
109  void printQoSInfo(ofstream &out, ofstream &outb);
110  double h_delayV;
111 
112  protected:
113  map<string, map<cModule *, modQoSInfo> > modulesQoSInfo;
114  map<string, modQoSInfo> hopQoSInfo;
115  map<string, int> QoSsend;
116 
117  map<cModule *, modQoSInfo> modulesInfo;
118 
119  map<string, map<flowId, flowInfo> > QoSFlowInfo;
120 
121  };
122 
123  class IListener : public cSimpleModule {
124  protected:
125  virtual void initialize();
126  virtual void finish();
127  private:
129  double h_delayV;
130  };
131 
132  double Idround(double a, int ndigits);
133  simtime_t toDistIndex(simtime_t t);
134 
135 }
simtime_t minDel
Definition: IListener.h:63
double Idround(double a, int ndigits)
Definition: IListener.cc:776
map< string, modQoSInfo > hopQoSInfo
Definition: IListener.h:114
simtime_t lastDelay
Definition: IListener.h:74
IListenerModule module
Definition: IListener.h:128
map< string, map< flowId, flowInfo > > QoSFlowInfo
Definition: IListener.h:119
map< int, int > distDel
Definition: IListener.h:41
simtime_t sumJit
Definition: IListener.h:78
simtime_t toDistIndex(simtime_t t)
Definition: IListener.cc:789
map< string, int > QoSsend
Definition: IListener.h:115
map< string, double > QoSJitter
Definition: IListener.h:95
map< int, int > countConsDrop
Definition: IListener.h:82
simtime_t minJitter
Definition: IListener.h:75
map< cModule *, modQoSInfo > modulesInfo
Definition: IListener.h:117
map< int, int > distPST
Definition: IListener.h:70
map< string, map< cModule *, modQoSInfo > > modulesQoSInfo
Definition: IListener.h:113
simtime_t sumDel
Definition: IListener.h:66
map< simtime_t, int > distJit
Definition: IListener.h:76
map< simtime_t, int > distDel
Definition: IListener.h:64