/** * * \section COPYRIGHT * * Copyright 2013-2021 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. * */ /******************************************************************************* * * 3GPP TS ASN1 RRC v15.11.0 (2020-09) * ******************************************************************************/ #ifndef SRSASN1_RRC_SECURITY_H #define SRSASN1_RRC_SECURITY_H #include "common.h" namespace asn1 { namespace rrc { /******************************************************************************* * Struct Definitions ******************************************************************************/ // SecurityAlgorithmConfig ::= SEQUENCE struct security_algorithm_cfg_s { struct integrity_prot_algorithm_opts { enum options { eia0_v920, eia1, eia2, eia3_v1130, spare4, spare3, spare2, spare1, /*...*/ nulltype } value; typedef uint8_t number_type; std::string to_string() const; uint8_t to_number() const; }; typedef enumerated integrity_prot_algorithm_e_; // member variables ciphering_algorithm_r12_e ciphering_algorithm; integrity_prot_algorithm_e_ integrity_prot_algorithm; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityConfigHO-v1530 ::= SEQUENCE struct security_cfg_ho_v1530_s { struct handov_type_v1530_c_ { struct intra5_gc_r15_s_ { bool security_algorithm_cfg_r15_present = false; bool nas_container_r15_present = false; security_algorithm_cfg_s security_algorithm_cfg_r15; bool key_change_ind_r15 = false; uint8_t next_hop_chaining_count_r15 = 0; dyn_octstring nas_container_r15; }; struct fivegc_to_epc_r15_s_ { security_algorithm_cfg_s security_algorithm_cfg_r15; uint8_t next_hop_chaining_count_r15 = 0; }; struct epc_to5_gc_r15_s_ { security_algorithm_cfg_s security_algorithm_cfg_r15; dyn_octstring nas_container_r15; }; struct types_opts { enum options { intra5_gc_r15, fivegc_to_epc_r15, epc_to5_gc_r15, nulltype } value; std::string to_string() const; }; typedef enumerated types; // choice methods handov_type_v1530_c_() = default; handov_type_v1530_c_(const handov_type_v1530_c_& other); handov_type_v1530_c_& operator=(const handov_type_v1530_c_& other); ~handov_type_v1530_c_() { destroy_(); } void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters intra5_gc_r15_s_& intra5_gc_r15() { assert_choice_type("intra5GC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } fivegc_to_epc_r15_s_& fivegc_to_epc_r15() { assert_choice_type("fivegc-ToEPC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } epc_to5_gc_r15_s_& epc_to5_gc_r15() { assert_choice_type("epc-To5GC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } const intra5_gc_r15_s_& intra5_gc_r15() const { assert_choice_type("intra5GC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } const fivegc_to_epc_r15_s_& fivegc_to_epc_r15() const { assert_choice_type("fivegc-ToEPC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } const epc_to5_gc_r15_s_& epc_to5_gc_r15() const { assert_choice_type("epc-To5GC-r15", type_.to_string(), "handoverType-v1530"); return c.get(); } intra5_gc_r15_s_& set_intra5_gc_r15() { set(types::intra5_gc_r15); return c.get(); } fivegc_to_epc_r15_s_& set_fivegc_to_epc_r15() { set(types::fivegc_to_epc_r15); return c.get(); } epc_to5_gc_r15_s_& set_epc_to5_gc_r15() { set(types::epc_to5_gc_r15); return c.get(); } private: types type_; choice_buffer_t c; void destroy_(); }; // member variables bool ext = false; handov_type_v1530_c_ handov_type_v1530; // ... // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityConfigHO ::= SEQUENCE struct security_cfg_ho_s { struct handov_type_c_ { struct intra_lte_s_ { bool security_algorithm_cfg_present = false; security_algorithm_cfg_s security_algorithm_cfg; bool key_change_ind = false; uint8_t next_hop_chaining_count = 0; }; struct inter_rat_s_ { security_algorithm_cfg_s security_algorithm_cfg; fixed_octstring<6> nas_security_param_to_eutra; }; struct types_opts { enum options { intra_lte, inter_rat, nulltype } value; std::string to_string() const; }; typedef enumerated types; // choice methods handov_type_c_() = default; handov_type_c_(const handov_type_c_& other); handov_type_c_& operator=(const handov_type_c_& other); ~handov_type_c_() { destroy_(); } void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters intra_lte_s_& intra_lte() { assert_choice_type("intraLTE", type_.to_string(), "handoverType"); return c.get(); } inter_rat_s_& inter_rat() { assert_choice_type("interRAT", type_.to_string(), "handoverType"); return c.get(); } const intra_lte_s_& intra_lte() const { assert_choice_type("intraLTE", type_.to_string(), "handoverType"); return c.get(); } const inter_rat_s_& inter_rat() const { assert_choice_type("interRAT", type_.to_string(), "handoverType"); return c.get(); } intra_lte_s_& set_intra_lte() { set(types::intra_lte); return c.get(); } inter_rat_s_& set_inter_rat() { set(types::inter_rat); return c.get(); } private: types type_; choice_buffer_t c; void destroy_(); }; // member variables bool ext = false; handov_type_c_ handov_type; // ... // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityConfigSMC ::= SEQUENCE struct security_cfg_smc_s { bool ext = false; security_algorithm_cfg_s security_algorithm_cfg; // ... // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeCommand-v8a0-IEs ::= SEQUENCE struct security_mode_cmd_v8a0_ies_s { bool late_non_crit_ext_present = false; bool non_crit_ext_present = false; dyn_octstring late_non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeCommand-r8-IEs ::= SEQUENCE struct security_mode_cmd_r8_ies_s { bool non_crit_ext_present = false; security_cfg_smc_s security_cfg_smc; security_mode_cmd_v8a0_ies_s non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeCommand ::= SEQUENCE struct security_mode_cmd_s { struct crit_exts_c_ { struct c1_c_ { struct types_opts { enum options { security_mode_cmd_r8, spare3, spare2, spare1, nulltype } value; std::string to_string() const; }; typedef enumerated types; // choice methods c1_c_() = default; void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters security_mode_cmd_r8_ies_s& security_mode_cmd_r8() { assert_choice_type("securityModeCommand-r8", type_.to_string(), "c1"); return c; } const security_mode_cmd_r8_ies_s& security_mode_cmd_r8() const { assert_choice_type("securityModeCommand-r8", type_.to_string(), "c1"); return c; } security_mode_cmd_r8_ies_s& set_security_mode_cmd_r8() { set(types::security_mode_cmd_r8); return c; } void set_spare3() { set(types::spare3); } void set_spare2() { set(types::spare2); } void set_spare1() { set(types::spare1); } private: types type_; security_mode_cmd_r8_ies_s c; }; using types = c1_or_crit_ext_e; // choice methods crit_exts_c_() = default; void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters c1_c_& c1() { assert_choice_type("c1", type_.to_string(), "criticalExtensions"); return c; } const c1_c_& c1() const { assert_choice_type("c1", type_.to_string(), "criticalExtensions"); return c; } c1_c_& set_c1() { set(types::c1); return c; } void set_crit_exts_future() { set(types::crit_exts_future); } private: types type_; c1_c_ c; }; // member variables uint8_t rrc_transaction_id = 0; crit_exts_c_ crit_exts; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeComplete-v8a0-IEs ::= SEQUENCE struct security_mode_complete_v8a0_ies_s { bool late_non_crit_ext_present = false; bool non_crit_ext_present = false; dyn_octstring late_non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeFailure-v8a0-IEs ::= SEQUENCE struct security_mode_fail_v8a0_ies_s { bool late_non_crit_ext_present = false; bool non_crit_ext_present = false; dyn_octstring late_non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeComplete-r8-IEs ::= SEQUENCE struct security_mode_complete_r8_ies_s { bool non_crit_ext_present = false; security_mode_complete_v8a0_ies_s non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeFailure-r8-IEs ::= SEQUENCE struct security_mode_fail_r8_ies_s { bool non_crit_ext_present = false; security_mode_fail_v8a0_ies_s non_crit_ext; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeComplete ::= SEQUENCE struct security_mode_complete_s { struct crit_exts_c_ { struct types_opts { enum options { security_mode_complete_r8, crit_exts_future, nulltype } value; std::string to_string() const; }; typedef enumerated types; // choice methods crit_exts_c_() = default; void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters security_mode_complete_r8_ies_s& security_mode_complete_r8() { assert_choice_type("securityModeComplete-r8", type_.to_string(), "criticalExtensions"); return c; } const security_mode_complete_r8_ies_s& security_mode_complete_r8() const { assert_choice_type("securityModeComplete-r8", type_.to_string(), "criticalExtensions"); return c; } security_mode_complete_r8_ies_s& set_security_mode_complete_r8() { set(types::security_mode_complete_r8); return c; } void set_crit_exts_future() { set(types::crit_exts_future); } private: types type_; security_mode_complete_r8_ies_s c; }; // member variables uint8_t rrc_transaction_id = 0; crit_exts_c_ crit_exts; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // SecurityModeFailure ::= SEQUENCE struct security_mode_fail_s { struct crit_exts_c_ { struct types_opts { enum options { security_mode_fail_r8, crit_exts_future, nulltype } value; std::string to_string() const; }; typedef enumerated types; // choice methods crit_exts_c_() = default; void set(types::options e = types::nulltype); types type() const { return type_; } SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; // getters security_mode_fail_r8_ies_s& security_mode_fail_r8() { assert_choice_type("securityModeFailure-r8", type_.to_string(), "criticalExtensions"); return c; } const security_mode_fail_r8_ies_s& security_mode_fail_r8() const { assert_choice_type("securityModeFailure-r8", type_.to_string(), "criticalExtensions"); return c; } security_mode_fail_r8_ies_s& set_security_mode_fail_r8() { set(types::security_mode_fail_r8); return c; } void set_crit_exts_future() { set(types::crit_exts_future); } private: types type_; security_mode_fail_r8_ies_s c; }; // member variables uint8_t rrc_transaction_id = 0; crit_exts_c_ crit_exts; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; // VarShortMAC-Input ::= SEQUENCE struct var_short_mac_input_s { fixed_bitstring<28> cell_id; uint16_t pci = 0; fixed_bitstring<16> c_rnti; // sequence methods SRSASN_CODE pack(bit_ref& bref) const; SRSASN_CODE unpack(cbit_ref& bref); void to_json(json_writer& j) const; }; } // namespace rrc } // namespace asn1 #endif // SRSASN1_RRC_SECURITY_H