A Discrete-Event Network Simulator
API
epc-enb-application.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jaume Nin <jnin@cttc.cat>
19  * Nicola Baldo <nbaldo@cttc.cat>
20  */
21 
22 #ifndef EPC_ENB_APPLICATION_H
23 #define EPC_ENB_APPLICATION_H
24 
25 #include <ns3/address.h>
26 #include <ns3/socket.h>
27 #include <ns3/virtual-net-device.h>
28 #include <ns3/traced-callback.h>
29 #include <ns3/callback.h>
30 #include <ns3/ptr.h>
31 #include <ns3/object.h>
32 #include <ns3/lte-common.h>
33 #include <ns3/application.h>
34 #include <ns3/eps-bearer.h>
35 #include <ns3/epc-enb-s1-sap.h>
36 #include <ns3/epc-s1ap-sap.h>
37 #include <map>
38 
39 namespace ns3 {
40 class EpcEnbS1SapUser;
42 
43 
50 {
51 
56 
57 
58 public:
63  static TypeId GetTypeId (void);
64 protected:
65  void DoDispose (void);
66 
67 public:
68 
69 
70 
78  EpcEnbApplication (Ptr<Socket> lteSocket, Ptr<Socket> lteSocket6, uint16_t cellId);
79 
87  void AddS1Interface (Ptr<Socket> s1uSocket, Ipv4Address enbAddress, Ipv4Address sgwAddress);
88 
89 
94  virtual ~EpcEnbApplication (void);
95 
96 
102  void SetS1SapUser (EpcEnbS1SapUser * s);
103 
109 
115  void SetS1apSapMme (EpcS1apSapMme * s);
116 
122 
128  void RecvFromLteSocket (Ptr<Socket> socket);
129 
130 
136  void RecvFromS1uSocket (Ptr<Socket> socket);
137 
143  typedef void (* RxTracedCallback)
144  (Ptr<Packet> packet);
145 
146 
150  struct EpsFlowId_t
151  {
152  uint16_t m_rnti;
153  uint8_t m_bid;
154 
155  public:
156  EpsFlowId_t ();
163  EpsFlowId_t (const uint16_t a, const uint8_t b);
164 
172  friend bool operator == (const EpsFlowId_t &a, const EpsFlowId_t &b);
180  friend bool operator < (const EpsFlowId_t &a, const EpsFlowId_t &b);
181  };
182 
183 
184 private:
185 
186  // ENB S1 SAP provider methods
192  void DoInitialUeMessage (uint64_t imsi, uint16_t rnti);
202  void DoUeContextRelease (uint16_t rnti);
203 
204  // S1-AP SAP ENB methods
211  void DoInitialContextSetupRequest (uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list<EpcS1apSapEnb::ErabToBeSetupItem> erabToBeSetupList);
219  void DoPathSwitchRequestAcknowledge (uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t cgi, std::list<EpcS1apSapEnb::ErabSwitchedInUplinkItem> erabToBeSwitchedInUplinkList);
220 
227  void DoReleaseIndication (uint64_t imsi, uint16_t rnti, uint8_t bearerId);
228 
229 
237  void SendToLteSocket (Ptr<Packet> packet, uint16_t rnti, uint8_t bid);
238 
239 
246  void SendToS1uSocket (Ptr<Packet> packet, uint32_t teid);
247 
248 
256  void SetupS1Bearer (uint32_t teid, uint16_t rnti, uint8_t bid);
257 
262 
267 
272 
277 
282 
287  std::map<uint16_t, std::map<uint8_t, uint32_t> > m_rbidTeidMap;
288 
293  std::map<uint32_t, EpsFlowId_t> m_teidRbidMap;
294 
298  uint16_t m_gtpuUdpPort;
299 
304 
309 
315 
321 
326  std::map<uint64_t, uint16_t> m_imsiRntiMap;
327 
328  uint16_t m_cellId;
329 
334 
339 };
340 
341 } //namespace ns3
342 
343 #endif /* EPC_ENB_APPLICATION_H */
344 
ns3::EpcEnbApplication::DoDispose
void DoDispose(void)
Destructor implementation.
Definition: epc-enb-application.cc:80
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::EpcEnbApplication::DoUeContextRelease
void DoUeContextRelease(uint16_t rnti)
UE Context Release function.
Definition: epc-enb-application.cc:197
ns3::EpcEnbApplication::EpsFlowId_t::m_bid
uint8_t m_bid
Bid, the EPS Bearer IDentifier.
Definition: epc-enb-application.h:153
ns3::EpcEnbApplication::~EpcEnbApplication
virtual ~EpcEnbApplication(void)
Destructor.
Definition: epc-enb-application.cc:119
ns3::EpcEnbApplication
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
Definition: epc-enb-application.h:50
ns3::EpcEnbApplication::EpsFlowId_t::EpsFlowId_t
EpsFlowId_t()
Definition: epc-enb-application.cc:38
ns3::EpcEnbApplication::DoPathSwitchRequestAcknowledge
void DoPathSwitchRequestAcknowledge(uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t cgi, std::list< EpcS1apSapEnb::ErabSwitchedInUplinkItem > erabToBeSwitchedInUplinkList)
Path Switch Request Acknowledge.
Definition: epc-enb-application.cc:251
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::EpcEnbApplication::SetS1apSapMme
void SetS1apSapMme(EpcS1apSapMme *s)
Set the MME side of the S1-AP SAP.
Definition: epc-enb-application.cc:139
ns3::EpcEnbApplication::SetS1SapUser
void SetS1SapUser(EpcEnbS1SapUser *s)
Set the S1 SAP User.
Definition: epc-enb-application.cc:126
ns3::MemberEpcEnbS1SapProvider
Template for the implementation of the EpcEnbS1SapProvider as a member of an owner class of type C to...
Definition: epc-enb-s1-sap.h:169
ns3::EpcEnbApplication::SendToLteSocket
void SendToLteSocket(Ptr< Packet > packet, uint16_t rnti, uint8_t bid)
Send a packet to the UE via the LTE radio interface of the eNB.
Definition: epc-enb-application.cc:321
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::EpcEnbApplication::m_lteSocket6
Ptr< Socket > m_lteSocket6
raw packet socket to send and receive the packets to and from the LTE radio interface
Definition: epc-enb-application.h:266
ns3::EpcEnbApplication::EpsFlowId_t::m_rnti
uint16_t m_rnti
RNTI.
Definition: epc-enb-application.h:152
ns3::EpcEnbApplication::m_sgwS1uAddress
Ipv4Address m_sgwS1uAddress
address of the SGW which terminates all S1-U tunnels
Definition: epc-enb-application.h:281
ns3::EpcEnbApplication::m_s1uSocket
Ptr< Socket > m_s1uSocket
UDP socket to send and receive GTP-U the packets to and from the S1-U interface.
Definition: epc-enb-application.h:271
ns3::EpcEnbApplication::EpcEnbApplication
EpcEnbApplication(Ptr< Socket > lteSocket, Ptr< Socket > lteSocket6, uint16_t cellId)
Constructor.
Definition: epc-enb-application.cc:90
ns3::EpcS1apSapEnb
eNB side of the S1-AP Service Access Point (SAP), provides the eNB methods to be called when an S1-AP...
Definition: epc-s1ap-sap.h:142
ns3::EpcEnbApplication::m_rxS1uSocketPktTrace
TracedCallback< Ptr< Packet > > m_rxS1uSocketPktTrace
Callback to trace RX (reception) data packets from S1-U Socket.
Definition: epc-enb-application.h:338
ns3::EpcEnbS1SapProvider
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
Definition: epc-enb-s1-sap.h:39
ns3::EpcS1apSapMme
MME side of the S1-AP Service Access Point (SAP), provides the MME methods to be called when an S1-AP...
Definition: epc-s1ap-sap.h:54
ns3::EpcEnbApplication::GetS1apSapEnb
EpcS1apSapEnb * GetS1apSapEnb()
Definition: epc-enb-application.cc:146
ns3::Ptr< Socket >
ns3::EpcEnbApplication::m_s1SapUser
EpcEnbS1SapUser * m_s1SapUser
User for the S1 SAP.
Definition: epc-enb-application.h:308
ns3::EpcEnbApplication::SendToS1uSocket
void SendToS1uSocket(Ptr< Packet > packet, uint32_t teid)
Send a packet to the SGW via the S1-U interface.
Definition: epc-enb-application.cc:350
ns3::EpcEnbApplication::m_imsiRntiMap
std::map< uint64_t, uint16_t > m_imsiRntiMap
UE context info.
Definition: epc-enb-application.h:326
ns3::EpcEnbApplication::DoInitialContextSetupRequest
void DoInitialContextSetupRequest(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapEnb::ErabToBeSetupItem > erabToBeSetupList)
Initial Context Setup Request.
Definition: epc-enb-application.cc:217
ns3::EpcEnbApplication::m_rxLteSocketPktTrace
TracedCallback< Ptr< Packet > > m_rxLteSocketPktTrace
Callback to trace RX (reception) data packets from LTE Socket.
Definition: epc-enb-application.h:333
ns3::EpcEnbApplication::m_s1SapProvider
EpcEnbS1SapProvider * m_s1SapProvider
Provider for the S1 SAP.
Definition: epc-enb-application.h:303
ns3::EpcEnbApplication::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: epc-enb-application.cc:62
ns3::EpcEnbS1SapUser
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
Definition: epc-enb-s1-sap.h:104
ns3::EpcEnbApplication::m_rbidTeidMap
std::map< uint16_t, std::map< uint8_t, uint32_t > > m_rbidTeidMap
map of maps telling for each RNTI and BID the corresponding S1-U TEID
Definition: epc-enb-application.h:287
ns3::EpcEnbApplication::m_teidRbidMap
std::map< uint32_t, EpsFlowId_t > m_teidRbidMap
map telling for each S1-U TEID the corresponding RNTI,BID
Definition: epc-enb-application.h:293
ns3::EpcEnbApplication::SetupS1Bearer
void SetupS1Bearer(uint32_t teid, uint16_t rnti, uint8_t bid)
internal method used for the actual setup of the S1 Bearer
ns3::EpcEnbApplication::DoReleaseIndication
void DoReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
This function accepts bearer id corresponding to a particular UE and schedules indication of bearer r...
Definition: epc-enb-application.cc:364
ns3::EpcEnbS1SapProvider::PathSwitchRequestParameters
PathSwitchRequestParameters structure.
Definition: epc-enb-s1-sap.h:68
ns3::EpcEnbApplication::m_gtpuUdpPort
uint16_t m_gtpuUdpPort
UDP port to be used for GTP.
Definition: epc-enb-application.h:298
ns3::EpcEnbApplication::RecvFromLteSocket
void RecvFromLteSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the LTE socket.
Definition: epc-enb-application.cc:265
ns3::EpcEnbApplication::RecvFromS1uSocket
void RecvFromS1uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S1-U socket.
Definition: epc-enb-application.cc:300
ns3::EpcEnbApplication::EpsFlowId_t::operator==
friend bool operator==(const EpsFlowId_t &a, const EpsFlowId_t &b)
Comparison operator.
Definition: epc-enb-application.cc:49
ns3::MemberEpcS1apSapEnb
Template for the implementation of the EpcS1apSapEnb as a member of an owner class of type C to which...
Definition: epc-s1ap-sap.h:299
ns3::EpcEnbApplication::DoInitialUeMessage
void DoInitialUeMessage(uint64_t imsi, uint16_t rnti)
Initial UE message function.
Definition: epc-enb-application.cc:152
ns3::EpcEnbApplication::EpsFlowId_t
EPS flow ID structure.
Definition: epc-enb-application.h:151
ns3::EpcEnbApplication::EpsFlowId_t::operator<
friend bool operator<(const EpsFlowId_t &a, const EpsFlowId_t &b)
Less than operator.
Definition: epc-enb-application.cc:55
ns3::EpcEnbApplication::GetS1SapProvider
EpcEnbS1SapProvider * GetS1SapProvider()
Definition: epc-enb-application.cc:133
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::EpcEnbApplication::m_enbS1uAddress
Ipv4Address m_enbS1uAddress
address of the eNB for S1-U communications
Definition: epc-enb-application.h:276
ns3::EpcEnbApplication::AddS1Interface
void AddS1Interface(Ptr< Socket > s1uSocket, Ipv4Address enbAddress, Ipv4Address sgwAddress)
Add a S1-U interface to the eNB.
Definition: epc-enb-application.cc:108
ns3::EpcEnbApplication::m_lteSocket
Ptr< Socket > m_lteSocket
raw packet socket to send and receive the packets to and from the LTE radio interface
Definition: epc-enb-application.h:261
ns3::Application
The base class for all ns3 applications.
Definition: application.h:61
ns3::EpcEnbApplication::m_s1apSapMme
EpcS1apSapMme * m_s1apSapMme
MME side of the S1-AP SAP.
Definition: epc-enb-application.h:314
ns3::EpcEnbApplication::DoPathSwitchRequest
void DoPathSwitchRequest(EpcEnbS1SapProvider::PathSwitchRequestParameters params)
Path switch request function.
Definition: epc-enb-application.cc:161
ns3::EpcEnbApplication::RxTracedCallback
void(* RxTracedCallback)(Ptr< Packet > packet)
TracedCallback signature for data Packet reception event.
Definition: epc-enb-application.h:144
ns3::EpcEnbApplication::m_s1apSapEnb
EpcS1apSapEnb * m_s1apSapEnb
ENB side of the S1-AP SAP.
Definition: epc-enb-application.h:320
ns3::EpcEnbApplication::m_cellId
uint16_t m_cellId
cell ID
Definition: epc-enb-application.h:328