TrafficFlowFilter.h Source File

Simu5G: TrafficFlowFilter.h Source File
Simu5G
TrafficFlowFilter.h
1//
2// Simu5G
3//
4// Copyright (C) 2012-2021 Giovanni Nardini, Giovanni Stea, Antonio Virdis et al. (University of Pisa)
5// Copyright (C) 2022-2026 Giovanni Nardini, Giovanni Stea et al. (University of Pisa)
6//
7// This file is part of a software released under the license included in file
8// "license.pdf". Please read LICENSE and README files before using it.
9// The above files and the present reference are part of the software itself,
10// and cannot be removed from it.
11//
12
13#ifndef __TRAFFICFLOWFILTER_H_
14#define __TRAFFICFLOWFILTER_H_
15
16#include <memory>
17#include <vector>
18
19#include <inet/common/ModuleRefByPar.h>
20#include <inet/common/packet/PacketFilter.h>
21#include <inet/networklayer/ipv4/Ipv4Header_m.h>
22
23#include "simu5g/common/LteDefs.h"
24#include "simu5g/common/QfiRuleSet.h"
25#include "simu5g/corenetwork/trafficFlowFilter/TftControlInfo_m.h"
26#include "simu5g/common/binder/Binder.h"
27#include "simu5g/corenetwork/gtp/GtpTunnel.h"
28
29namespace simu5g {
30
31using namespace omnetpp;
32
43class TrafficFlowFilter : public cSimpleModule
44{
45 protected:
46 // specifies the type of the node that contains this filter (it can be ENB or PGW)
47 // the filterTable_ will be indexed differently depending on this parameter
48 CoreNodeType ownerType_;
49
50 // reference to the LTE Binder module
51 inet::ModuleRefByPar<Binder> binder_;
52
53 // if this flag is set, each packet received from the radio network, having the same radio network as destination
54 // must be re-sent down without going through the Internet
55 bool fastForwarding_;
56
57 // store the name of the gateway node (for MEC Hosts and base stations only)
58 std::string gateway_;
59
60 // === MEC support === //
61
62 // only if owner type is ENB or GNB
63 std::string meHost;
64 inet::L3Address meHostAddress;
65 // only if owner type is GTPENDPOINT
66 inet::L3Address eNodeBAddress;
67
68 //@author Alessandro Noferi
69 //
70 // for emulation when the MEC host is directly connected to the BS
71 inet::L3Address meAppsExtAddress_;
72 int meAppsExtAddressMask_;
73
74 // The QFI-assignment rules of this tunnel-entry filter, installed by the node's
75 // control-plane entry point (see UserPlaneNodeControl::setDownlinkClassifierRules(), and the dlQfiRules parameter
76 // of the bearer configurator they are authored in): the first rule whose filter
77 // matches the packet supplies its QFI -- a fixed value, or the packet's DSCP
78 // field read as the QFI. Stays empty at a base-station filter, which classifies
79 // by the built-in residual instead (see handleMessage()).
80 QfiRuleSet qfiRules_;
81
82 // At an anchor UPF: the Unstructured sessions it anchors, by the address of each
83 // session's N6 tunnel (see UserPlaneNodeControl), which the data network sends
84 // the session's downlink to
85 struct N6Session {
86 SessionRef session;
87 N6Tunnel tunnel;
88 };
89 std::map<inet::L3Address, N6Session> n6Sessions_;
90
91 protected:
92 int numInitStages() const override { return inet::NUM_INIT_STAGES; }
93 void initialize(int stage) override;
94
95 // The TrafficFlowFilter module may receive messages only from the input interface of its compound module
96 void handleMessage(cMessage *msg) override;
97
98 CoreNodeType selectOwnerType(const char *type);
99
100 // Where a datagram goes; for TFT_PDU_SESSION, ueNodeId is set to the destination UE
101 TftOutcome findTrafficFlow(const inet::L3Address& srcAddress, const inet::L3Address& destAddress, MacNodeId& ueNodeId);
102
103 // At a base station: the uplink of a non-IP session enters the tunnel to the
104 // session's anchor, on the QoS flow SDAP attributed it to
105 virtual void handleNonIpUplink(inet::Packet *pkt);
106
107 // At an anchor UPF: a datagram of the data network on the N6 tunnel of an
108 // Unstructured session loses the tunnel's UDP/IP headers, and its payload goes
109 // into the session's tunnel on the default QoS flow (TS 29.561 9.2)
110 virtual void handleN6Downlink(inet::Packet *pkt, const N6Session& n6Session);
111
112 // At a UPF/PGW: a packet that names its session (SessionTag) goes into the session's tunnel:
113 // a downlink frame of an Ethernet session, from the Ethernet session bridge, on the QFI the
114 // rules assign to the full frame; a reply of the Neighbor Discovery responder on the default flow
115 virtual void handleSessionDownlink(inet::Packet *pkt);
116
117 public:
118 // Take delivery of this filter's compiled QFI-assignment rules from the
119 // bearer configurator
120 virtual void setQfiRules(QfiRuleSet&& rules);
121
122 // At an anchor UPF: the N6 tunnel of an Unstructured session, whose address the
123 // session's downlink is recognized by; and its removal, at the session's release
124 virtual void addN6Tunnel(const SessionRef& session, const N6Tunnel& tunnel);
125 virtual void removeN6Tunnel(const SessionRef& session);
126};
127
128} //namespace
129
130#endif
An ordered set of QFI-assignment rules, shared by every module that classifies packets to QoS flows.
Definition QfiRuleSet.h:57
Definition TrafficFlowFilter.h:44
Definition AlertReceiver.h:24
Definition GtpTunnel.h:126
Definition GtpTunnel.h:51