RINASim  October 2016
Documentation of framework for OMNeT++
DAFRIBd.cc
Go to the documentation of this file.
1 //
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 
24 #include <RIB/DAFRIBd.h>
25 
26 const char* PAR_USEDAFENROLLNOTIF = "useEnrollmentNotifier";
27 
29 
31 
32  useEnrollmentNotifier = false;
33 
34  //Init signals and listeners
36 
37  //Pointers
38  initPointers();
39 }
40 
42  EnrollNotif = getRINAModule<EnrollmentNotifierBase*>(this, 1, {"enrollmentNotifier"}, false);
43  if (EnrollNotif) {
44  useEnrollmentNotifier = true;
45  this->par(PAR_USEDAFENROLLNOTIF) = true;
46  }
47 }
48 
49 void DAFRIBd::handleMessage(cMessage *msg) {
50 
51 }
52 
54  Enter_Method("receiveData()");
55 
56  //EnrollmentNotifier processing
59  }
60  //delete msg;
61 }
62 
64  cModule* catcher1 = this->getParentModule();
65 
66  //Signals that this module is emitting
67  sigDAFRIBDSendData = registerSignal(SIG_RIBD_DataSend);
68 
69 
71  catcher1->subscribe(SIG_CDAP_DateReceive, lisDAFRIBDRcvData);
72 
73 }
74 
76  Enter_Method("signalizeSendData()");
77 
78  //Check dstAddress
80  EV << "Destination address cannot be UNSPECIFIED!" << endl;
81  return;
82  }
83 
84  msg->setBitLength(msg->getBitLength() + msg->getHeaderBitLength());
85  //Pass message to CDAP
86  EV << "Emits SendData signal for message " << msg->getName() << endl;
87  emit(sigDAFRIBDSendData, msg);
88 }
89 
90 
Define_Module(DAFRIBd)
virtual unsigned int getHeaderBitLength() const
static const Address UNSPECIFIED_ADDRESS
Definition: Address.h:44
virtual Address & getDstAddr()
virtual void receiveData(CDAPMessage *cimsg)
Definition: DAFRIBd.cc:53
virtual void initialize()
Definition: DAFRIBd.cc:30
virtual void receiveMessage(CDAPMessage *msg)
Function checks the type of CDAP message and passes it to appropriate processing method.
bool useEnrollmentNotifier
Definition: DAFRIBd.h:48
simsignal_t sigDAFRIBDSendData
Definition: DAFRIBd.h:57
void initPointers()
Definition: DAFRIBd.cc:41
virtual bool isMessageProcessable(CDAPMessage *msg)
Function checks whether CDAP message can be processed by notifier.
virtual void handleMessage(cMessage *msg)
Definition: DAFRIBd.cc:49
EnrollmentNotifierBase * EnrollNotif
Definition: DAFRIBd.h:46
const char * PAR_USEDAFENROLLNOTIF
Definition: DAFRIBd.cc:26
virtual void signalizeSendData(CDAPMessage *msg)
Definition: DAFRIBd.cc:75
void initSignalsAndListeners()
Definition: DAFRIBd.cc:63
const char * SIG_RIBD_DataSend
Definition: RINASignals.cc:45
const char * SIG_CDAP_DateReceive
Definition: RINASignals.cc:81
LisDAFRIBDRcvData * lisDAFRIBDRcvData
Definition: DAFRIBd.h:60