5G-LENA nr-v4.1
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-epc-gnb-application.h
1// Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4//
5// Authors:
6// Jaume Nin <jnin@cttc.cat>
7// Nicola Baldo <nbaldo@cttc.cat>
8
9#ifndef NR_EPC_GNB_APPLICATION_H
10#define NR_EPC_GNB_APPLICATION_H
11
12#include "nr-epc-gnb-s1-sap.h"
13#include "nr-epc-s1ap-sap.h"
14
15#include "ns3/address.h"
16#include "ns3/application.h"
17#include "ns3/callback.h"
18#include "ns3/object.h"
19#include "ns3/ptr.h"
20#include "ns3/socket.h"
21#include "ns3/traced-callback.h"
22#include "ns3/virtual-net-device.h"
23
24#include <map>
25
26namespace ns3
27{
30
37class NrEpcGnbApplication : public Application
38{
43
44 public:
49 static TypeId GetTypeId();
50
51 protected:
52 void DoDispose() override;
53
54 public:
64 NrEpcGnbApplication(Ptr<Socket> nrSocket, Ptr<Socket> nrSocket6, uint16_t cellId);
65
75 void AddS1Interface(Ptr<Socket> s1uSocket,
76 Ipv4Address gnbS1uAddress,
77 Ipv4Address sgwS1uAddress);
78
83 ~NrEpcGnbApplication() override;
84
91
97
104
110
117 void RecvFromNrSocket(Ptr<Socket> socket);
118
125 void RecvFromS1uSocket(Ptr<Socket> socket);
126
132 typedef void (*RxTracedCallback)(Ptr<Packet> packet);
133
138 {
139 uint16_t m_rnti;
140 uint8_t m_bid;
141
142 public:
143 EpsFlowId_t();
150 EpsFlowId_t(const uint16_t a, const uint8_t b);
151
159 friend bool operator==(const EpsFlowId_t& a, const EpsFlowId_t& b);
167 friend bool operator<(const EpsFlowId_t& a, const EpsFlowId_t& b);
168 };
169
170 private:
171 // gNB S1 SAP provider methods
177 void DoInitialUeMessage(uint64_t imsi, uint16_t rnti);
182 void DoPathSwitchRequest(NrEpcGnbS1SapProvider::PathSwitchRequestParameters params);
187 void DoUeContextRelease(uint16_t rnti);
188
189 // S1-AP SAP gNB methods
196 void DoInitialContextSetupRequest(
197 uint64_t mmeUeS1Id,
198 uint16_t gnbUeS1Id,
199 std::list<NrEpcS1apSapGnb::ErabToBeSetupItem> erabToBeSetupList);
207 void DoPathSwitchRequestAcknowledge(
208 uint64_t gnbUeS1Id,
209 uint64_t mmeUeS1Id,
210 uint16_t cgi,
211 std::list<NrEpcS1apSapGnb::ErabSwitchedInUplinkItem> erabToBeSwitchedInUplinkList);
212
220 void DoReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId);
221
229 void SendToNrSocket(Ptr<Packet> packet, uint16_t rnti, uint8_t bid);
230
237 void SendToS1uSocket(Ptr<Packet> packet, uint32_t teid);
238
246 void SetupS1Bearer(uint32_t teid, uint16_t rnti, uint8_t bid);
247
251 Ptr<Socket> m_nrSocket;
252
256 Ptr<Socket> m_nrSocket6;
257
261 Ptr<Socket> m_s1uSocket;
262
266 Ipv4Address m_gnbS1uAddress;
267
271 Ipv4Address m_sgwS1uAddress;
272
277 std::map<uint16_t, std::map<uint8_t, uint32_t>> m_rbidTeidMap;
278
283 std::map<uint32_t, EpsFlowId_t> m_teidRbidMap;
284
288 uint16_t m_gtpuUdpPort;
289
293 NrEpcGnbS1SapProvider* m_s1SapProvider;
294
298 NrEpcGnbS1SapUser* m_s1SapUser;
299
304 NrEpcS1apSapMme* m_s1apSapMme;
305
310 NrEpcS1apSapGnb* m_s1apSapGnb;
311
316 std::map<uint64_t, uint16_t> m_imsiRntiMap;
317
318 uint16_t m_cellId;
319
323 TracedCallback<Ptr<Packet>> m_rxNrSocketPktTrace;
324
328 TracedCallback<Ptr<Packet>> m_rxS1uSocketPktTrace;
329};
330
331} // namespace ns3
332
333#endif /* NR_EPC_GNB_APPLICATION_H */
void(* RxTracedCallback)(Ptr< Packet > packet)
void AddS1Interface(Ptr< Socket > s1uSocket, Ipv4Address gnbS1uAddress, Ipv4Address sgwS1uAddress)
void SetS1apSapMme(NrEpcS1apSapMme *s)
void RecvFromS1uSocket(Ptr< Socket > socket)
static TypeId GetTypeId()
Get the type ID.
void RecvFromNrSocket(Ptr< Socket > socket)
void SetS1SapUser(NrEpcGnbS1SapUser *s)
NrEpcGnbS1SapProvider * GetS1SapProvider()
friend bool operator==(const EpsFlowId_t &a, const EpsFlowId_t &b)
uint8_t m_bid
Bid, the EPS Bearer Identifier.
friend bool operator<(const EpsFlowId_t &a, const EpsFlowId_t &b)