RINASim  October 2016
Documentation of framework for OMNeT++
QueuePerNFlow.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 //
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 <QueuePerNFlow.h>
25 
27 
29 {
30  rmtAllocator->addQueue(RMTQueue::OUTPUT, port, idGenerator->generateIDFromFlow(flow).c_str())->setFlow(flow);
31  flow->swapFlow();
32  rmtAllocator->addQueue(RMTQueue::INPUT, port, idGenerator->generateIDFromFlow(flow).c_str())->setFlow(flow);
33  flow->swapFlow();
34 }
35 
37 {
38  // In this policy, each port gets a queue for each active (N)-flow.
39  // Since there's a possibility of RMT receiving a PDU generated by a mock
40  // EFCP instance (i.e. its connection-id equals {0, 0, MGMT}), we need to
41  // take care of this exception by adding a fallback queue.
42 
43  rmtAllocator->addQueue(RMTQueue::OUTPUT, port, "noflow");
44  rmtAllocator->addQueue(RMTQueue::INPUT, port, "noflow");
45 }
Class representing flow object with attributes from specs.
Definition: Flow.h:45
virtual void onNM1PortInit(RMTPort *port)
QueueIDGenBase * idGenerator
RMTModuleAllocator * rmtAllocator
virtual void onNFlowAlloc(RMTPort *port, Flow *flow)
Define_Module(QueuePerNFlow)
RMTQueue * addQueue(RMTQueueType type, RMTPort *port, const char *queueId="0")
virtual std::string generateIDFromFlow(Flow *flow)
Flow & swapFlow()
Function that swaps relevant source and destination Flow parameters It is being used mainly for count...
Definition: Flow.cc:311