srsLTE/srsue/hdr/stack/upper/nas_emm_state.h

92 lines
2.5 KiB
C
Raw Normal View History

/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#ifndef SRSUE_NAS_EMM_STATE_H
#define SRSUE_NAS_EMM_STATE_H
Upgrade loggers in srsue (#2163) * Replaced UE logger in the ue class. * Replaced loggers in the main phy class and prach. * Replaced loggers in phy common and ta_control. * Replace loggers in cc and sf workers. * Replaced loggers in intra_measure, scell_recv, search, sfn_sync, sync. * Remove last uses of the old loggers in the main phy class. * Remove stray newline in logs. * Replaced loggers in ue gw. * - Started to replace loggers in the ue stack. - Replaced loggers in usim and pcsc. - Adapted nas and usim tests. * Replace loggers in nas. * Added missing log init calls in two previously modified tests. * Replaced logger in nas idle procs. * Replaced loggers in nas emm state. * Replaced loggers in tft packet filter and adapted tft test. * Replaced loggers in main RRC class. * Replaced loggers in RRC cell. * Replaced loggers in RRC meas. * Replaced loggers in rrc procedures. * Started logger replacement in MAC layer, more precisely in demux and dl_harq classes. Been unable to inject loggers in construction for dl_tb_process due to very weird static assertions in the std::vector code being the type not constructible which is not true, so instead use the main MAC logger directly. * Replaced loggers in mac mux class. * Replaced loggers in mac pro_bsr. * Replaced loggers in mac proc phr. * Replaced loggers in mac proc SR and RA. * Replace loggers in mac UL HARQ. * Replaced loggers in main ue stack class. * Fixed nas test crashing due to a null string. * Ported mac_test to use the new loggers. * Removed TTI reporting for the PHY log as the old logger did. * Replaced loggers in UE phy tests. * Configure loggers in nas_test. * Replaced loggers in rrc_meas_test. * Replaced loggers in rrc_reconfig_test. * Added missing newline in tft_test. * Fix compilation errors in TTCN3 tests. * Fix linker error detected in CI and warning. * Replaced loggers in TTCN3 tests. * Fix a text replace error in some log messages. * Remove trailing newlines from log entries. * Remove old logger from rrc. * Flush backend before printing the test status. * - Fix compilation error from previous rebase. - Remove trailing newlines from some missing log entries.
2021-01-28 08:17:43 -08:00
#include "srslte/srslog/srslog.h"
#include <atomic>
#include <string>
namespace srsue {
// EMM states (3GPP 24.302 v14.0.0)
class emm_state_t
{
public:
enum class state_t {
null = 0,
deregistered,
deregistered_initiated,
registered,
registered_initiated,
tau_initiated,
service_request_initiated,
};
// EMM-DEREGISTERED sub-states (3GPP 24.302 v14.0.0)
enum class deregistered_substate_t {
null = 0, // This should be used when not in EMM-DEREGISTERED
normal_service,
limited_service,
attempting_to_attach,
plmn_search,
no_imsi,
attach_needed,
no_cell_available,
e_call_inactive,
};
// EMM-REGISTERED sub-states (3GPP 24.302 v14.0.0)
enum class registered_substate_t {
null = 0, // This should be used when not in EMM-REGISTERED
normal_service,
attempting_to_update,
limited_service,
plmn_search,
update_needed,
no_cell_available,
attempting_to_update_mm,
imsi_dettach_initiated,
};
// FSM setters
void set_null();
void set_deregistered(deregistered_substate_t substate);
void set_deregistered_initiated();
void set_registered(registered_substate_t substate);
void set_registered_initiated();
void set_tau_initiated();
void set_service_request_initiated();
// FSM getters
state_t get_state() { return state; }
deregistered_substate_t get_deregistered_substate() { return deregistered_substate; }
registered_substate_t get_registered_substate() { return registered_substate; }
// Text Helpers
const std::string get_full_state_text();
private:
std::atomic<state_t> state{state_t::null}; // The GW might require to know the NAS state from another thread
deregistered_substate_t deregistered_substate = deregistered_substate_t::null;
registered_substate_t registered_substate = registered_substate_t::null;
Upgrade loggers in srsue (#2163) * Replaced UE logger in the ue class. * Replaced loggers in the main phy class and prach. * Replaced loggers in phy common and ta_control. * Replace loggers in cc and sf workers. * Replaced loggers in intra_measure, scell_recv, search, sfn_sync, sync. * Remove last uses of the old loggers in the main phy class. * Remove stray newline in logs. * Replaced loggers in ue gw. * - Started to replace loggers in the ue stack. - Replaced loggers in usim and pcsc. - Adapted nas and usim tests. * Replace loggers in nas. * Added missing log init calls in two previously modified tests. * Replaced logger in nas idle procs. * Replaced loggers in nas emm state. * Replaced loggers in tft packet filter and adapted tft test. * Replaced loggers in main RRC class. * Replaced loggers in RRC cell. * Replaced loggers in RRC meas. * Replaced loggers in rrc procedures. * Started logger replacement in MAC layer, more precisely in demux and dl_harq classes. Been unable to inject loggers in construction for dl_tb_process due to very weird static assertions in the std::vector code being the type not constructible which is not true, so instead use the main MAC logger directly. * Replaced loggers in mac mux class. * Replaced loggers in mac pro_bsr. * Replaced loggers in mac proc phr. * Replaced loggers in mac proc SR and RA. * Replace loggers in mac UL HARQ. * Replaced loggers in main ue stack class. * Fixed nas test crashing due to a null string. * Ported mac_test to use the new loggers. * Removed TTI reporting for the PHY log as the old logger did. * Replaced loggers in UE phy tests. * Configure loggers in nas_test. * Replaced loggers in rrc_meas_test. * Replaced loggers in rrc_reconfig_test. * Added missing newline in tft_test. * Fix compilation errors in TTCN3 tests. * Fix linker error detected in CI and warning. * Replaced loggers in TTCN3 tests. * Fix a text replace error in some log messages. * Remove trailing newlines from log entries. * Remove old logger from rrc. * Flush backend before printing the test status. * - Fix compilation error from previous rebase. - Remove trailing newlines from some missing log entries.
2021-01-28 08:17:43 -08:00
srslog::basic_logger& logger = srslog::fetch_basic_logger("NAS");
};
const char* emm_state_text(emm_state_t::state_t type);
const char* emm_deregistered_substate_text(emm_state_t::deregistered_substate_t type);
const char* emm_registered_substate_text(emm_state_t::registered_substate_t type);
} // namespace srsue
#endif