RINASim  October 2016
Documentation of framework for OMNeT++
FAListeners.cc
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 #include "FAListeners.h"
24 
25 void LisFAAllocReq::receiveSignal(cComponent* src, simsignal_t id, cObject* obj, cObject *detail) {
26  EV << "AllocateRequest initiated by " << src->getFullPath()
27  << " and processed by " << fa->getFullPath() << endl;
28  Flow* flow = dynamic_cast<Flow*>(obj);
29  if (flow) {
31  }
32  else
33  EV << "FAListener received not a flow object!" << endl;
34 }
35 
36 void LisFADeallocReq::receiveSignal(cComponent* src, simsignal_t id,
37  cObject* obj, cObject *detail) {
38  EV << "DeallocateRequest initiated by " << src->getFullPath()
39  << " and processed by " << fa->getFullPath() << endl;
40  Flow* flow = dynamic_cast<Flow*>(obj);
41  if (flow) {
43  }
44  else
45  EV << "FAListener received not a flow object!" << endl;
46 }
47 
54 void LisFACreReq::receiveSignal(cComponent* src, simsignal_t id, cObject* obj, cObject *detail) {
55  EV << "CreateRequest initiated by " << src->getFullPath() << " and processed by " << fa->getFullPath() << endl;
56  Flow* flow = dynamic_cast<Flow*>(obj);
57  if (flow)
59  else
60  EV << "Received not a flow object!" << endl;
61  return;
62 }
63 
64 
65 void LisFACreFloPosi::receiveSignal(cComponent* src, simsignal_t id,
66  cObject* obj, cObject *detail) {
67  EV << "NM1FlowCreated initiated by " << src->getFullPath() << " and processed by " << fa->getFullPath() << endl;
68  Flow* flow = dynamic_cast<Flow*>(obj);
69  if (flow
70  && fa->getMyAddress().getApn() == flow->getSrcApni().getApn()
71  && !flow->isManagementFlowLocalToIPCP() )
72  {
73  //EV << "-----\n" << flow->info() << endl;
75  for (TFTPtrsIter it = entries.begin(); it != entries.end(); ++it) {
76  fa->receiveNM1FlowCreated( (*it)->getFlow() );
77  }
78  }
79  else {
80  if (!flow) { EV << "Received not a flow object!" << endl; }
81  else if (!flow->getConId().getQoSId().compare(VAL_MGMTQOSID)) { EV << "Management flow allocated!" << endl; }
82  else { EV << "Flow not intended for my FA!" << endl; }
83  }
84 }
85 
86 void LisFAAllocFinMgmt::receiveSignal(cComponent* src, simsignal_t id,
87  cObject* obj, cObject *detail) {
88  EV << "AllocFinMgmt initiated by " << src->getFullPath() << " and processed by " << fa->getFullPath() << endl;
89 
90  /*
91  Flow* flow = dynamic_cast<Flow*>(obj);
92  EV << flow->info() << endl;
93  if (flow
94  && fa->getMyAddress().getApname() == flow->getSrcApni().getApn()
95  && flow->isManagementFlow())
96  {
97  //Notify pending flows that mgmt flow is prepared
98  TFAIPtrs entries = fa->getNFlowTable()->findEntriesAffectedByMgmt(flow);
99  for (TFTPtrsIter it = entries.begin(); it != entries.end(); ++it) {
100  fa->PendingFlows.push_back((*it)->getFlow());
101  }
102  fa->receiveMgmtAllocateFinish();
103  }
104  else {
105  if (!flow) { EV << "Received not a flow object!" << endl; }
106  else if (!flow->getConId().getQoSId().compare(VAL_MGMTQOSID)) { EV << "Management flow allocated!" << endl; }
107  else { EV << "Flow not intended for my FA!" << endl; }
108  }
109  */
110  APNIPair* apnip = dynamic_cast<APNIPair*>(obj);
111  //EV << "!!!!!" << apnip->info() << endl;
112  if (apnip && fa->getMyAddress().getApn() == apnip->first.getApn()) {
113  //EV << "!!!!!Uvnitr" << endl;
114  //Notify pending flows that mgmt flow is prepared
115  TFAIPtrs entries = fa->getNFlowTable()->findEntriesAffectedByMgmt(apnip);
116  for (TFTPtrsIter it = entries.begin(); it != entries.end(); ++it) {
117  fa->PendingFlows.push_back((*it)->getFlow());
118  }
119  //EV << "!!!!!Venku" << endl;
121  }
122  else {
123  EV << "FA received unknown object!" << endl;
124  }
125 
126 
127 
128 }
Class representing flow object with attributes from specs.
Definition: Flow.h:45
TFAIPtrs findEntriesByDstNeighborAndFwd(const APN &apname)
Definition: NFlowTable.cc:86
const APNamingInfo & getSrcApni() const
Gets read-only source APNamingInfo.
Definition: Flow.cc:134
virtual bool receiveAllocateRequest(Flow *flow)=0
std::string getQoSId() const
Getter of selected QoS-cube identifier.
Definition: ConnectionId.cc:44
APNamingInfo first
Definition: APNamingInfo.h:200
const std::string VAL_MGMTQOSID
Definition: QoSCube.cc:37
const APN & getApn() const
Getter of APN.
Definition: APNamingInfo.h:142
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: FAListeners.cc:36
TFAIPtrs findEntriesAffectedByMgmt(const APNIPair *apnip)
Definition: NFlowTable.cc:239
virtual bool receiveMgmtAllocateFinish()=0
TFAIPtrs::iterator TFTPtrsIter
Definition: NFlowTable.h:36
virtual bool receiveCreateFlowRequestFromRibd(Flow *flow)=0
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: FAListeners.cc:54
std::list< NFlowTableEntry * > TFAIPtrs
Definition: NFlowTable.h:33
const Address & getMyAddress() const
Definition: FABase.cc:54
FABase * fa
Definition: FAListeners.h:31
NFlowTable * getNFlowTable() const
Definition: FABase.cc:36
virtual bool receiveDeallocateRequest(Flow *flow)=0
const ConnectionId & getConId() const
Gets read-only Flow's ConnectionId.
Definition: Flow.cc:86
std::list< Flow * > PendingFlows
Definition: FABase.h:39
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: FAListeners.cc:86
const APN & getApn() const
Getter of unique APN which is initialized during object construction.
Definition: Address.cc:119
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: FAListeners.cc:65
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: FAListeners.cc:25
bool isManagementFlowLocalToIPCP() const
Definition: Flow.cc:370
virtual void receiveNM1FlowCreated(Flow *flow)=0
const APNamingInfo & getDstApni() const
Gets read-only destination APNamingInfo.
Definition: Flow.cc:102