RINASim  October 2016
Documentation of framework for OMNeT++
CDAP.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 "CDAP.h"
24 
26 
28 {
30 }
31 
32 void CDAP::handleMessage(cMessage* msg)
33 {
34  //Pass CDAP message to AE or RIBd or Enrollment
35  if (dynamic_cast<CDAPMessage*>(msg)) {
36  CDAPMessage* cmsg = check_and_cast<CDAPMessage*>(msg);
38  //delete cmsg;
39  }
40  //FIXME: Vesely - Proper disposing of object
41  //cancelAndDelete(msg);
42 }
43 
45  cModule* catcher = this->getModuleByPath("^.^");
46  //cModule* catcher2 = this->getModuleByPath("^.^.^")->getSubmodule(MOD_ENROLLMENTMODULE)->getSubmodule(MOD_ENROLLMENT);
47 
48  //Signals emmited by this module
49  sigCDAPReceiveData = registerSignal(SIG_CDAP_DateReceive);
50 
51  //Listeners registered to process signal
52  lisCDAPSendData = new LisCDAPSendData(this);
53  catcher->subscribe(SIG_AE_DataSend, lisCDAPSendData);
54  catcher->subscribe(SIG_RIBD_DataSend, lisCDAPSendData);
55 }
56 
58  //Change and take ownership
59  Enter_Method("SendData()");
60  take(check_and_cast<cOwnedObject*>(cmsg) );
61 
62  //Send message
63  cGate* out = gateHalf(GATE_SPLITIO, cGate::OUTPUT);
64  send(cmsg, out);
65 }
66 
68  emit(sigCDAPReceiveData, cmsg);
69 }
const char * GATE_SPLITIO
LisCDAPSendData * lisCDAPSendData
Definition: CDAP.h:54
Define_Module(CDAP)
const char * SIG_AE_DataSend
Definition: RINASignals.cc:36
Definition: CDAP.h:36
void initSignalsAndListeners()
Definition: CDAP.cc:44
virtual void handleMessage(cMessage *msg)
Definition: CDAP.cc:32
void signalizeReceiveData(CDAPMessage *cmsg)
Definition: CDAP.cc:67
const char * SIG_RIBD_DataSend
Definition: RINASignals.cc:45
void sendData(CDAPMessage *cmsg)
Definition: CDAP.cc:57
const char * SIG_CDAP_DateReceive
Definition: RINASignals.cc:81
simsignal_t sigCDAPReceiveData
Definition: CDAP.h:51
virtual void initialize()
Definition: CDAP.cc:27