|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
25 #include "ns3/mac48-address.h"
27 #include "ns3/inet-socket-address.h"
28 #include "ns3/uinteger.h"
67 .AddTraceSource (
"RxFromEnb",
68 "Receive data packets from LTE Enb Net Device",
70 "ns3::EpcEnbApplication::RxTracedCallback")
71 .AddTraceSource (
"RxFromS1u",
72 "Receive data packets from S1-U Net Device",
74 "ns3::EpcEnbApplication::RxTracedCallback")
164 uint16_t enbUeS1Id = params.
rnti;
166 uint64_t imsi = mmeUeS1Id;
170 uint16_t gci = params.
cellId;
171 std::list<EpcS1apSapMme::ErabSwitchedInDownlinkItem> erabToBeSwitchedInDownlinkList;
172 for (std::list<EpcEnbS1SapProvider::BearerToBeSwitched>::iterator bit = params.
bearersToBeSwitched.begin ();
178 flowId.
m_bid = bit->epsBearerId;
179 uint32_t teid = bit->teid;
187 erab.
erabId = bit->epsBearerId;
191 erabToBeSwitchedInDownlinkList.push_back (erab);
200 std::map<uint16_t, std::map<uint8_t, uint32_t> >::iterator rntiIt =
m_rbidTeidMap.find (rnti);
203 for (std::map<uint8_t, uint32_t>::iterator bidIt = rntiIt->second.begin ();
204 bidIt != rntiIt->second.end ();
207 uint32_t teid = bidIt->second;
212 NS_LOG_INFO (
"RNTI: " << rntiIt->first <<
" erased");
221 uint64_t imsi = mmeUeS1Id;
222 std::map<uint64_t, uint16_t>::iterator imsiIt =
m_imsiRntiMap.find (imsi);
224 uint16_t rnti = imsiIt->second;
226 for (std::list<EpcS1apSapEnb::ErabToBeSetupItem>::iterator erabIt = erabToBeSetupList.begin ();
227 erabIt != erabToBeSetupList.end ();
233 params.
bearer = erabIt->erabLevelQosParameters;
235 params.
gtpTeid = erabIt->sgwTeid;
255 uint64_t imsi = mmeUeS1Id;
256 std::map<uint64_t, uint16_t>::iterator imsiIt =
m_imsiRntiMap.find (imsi);
258 uint16_t rnti = imsiIt->second;
281 uint16_t rnti = tag.
GetRnti ();
282 uint8_t bid = tag.
GetBid ();
283 NS_LOG_LOGIC (
"received packet with RNTI=" << (uint32_t) rnti <<
", BID=" << (uint32_t) bid);
284 std::map<uint16_t, std::map<uint8_t, uint32_t> >::iterator rntiIt =
m_rbidTeidMap.find (rnti);
287 NS_LOG_WARN (
"UE context not found, discarding packet");
291 std::map<uint8_t, uint32_t>::iterator bidIt = rntiIt->second.find (bid);
292 NS_ASSERT (bidIt != rntiIt->second.end ());
293 uint32_t teid = bidIt->second;
307 uint32_t teid = gtpu.
GetTeid ();
308 std::map<uint32_t, EpsFlowId_t>::iterator it =
m_teidRbidMap.find (teid);
329 ipType = (ipType>>4) & 0x0f;
336 else if (ipType == 0x06)
342 NS_ABORT_MSG (
"EpcEnbApplication::SendToLteSocket - Unknown IP type...");
367 std::list<EpcS1apSapMme::ErabToBeReleasedIndication> erabToBeReleaseIndication;
370 erabToBeReleaseIndication.push_back (erab);
void DoDispose(void)
Destructor implementation.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
EpsBearer bearer
the characteristics of the bearer to be setup
void DoUeContextRelease(uint16_t rnti)
UE Context Release function.
uint8_t GetBid(void) const
Get Bearer Id function.
uint8_t m_bid
Bid, the EPS Bearer IDentifier.
virtual ~EpcEnbApplication(void)
Destructor.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
friend class MemberEpcEnbS1SapProvider< EpcEnbApplication >
allow MemberEpcEnbS1SapProvider<EpcEnbApplication> class friend access
void DoPathSwitchRequestAcknowledge(uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t cgi, std::list< EpcS1apSapEnb::ErabSwitchedInUplinkItem > erabToBeSwitchedInUplinkList)
Path Switch Request Acknowledge.
Parameters passed to InitialContextSetupRequest ()
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t mmeUeS1Id
mmeUeS1Id in practice, we use the IMSI
void AddHeader(const Header &header)
Add header to this packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void ErabReleaseIndication(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< ErabToBeReleasedIndication > erabToBeReleaseIndication)=0
As per 3GPP TS 23.401 Release 9 V9.5.0 Figure 5.4.4.2-1 eNB sends indication of Bearer Release to MME...
void SetS1apSapMme(EpcS1apSapMme *s)
Set the MME side of the S1-AP SAP.
Parameters passed to DataRadioBearerSetupRequest ()
bool operator<(const EventId &a, const EventId &b)
void SetS1SapUser(EpcEnbS1SapUser *s)
Set the S1 SAP User.
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.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Ipv4 addresses are stored in host order in this class.
Ptr< Socket > m_lteSocket6
raw packet socket to send and receive the packets to and from the LTE radio interface
Ipv4Address m_sgwS1uAddress
address of the SGW which terminates all S1-U tunnels
Ptr< Socket > m_s1uSocket
UDP socket to send and receive GTP-U the packets to and from the S1-U interface.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
uint32_t gtpTeid
S1-bearer GTP tunnel endpoint identifier, see 36.423 9.2.1.
EpcEnbApplication(Ptr< Socket > lteSocket, Ptr< Socket > lteSocket6, uint16_t cellId)
Constructor.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
eNB side of the S1-AP Service Access Point (SAP), provides the eNB methods to be called when an S1-AP...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
TracedCallback< Ptr< Packet > > m_rxS1uSocketPktTrace
Callback to trace RX (reception) data packets from S1-U Socket.
virtual void PathSwitchRequestAcknowledge(PathSwitchRequestAcknowledgeParameters params)=0
request a path switch acknowledge
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
MME side of the S1-AP Service Access Point (SAP), provides the MME methods to be called when an S1-AP...
EpcS1apSapEnb * GetS1apSapEnb()
EpcEnbS1SapUser * m_s1SapUser
User for the S1 SAP.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
virtual void PathSwitchRequest(uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t gci, std::list< ErabSwitchedInDownlinkItem > erabToBeSwitchedInDownlinkList)=0
PATH SWITCH REQUEST message, see 3GPP TS 36.413 9.1.5.8.
void SendToS1uSocket(Ptr< Packet > packet, uint32_t teid)
Send a packet to the SGW via the S1-U interface.
std::map< uint64_t, uint16_t > m_imsiRntiMap
UE context info.
A base class which provides memory management and object aggregation.
Ipv4Address enbTransportLayerAddress
address
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
void DoInitialContextSetupRequest(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapEnb::ErabToBeSetupItem > erabToBeSetupList)
Initial Context Setup Request.
TracedCallback< Ptr< Packet > > m_rxLteSocketPktTrace
Callback to trace RX (reception) data packets from LTE Socket.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
EpcEnbS1SapProvider * m_s1SapProvider
Provider for the S1 SAP.
static TypeId GetTypeId(void)
Get the type ID.
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
std::list< BearerToBeSwitched > bearersToBeSwitched
list of bearers to be switched
uint16_t GetRnti(void) const
Get RNTI function.
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
bool operator==(const EventId &a, const EventId &b)
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
PathSwitchRequestAcknowledgeParameters structure.
uint16_t rnti
the RNTI identifying the UE for which the DataRadioBearer is to be created
std::map< uint32_t, EpsFlowId_t > m_teidRbidMap
map telling for each S1-U TEID the corresponding RNTI,BID
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
uint16_t rnti
the RNTI identifying the UE
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...
E-RABs Switched in Downlink Item IE, see 3GPP TS 36.413 9.1.5.8.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
PathSwitchRequestParameters structure.
friend class MemberEpcS1apSapEnb< EpcEnbApplication >
allow MemberEpcS1apSapEnb<EpcEnbApplication> class friend access
uint16_t m_gtpuUdpPort
UDP port to be used for GTP.
void RecvFromLteSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the LTE socket.
E-RAB Release Indication Item IEs, 3GPP TS 36.413 version 9.8.0 section 9.1.3.7.
void RecvFromS1uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S1-U socket.
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
void DoInitialUeMessage(uint64_t imsi, uint16_t rnti)
Initial UE message function.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
EpcEnbS1SapProvider * GetS1SapProvider()
Ipv4Address m_enbS1uAddress
address of the eNB for S1-U communications
void AddS1Interface(Ptr< Socket > s1uSocket, Ipv4Address enbAddress, Ipv4Address sgwAddress)
Add a S1-U interface to the eNB.
Ptr< Socket > m_lteSocket
raw packet socket to send and receive the packets to and from the LTE radio interface
virtual void InitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t stmsi, uint16_t ecgi)=0
EpcS1apSapMme * m_s1apSapMme
MME side of the S1-AP SAP.
uint8_t bearerId
the EPS Bearer Identifier
virtual void InitialContextSetupRequest(InitialContextSetupRequestParameters params)=0
Initial context setup request.
void DoPathSwitchRequest(EpcEnbS1SapProvider::PathSwitchRequestParameters params)
Path switch request function.
virtual void DataRadioBearerSetupRequest(DataRadioBearerSetupRequestParameters params)=0
request the setup of a DataRadioBearer
EpcS1apSapEnb * m_s1apSapEnb
ENB side of the S1-AP SAP.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.