RINASim  October 2016
Documentation of framework for OMNeT++
RoutingNotifier.cc
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #include "RoutingNotifier.h"
17 
19 
20 const char* MSG_ROUTINGUPDATE = "RoutingUpdate";
21 
23 {
25  initPointers();
26 }
27 
29 {
30  RIBd = getRINAModule<RIBdBase*>(this, 1, { "ribd" });
31 }
32 
34 {
35  cModule* catcher2 = this->getModuleByPath("^.^");
36 
38 
40  catcher2->subscribe(SIG_RIBD_RoutingUpdate, lisRIBDRoutingUpdate);
41 }
42 
43 void RoutingNotifier::handleMessage(cMessage *msg)
44 {
45 
46 }
47 
49 {
50  RIBd->signalizeSendData(msg);
51 }
52 
54 {
55  EV << getFullPath() << " Forwarding update to send to "
56  << info->getDestination();
57 
58  /* Emits the CDAP message. */
59 
61  std::ostringstream os;
62  object_t flowobj;
63 
64  /* Prepare the object to send. */
65 
66  os << "RoutingUpdateTo" << info->getDestination();
67 
68  flowobj.objectClass = info->getClassName();
69  flowobj.objectName = os.str();
70  flowobj.objectVal = info;
71  //TODO: Vesely - Assign appropriate values
73 
74  cdapm->setObjectItem(flowobj);
75 
76  //TODO: Vesely - Work more on InvokeId
77 
78  /* This message will be sent to... */
79  cdapm->setDstAddr(info->getDestination());
80 
81  /* Finally order to send the data... */
82  RIBd->signalizeSendData(cdapm);
83 }
84 
86 {
87  object_t object = msg->getObjectItem();
88 
89  if (dynamic_cast<IntRoutingUpdate *>(object.objectVal))
90  {
91  IntRoutingUpdate* update = check_and_cast<IntRoutingUpdate *>(
92  object.objectVal);
93  emit(sigRIBDRoutingUpdateRecv, update);
94  }
95 }
::omnetpp::opp_string objectClass
const int VAL_DEFINSTANCE
const char * SIG_RIBD_RoutingUpdateReceived
Definition: RINASignals.cc:53
Definition: RIBd.h:54
int objectInstance
virtual void signalizeMessage(CDAPMessage *msg)
Function asks for notifies about CDAP message ready to be sent.
simsignal_t sigRIBDRoutingUpdateRecv
virtual void setObjectItem(const object_t &objectItem)
virtual void signalizeSendData(CDAPMessage *msg)
Definition: RIBd.cc:444
virtual void receiveRoutingUpdateFromRouting(IntRoutingUpdate *update)
virtual void initialize()
LisRIBDRoutingUpdate * lisRIBDRoutingUpdate
void initSignalsAndListeners()
const char * MSG_ROUTINGUPDATE
virtual void handleMessage(cMessage *msg)
virtual object_t & getObjectItem()
Address getDestination()
const char * SIG_RIBD_RoutingUpdate
Definition: RINASignals.cc:140
Define_Module(RoutingNotifier)
ObjectPtr objectVal
virtual void setDstAddr(const Address &dstAddr)
virtual void processMWrite(CDAP_M_Write *msg)
Function crunching supported M_WRITE message.
::omnetpp::opp_string objectName