RINASim  October 2016
Documentation of framework for OMNeT++
AEListeners.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 "AE.h"
24 #include "AEListeners.h"
25 
27 {
28 }
29 
31  ae = NULL;
32 }
33 
34 void LisAEReceiveData::receiveSignal(cComponent* src, simsignal_t id,
35  cObject* obj, cObject *detail) {
36  EV << "ReceiveData initiated by " << src->getFullPath()
37  << " and processed by " << ae->getFullPath() << endl;
38  CDAPMessage* msg = dynamic_cast<CDAPMessage*>(obj);
39  if (msg) {
40  ae->receiveData(msg);
41  }
42  else
43  EV << "AEListener received unknown object!" << endl;
44 }
45 
46 void LisAEAllReqFromFai::receiveSignal(cComponent* src, simsignal_t id,
47  cObject* obj, cObject *detail) {
48  EV << "AllocationRequest{fromFAI} initiated by " << src->getFullPath()
49  << " and processed by " << ae->getFullPath() << endl;
50  Flow* flow = dynamic_cast<Flow*>(obj);
51  if (flow) {
52  //Check whether dstApp is local...
53  //const APN dstApn = flow->getSrcApni().getApn();
54  //if (ae->getApni().getApn() == dstApn)
55  const APNamingInfo dstApni = flow->getSrcApni();
56  if (ae->getApni() == dstApni)
58  }
59  else
60  EV << "AEListener received unknown object!" << endl;
61 }
62 
63 void LisAEAllResPosi::receiveSignal(cComponent* src, simsignal_t id,
64  cObject* obj, cObject *detail) {
65  EV << "AllocateResponsePositive initiated by " << src->getFullPath()
66  << " and processed by " << ae->getFullPath() << endl;
67  Flow* flow = dynamic_cast<Flow*>(obj);
68  if (flow) {
69  if (ae->hasFlow(flow))
71  }
72  else
73  EV << "AEListener received unknown object!" << endl;
74 }
75 
76 void LisAEAllResNega::receiveSignal(cComponent* src, simsignal_t id,
77  cObject* obj, cObject *detail) {
78  EV << "AllocateResponseNegative initiated by " << src->getFullPath()
79  << " and processed by " << ae->getFullPath() << endl;
80  Flow* flow = dynamic_cast<Flow*>(obj);
81  if (flow) {
82  if (ae->hasFlow(flow))
84  }
85  else
86  EV << "AEListener received unknown object!" << endl;
87 }
88 
89 void LisAEDeallReqFromFai::receiveSignal(cComponent* src, simsignal_t id,
90  cObject* obj, cObject *detail) {
91  EV << "DeallocationRequest{fromFAI} initiated by " << src->getFullPath()
92  << " and processed by " << ae->getFullPath() << endl;
93  Flow* flow = dynamic_cast<Flow*>(obj);
94  if (flow) {
95  //Check whether dstApp is local...
96  //const APN dstApn = flow->getSrcApni().getApn();
97  //if (ae->getApni().getApn() == dstApn && ae->hasFlow(flow))
98  const APNamingInfo dstApni = flow->getSrcApni();
99  if (ae->getApni() == dstApni && ae->hasFlow(flow))
101  }
102  else
103  EV << "AEListener received unknown object!" << endl;
104 }
105 
106 void LisAEConResPosi::receiveSignal(cComponent* src, simsignal_t id,
107  cObject* obj, cObject *detail) {
108 
110  //TODO: signalize that result is available --> api call
111 }
112 
113 void LisAEConResNega::receiveSignal(cComponent* src, simsignal_t id,
114  cObject* obj, cObject *detail) {
115 
117  //TODO: signalize that result is available --> api call
118 
119 }
120 
121 void LisAERelRes::receiveSignal(cComponent* src, simsignal_t id,
122  cObject* obj, cObject *detail) {
123 
125  //TODO: signalize that ae can close flow, result is available --> api call
126 }
127 
128 void LisAEEnrolled::receiveSignal(cComponent* src, simsignal_t id,
129  long obj, cObject *detail) {
130 
131  //TODO: checks before call
132  //ae->afterOnStart();
133 }
134 
135 void LisAPAEAPI::receiveSignal(cComponent* src, simsignal_t id,
136  cObject* obj, cObject *detail) {
137  EV << "APIRequest initiated by " << src->getFullPath()
138  << " and processed by " << ae->getFullPath() << endl;
139  APIReqObj* apiObj = dynamic_cast<APIReqObj*>(obj);
140  if (apiObj->getCDAPConId() == ae->getCdapConId()) {
141  ae->apiSwitcher(apiObj);
142  }
143 }
Class representing flow object with attributes from specs.
Definition: Flow.h:45
const APNamingInfo & getSrcApni() const
Gets read-only source APNamingInfo.
Definition: Flow.cc:134
bool hasFlow(const Flow *flow)
Definition: AEBase.cc:189
unsigned long getCDAPConId()
Definition: APIObjBase.cc:36
void apiSwitcher(APIReqObj *obj)
Definition: AE.cc:269
void receiveAllocationResponseNegative(Flow *flow)
Definition: AE.cc:349
Definition: AE.h:44
const APNamingInfo & getApni() const
Definition: AEBase.cc:47
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:121
virtual ~AEListeners()
Definition: AEListeners.cc:30
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:76
void receiveAllocationResponsePositive(Flow *flow)
Definition: AE.cc:360
void receiveData(CDAPMessage *obj)
Definition: AE.cc:284
const unsigned long getCdapConId()
Definition: AEBase.cc:194
Definition: AEBase.h:58
APNamingInfo holds complete naming info for particular application process.
Definition: APNamingInfo.h:43
virtual void receiveSignal(cComponent *src, simsignal_t id, long obj, cObject *detail)
Definition: AEListeners.cc:128
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail) override
Definition: AEListeners.cc:34
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:63
void receiveAllocationRequestFromFAI(Flow *flow)
Definition: AE.cc:321
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:89
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:46
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:113
AEListeners(AE *nae)
Definition: AEListeners.cc:26
void receiveDeallocationRequestFromFAI(Flow *flow)
Definition: AE.cc:414
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:135
void changeConStatus(CDAPConnectionState conState)
Definition: AEBase.cc:103
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: AEListeners.cc:106