IPv4のみ送信可能
lte-ue-net-device.ccbool
LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
{
NS_LOG_FUNCTION (this << dest << protocolNumber);
if (protocolNumber != Ipv4L3Protocol::PROT_NUMBER)
{
NS_LOG_INFO("unsupported protocol " << protocolNumber << ", only IPv4 is supported");
return true;
}
return m_nas->Send (packet);
}
UE-NASがActiveであること。ClassifyのIDチェックがある
epc-ue-nas.ccbool
EpcUeNas::Send (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (this << packet);
switch (m_state)
{
case ACTIVE:
{
uint32_t id = m_tftClassifier.Classify (packet, EpcTft::UPLINK);
NS_ASSERT ((id & 0xFFFFFF00) == 0);
uint8_t bid = (uint8_t) (id & 0x000000FF);
if (bid == 0)
{
return false;
}
else
{
m_asSapProvider->SendData (packet, bid);
return true;
}
}
break;
default:
NS_LOG_WARN (this << " NAS OFF, discarding packet");
return false;
break;
}
}
drbdidのチェックがある。
lte-ue-rrc.ccvoid
LteUeRrc::DoSendData (Ptr<Packet> packet, uint8_t bid)
{
NS_LOG_FUNCTION (this << packet);
uint8_t drbid = Bid2Drbid (bid);
if (drbid != 0)
{
std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.find (drbid);
NS_ASSERT_MSG (it != m_drbMap.end (), "could not find bearer with drbid == " << drbid);
LtePdcpSapProvider::TransmitPdcpSduParameters params;
params.pdcpSdu = packet;
params.rnti = m_rnti;
params.lcid = it->second->m_logicalChannelIdentity;
NS_LOG_LOGIC (this << " RNTI=" << m_rnti << " sending packet " << packet
<< " on DRBID " << (uint32_t) drbid
<< " (LCID " << (uint32_t) params.lcid << ")"
<< " (" << packet->GetSize () << " bytes)");
it->second->m_pdcp->GetLtePdcpSapProvider ()->TransmitPdcpSdu (params);
}
}
lte-ue-pdcp.ccvoid
LtePdcp::DoTransmitPdcpSdu (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize ());
LtePdcpHeader pdcpHeader;
pdcpHeader.SetSequenceNumber (m_txSequenceNumber);
m_txSequenceNumber++;
if (m_txSequenceNumber > m_maxPdcpSn)
{
m_txSequenceNumber = 0;
}
pdcpHeader.SetDcBit (LtePdcpHeader::DATA_PDU);
NS_LOG_LOGIC ("PDCP header: " << pdcpHeader);
p->AddHeader (pdcpHeader);
// Sender timestamp
PdcpTag pdcpTag (Simulator::Now ());
p->AddPacketTag (pdcpTag);
m_txPdu (m_rnti, m_lcid, p->GetSize ());
LteRlcSapProvider::TransmitPdcpPduParameters params;
params.rnti = m_rnti;
params.lcid = m_lcid;
params.pdcpPdu = p;
m_rlcSapProvider->TransmitPdcpPdu (params);
}
チェック無し
Radio Link Control
lte-rlc.ccvoid
LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
{
NS_LOG_FUNCTION (this << bytes);
LteMacSapProvider::TransmitPduParameters params;
params.pdu = Create<Packet> (bytes);
params.rnti = m_rnti;
params.lcid = m_lcid;
params.layer = layer;
params.harqProcessId = harqId;
// RLC Performance evaluation
RlcTag tag (Simulator::Now());
params.pdu->AddPacketTag (tag);
NS_LOG_LOGIC (" RNTI=" << m_rnti
<< " LCID=" << (uint32_t) m_lcid
<< " size=" << bytes);
m_txPdu(m_rnti, m_lcid, bytes);
m_macSapProvider->TransmitPdu (params);
ReportBufferStatus ();
}
RNTI確認
m_uePhySapProviderには、ポインタ渡しでlte-ue-phyのメンバが入る。
lte-ue-mac.ccvoid
LteUeMac::DoTransmitPdu (LteMacSapProvider::TransmitPduParameters params)
{
NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (m_rnti == params.rnti, "RNTI mismatch between RLC and MAC");
LteRadioBearerTag tag (params.rnti, params.lcid, 0 /* UE works in SISO mode*/);
params.pdu->AddPacketTag (tag);
// store pdu in HARQ buffer
m_miUlHarqProcessesPacket.at (m_harqProcessId)->AddPacket (params.pdu);
m_miUlHarqProcessesPacketTimer.at (m_harqProcessId) = HARQ_PERIOD;
m_uePhySapProvider->SendMacPdu (params.pdu);
}
ラッパーのみ
lte-ue-phy.ccvoid
LteUePhy::DoSendMacPdu (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this);
SetMacPdu (p);
}
packetBurstに入る
lte-phy.ccvoid
LtePhy::SetMacPdu (Ptr<Packet> p)
{
m_packetBurstQueue.at (m_packetBurstQueue.size () - 1)->AddPacket (p);
}