Commit a60627dc authored by aligungr's avatar aligungr

UE SRA dev.

parent e9ec142c
......@@ -35,7 +35,7 @@ void GnbSraTask::handleCellInfoRequest(const InetAddress &addr, const sra::SraCe
return;
}
sra::SraCellInfoResponse resp{};
sra::SraCellInfoResponse resp{m_sti};
resp.cellId.nci = m_base->config->nci;
resp.cellId.plmn = m_base->config->plmn;
resp.tac = m_base->config->tac;
......
......@@ -10,6 +10,7 @@
#include <gnb/gtp/task.hpp>
#include <gnb/nts.hpp>
#include <gnb/rrc/task.hpp>
#include <utils/common.hpp>
#include <utils/constants.hpp>
#include <utils/libc_error.hpp>
......@@ -19,6 +20,7 @@ namespace nr::gnb
GnbSraTask::GnbSraTask(TaskBase *base) : m_base{base}, m_udpTask{}
{
m_logger = m_base->logBase->makeUniqueLogger("sra");
m_sti = utils::Random64();
}
void GnbSraTask::onStart()
......@@ -70,5 +72,4 @@ void GnbSraTask::onQuit()
delete m_udpTask;
}
} // namespace nr::gnb
......@@ -30,6 +30,8 @@ class GnbSraTask : public NtsTask
std::unique_ptr<Logger> m_logger;
udp::UdpServerTask *m_udpTask;
uint64_t m_sti;
friend class GnbCmdHandler;
public:
......
......@@ -41,7 +41,7 @@ void UeSraTask::onMeasurement()
// Issue another cell info request for each address in the search space
for (auto &ip : m_cellSearchSpace)
{
sra::SraCellInfoRequest req{};
sra::SraCellInfoRequest req{m_sti};
sendSraMessage(ip, req);
}
}
......
......@@ -41,8 +41,7 @@ void UeSraTask::deliverUplinkPdu(sra::EPduType pduType, OctetString &&pdu, Octet
return;
}
sra::SraPduDelivery msg{};
msg.sti = m_sti;
sra::SraPduDelivery msg{m_sti};
msg.pduType = pduType;
msg.pdu = std::move(pdu);
msg.payload = std::move(payload);
......
......@@ -50,6 +50,7 @@ void EncodeSraMessage(const SraMessage &msg, OctetString &stream)
stream.appendOctet(cons::Minor);
stream.appendOctet(cons::Patch);
stream.appendOctet(static_cast<uint8_t>(msg.msgType));
stream.appendOctet8(msg.sti);
if (msg.msgType == EMessageType::CELL_INFO_REQUEST)
{
auto &m = (const SraCellInfoRequest &)msg;
......@@ -71,7 +72,6 @@ void EncodeSraMessage(const SraMessage &msg, OctetString &stream)
else if (msg.msgType == EMessageType::PDU_DELIVERY)
{
auto &m = (const SraPduDelivery &)msg;
stream.appendOctet8(m.sti);
stream.appendOctet(static_cast<uint8_t>(m.pduType));
stream.appendOctet4(m.pdu.length());
stream.append(m.pdu);
......@@ -94,9 +94,11 @@ std::unique_ptr<SraMessage> DecodeSraMessage(const OctetView &stream)
return nullptr;
auto msgType = static_cast<EMessageType>(stream.readI());
uint64_t sti = stream.read8UL();
if (msgType == EMessageType::CELL_INFO_REQUEST)
{
auto res = std::make_unique<SraCellInfoRequest>();
auto res = std::make_unique<SraCellInfoRequest>(sti);
res->simPos.x = stream.read4I();
res->simPos.y = stream.read4I();
res->simPos.z = stream.read4I();
......@@ -104,7 +106,7 @@ std::unique_ptr<SraMessage> DecodeSraMessage(const OctetView &stream)
}
else if (msgType == EMessageType::CELL_INFO_RESPONSE)
{
auto res = std::make_unique<SraCellInfoResponse>();
auto res = std::make_unique<SraCellInfoResponse>(sti);
res->cellId = DecodeGlobalNci(stream);
res->tac = stream.read4I();
res->dbm = stream.read4I();
......@@ -114,8 +116,7 @@ std::unique_ptr<SraMessage> DecodeSraMessage(const OctetView &stream)
}
else if (msgType == EMessageType::PDU_DELIVERY)
{
auto res = std::make_unique<SraPduDelivery>();
res->sti = stream.read8UL();
auto res = std::make_unique<SraPduDelivery>(sti);
res->pduType = static_cast<EPduType>(stream.readI());
res->pdu = stream.readOctetString(stream.read4I());
res->payload = stream.readOctetString(stream.read4I());
......
......@@ -34,8 +34,9 @@ enum class EPduType : uint8_t
struct SraMessage
{
const EMessageType msgType;
const uint64_t sti{};
explicit SraMessage(EMessageType msgType) : msgType(msgType)
explicit SraMessage(EMessageType msgType, uint64_t sti) : msgType(msgType), sti(sti)
{
}
};
......@@ -44,7 +45,7 @@ struct SraCellInfoRequest : SraMessage
{
Vector3 simPos{};
SraCellInfoRequest() : SraMessage(EMessageType::CELL_INFO_REQUEST)
explicit SraCellInfoRequest(uint64_t sti) : SraMessage(EMessageType::CELL_INFO_REQUEST, sti)
{
}
};
......@@ -57,19 +58,18 @@ struct SraCellInfoResponse : SraMessage
std::string gnbName{};
std::string linkIp{};
SraCellInfoResponse() : SraMessage(EMessageType::CELL_INFO_RESPONSE)
explicit SraCellInfoResponse(uint64_t sti) : SraMessage(EMessageType::CELL_INFO_RESPONSE, sti)
{
}
};
struct SraPduDelivery : SraMessage
{
uint64_t sti{};
EPduType pduType{};
OctetString pdu{};
OctetString payload{};
SraPduDelivery() : SraMessage(EMessageType::PDU_DELIVERY)
explicit SraPduDelivery(uint64_t sti) : SraMessage(EMessageType::PDU_DELIVERY, sti)
{
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment