RINASim  October 2016
Documentation of framework for OMNeT++
RIBdSplitter.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 "RIBdSplitter.h"
24 
26 
28 {
29  FaiTable = NULL;
30  initPointers();
31 }
32 
33 void RIBdSplitter::handleMessage(cMessage *msg)
34 {
35  //Output gate pointer
36  cGate* out;
37 
38  //From CDAP
39  if(strstr(msg->getArrivalGate()->getName(), GATE_CDAPIO) != NULL) {
40  /*
41  * FIXME: Vesely
42  * After huge debate with John, we understand now, that reliability of management
43  * traffic is done by N-1 flow. Thus, N-management flow exist WITHOUT dedicated
44  * exchange of M_CREATE messages. This implies that all mgmt traffic is sent
45  * through MockEFCPI. However, one day there may be use-case when we will do not
46  * trust N-1 flow and want to provide additional reliability or encryption. Hence,
47  * I am just commenting out the code instead of removing it.
48  */
49 
50  //CDAPMessage* cdapmsg = check_and_cast<CDAPMessage*>(msg);
51  //FAITableEntry* tfe = FaiTable->findMgmtEntryByDstNeighbor(cdapmsg->getDstAddr());
52  //if (tfe
53  // && !dynamic_cast<CDAP_M_Create*>(msg)
54  // //&& tfe->getCFlow()->getSrcPortId() != VAL_UNDEF_PORTID
55  // //&& tfe->getCFlow()->getDstPortId() != VAL_UNDEF_PORTID
56  // ) {
57  // std::ostringstream ribdName;
58  // ribdName << GATE_EFCPIO_ << tfe->getCFlow()->getSrcPortId();
59  // out = this->gateHalf(ribdName.str().c_str(), cGate::OUTPUT);
60  //}
61  //else {
62  // EV << "Message sent out via mock EFCP instance!" << endl;
63  out = this->gateHalf(GATE_EFCPIO, cGate::OUTPUT);
64  //}
65  }
66  //From EFCP or RMT
67  else {
68  out = gateHalf(GATE_CDAPIO, cGate::OUTPUT);
69  }
70 
71  //Send through appropriate gate
72  send(msg, out);
73 }
74 
76  FaiTable = getRINAModule<NFlowTable*>(this, 2, {MOD_FLOWALLOC, MOD_NFLOWTABLE});
77 }
Define_Module(RIBdSplitter)
void initPointers()
Definition: RIBdSplitter.cc:75
NFlowTable * FaiTable
Definition: RIBdSplitter.h:36
const char * GATE_EFCPIO
virtual void handleMessage(cMessage *msg)
Definition: RIBdSplitter.cc:33
const char * MOD_FLOWALLOC
Definition: ExternConsts.cc:47
const char * GATE_CDAPIO
const char * MOD_NFLOWTABLE
Definition: ExternConsts.cc:53
virtual void initialize()
Definition: RIBdSplitter.cc:27