Commit 0b5cad7a authored by aligungr's avatar aligungr

UE SRA dev.

parent 2ab318fe
......@@ -12,7 +12,7 @@
#include "mr/task.hpp"
#include "ngap/task.hpp"
#include "rrc/task.hpp"
#include "sas/task.hpp"
#include "sra/task.hpp"
#include "sctp/task.hpp"
#include <app/cli_base.hpp>
......@@ -35,7 +35,7 @@ GNodeB::GNodeB(GnbConfig *config, app::INodeListener *nodeListener, NtsTask *cli
base->rrcTask = new GnbRrcTask(base);
base->gtpTask = new GtpTask(base);
base->mrTask = new GnbMrTask(base);
base->sasTask = new GnbSasTask(base);
base->sraTask = new GnbSraTask(base);
taskBase = base;
}
......@@ -48,7 +48,7 @@ GNodeB::~GNodeB()
taskBase->rrcTask->quit();
taskBase->gtpTask->quit();
taskBase->mrTask->quit();
taskBase->sasTask->quit();
taskBase->sraTask->quit();
delete taskBase->appTask;
delete taskBase->sctpTask;
......@@ -56,7 +56,7 @@ GNodeB::~GNodeB()
delete taskBase->rrcTask;
delete taskBase->gtpTask;
delete taskBase->mrTask;
delete taskBase->sasTask;
delete taskBase->sraTask;
delete taskBase->logBase;
......@@ -69,7 +69,7 @@ void GNodeB::start()
taskBase->sctpTask->start();
taskBase->ngapTask->start();
taskBase->rrcTask->start();
taskBase->sasTask->start();
taskBase->sraTask->start();
taskBase->mrTask->start();
taskBase->gtpTask->start();
}
......
......@@ -26,7 +26,7 @@ static int EstimateSimulatedDbm(const Vector3 &myPos, const Vector3 &uePos)
namespace nr::gnb
{
void GnbSasTask::handleCellInfoRequest(const InetAddress &addr, const sas::SasCellInfoRequest &msg)
void GnbSraTask::handleCellInfoRequest(const InetAddress &addr, const sra::SraCellInfoRequest &msg)
{
int dbm = EstimateSimulatedDbm(m_base->config->phyLocation, msg.simPos);
if (dbm < MIN_ALLOWED_DBM)
......@@ -35,7 +35,7 @@ void GnbSasTask::handleCellInfoRequest(const InetAddress &addr, const sas::SasCe
return;
}
sas::SasCellInfoResponse resp{};
sra::SraCellInfoResponse resp{};
resp.cellId.nci = m_base->config->nci;
resp.cellId.plmn = m_base->config->plmn;
resp.tac = m_base->config->tac;
......@@ -43,7 +43,7 @@ void GnbSasTask::handleCellInfoRequest(const InetAddress &addr, const sas::SasCe
resp.gnbName = m_base->config->name;
resp.linkIp = m_base->config->portalIp;
sendSasMessage(addr, resp);
sendSraMessage(addr, resp);
}
} // namespace nr::gnb
......@@ -16,12 +16,12 @@
namespace nr::gnb
{
GnbSasTask::GnbSasTask(TaskBase *base) : m_base{base}, m_udpTask{}
GnbSraTask::GnbSraTask(TaskBase *base) : m_base{base}, m_udpTask{}
{
m_logger = m_base->logBase->makeUniqueLogger("sas");
m_logger = m_base->logBase->makeUniqueLogger("sra");
}
void GnbSasTask::onStart()
void GnbSraTask::onStart()
{
try
{
......@@ -30,13 +30,13 @@ void GnbSasTask::onStart()
}
catch (const LibError &e)
{
m_logger->err("SAS failure [%s]", e.what());
m_logger->err("SRA failure [%s]", e.what());
quit();
return;
}
}
void GnbSasTask::onLoop()
void GnbSraTask::onLoop()
{
NtsMessage *msg = take();
if (!msg)
......@@ -46,13 +46,13 @@ void GnbSasTask::onLoop()
{
case NtsMessageType::UDP_SERVER_RECEIVE: {
auto *w = dynamic_cast<udp::NwUdpServerReceive *>(msg);
auto sasMsg = sas::DecodeSasMessage(OctetView{w->packet});
if (sasMsg == nullptr)
auto sraMsg = sra::DecodeSraMessage(OctetView{w->packet});
if (sraMsg == nullptr)
{
m_logger->err("Unable to decode SAS message");
m_logger->err("Unable to decode SRA message");
break;
}
receiveSasMessage(w->fromAddress, *sasMsg);
receiveSraMessage(w->fromAddress, *sraMsg);
break;
}
default:
......@@ -63,7 +63,7 @@ void GnbSasTask::onLoop()
delete msg;
}
void GnbSasTask::onQuit()
void GnbSraTask::onQuit()
{
if (m_udpTask != nullptr)
m_udpTask->quit();
......
......@@ -15,7 +15,7 @@
#include <udp/server_task.hpp>
#include <unordered_map>
#include <urs/rls/gnb_entity.hpp>
#include <urs/sas_pdu.hpp>
#include <urs/sra_pdu.hpp>
#include <utils/logger.hpp>
#include <utils/nts.hpp>
#include <vector>
......@@ -23,7 +23,7 @@
namespace nr::gnb
{
class GnbSasTask : public NtsTask
class GnbSraTask : public NtsTask
{
private:
TaskBase *m_base;
......@@ -33,8 +33,8 @@ class GnbSasTask : public NtsTask
friend class GnbCmdHandler;
public:
explicit GnbSasTask(TaskBase *base);
~GnbSasTask() override = default;
explicit GnbSraTask(TaskBase *base);
~GnbSraTask() override = default;
protected:
void onStart() override;
......@@ -42,11 +42,11 @@ class GnbSasTask : public NtsTask
void onQuit() override;
private: /* Transport */
void receiveSasMessage(const InetAddress &addr, const sas::SasMessage &msg);
void sendSasMessage(const InetAddress &addr, const sas::SasMessage &msg);
void receiveSraMessage(const InetAddress &addr, const sra::SraMessage &msg);
void sendSraMessage(const InetAddress &addr, const sra::SraMessage &msg);
private: /* Handler */
void handleCellInfoRequest(const InetAddress &addr, const sas::SasCellInfoRequest &msg);
void handleCellInfoRequest(const InetAddress &addr, const sra::SraCellInfoRequest &msg);
};
} // namespace nr::gnb
\ No newline at end of file
......@@ -11,23 +11,23 @@
namespace nr::gnb
{
void GnbSasTask::receiveSasMessage(const InetAddress &addr, const sas::SasMessage &msg)
void GnbSraTask::receiveSraMessage(const InetAddress &addr, const sra::SraMessage &msg)
{
switch (msg.msgType)
{
case sas::SasMessageType::CELL_INFO_REQUEST:
handleCellInfoRequest(addr, (const sas::SasCellInfoRequest &)msg);
case sra::SraMessageType::CELL_INFO_REQUEST:
handleCellInfoRequest(addr, (const sra::SraCellInfoRequest &)msg);
break;
default:
m_logger->err("Unhandled SAS message received with type[%d]", static_cast<int>(msg.msgType));
m_logger->err("Unhandled SRA message received with type[%d]", static_cast<int>(msg.msgType));
break;
}
}
void GnbSasTask::sendSasMessage(const InetAddress &addr, const sas::SasMessage &msg)
void GnbSraTask::sendSraMessage(const InetAddress &addr, const sra::SraMessage &msg)
{
OctetString stream{};
sas::EncodeSasMessage(msg, stream);
sra::EncodeSraMessage(msg, stream);
m_udpTask->send(addr, stream);
}
......
......@@ -26,7 +26,7 @@ class GtpTask;
class GnbMrTask;
class NgapTask;
class GnbRrcTask;
class GnbSasTask;
class GnbSraTask;
class SctpTask;
enum class EAmfState
......@@ -326,7 +326,7 @@ struct TaskBase
NgapTask *ngapTask{};
GnbRrcTask *rrcTask{};
SctpTask *sctpTask{};
GnbSasTask *sasTask{};
GnbSraTask *sraTask{};
};
struct MrUeContext
......
......@@ -12,7 +12,7 @@
#include <ue/mr/task.hpp>
#include <ue/nas/task.hpp>
#include <ue/rrc/task.hpp>
#include <ue/sas/task.hpp>
#include <ue/sra/task.hpp>
#include <ue/tun/task.hpp>
#include <utils/common.hpp>
#include <utils/printer.hpp>
......@@ -163,7 +163,7 @@ void UeCmdHandler::handleCmdImpl(NwUeCliCommand &msg)
break;
}
case app::UeCliCommand::COVERAGE: {
auto &map = m_base->sasTask->m_activeMeasurements;
auto &map = m_base->sraTask->m_activeMeasurements;
if (map.empty())
{
sendResult(msg.address, "No cell exists in the range");
......
......@@ -218,7 +218,7 @@ struct NwUeRrcToMr : NtsMessage
}
};
struct NwUeRrcToSas : NtsMessage
struct NwUeRrcToSra : NtsMessage
{
enum PR
{
......@@ -230,12 +230,12 @@ struct NwUeRrcToSas : NtsMessage
GlobalNci cellId{};
bool isSuitableCell{}; // otherwise 'acceptable'
explicit NwUeRrcToSas(PR present) : NtsMessage(NtsMessageType::UE_RRC_TO_SAS), present(present)
explicit NwUeRrcToSra(PR present) : NtsMessage(NtsMessageType::UE_RRC_TO_SRA), present(present)
{
}
};
struct NwUeSasToRrc : NtsMessage
struct NwUeSraToRrc : NtsMessage
{
enum PR
{
......@@ -249,7 +249,7 @@ struct NwUeSasToRrc : NtsMessage
// SERVING_CELL_CHANGE
UeCellInfo servingCell{};
explicit NwUeSasToRrc(PR present) : NtsMessage(NtsMessageType::UE_SAS_TO_RRC), present(present)
explicit NwUeSraToRrc(PR present) : NtsMessage(NtsMessageType::UE_SRA_TO_RRC), present(present)
{
}
};
......
......@@ -15,7 +15,7 @@
#include <ue/app/task.hpp>
#include <ue/mr/task.hpp>
#include <ue/nas/task.hpp>
#include <ue/sas/task.hpp>
#include <ue/sra/task.hpp>
#include <utils/common.hpp>
namespace nr::ue
......@@ -65,7 +65,7 @@ void UeRrcTask::onLoop()
switch (w->present)
{
case NwUeNasToRrc::PLMN_SEARCH_REQUEST: {
m_base->sasTask->push(new NwUeRrcToSas(NwUeRrcToSas::PLMN_SEARCH_REQUEST));
m_base->sraTask->push(new NwUeRrcToSra(NwUeRrcToSra::PLMN_SEARCH_REQUEST));
break;
}
case NwUeNasToRrc::INITIAL_NAS_DELIVERY: {
......@@ -87,26 +87,26 @@ void UeRrcTask::onLoop()
break;
}
case NwUeNasToRrc::CELL_SELECTION_COMMAND: {
auto *wr = new NwUeRrcToSas(NwUeRrcToSas::CELL_SELECTION_COMMAND);
auto *wr = new NwUeRrcToSra(NwUeRrcToSra::CELL_SELECTION_COMMAND);
wr->cellId = w->cellId;
wr->isSuitableCell = w->isSuitableCell;
m_base->sasTask->push(wr);
m_base->sraTask->push(wr);
break;
}
}
break;
}
case NtsMessageType::UE_SAS_TO_RRC: {
auto *w = dynamic_cast<NwUeSasToRrc *>(msg);
case NtsMessageType::UE_SRA_TO_RRC: {
auto *w = dynamic_cast<NwUeSraToRrc *>(msg);
switch (w->present)
{
case NwUeSasToRrc::PLMN_SEARCH_RESPONSE: {
case NwUeSraToRrc::PLMN_SEARCH_RESPONSE: {
auto *wr = new NwUeRrcToNas(NwUeRrcToNas::PLMN_SEARCH_RESPONSE);
wr->measurements = std::move(w->measurements);
m_base->nasTask->push(wr);
break;
}
case NwUeSasToRrc::SERVING_CELL_CHANGE: {
case NwUeSraToRrc::SERVING_CELL_CHANGE: {
auto *wr = new NwUeRrcToNas(NwUeRrcToNas::SERVING_CELL_CHANGE);
wr->servingCell = w->servingCell;
m_base->nasTask->push(wr);
......
......@@ -14,7 +14,7 @@
namespace nr::ue
{
void UeSasTask::handleCellSelectionCommand(const GlobalNci &cellId, bool isSuitable)
void UeSraTask::handleCellSelectionCommand(const GlobalNci &cellId, bool isSuitable)
{
if (!m_activeMeasurements.count(cellId))
{
......@@ -31,7 +31,7 @@ void UeSasTask::handleCellSelectionCommand(const GlobalNci &cellId, bool isSuita
m_servingCell->linkIp = measurement.linkIp;
m_servingCell->cellCategory = isSuitable ? ECellCategory::SUITABLE_CELL : ECellCategory::ACCEPTABLE_CELL;
auto *w = new NwUeSasToRrc(NwUeSasToRrc::SERVING_CELL_CHANGE);
auto *w = new NwUeSraToRrc(NwUeSraToRrc::SERVING_CELL_CHANGE);
w->servingCell = *m_servingCell;
m_base->rrcTask->push(w);
}
......
......@@ -14,7 +14,7 @@
namespace nr::ue
{
void UeSasTask::onMeasurement()
void UeSraTask::onMeasurement()
{
std::vector<GlobalNci> entered{};
std::vector<GlobalNci> exited{};
......@@ -41,12 +41,12 @@ void UeSasTask::onMeasurement()
// Issue another cell info request for each address in the search space
for (auto &ip : m_cellSearchSpace)
{
sas::SasCellInfoRequest req{};
sendSasMessage(ip, req);
sra::SraCellInfoRequest req{};
sendSraMessage(ip, req);
}
}
void UeSasTask::receiveCellInfoResponse(const sas::SasCellInfoResponse &msg)
void UeSraTask::receiveCellInfoResponse(const sra::SraCellInfoResponse &msg)
{
UeCellMeasurement meas{};
meas.cellId = msg.cellId;
......@@ -58,19 +58,19 @@ void UeSasTask::receiveCellInfoResponse(const sas::SasCellInfoResponse &msg)
m_pendingMeasurements[meas.cellId] = meas;
}
void UeSasTask::onCoverageChange(const std::vector<GlobalNci> &entered, const std::vector<GlobalNci> &exited)
void UeSraTask::onCoverageChange(const std::vector<GlobalNci> &entered, const std::vector<GlobalNci> &exited)
{
m_logger->debug("Coverage change detected. [%d] cell entered, [%d] cell exited", static_cast<int>(entered.size()),
static_cast<int>(exited.size()));
}
void UeSasTask::plmnSearchRequested()
void UeSraTask::plmnSearchRequested()
{
std::vector<UeCellMeasurement> measurements{};
for (auto &m : m_activeMeasurements)
measurements.push_back(m.second);
auto *w = new NwUeSasToRrc(NwUeSasToRrc::PLMN_SEARCH_RESPONSE);
auto *w = new NwUeSraToRrc(NwUeSraToRrc::PLMN_SEARCH_RESPONSE);
w->measurements = std::move(measurements);
m_base->rrcTask->push(w);
}
......
......@@ -16,16 +16,16 @@ static const int TIMER_PERIOD_MEASUREMENT = 2000;
namespace nr::ue
{
UeSasTask::UeSasTask(TaskBase *base)
UeSraTask::UeSraTask(TaskBase *base)
: m_base{base}, m_udpTask{}, m_cellSearchSpace{}, m_pendingMeasurements{}, m_activeMeasurements{}, m_servingCell{}
{
m_logger = m_base->logBase->makeUniqueLogger(m_base->config->getLoggerPrefix() + "sas");
m_logger = m_base->logBase->makeUniqueLogger(m_base->config->getLoggerPrefix() + "sra");
for (auto &addr : m_base->config->gnbSearchList)
m_cellSearchSpace.emplace_back(addr, cons::PortalPort);
}
void UeSasTask::onStart()
void UeSraTask::onStart()
{
m_udpTask = new udp::UdpServerTask(this);
......@@ -39,7 +39,7 @@ void UeSasTask::onStart()
onMeasurement();
}
void UeSasTask::onLoop()
void UeSraTask::onLoop()
{
NtsMessage *msg = take();
if (!msg)
......@@ -47,11 +47,11 @@ void UeSasTask::onLoop()
switch (msg->msgType)
{
case NtsMessageType::UE_RRC_TO_SAS: {
auto *w = dynamic_cast<NwUeRrcToSas *>(msg);
if (w->present == NwUeRrcToSas::PLMN_SEARCH_REQUEST)
case NtsMessageType::UE_RRC_TO_SRA: {
auto *w = dynamic_cast<NwUeRrcToSra *>(msg);
if (w->present == NwUeRrcToSra::PLMN_SEARCH_REQUEST)
plmnSearchRequested();
else if (w->present == NwUeRrcToSas::CELL_SELECTION_COMMAND)
else if (w->present == NwUeRrcToSra::CELL_SELECTION_COMMAND)
handleCellSelectionCommand(w->cellId, w->isSuitableCell);
break;
}
......@@ -66,13 +66,13 @@ void UeSasTask::onLoop()
}
case NtsMessageType::UDP_SERVER_RECEIVE: {
auto *w = dynamic_cast<udp::NwUdpServerReceive *>(msg);
auto sasMsg = sas::DecodeSasMessage(OctetView{w->packet});
if (sasMsg == nullptr)
auto sraMsg = sra::DecodeSraMessage(OctetView{w->packet});
if (sraMsg == nullptr)
{
m_logger->err("Unable to decode SAS message");
m_logger->err("Unable to decode SRA message");
break;
}
receiveSasMessage(w->fromAddress, *sasMsg);
receiveSraMessage(w->fromAddress, *sraMsg);
break;
}
default:
......@@ -83,7 +83,7 @@ void UeSasTask::onLoop()
delete msg;
}
void UeSasTask::onQuit()
void UeSraTask::onQuit()
{
m_udpTask->quit();
delete m_udpTask;
......
......@@ -14,7 +14,7 @@
#include <udp/server_task.hpp>
#include <ue/types.hpp>
#include <unordered_map>
#include <urs/sas_pdu.hpp>
#include <urs/sra_pdu.hpp>
#include <utils/common_types.hpp>
#include <utils/logger.hpp>
#include <utils/nts.hpp>
......@@ -23,7 +23,7 @@
namespace nr::ue
{
class UeSasTask : public NtsTask
class UeSraTask : public NtsTask
{
private:
TaskBase *m_base;
......@@ -39,8 +39,8 @@ class UeSasTask : public NtsTask
friend class UeCmdHandler;
public:
explicit UeSasTask(TaskBase *base);
~UeSasTask() override = default;
explicit UeSraTask(TaskBase *base);
~UeSraTask() override = default;
protected:
void onStart() override;
......@@ -48,12 +48,12 @@ class UeSasTask : public NtsTask
void onQuit() override;
private: /* Transport */
void receiveSasMessage(const InetAddress &address, const sas::SasMessage &msg);
void sendSasMessage(const InetAddress &address, const sas::SasMessage &msg);
void receiveSraMessage(const InetAddress &address, const sra::SraMessage &msg);
void sendSraMessage(const InetAddress &address, const sra::SraMessage &msg);
private: /* Measurement */
void onMeasurement();
void receiveCellInfoResponse(const sas::SasCellInfoResponse &msg);
void receiveCellInfoResponse(const sra::SraCellInfoResponse &msg);
void onCoverageChange(const std::vector<GlobalNci> &entered, const std::vector<GlobalNci> &exited);
void plmnSearchRequested();
......
......@@ -11,24 +11,24 @@
namespace nr::ue
{
void UeSasTask::receiveSasMessage(const InetAddress &address, const sas::SasMessage &msg)
void UeSraTask::receiveSraMessage(const InetAddress &address, const sra::SraMessage &msg)
{
switch (msg.msgType)
{
case sas::SasMessageType::CELL_INFO_RESPONSE: {
receiveCellInfoResponse((const sas::SasCellInfoResponse &)msg);
case sra::SraMessageType::CELL_INFO_RESPONSE: {
receiveCellInfoResponse((const sra::SraCellInfoResponse &)msg);
break;
default:
m_logger->err("Unhandled SAS message type[%d]", static_cast<int>(msg.msgType));
m_logger->err("Unhandled SRA message type[%d]", static_cast<int>(msg.msgType));
break;
}
}
}
void UeSasTask::sendSasMessage(const InetAddress &address, const sas::SasMessage &msg)
void UeSraTask::sendSraMessage(const InetAddress &address, const sra::SraMessage &msg)
{
OctetString stream{};
sas::EncodeSasMessage(msg, stream);
sra::EncodeSraMessage(msg, stream);
m_udpTask->send(address, stream);
}
......
......@@ -27,7 +27,7 @@ class UeAppTask;
class UeMrTask;
class NasTask;
class UeRrcTask;
class UeSasTask;
class UeSraTask;
class UserEquipment;
struct SupportedAlgs
......@@ -126,7 +126,7 @@ struct TaskBase
UeMrTask *mrTask{};
NasTask *nasTask{};
UeRrcTask *rrcTask{};
UeSasTask *sasTask{};
UeSraTask *sraTask{};
};
struct UeTimers
......
......@@ -12,7 +12,7 @@
#include "mr/task.hpp"
#include "nas/task.hpp"
#include "rrc/task.hpp"
#include "sas/task.hpp"
#include "sra/task.hpp"
namespace nr::ue
{
......@@ -32,7 +32,7 @@ UserEquipment::UserEquipment(UeConfig *config, app::IUeController *ueController,
base->rrcTask = new UeRrcTask(base);
base->mrTask = new UeMrTask(base);
base->appTask = new UeAppTask(base);
base->sasTask = new UeSasTask(base);
base->sraTask = new UeSraTask(base);
taskBase = base;
}
......@@ -42,13 +42,13 @@ UserEquipment::~UserEquipment()
taskBase->nasTask->quit();
taskBase->rrcTask->quit();
taskBase->mrTask->quit();
taskBase->sasTask->quit();
taskBase->sraTask->quit();
taskBase->appTask->quit();
delete taskBase->nasTask;
delete taskBase->rrcTask;
delete taskBase->mrTask;
delete taskBase->sasTask;
delete taskBase->sraTask;
delete taskBase->appTask;
delete taskBase->logBase;
......@@ -61,7 +61,7 @@ void UserEquipment::start()
taskBase->nasTask->start();
taskBase->rrcTask->start();
taskBase->mrTask->start();
taskBase->sasTask->start();
taskBase->sraTask->start();
taskBase->appTask->start();
}
......
......@@ -6,10 +6,10 @@
// and subject to the terms and conditions defined in LICENSE file.
//
#include "sas_pdu.hpp"
#include "sra_pdu.hpp"
#include <utils/constants.hpp>
namespace sas
namespace sra
{
static void AppendPlmn(const Plmn &plmn, OctetString &stream)
......@@ -42,7 +42,7 @@ static GlobalNci DecodeGlobalNci(const OctetView &stream)
return res;
}
void EncodeSasMessage(const SasMessage &msg, OctetString &stream)
void EncodeSraMessage(const SraMessage &msg, OctetString &stream)
{
stream.appendOctet(0x03); // (Just for old RLS compatibility)
......@@ -50,16 +50,16 @@ void EncodeSasMessage(const SasMessage &msg, OctetString &stream)
stream.appendOctet(cons::Minor);
stream.appendOctet(cons::Patch);
stream.appendOctet(static_cast<uint8_t>(msg.msgType));
if (msg.msgType == SasMessageType::CELL_INFO_REQUEST)
if (msg.msgType == SraMessageType::CELL_INFO_REQUEST)
{
auto m = (const SasCellInfoRequest &)msg;
auto m = (const SraCellInfoRequest &)msg;
stream.appendOctet4(m.simPos.x);
stream.appendOctet4(m.simPos.y);
stream.appendOctet4(m.simPos.z);
}
else if (msg.msgType == SasMessageType::CELL_INFO_RESPONSE)
else if (msg.msgType == SraMessageType::CELL_INFO_RESPONSE)
{
auto m = (const SasCellInfoResponse &)msg;
auto m = (const SraCellInfoResponse &)msg;
AppendGlobalNci(m.cellId, stream);
stream.appendOctet4(m.tac);
stream.appendOctet4(m.dbm);
......@@ -70,7 +70,7 @@ void EncodeSasMessage(const SasMessage &msg, OctetString &stream)
}
}
std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream)
std::unique_ptr<SraMessage> DecodeSraMessage(const OctetView &stream)
{
auto first = stream.readI(); // (Just for old RLS compatibility)
if (first != 3)
......@@ -83,18 +83,18 @@ std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream)
if (stream.read() != cons::Patch)
return nullptr;
auto msgType = static_cast<SasMessageType>(stream.readI());
if (msgType == SasMessageType::CELL_INFO_REQUEST)
auto msgType = static_cast<SraMessageType>(stream.readI());
if (msgType == SraMessageType::CELL_INFO_REQUEST)
{
auto res = std::make_unique<SasCellInfoRequest>();
auto res = std::make_unique<SraCellInfoRequest>();
res->simPos.x = stream.read4I();
res->simPos.y = stream.read4I();
res->simPos.z = stream.read4I();
return res;
}
else if (msgType == SasMessageType::CELL_INFO_RESPONSE)
else if (msgType == SraMessageType::CELL_INFO_RESPONSE)
{
auto res = std::make_unique<SasCellInfoResponse>();
auto res = std::make_unique<SraCellInfoResponse>();
res->cellId = DecodeGlobalNci(stream);
res->tac = stream.read4I();
res->dbm = stream.read4I();
......@@ -106,4 +106,4 @@ std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream)
return nullptr;
}
} // namespace sas
} // namespace sra
......@@ -14,35 +14,35 @@
#include <utils/octet_string.hpp>
#include <utils/octet_view.hpp>
namespace sas
namespace sra
{
enum class SasMessageType : uint8_t
enum class SraMessageType : uint8_t
{
RESERVED = 0,
CELL_INFO_REQUEST,
CELL_INFO_RESPONSE,
};
struct SasMessage
struct SraMessage
{
const SasMessageType msgType;
const SraMessageType msgType;
explicit SasMessage(SasMessageType msgType) : msgType(msgType)
explicit SraMessage(SraMessageType msgType) : msgType(msgType)
{
}
};
struct SasCellInfoRequest : SasMessage
struct SraCellInfoRequest : SraMessage
{
Vector3 simPos{};
SasCellInfoRequest() : SasMessage(SasMessageType::CELL_INFO_REQUEST)
SraCellInfoRequest() : SraMessage(SraMessageType::CELL_INFO_REQUEST)
{
}
};
struct SasCellInfoResponse : SasMessage
struct SraCellInfoResponse : SraMessage
{
GlobalNci cellId{};
int tac{};
......@@ -50,12 +50,12 @@ struct SasCellInfoResponse : SasMessage
std::string gnbName{};
std::string linkIp{};
SasCellInfoResponse() : SasMessage(SasMessageType::CELL_INFO_RESPONSE)
SraCellInfoResponse() : SraMessage(SraMessageType::CELL_INFO_RESPONSE)
{
}
};
void EncodeSasMessage(const SasMessage &msg, OctetString &stream);
std::unique_ptr<SasMessage> DecodeSasMessage(const OctetView &stream);
void EncodeSraMessage(const SraMessage &msg, OctetString &stream);
std::unique_ptr<SraMessage> DecodeSraMessage(const OctetView &stream);
} // namespace sas
\ No newline at end of file
} // namespace sra
\ No newline at end of file
......@@ -53,9 +53,9 @@ enum class NtsMessageType
UE_RRC_TO_NAS,
UE_NAS_TO_RRC,
UE_RRC_TO_MR,
UE_RRC_TO_SAS,
UE_RRC_TO_SRA,
UE_NAS_TO_NAS,
UE_SAS_TO_RRC,
UE_SRA_TO_RRC,
UE_NAS_TO_APP,
};
......
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