Commit 6c831a70 authored by aligungr's avatar aligungr

RRC developments

parent 26a8e3d0
......@@ -7,6 +7,7 @@
//
#include "task.hpp"
#include <lib/rrc/encode.hpp>
#include <ue/nas/task.hpp>
......@@ -64,7 +65,12 @@ bool UeRrcTask::hasSignalToCell(int cellId)
void UeRrcTask::updateAvailablePlmns()
{
// TODO
m_base->shCtx.availablePlmns.mutate([this](std::unordered_set<Plmn> &value) {
value.clear();
for (auto &cellDesc : m_cellDesc)
if (cellDesc.second.sib1.hasSib1)
value.insert(cellDesc.second.sib1.plmn);
});
}
} // namespace nr::ue
......@@ -29,6 +29,8 @@ void UeRrcTask::receiveMib(int cellId, const ASN_RRC_MIB &msg)
desc.mib.isBarred = msg.cellBarred == ASN_RRC_MIB__cellBarred_barred;
desc.mib.isIntraFreqReselectAllowed = msg.intraFreqReselection == ASN_RRC_MIB__intraFreqReselection_allowed;
desc.mib.hasMib = true;
updateAvailablePlmns();
}
......@@ -60,6 +62,8 @@ void UeRrcTask::receiveSib1(int cellId, const ASN_RRC_SIB1 &msg)
desc.sib1.aiBarringSet.ai2 = bits::BitAt<5>(barringBits);
desc.sib1.aiBarringSet.ai1 = bits::BitAt<6>(barringBits);
desc.sib1.hasSib1 = true;
updateAvailablePlmns();
}
......
......@@ -11,6 +11,7 @@
#include <array>
#include <atomic>
#include <memory>
#include <unordered_set>
#include <lib/app/monitor.hpp>
#include <lib/app/ue_ctl.hpp>
......@@ -18,6 +19,7 @@
#include <lib/nas/timer.hpp>
#include <utils/common_types.hpp>
#include <utils/json.hpp>
#include <utils/locked.hpp>
#include <utils/logger.hpp>
#include <utils/nts.hpp>
#include <utils/octet_string.hpp>
......@@ -138,7 +140,7 @@ struct UeConfig
struct UeSharedContext
{
std::array<std::atomic<Plmn>, 16> availablePlmns{};
Locked<std::unordered_set<Plmn>> availablePlmns{};
};
struct TaskBase
......
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "locked.hpp"
\ No newline at end of file
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include <mutex>
template <typename T>
class Locked
{
private:
T m_value;
std::recursive_mutex m_mutex;
public:
Locked() : m_value{}, m_mutex{}
{
}
explicit Locked(T value) : m_value{value}, m_mutex{}
{
}
Locked(const T &) = delete;
Locked(T &&) = delete;
Locked &operator=(const Locked &) = delete;
Locked &operator=(Locked &&) = delete;
template <typename Func>
inline void access(Func fun)
{
// Şimdilik access ve mutate aynı, optimizasyon adına read-write lock kullanılabilir
mutate(fun);
}
template <typename Func>
inline void mutate(Func fun)
{
std::lock_guard lk(m_mutex);
fun(m_value);
}
};
\ No newline at end of file
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