18#include <inet/common/packet/Packet.h>
19#include <inet/networklayer/common/L3Address.h>
21#include "simu5g/common/LteTypes.h"
22#include "simu5g/common/SessionTag_m.h"
23#include "simu5g/corenetwork/gtp/GtpUserMsg_m.h"
34 inet::L3Address address;
37 bool isSet()
const {
return teid !=
TEID_NONE; }
40inline std::ostream& operator<<(std::ostream& os,
const FTeid& fteid)
42 return os << fteid.address.str() <<
"/teid=" << fteid.teid;
54 SessionId
id = SessionId(0);
59 if (a.lteNodeId != b.lteNodeId)
60 return a.lteNodeId < b.lteNodeId;
61 if (a.nrNodeId != b.nrNodeId)
62 return a.nrNodeId < b.nrNodeId;
66inline bool operator==(
const SessionRef& a,
const SessionRef& b)
68 return a.lteNodeId == b.lteNodeId && a.nrNodeId == b.nrNodeId && a.id == b.id;
71inline std::ostream& operator<<(std::ostream& os,
const SessionRef& session)
73 return os <<
"session " << session.id <<
" of UE " << session.lteNodeId <<
"/" << session.nrNodeId;
82 inet::L3Address prefix;
86 AddressPrefix(
const inet::L3Address& prefix,
int length) : prefix(prefix), length(length) {}
87 bool matches(
const inet::L3Address& address)
const {
return address.getType() == prefix.getType() && address.matches(prefix, length); }
90inline std::ostream& operator<<(std::ostream& os,
const AddressPrefix& p)
92 return os << p.prefix.str() <<
"/" << p.length;
102 SessionType type = IP_V4;
111 auto tag = datagram->addTag<SessionTag>();
112 tag->setSessionId(session.ref.id);
113 tag->setLteNodeId(session.ref.lteNodeId);
114 tag->setNrNodeId(session.ref.nrNodeId);
115 tag->setSessionType(session.type);
127 inet::L3Address sessionAddress;
129 inet::L3Address serverAddress;
133inline std::ostream& operator<<(std::ostream& os,
const N6Tunnel& tunnel)
135 return os <<
"[" << tunnel.sessionAddress.str() <<
"]:" << tunnel.localPort <<
" <-> [" << tunnel.serverAddress.str() <<
"]:" << tunnel.serverPort;
146 std::map<inet::L3Address, Teid> mecHosts;
159 SessionType type = IP_V4;
169inline inet::Ptr<GtpUserMsg>
makeGtpUserHeader(Teid teid, Qfi qfi, PduSessionContainerType container, inet::B tpduLength)
171 auto header = inet::makeShared<GtpUserMsg>();
172 header->setTeid(teid);
174 header->setPduSessionContainer(container);
175 inet::B headerLength = gtpUserHeaderLength(container);
176 header->setChunkLength(headerLength);
177 header->setLengthField((headerLength - inet::B(8) + tpduLength).get());
Definition AlertReceiver.h:24
constexpr Teid TEID_NONE
GTP-U Tunnel Endpoint Identifier (TS 29.281), chosen by the receiving end of the tunnel.
Definition LteTypes.h:87
void attachSessionTag(inet::Packet *datagram, const TunnelSession &session)
Definition GtpTunnel.h:109
inet::Ptr< GtpUserMsg > makeGtpUserHeader(Teid teid, Qfi qfi, PduSessionContainerType container, inet::B tpduLength)
Definition GtpTunnel.h:169
constexpr MacNodeId NODEID_NONE
MAC node ID.
Definition LteTypes.h:54
Definition GtpTunnel.h:81
Definition GtpTunnel.h:33
Definition GtpTunnel.h:126
Definition GtpTunnel.h:51
Definition GtpTunnel.h:157
Definition GtpTunnel.h:100
Definition GtpTunnel.h:144