RINASim  October 2016
Documentation of framework for OMNeT++
APListeners.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 <AP/APListeners.h>
24 
25 APListeners::APListeners(AP* nap) : ap(nap) {
26 }
27 
29  ap = NULL;
30 }
31 
32 void LisAPAllReqFromFai::receiveSignal(cComponent* src, simsignal_t id,
33  cObject* obj, cObject *detail) {
34  EV << "AllocationRequest{fromFAI} initiated by " << src->getFullPath()
35  << " and processed by " << ap->getFullPath() << endl;
36  Flow* flow = dynamic_cast<Flow*>(obj);
37  if (flow) {
38  const APNamingInfo dstApni = flow->getSrcApni();
39  if (std::strcmp(dstApni.getAename().c_str(),""))
40  if (ap->getCurrentAEInstNum(dstApni.getAename()) < std::stoi(dstApni.getAeinstance()) ||
41  std::stoi(dstApni.getAeinstance()) == -1)
43  }
44  else
45  EV << "APListener received unknown object!" << endl;
46 }
47 
48 void LisAEAPAPI::receiveSignal(cComponent* src, simsignal_t id,
49  cObject* obj, cObject *detail) {
50  EV << "APWriteR initiated by " << src->getFullPath()
51  << " and processed by " << ap->getFullPath() << endl;
52  APIResult* result = dynamic_cast<APIResult*>(obj);
53  if (result) {
54  ap->resultAssign(result);
55  }
56  else
57  EV << "APListener received unknown object!" << endl;
58 }
59 
60 
61 void LisAPEnrolled::receiveSignal(cComponent* src, simsignal_t id,
62  long obj, cObject *detail) {
63  EV << "APEnrollmentEnrolled initiated by " << src->getFullPath()
64  << " and processed by " << ap->getFullPath() << endl;
66 }
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: APListeners.cc:48
void receiveAllocationRequestFromFAI(Flow *flow)
Definition: AP.cc:241
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
virtual void resultAssign(APIResult *result)
Definition: AP.cc:292
Definition: AP.h:40
const std::string & getAename() const
Getter of AE name.
Definition: APNamingInfo.h:110
int getCurrentAEInstNum(std::string AEName)
Definition: APBase.cc:51
virtual ~APListeners()
Definition: APListeners.cc:28
APNamingInfo holds complete naming info for particular application process.
Definition: APNamingInfo.h:43
virtual void receiveSignal(cComponent *src, simsignal_t id, cObject *obj, cObject *detail)
Definition: APListeners.cc:32
const std::string & getAeinstance() const
Getter of AE-instance attribute.
Definition: APNamingInfo.h:94
virtual void receiveSignal(cComponent *src, simsignal_t id, long obj, cObject *detail)
Definition: APListeners.cc:61
APListeners(AP *nap)
Definition: APListeners.cc:25
virtual void startRequestedConnections()
Definition: AP.cc:310