RINASim  October 2016
Documentation of framework for OMNeT++
IDPerNFlow.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 
24 #include "IDPerNFlow.h"
25 
27 
28 std::string IDPerNFlow::constructQueueID(const std::string& ipcName, ConnectionId& connID)
29 {
30  // Currently (without CO routing), it's sufficient to identify distinct (N)-flow's
31  // traffic by a concatenation of the other endpoint's IPC address and CEP-id.
32  // However, we also need to accommodate management PDUs that may arrive without
33  // an allocated (N)-flow.
34 
35  std::string id;
36 
37  if (connID.getQoSId() == VAL_MGMTQOSID)
38  {
39  id = std::string("noflow");
40  }
41  else
42  {
43  std::ostringstream id_ostr;
44  id_ostr << ipcName << "_" << connID.getSrcCepId();
45  id = id_ostr.str();
46  }
47 
48  return id;
49 }
50 
52 {
54  pdu->getConnId());
55 }
56 
58 {
59  return generateOutputQueueID(pdu);
60 }
61 
63 {
65  flow->getConnectionId());
66 }
Class representing flow object with attributes from specs.
Definition: Flow.h:45
ConnectionId & getConnectionId()
Gets Flow's ConnectionId.
Definition: Flow.cc:209
std::string getQoSId() const
Getter of selected QoS-cube identifier.
Definition: ConnectionId.cc:44
const APN & getIpcAddress() const
Getter of IPC Process address which should be unambiguous within DIF.
Definition: Address.cc:83
std::string constructQueueID(const std::string &ipcName, ConnectionId &connID)
Definition: IDPerNFlow.cc:28
Define_Module(IDPerNFlow)
Connection identifier as defined in specifications.
Definition: ConnectionId.h:42
int getSrcCepId() const
Getter of source Connection-Endpoint identifier.
Definition: ConnectionId.cc:54
const std::string VAL_MGMTQOSID
Definition: QoSCube.cc:37
virtual ConnectionId & getConnId()
Definition: PDU_m.cc:336
Definition: PDU.h:42
const Address & getSrcAddr() const
Gets source Address, which is the address of communication start-point.
Definition: Flow.cc:158
virtual std::string generateOutputQueueID(PDU *pdu)
Definition: IDPerNFlow.cc:51
virtual Address & getSrcAddr()
Definition: PDU_m.cc:296
virtual std::string generateIDFromFlow(Flow *flow)
Definition: IDPerNFlow.cc:62
virtual std::string generateInputQueueID(PDU *pdu)
Definition: IDPerNFlow.cc:57
const std::string & getName() const
Gets APN string name representation.
Definition: APN.cc:40