NAS-5GS is added

This commit is contained in:
Sukchan Lee 2020-05-21 21:24:21 -04:00
parent 3b19cd85cc
commit a9eaed18aa
135 changed files with 18180 additions and 4552 deletions

View File

@ -47,6 +47,7 @@ extern "C" {
#define OGS_MAX_NUM_OF_HOSTNAME 16
#define OGS_MAX_APN_LEN 100
#define OGS_MAX_DNN_LEN 100
#define OGS_MAX_PCO_LEN 251
#define OGS_MAX_FQDN_LEN 256
#define OGS_MAX_IFNAME_LEN 32

2817
lib/nas/5gs/decoder.c Normal file

File diff suppressed because it is too large Load Diff

3187
lib/nas/5gs/encoder.c Normal file

File diff suppressed because it is too large Load Diff

3678
lib/nas/5gs/ies.c Normal file

File diff suppressed because it is too large Load Diff

273
lib/nas/5gs/ies.h Normal file
View File

@ -0,0 +1,273 @@
/*
* The MIT License
*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-05-21 21:20:09.020951 by acetcom
* from 24501-g41.docx
******************************************************************************/
#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_IES_H
#define OGS_NAS_5GS_IES_H
#ifdef __cplusplus
extern "C" {
#endif
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
int ogs_nas_decode_additional_information(ogs_nas_additional_information_t *additional_information, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_access_type(ogs_nas_access_type_t *access_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_dnn(ogs_nas_dnn_t *dnn, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_eap_message(ogs_nas_eap_message_t *eap_message, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_gprs_timer(ogs_nas_gprs_timer_t *gprs_timer, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_gprs_timer_2(ogs_nas_gprs_timer_2_t *gprs_timer_2, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_gprs_timer_3(ogs_nas_gprs_timer_3_t *gprs_timer_3, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_s_nssai(ogs_nas_s_nssai_t *s_nssai, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gmm_capability(ogs_nas_5gmm_capability_t *gmm_capability, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_abba(ogs_nas_abba_t *abba, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_additional_5g_security_information(ogs_nas_additional_5g_security_information_t *additional_security_information, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_additional_information_requested(ogs_nas_additional_information_requested_t *additional_information_requested, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_allowed_pdu_session_status(ogs_nas_allowed_pdu_session_status_t *allowed_pdu_session_status, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_authentication_failure_parameter(ogs_nas_authentication_failure_parameter_t *authentication_failure_parameter, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_authentication_parameter_autn(ogs_nas_authentication_parameter_autn_t *authentication_parameter_autn, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_authentication_parameter_rand(ogs_nas_authentication_parameter_rand_t *authentication_parameter_rand, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_authentication_response_parameter(ogs_nas_authentication_response_parameter_t *authentication_response_parameter, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_configuration_update_indication(ogs_nas_configuration_update_indication_t *configuration_update_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_cag_information_list(ogs_nas_cag_information_list_t *cag_information_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ciot_small_data_container(ogs_nas_ciot_small_data_container_t *ciot_small_data_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ciphering_key_data(ogs_nas_ciphering_key_data_t *ciphering_key_data, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_control_plane_service_type(ogs_nas_control_plane_service_type_t *control_plane_service_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_daylight_saving_time(ogs_nas_daylight_saving_time_t *daylight_saving_time, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gmm_cause(ogs_nas_5gmm_cause_t *gmm_cause, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_de_registration_type(ogs_nas_de_registration_type_t *de_registration_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_emergency_number_list(ogs_nas_emergency_number_list_t *emergency_number_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_eps_bearer_context_status(ogs_nas_eps_bearer_context_status_t *eps_bearer_context_status, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_eps_nas_message_container(ogs_nas_eps_nas_message_container_t *eps_nas_message_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_eps_nas_security_algorithms(ogs_nas_eps_nas_security_algorithms_t *eps_nas_security_algorithms, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_extended_emergency_number_list(ogs_nas_extended_emergency_number_list_t *extended_emergency_number_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_extended_drx_parameters(ogs_nas_extended_drx_parameters_t *extended_drx_parameters, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_imeisv_request(ogs_nas_imeisv_request_t *imeisv_request, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ladn_indication(ogs_nas_ladn_indication_t *ladn_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_drx_parameters(ogs_nas_5gs_drx_parameters_t *drx_parameters, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_identity_type(ogs_nas_5gs_identity_type_t *identity_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ladn_information(ogs_nas_ladn_information_t *ladn_information, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_mico_indication(ogs_nas_mico_indication_t *mico_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ma_pdu_session_information(ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_mapped_nssai(ogs_nas_mapped_nssai_t *mapped_nssai, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_mobile_station_classmark_2(ogs_nas_mobile_station_classmark_2_t *mobile_station_classmark_2, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_key_set_identifier(ogs_nas_key_set_identifier_t *key_set_identifier, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_message_container(ogs_nas_message_container_t *message_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_security_algorithms(ogs_nas_security_algorithms_t *security_algorithms, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_network_name(ogs_nas_network_name_t *network_name, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_network_slicing_indication(ogs_nas_network_slicing_indication_t *network_slicing_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_non_3gpp_nw_provided_policies(ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_nssai(ogs_nas_nssai_t *nssai, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_nssai_inclusion_mode(ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_operator_defined_access_category_definitions(ogs_nas_operator_defined_access_category_definitions_t *operator_defined_access_category_definitions, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_payload_container(ogs_nas_payload_container_t *payload_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_mobile_identity(ogs_nas_5gs_mobile_identity_t *mobile_identity, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_payload_container_type(ogs_nas_payload_container_type_t *payload_container_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_session_identity_2(ogs_nas_pdu_session_identity_2_t *pdu_session_identity_2, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_session_reactivation_result(ogs_nas_pdu_session_reactivation_result_t *pdu_session_reactivation_result, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_session_reactivation_result_error_cause(ogs_nas_pdu_session_reactivation_result_error_cause_t *pdu_session_reactivation_result_error_cause, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_session_status(ogs_nas_pdu_session_status_t *pdu_session_status, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_plmn_list(ogs_nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_rejected_nssai(ogs_nas_rejected_nssai_t *rejected_nssai, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_release_assistance_indication(ogs_nas_release_assistance_indication_t *release_assistance_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_request_type(ogs_nas_request_type_t *request_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_s1_ue_network_capability(ogs_nas_s1_ue_network_capability_t *s1_ue_network_capability, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_s1_ue_security_capability(ogs_nas_s1_ue_security_capability_t *s1_ue_security_capability, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_service_area_list(ogs_nas_service_area_list_t *service_area_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_network_feature_support(ogs_nas_5gs_network_feature_support_t *network_feature_support, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_sms_indication(ogs_nas_sms_indication_t *sms_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_sor_transparent_container(ogs_nas_sor_transparent_container_t *sor_transparent_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_supported_codec_list(ogs_nas_supported_codec_list_t *supported_codec_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_time_zone(ogs_nas_time_zone_t *time_zone, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_time_zone_and_time(ogs_nas_time_zone_and_time_t *time_zone_and_time, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_security_capability(ogs_nas_ue_security_capability_t *ue_security_capability, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_usage_setting(ogs_nas_ue_usage_setting_t *ue_usage_setting, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_status(ogs_nas_ue_status_t *ue_status, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_uplink_data_status(ogs_nas_uplink_data_status_t *uplink_data_status, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_registration_result(ogs_nas_5gs_registration_result_t *registration_result, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_radio_capability_id(ogs_nas_ue_radio_capability_id_t *ue_radio_capability_id, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_radio_capability_id_deletion_indication(ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_registration_type(ogs_nas_5gs_registration_type_t *registration_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_truncated_5g_s_tmsi_configuration(ogs_nas_truncated_5g_s_tmsi_configuration_t *truncated_s_tmsi_configuration, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_wus_assistance_information(ogs_nas_wus_assistance_information_t *wus_assistance_information, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_n5gc_indication(ogs_nas_n5gc_indication_t *n5gc_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_tracking_area_identity(ogs_nas_5gs_tracking_area_identity_t *tracking_area_identity, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_tracking_area_identity_list(ogs_nas_5gs_tracking_area_identity_list_t *tracking_area_identity_list, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gs_update_type(ogs_nas_5gs_update_type_t *update_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gsm_capability(ogs_nas_5gsm_capability_t *gsm_capability, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_address(ogs_nas_pdu_address_t *pdu_address, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_pdu_session_type(ogs_nas_pdu_session_type_t *pdu_session_type, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_qos_flow_descriptions(ogs_nas_qos_flow_descriptions_t *qos_flow_descriptions, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_qos_rules(ogs_nas_qos_rules_t *qos_rules, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_sm_pdu_dn_request_container(ogs_nas_sm_pdu_dn_request_container_t *sm_pdu_dn_request_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ssc_mode(ogs_nas_ssc_mode_t *ssc_mode, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_re_attempt_indicator(ogs_nas_re_attempt_indicator_t *re_attempt_indicator, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gsm_network_feature_support(ogs_nas_5gsm_network_feature_support_t *gsm_network_feature_support, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gsm_cause(ogs_nas_5gsm_cause_t *gsm_cause, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_serving_plmn_rate_control(ogs_nas_serving_plmn_rate_control_t *serving_plmn_rate_control, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_5gsm_congestion_re_attempt_indicator(ogs_nas_5gsm_congestion_re_attempt_indicator_t *gsm_congestion_re_attempt_indicator, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_atsss_container(ogs_nas_atsss_container_t *atsss_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_control_plane_only_indication(ogs_nas_control_plane_only_indication_t *control_plane_only_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_header_compression_configuration(ogs_nas_header_compression_configuration_t *header_compression_configuration, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ds_tt_ethernet_port_mac_address(ogs_nas_ds_tt_ethernet_port_mac_address_t *ds_tt_ethernet_port_mac_address, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_ue_ds_tt_residence_time(ogs_nas_ue_ds_tt_residence_time_t *ue_ds_tt_residence_time, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_port_management_information_container(ogs_nas_port_management_information_container_t *port_management_information_container, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_always_on_pdu_session_indication(ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_always_on_pdu_session_requested(ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_allowed_ssc_mode(ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_extended_protocol_configuration_options(ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_integrity_protection_maximum_data_rate(ogs_nas_integrity_protection_maximum_data_rate_t *integrity_protection_maximum_data_rate, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_mapped_eps_bearer_contexts(ogs_nas_mapped_eps_bearer_contexts_t *mapped_eps_bearer_contexts, ogs_pkbuf_t *pkbuf);
int ogs_nas_decode_maximum_number_of_supported_packet_filters(ogs_nas_maximum_number_of_supported_packet_filters_t *maximum_number_of_supported_packet_filters, ogs_pkbuf_t *pkbuf);
int ogs_nas_encode_additional_information(ogs_pkbuf_t *pkbuf, ogs_nas_additional_information_t *additional_information);
int ogs_nas_encode_access_type(ogs_pkbuf_t *pkbuf, ogs_nas_access_type_t *access_type);
int ogs_nas_encode_dnn(ogs_pkbuf_t *pkbuf, ogs_nas_dnn_t *dnn);
int ogs_nas_encode_eap_message(ogs_pkbuf_t *pkbuf, ogs_nas_eap_message_t *eap_message);
int ogs_nas_encode_gprs_timer(ogs_pkbuf_t *pkbuf, ogs_nas_gprs_timer_t *gprs_timer);
int ogs_nas_encode_gprs_timer_2(ogs_pkbuf_t *pkbuf, ogs_nas_gprs_timer_2_t *gprs_timer_2);
int ogs_nas_encode_gprs_timer_3(ogs_pkbuf_t *pkbuf, ogs_nas_gprs_timer_3_t *gprs_timer_3);
int ogs_nas_encode_s_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_s_nssai_t *s_nssai);
int ogs_nas_encode_5gmm_capability(ogs_pkbuf_t *pkbuf, ogs_nas_5gmm_capability_t *gmm_capability);
int ogs_nas_encode_abba(ogs_pkbuf_t *pkbuf, ogs_nas_abba_t *abba);
int ogs_nas_encode_additional_5g_security_information(ogs_pkbuf_t *pkbuf, ogs_nas_additional_5g_security_information_t *additional_security_information);
int ogs_nas_encode_additional_information_requested(ogs_pkbuf_t *pkbuf, ogs_nas_additional_information_requested_t *additional_information_requested);
int ogs_nas_encode_allowed_pdu_session_status(ogs_pkbuf_t *pkbuf, ogs_nas_allowed_pdu_session_status_t *allowed_pdu_session_status);
int ogs_nas_encode_authentication_failure_parameter(ogs_pkbuf_t *pkbuf, ogs_nas_authentication_failure_parameter_t *authentication_failure_parameter);
int ogs_nas_encode_authentication_parameter_autn(ogs_pkbuf_t *pkbuf, ogs_nas_authentication_parameter_autn_t *authentication_parameter_autn);
int ogs_nas_encode_authentication_parameter_rand(ogs_pkbuf_t *pkbuf, ogs_nas_authentication_parameter_rand_t *authentication_parameter_rand);
int ogs_nas_encode_authentication_response_parameter(ogs_pkbuf_t *pkbuf, ogs_nas_authentication_response_parameter_t *authentication_response_parameter);
int ogs_nas_encode_configuration_update_indication(ogs_pkbuf_t *pkbuf, ogs_nas_configuration_update_indication_t *configuration_update_indication);
int ogs_nas_encode_cag_information_list(ogs_pkbuf_t *pkbuf, ogs_nas_cag_information_list_t *cag_information_list);
int ogs_nas_encode_ciot_small_data_container(ogs_pkbuf_t *pkbuf, ogs_nas_ciot_small_data_container_t *ciot_small_data_container);
int ogs_nas_encode_ciphering_key_data(ogs_pkbuf_t *pkbuf, ogs_nas_ciphering_key_data_t *ciphering_key_data);
int ogs_nas_encode_control_plane_service_type(ogs_pkbuf_t *pkbuf, ogs_nas_control_plane_service_type_t *control_plane_service_type);
int ogs_nas_encode_daylight_saving_time(ogs_pkbuf_t *pkbuf, ogs_nas_daylight_saving_time_t *daylight_saving_time);
int ogs_nas_encode_5gmm_cause(ogs_pkbuf_t *pkbuf, ogs_nas_5gmm_cause_t *gmm_cause);
int ogs_nas_encode_de_registration_type(ogs_pkbuf_t *pkbuf, ogs_nas_de_registration_type_t *de_registration_type);
int ogs_nas_encode_emergency_number_list(ogs_pkbuf_t *pkbuf, ogs_nas_emergency_number_list_t *emergency_number_list);
int ogs_nas_encode_eps_bearer_context_status(ogs_pkbuf_t *pkbuf, ogs_nas_eps_bearer_context_status_t *eps_bearer_context_status);
int ogs_nas_encode_eps_nas_message_container(ogs_pkbuf_t *pkbuf, ogs_nas_eps_nas_message_container_t *eps_nas_message_container);
int ogs_nas_encode_eps_nas_security_algorithms(ogs_pkbuf_t *pkbuf, ogs_nas_eps_nas_security_algorithms_t *eps_nas_security_algorithms);
int ogs_nas_encode_extended_emergency_number_list(ogs_pkbuf_t *pkbuf, ogs_nas_extended_emergency_number_list_t *extended_emergency_number_list);
int ogs_nas_encode_extended_drx_parameters(ogs_pkbuf_t *pkbuf, ogs_nas_extended_drx_parameters_t *extended_drx_parameters);
int ogs_nas_encode_imeisv_request(ogs_pkbuf_t *pkbuf, ogs_nas_imeisv_request_t *imeisv_request);
int ogs_nas_encode_ladn_indication(ogs_pkbuf_t *pkbuf, ogs_nas_ladn_indication_t *ladn_indication);
int ogs_nas_encode_5gs_drx_parameters(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_drx_parameters_t *drx_parameters);
int ogs_nas_encode_5gs_identity_type(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_identity_type_t *identity_type);
int ogs_nas_encode_ladn_information(ogs_pkbuf_t *pkbuf, ogs_nas_ladn_information_t *ladn_information);
int ogs_nas_encode_mico_indication(ogs_pkbuf_t *pkbuf, ogs_nas_mico_indication_t *mico_indication);
int ogs_nas_encode_ma_pdu_session_information(ogs_pkbuf_t *pkbuf, ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information);
int ogs_nas_encode_mapped_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_mapped_nssai_t *mapped_nssai);
int ogs_nas_encode_mobile_station_classmark_2(ogs_pkbuf_t *pkbuf, ogs_nas_mobile_station_classmark_2_t *mobile_station_classmark_2);
int ogs_nas_encode_key_set_identifier(ogs_pkbuf_t *pkbuf, ogs_nas_key_set_identifier_t *key_set_identifier);
int ogs_nas_encode_message_container(ogs_pkbuf_t *pkbuf, ogs_nas_message_container_t *message_container);
int ogs_nas_encode_security_algorithms(ogs_pkbuf_t *pkbuf, ogs_nas_security_algorithms_t *security_algorithms);
int ogs_nas_encode_network_name(ogs_pkbuf_t *pkbuf, ogs_nas_network_name_t *network_name);
int ogs_nas_encode_network_slicing_indication(ogs_pkbuf_t *pkbuf, ogs_nas_network_slicing_indication_t *network_slicing_indication);
int ogs_nas_encode_non_3gpp_nw_provided_policies(ogs_pkbuf_t *pkbuf, ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies);
int ogs_nas_encode_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_nssai_t *nssai);
int ogs_nas_encode_nssai_inclusion_mode(ogs_pkbuf_t *pkbuf, ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode);
int ogs_nas_encode_operator_defined_access_category_definitions(ogs_pkbuf_t *pkbuf, ogs_nas_operator_defined_access_category_definitions_t *operator_defined_access_category_definitions);
int ogs_nas_encode_payload_container(ogs_pkbuf_t *pkbuf, ogs_nas_payload_container_t *payload_container);
int ogs_nas_encode_5gs_mobile_identity(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_mobile_identity_t *mobile_identity);
int ogs_nas_encode_payload_container_type(ogs_pkbuf_t *pkbuf, ogs_nas_payload_container_type_t *payload_container_type);
int ogs_nas_encode_pdu_session_identity_2(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_identity_2_t *pdu_session_identity_2);
int ogs_nas_encode_pdu_session_reactivation_result(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_reactivation_result_t *pdu_session_reactivation_result);
int ogs_nas_encode_pdu_session_reactivation_result_error_cause(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_reactivation_result_error_cause_t *pdu_session_reactivation_result_error_cause);
int ogs_nas_encode_pdu_session_status(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_status_t *pdu_session_status);
int ogs_nas_encode_plmn_list(ogs_pkbuf_t *pkbuf, ogs_nas_plmn_list_t *plmn_list);
int ogs_nas_encode_rejected_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_rejected_nssai_t *rejected_nssai);
int ogs_nas_encode_release_assistance_indication(ogs_pkbuf_t *pkbuf, ogs_nas_release_assistance_indication_t *release_assistance_indication);
int ogs_nas_encode_request_type(ogs_pkbuf_t *pkbuf, ogs_nas_request_type_t *request_type);
int ogs_nas_encode_s1_ue_network_capability(ogs_pkbuf_t *pkbuf, ogs_nas_s1_ue_network_capability_t *s1_ue_network_capability);
int ogs_nas_encode_s1_ue_security_capability(ogs_pkbuf_t *pkbuf, ogs_nas_s1_ue_security_capability_t *s1_ue_security_capability);
int ogs_nas_encode_service_area_list(ogs_pkbuf_t *pkbuf, ogs_nas_service_area_list_t *service_area_list);
int ogs_nas_encode_5gs_network_feature_support(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_network_feature_support_t *network_feature_support);
int ogs_nas_encode_sms_indication(ogs_pkbuf_t *pkbuf, ogs_nas_sms_indication_t *sms_indication);
int ogs_nas_encode_sor_transparent_container(ogs_pkbuf_t *pkbuf, ogs_nas_sor_transparent_container_t *sor_transparent_container);
int ogs_nas_encode_supported_codec_list(ogs_pkbuf_t *pkbuf, ogs_nas_supported_codec_list_t *supported_codec_list);
int ogs_nas_encode_time_zone(ogs_pkbuf_t *pkbuf, ogs_nas_time_zone_t *time_zone);
int ogs_nas_encode_time_zone_and_time(ogs_pkbuf_t *pkbuf, ogs_nas_time_zone_and_time_t *time_zone_and_time);
int ogs_nas_encode_ue_security_capability(ogs_pkbuf_t *pkbuf, ogs_nas_ue_security_capability_t *ue_security_capability);
int ogs_nas_encode_ue_usage_setting(ogs_pkbuf_t *pkbuf, ogs_nas_ue_usage_setting_t *ue_usage_setting);
int ogs_nas_encode_ue_status(ogs_pkbuf_t *pkbuf, ogs_nas_ue_status_t *ue_status);
int ogs_nas_encode_uplink_data_status(ogs_pkbuf_t *pkbuf, ogs_nas_uplink_data_status_t *uplink_data_status);
int ogs_nas_encode_5gs_registration_result(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_registration_result_t *registration_result);
int ogs_nas_encode_ue_radio_capability_id(ogs_pkbuf_t *pkbuf, ogs_nas_ue_radio_capability_id_t *ue_radio_capability_id);
int ogs_nas_encode_ue_radio_capability_id_deletion_indication(ogs_pkbuf_t *pkbuf, ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication);
int ogs_nas_encode_5gs_registration_type(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_registration_type_t *registration_type);
int ogs_nas_encode_truncated_5g_s_tmsi_configuration(ogs_pkbuf_t *pkbuf, ogs_nas_truncated_5g_s_tmsi_configuration_t *truncated_s_tmsi_configuration);
int ogs_nas_encode_wus_assistance_information(ogs_pkbuf_t *pkbuf, ogs_nas_wus_assistance_information_t *wus_assistance_information);
int ogs_nas_encode_n5gc_indication(ogs_pkbuf_t *pkbuf, ogs_nas_n5gc_indication_t *n5gc_indication);
int ogs_nas_encode_5gs_tracking_area_identity(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_tracking_area_identity_t *tracking_area_identity);
int ogs_nas_encode_5gs_tracking_area_identity_list(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_tracking_area_identity_list_t *tracking_area_identity_list);
int ogs_nas_encode_5gs_update_type(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_update_type_t *update_type);
int ogs_nas_encode_5gsm_capability(ogs_pkbuf_t *pkbuf, ogs_nas_5gsm_capability_t *gsm_capability);
int ogs_nas_encode_pdu_address(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_address_t *pdu_address);
int ogs_nas_encode_pdu_session_type(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_type_t *pdu_session_type);
int ogs_nas_encode_qos_flow_descriptions(ogs_pkbuf_t *pkbuf, ogs_nas_qos_flow_descriptions_t *qos_flow_descriptions);
int ogs_nas_encode_qos_rules(ogs_pkbuf_t *pkbuf, ogs_nas_qos_rules_t *qos_rules);
int ogs_nas_encode_session_ambr(ogs_pkbuf_t *pkbuf, ogs_nas_session_ambr_t *session_ambr);
int ogs_nas_encode_sm_pdu_dn_request_container(ogs_pkbuf_t *pkbuf, ogs_nas_sm_pdu_dn_request_container_t *sm_pdu_dn_request_container);
int ogs_nas_encode_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_ssc_mode_t *ssc_mode);
int ogs_nas_encode_re_attempt_indicator(ogs_pkbuf_t *pkbuf, ogs_nas_re_attempt_indicator_t *re_attempt_indicator);
int ogs_nas_encode_5gsm_network_feature_support(ogs_pkbuf_t *pkbuf, ogs_nas_5gsm_network_feature_support_t *gsm_network_feature_support);
int ogs_nas_encode_5gsm_cause(ogs_pkbuf_t *pkbuf, ogs_nas_5gsm_cause_t *gsm_cause);
int ogs_nas_encode_serving_plmn_rate_control(ogs_pkbuf_t *pkbuf, ogs_nas_serving_plmn_rate_control_t *serving_plmn_rate_control);
int ogs_nas_encode_5gsm_congestion_re_attempt_indicator(ogs_pkbuf_t *pkbuf, ogs_nas_5gsm_congestion_re_attempt_indicator_t *gsm_congestion_re_attempt_indicator);
int ogs_nas_encode_atsss_container(ogs_pkbuf_t *pkbuf, ogs_nas_atsss_container_t *atsss_container);
int ogs_nas_encode_control_plane_only_indication(ogs_pkbuf_t *pkbuf, ogs_nas_control_plane_only_indication_t *control_plane_only_indication);
int ogs_nas_encode_header_compression_configuration(ogs_pkbuf_t *pkbuf, ogs_nas_header_compression_configuration_t *header_compression_configuration);
int ogs_nas_encode_ds_tt_ethernet_port_mac_address(ogs_pkbuf_t *pkbuf, ogs_nas_ds_tt_ethernet_port_mac_address_t *ds_tt_ethernet_port_mac_address);
int ogs_nas_encode_ue_ds_tt_residence_time(ogs_pkbuf_t *pkbuf, ogs_nas_ue_ds_tt_residence_time_t *ue_ds_tt_residence_time);
int ogs_nas_encode_port_management_information_container(ogs_pkbuf_t *pkbuf, ogs_nas_port_management_information_container_t *port_management_information_container);
int ogs_nas_encode_always_on_pdu_session_indication(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication);
int ogs_nas_encode_always_on_pdu_session_requested(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested);
int ogs_nas_encode_allowed_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode);
int ogs_nas_encode_extended_protocol_configuration_options(ogs_pkbuf_t *pkbuf, ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options);
int ogs_nas_encode_integrity_protection_maximum_data_rate(ogs_pkbuf_t *pkbuf, ogs_nas_integrity_protection_maximum_data_rate_t *integrity_protection_maximum_data_rate);
int ogs_nas_encode_mapped_eps_bearer_contexts(ogs_pkbuf_t *pkbuf, ogs_nas_mapped_eps_bearer_contexts_t *mapped_eps_bearer_contexts);
int ogs_nas_encode_maximum_number_of_supported_packet_filters(ogs_pkbuf_t *pkbuf, ogs_nas_maximum_number_of_supported_packet_filters_t *maximum_number_of_supported_packet_filters);
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_IES_H */

37
lib/nas/5gs/meson.build Normal file
View File

@ -0,0 +1,37 @@
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
libnas_5gs_sources = files('''
ies.c
decoder.c
encoder.c
'''.split())
libnas_5gs_inc = include_directories('.')
libnas_5gs = library('ogsnas-5gs',
sources : libnas_5gs_sources,
version : libogslib_version,
c_args : '-DOGS_NAS_COMPILATION',
include_directories : libnas_5gs_inc,
dependencies : libnas_common_dep,
install : true)
libnas_5gs_dep = declare_dependency(
link_with : libnas_5gs,
include_directories : libnas_5gs_inc,
dependencies : libnas_common_dep)

1384
lib/nas/5gs/message.h Normal file

File diff suppressed because it is too large Load Diff

41
lib/nas/5gs/ogs-nas-5gs.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef OGS_NAS_5GS_H
#define OGS_NAS_5GS_H
#include "ogs-nas-common.h"
#define OGS_NAS_INSIDE
#include "nas/5gs/types.h"
#include "nas/5gs/ies.h"
#include "nas/5gs/message.h"
#undef OGS_NAS_INSIDE
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_H */

Binary file not shown.

View File

@ -0,0 +1,16 @@
* Install python-pip
user@host ~/Documents/git/open5gs/lib/gtp/support$ \
sudo apt-get install python-pip
* Install python-docx
user@host ~/Documents/git/open5gs/lib/gtp/support$ \
sudo pip install python-docx
* Change the format of standard specification
from 24301-d80.doc to 24301-d80.docx
using Microsoft Office 2007+
* Generate Message support files
user@host ~/Documents/git/open5gs/lib/s1ap/support$ \
python nas-message.py -f 24501-g41.docx -o ..

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Access type", "type" : "Access type", "reference" : "9.11.2.1A", "presence" : "M", "format" : "V", "length" : "1/2"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "M", "format" : "LV-E", "length" : "3-65537"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "59", "value" : "Old PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "8", "value" : "Request type", "type" : "Request type", "reference" : "9.11.3.47", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"})
ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "A-", "value" : "MA PDU session information", "type" : "MA PDU session information", "reference" : "9.11.3.31A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,8 @@
ies = []
ies.append({ "iei" : "", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "M", "format" : "LV-E", "length" : "3-65537"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "58", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Control plane service type", "type" : "Control plane service type", "reference" : "9.11.3.18D", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "6F", "value" : "CIoT small data container", "type" : "CIoT small data container", "reference" : "9.11.3.18B", "presence" : "O", "format" : "TLV", "length" : "4-257"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,14 @@
ies = []
ies.append({ "iei" : "", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "M", "format" : "V", "length" : "2"})
ies.append({ "iei" : "9-", "value" : "PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "A-", "value" : "SSC mode", "type" : "SSC mode", "reference" : "9.11.4.16", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "39", "value" : "SM PDU DN request container", "type" : "SM PDU DN request container", "reference" : "9.11.4.15", "presence" : "O", "format" : "TLV", "length" : "3-255"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
ies.append({ "iei" : "6E", "value" : "DS-TT Ethernet port MAC address", "type" : "DS-TT Ethernet port MAC address", "reference" : "9.11.4.25", "presence" : "O", "format" : "TLV", "length" : "8"})
ies.append({ "iei" : "6F", "value" : "UE-DS-TT residence time", "type" : "UE-DS-TT residence time", "reference" : "9.11.4.26", "presence" : "O", "format" : "TLV", "length" : "10"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,20 @@
ies = []
ies.append({ "iei" : "", "value" : "Selected PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "M", "format" : "LV-E", "length" : "6-65538"})
ies.append({ "iei" : "", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "M", "format" : "LV", "length" : "7"})
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "29", "value" : "PDU address", "type" : "PDU address", "reference" : "9.11.4.10", "presence" : "O", "format" : "TLV", "length" : "7, 11 or 15"})
ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"})
ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"})
ies.append({ "iei" : "17", "value" : "5GSM network feature support", "type" : "5GSM network feature support", "reference" : "9.11.4.18", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "18", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "C-", "value" : "Control plane only indication", "type" : "Control plane only indication", "reference" : "9.11.4.23", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,9 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "F-", "value" : "Allowed SSC mode", "type" : "Allowed SSC mode", "reference" : "9.11.4.5", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,13 @@
ies = []
ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "13", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "7A", "value" : "Requested QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "79", "value" : "Requested QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,14 @@
ies = []
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "2A", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "O", "format" : "TLV", "length" : "8"})
ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7A", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "1E", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

35
lib/nas/5gs/support/cache/nas-msg-65.py vendored Normal file
View File

@ -0,0 +1,35 @@
ies = []
ies.append({ "iei" : "", "value" : "5GS registration type", "type" : "5GS registration type", "reference" : "9.11.3.7", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5GS mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "6-n"})
ies.append({ "iei" : "C-", "value" : "Non-current native NAS key set identifier", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "10", "value" : "5GMM capability", "type" : "5GMM capability", "reference" : "9.11.3.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "2E", "value" : "UE security capability", "type" : "UE security capability", "reference" : "9.11.3.54", "presence" : "O", "format" : "TLV", "length" : "4-10"})
ies.append({ "iei" : "2F", "value" : "Requested NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "52", "value" : "Last visited registered TAI", "type" : "5GS tracking area identity", "reference" : "9.11.3.8", "presence" : "O", "format" : "TV", "length" : "7"})
ies.append({ "iei" : "17", "value" : "S1 UE network capability", "type" : "S1 UE network capability", "reference" : "9.11.3.48", "presence" : "O", "format" : "TLV", "length" : "4-15"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "2B", "value" : "UE status", "type" : "UE status", "reference" : "9.11.3.56", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "77", "value" : "Additional GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "25", "value" : "Allowed PDU session status", "type" : "Allowed PDU session status", "reference" : "9.11.3.13", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "18", "value" : "UE usage setting", "type" : "UE usage setting", "reference" : "9.11.3.55", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "51", "value" : "Requested DRX parameters", "type" : "5GS DRX parameters", "reference" : "9.11.3.2A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "70", "value" : "EPS NAS message container", "type" : "EPS NAS message container", "reference" : "9.11.3.24", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "74", "value" : "LADN indication", "type" : "LADN indication", "reference" : "9.11.3.29", "presence" : "O", "format" : "TLV-E", "length" : "3-811"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "53", "value" : "5GS update type", "type" : "5GS update type", "reference" : "9.11.3.9A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "41", "value" : "Mobile station classmark 2", "type" : "Mobile station classmark 2", "reference" : "9.11.3.31C", "presence" : "O", "format" : "TLV", "length" : "5"})
ies.append({ "iei" : "42", "value" : "Supported codecs", "type" : "Supported codec list", "reference" : "9.11.3.51A", "presence" : "O", "format" : "TLV", "length" : "5-n"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "60", "value" : "EPS bearer context status", "type" : "EPS bearer context status", "reference" : "9.11.3.23A", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "6E", "value" : "Requested extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.11.3.26A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "35", "value" : "Requested mapped NSSAI", "type" : "Mapped NSSAI", "reference" : "9.11.3.31B", "presence" : "O", "format" : "TLV", "length" : "3-42"})
ies.append({ "iei" : "48", "value" : "Additional information requested", "type" : "Additional information requested", "reference" : "9.11.3.12A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1A", "value" : "Requested WUS assistance information", "type" : "WUS assistance information", "reference" : "9.11.3.71", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "A1", "value" : "N5GC indication", "type" : "N5GC indication", "reference" : "9.11.3.72", "presence" : "O", "format" : "T", "length" : "1"})
msg_list[key]["ies"] = ies

40
lib/nas/5gs/support/cache/nas-msg-66.py vendored Normal file
View File

@ -0,0 +1,40 @@
ies = []
ies.append({ "iei" : "", "value" : "5GS registration result", "type" : "5GS registration result", "reference" : "9.11.3.6", "presence" : "M", "format" : "LV", "length" : "2"})
ies.append({ "iei" : "77", "value" : "5G-GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "4A", "value" : "Equivalent PLMNs", "type" : "PLMN list", "reference" : "9.11.3.45", "presence" : "O", "format" : "TLV", "length" : "5-47"})
ies.append({ "iei" : "54", "value" : "TAI list", "type" : "5GS tracking area identity list", "reference" : "9.11.3.9", "presence" : "O", "format" : "TLV", "length" : "9-114"})
ies.append({ "iei" : "15", "value" : "Allowed NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "11", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
ies.append({ "iei" : "31", "value" : "Configured NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-146"})
ies.append({ "iei" : "21", "value" : "5GS network feature support", "type" : "5GS network feature support", "reference" : "9.11.3.5", "presence" : "O", "format" : "TLV", "length" : "3-5"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "26", "value" : "PDU session reactivation result", "type" : "PDU session reactivation result", "reference" : "9.11.3.42", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "72", "value" : "PDU session reactivation result error cause", "type" : "PDU session reactivation result error cause", "reference" : "9.11.3.43", "presence" : "O", "format" : "TLV-E", "length" : "5-515"})
ies.append({ "iei" : "79", "value" : "LADN information", "type" : "LADN information", "reference" : "9.11.3.30", "presence" : "O", "format" : "TLV-E", "length" : "12-1715"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "27", "value" : "Service area list", "type" : "Service area list", "reference" : "9.11.3.49", "presence" : "O", "format" : "TLV", "length" : "6-114"})
ies.append({ "iei" : "5E", "value" : "T3512 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5D", "value" : "Non-3GPP de-registration timer value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "16", "value" : "T3502 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "34", "value" : "Emergency number list", "type" : "Emergency number list", "reference" : "9.11.3.23", "presence" : "O", "format" : "TLV", "length" : "5-50"})
ies.append({ "iei" : "7A", "value" : "Extended emergency number list", "type" : "Extended emergency number list", "reference" : "9.11.3.26", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "73", "value" : "SOR transparent container", "type" : "SOR transparent container", "reference" : "9.11.3.51", "presence" : "O", "format" : "TLV-E", "length" : "20-n"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "A-", "value" : "NSSAI inclusion mode", "type" : "NSSAI inclusion mode", "reference" : "9.11.3.37A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "76", "value" : "Operator-defined access category definitions", "type" : "Operator-defined access category definitions", "reference" : "9.11.3.38", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "51", "value" : "Negotiated DRX parameters", "type" : "5GS DRX parameters", "reference" : "9.11.3.2A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "D-", "value" : "Non-3GPP NW policies", "type" : "Non-3GPP NW provided policies", "reference" : "9.11.3.36A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "60", "value" : "EPS bearer context status", "type" : "EPS bearer context status", "reference" : "9.11.3.23A", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "6E", "value" : "Negotiated extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.11.3.26A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6C", "value" : "T3447 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "68", "value" : "UE radio capability ID deletion indication", "type" : "UE radio capability ID deletion indication", "reference" : "9.11.3.69", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "39", "value" : "Pending NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "74", "value" : "Ciphering key data", "type" : "Ciphering key data", "reference" : "9.11.3.18C", "presence" : "O", "format" : "TLV-E", "length" : "x-n"})
ies.append({ "iei" : "75", "value" : "CAG information list", "type" : "CAG information list", "reference" : "9.11.3.18A", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "1B", "value" : "Truncated 5G-S-TMSI configuration", "type" : "Truncated 5G-S-TMSI configuration", "reference" : "9.11.3.70", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1C", "value" : "Negotiated WUS assistance information", "type" : "WUS assistance information", "reference" : "9.11.3.71", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "73", "value" : "SOR transparent container", "type" : "SOR transparent container", "reference" : "9.11.3.51", "presence" : "O", "format" : "TLV-E", "length" : "20"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "16", "value" : "T3502 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "69", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "De-registration type", "type" : "De-registration type", "reference" : "9.11.3.20", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5GS mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "6-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,6 @@
ies = []
ies.append({ "iei" : "", "value" : "De-registration type", "type" : "De-registration type", "reference" : "9.11.3.20", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "58", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6D", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,8 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5G-S-TMSI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "9"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "25", "value" : "Allowed PDU session status", "type" : "Allowed PDU session status", "reference" : "9.11.3.13", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "26", "value" : "PDU session reactivation result", "type" : "PDU session reactivation result", "reference" : "9.11.3.42", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "72", "value" : "PDU session reactivation result error cause", "type" : "PDU session reactivation result error cause", "reference" : "9.11.3.43", "presence" : "O", "format" : "TLV-E", "length" : "5-515"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

25
lib/nas/5gs/support/cache/nas-msg-84.py vendored Normal file
View File

@ -0,0 +1,25 @@
ies = []
ies.append({ "iei" : "D-", "value" : "Configuration update indication", "type" : "Configuration update indication", "reference" : "9.11.3.18", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "77", "value" : "5G-GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "54", "value" : "TAI list", "type" : "5GS tracking area identity list", "reference" : "9.11.3.9", "presence" : "O", "format" : "TLV", "length" : "9-114"})
ies.append({ "iei" : "15", "value" : "Allowed NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "27", "value" : "Service area list", "type" : "Service area list", "reference" : "9.11.3.49", "presence" : "O", "format" : "TLV", "length" : "6-114"})
ies.append({ "iei" : "43", "value" : "Full name for network", "type" : "Network name", "reference" : "9.11.3.35", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "45", "value" : "Short name for network", "type" : "Network name", "reference" : "9.11.3.35", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "46", "value" : "Local time zone", "type" : "Time zone", "reference" : "9.11.3.52", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "47", "value" : "Universal time and local time zone", "type" : "Time zone and time", "reference" : "9.11.3.53", "presence" : "O", "format" : "TV", "length" : "8"})
ies.append({ "iei" : "49", "value" : "Network daylight saving time", "type" : "Daylight saving time", "reference" : "9.11.3.19", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "79", "value" : "LADN information", "type" : "LADN information", "reference" : "9.11.3.30", "presence" : "O", "format" : "TLV-E", "length" : "3-1715"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "31", "value" : "Configured NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-146"})
ies.append({ "iei" : "11", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
ies.append({ "iei" : "76", "value" : "Operator-defined access category definitions", "type" : "Operator-defined access category definitions", "reference" : "9.11.3.38", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "F-", "value" : "SMS indication", "type" : "SMS indication", "reference" : "9.11.3.50A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "6C", "value" : "T3447 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "75", "value" : "CAG information list", "type" : "CAG information list", "reference" : "9.11.3.18A", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "68", "value" : "UE radio capability ID deletion indication", "type" : "UE radio capability ID deletion indication", "reference" : "9.11.3.69", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "44", "value" : "5GS registration result", "type" : "5GS registration result", "reference" : "9.11.3.6", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1B", "value" : "Truncated 5G-S-TMSI configuration", "type" : "Truncated 5G-S-TMSI configuration", "reference" : "9.11.3.70", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

12
lib/nas/5gs/support/cache/nas-msg-85.py vendored Normal file
View File

@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Control plane service type", "type" : "Control plane service type", "reference" : "9.11.3.18D", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "6F", "value" : "CIoT small data container", "type" : "CIoT small data container", "reference" : "9.11.3.18B", "presence" : "O", "format" : "TLV", "length" : "4-257"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "M", "format" : "LV", "length" : "3-n"})
ies.append({ "iei" : "21", "value" : "Authentication parameter RAND", "type" : "Authentication parameter RAND", "reference" : "9.11.3.16", "presence" : "O", "format" : "TV", "length" : "17"})
ies.append({ "iei" : "20", "value" : "Authentication parameter AUTN", "type" : "Authentication parameter AUTN", "reference" : "9.11.3.15", "presence" : "O", "format" : "TLV", "length" : "18"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "2D", "value" : "Authentication response parameter", "type" : "Authentication response parameter", "reference" : "9.11.3.17", "presence" : "O", "format" : "TLV", "length" : "18"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "30", "value" : "Authentication failure parameter", "type" : "Authentication failure parameter", "reference" : "9.11.3.14", "presence" : "O", "format" : "TLV", "length" : "16"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,5 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "38", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "O", "format" : "TLV", "length" : "4-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Identity type", "type" : "5GS identity type", "reference" : "9.11.3.3", "presence" : "M", "format" : "V", "length" : "1/2"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "3-n"})
msg_list[key]["ies"] = ies

11
lib/nas/5gs/support/cache/nas-msg-93.py vendored Normal file
View File

@ -0,0 +1,11 @@
ies = []
ies.append({ "iei" : "", "value" : "Selected NAS security algorithms", "type" : "security algorithms", "reference" : "9.11.3.34", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Replayed UE security capabilities", "type" : "UE security capability", "reference" : "9.11.3.54", "presence" : "M", "format" : "LV", "length" : "3-9"})
ies.append({ "iei" : "E-", "value" : "IMEISV request", "type" : "IMEISV request", "reference" : "9.11.3.28", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "57", "value" : "Selected EPS NAS security algorithms", "type" : "EPS NAS security algorithms", "reference" : "9.11.3.25", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "36", "value" : "Additional 5G security information", "type" : "Additional 5G security information", "reference" : "9.11.3.12", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "38", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "O", "format" : "TLV", "length" : "4-n"})
ies.append({ "iei" : "19", "value" : "Replayed S1 UE security capabilities", "type" : "S1 UE security capability", "reference" : "9.11.3.48A", "presence" : "O", "format" : "TLV", "length" : "4-7"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,5 @@
ies = []
ies.append({ "iei" : "77", "value" : "IMEISV", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "12"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "78", "value" : "non-IMEISV PEI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "7-n"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@ -0,0 +1,965 @@
# The MIT License
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from docx import Document
import re, os, sys, string
import datetime
import getopt
import getpass
version = "0.2.0"
msg_list = {}
type_list = {}
verbosity = 0
filename = ""
outdir = './'
cachedir = './cache/'
currentdir = './'
FAIL = '\033[91m'
INFO = '\033[93m'
ENDC = '\033[0m'
def d_print(string):
if verbosity > 0:
sys.stdout.write(string)
def d_info(string):
sys.stdout.write(INFO + string + ENDC + "\n")
def d_error(string):
sys.stderr.write(FAIL + string + ENDC + "\n")
sys.exit(0)
def write_file(f, string):
f.write(string)
d_print(string)
def output_header_to_file(f):
now = datetime.datetime.now()
f.write("""/*
* The MIT License
*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
""")
f.write("/*******************************************************************************\n")
f.write(" * This file had been created by nas-message.py script v%s\n" % (version))
f.write(" * Please do not modify this file but regenerate it via script.\n")
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
f.write(" ******************************************************************************/\n\n")
def usage():
print "Python generating NAS Message encoder/decoder v%s" % (version)
print "Usage: python nas-message.py [options]"
print "Available options:"
print "-d Enable script debug"
print "-f [file] Input file to parse"
print "-o [dir] Output files to given directory"
print "-c [dir] Cache files to given directory"
print "-h Print this help and return"
def v_upper(v):
return re.sub('_TO_UE', '', re.sub('_FROM_UE', '', re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).upper()))
def v_lower(v):
return re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).lower()
def get_value(v):
return re.sub('5gs_', '', re.sub('5g_', '', re.sub('5gsm', 'gsm', re.sub('5gmm', 'gmm', re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).lower()))))
def get_cells(cells):
iei = cells[0].text.encode('ascii', 'ignore')
value = re.sub("\s*$", "", re.sub("\s*\n*\s*\([^\)]*\)*", "", re.sub("'s", "", cells[1].text))).encode('ascii', 'ignore')
type = re.sub("^NAS ", "", re.sub("'s", "", re.sub('\s*\n\s*[a-zA-Z0-9.]*', '', cells[2].text))).encode('ascii', 'ignore')
reference = re.sub('[a-zA-Z0-9\'\-\s]*\n\s*', '', cells[2].text).encode('ascii', 'ignore')
presence = cells[3].text.encode('ascii', 'ignore')
format = cells[4].text.encode('ascii', 'ignore')
length = cells[5].text.encode('ascii', 'ignore')
return { "iei" : iei, "value" : value, "type" : type, "reference" : reference, "presence" : presence, "format" : format, "length" : length }
def write_cells_to_file(name, cells):
write_file(f, name + ".append({ \"iei\" : \"" + cells["iei"] + \
"\", \"value\" : \"" + cells["value"] + \
"\", \"type\" : \"" + cells["type"] + \
"\", \"reference\" : \"" + cells["reference"] + \
"\", \"presence\" : \"" + cells["presence"] + \
"\", \"format\" : \"" + cells["format"] + \
"\", \"length\" : \"" + cells["length"] + "\"})\n")
try:
opts, args = getopt.getopt(sys.argv[1:], "df:ho:c:", ["debug", "file", "help", "output", "cache"])
except getopt.GetoptError as err:
# print help information and exit:
usage()
sys.exit(2)
for o, a in opts:
if o in ("-d", "--debug"):
verbosity = 1
if o in ("-f", "--file"):
filename = a
if o in ("-o", "--output"):
outdir = a
if outdir.rfind('/') != len(outdir):
outdir += '/'
if o in ("-c", "--cache"):
cache = a
if cachedir.rfind('/') != len(cachedir):
cachedir += '/'
if o in ("-h", "--help"):
usage()
sys.exit(2)
# Message Type List
msg_list["REGISTRATION REQUEST"] = { "type" : "65" }
msg_list["REGISTRATION ACCEPT"] = { "type" : "66" }
msg_list["REGISTRATION COMPLETE"] = { "type" : "67" }
msg_list["REGISTRATION REJECT"] = { "type" : "68" }
msg_list["DEREGISTRATION REQUEST FROM UE"] = { "type" : "69" }
msg_list["DEREGISTRATION ACCEPT FROM UE"] = { "type" : "70" }
msg_list["DEREGISTRATION REQUEST TO UE"] = { "type" : "71" }
msg_list["DEREGISTRATION ACCEPT TO UE"] = { "type" : "72" }
msg_list["SERVICE REQUEST"] = { "type" : "76" }
msg_list["SERVICE REJECT"] = { "type" : "77" }
msg_list["SERVICE ACCEPT"] = { "type" : "78" }
msg_list["CONFIGURATION UPDATE COMMAND"] = { "type" : "84" }
msg_list["CONFIGURATION UPDATE COMPLETE"] = { "type" : "85" }
msg_list["AUTHENTICATION REQUEST"] = { "type" : "86" }
msg_list["AUTHENTICATION RESPONSE"] = { "type" : "87" }
msg_list["AUTHENTICATION REJECT"] = { "type" : "88" }
msg_list["AUTHENTICATION FAILURE"] = { "type" : "89" }
msg_list["AUTHENTICATION RESULT"] = { "type" : "90" }
msg_list["IDENTITY REQUEST"] = { "type" : "91" }
msg_list["IDENTITY RESPONSE"] = { "type" : "92" }
msg_list["SECURITY MODE COMMAND"] = { "type" : "93" }
msg_list["SECURITY MODE COMPLETE"] = { "type" : "94" }
msg_list["SECURITY MODE REJECT"] = { "type" : "95" }
msg_list["5GMM STATUS"] = { "type" : "100" }
msg_list["NOTIFICATION"] = { "type" : "101" }
msg_list["NOTIFICATION RESPONSE"] = { "type" : "102" }
msg_list["UL NAS TRANSPORT"] = { "type" : "103" }
msg_list["DL NAS TRANSPORT"] = { "type" : "104" }
msg_list["PDU SESSION ESTABLISHMENT REQUEST"] = { "type" : "193" }
msg_list["PDU SESSION ESTABLISHMENT ACCEPT"] = { "type" : "194" }
msg_list["PDU SESSION ESTABLISHMENT REJECT"] = { "type" : "195" }
msg_list["PDU SESSION AUTHENTICATION COMMAND"] = { "type" : "197" }
msg_list["PDU SESSION AUTHENTICATION COMPLETE"] = { "type" : "198" }
msg_list["PDU SESSION AUTHENTICATION RESULT"] = { "type" : "199" }
msg_list["PDU SESSION MODIFICATION REQUEST"] = { "type" : "201" }
msg_list["PDU SESSION MODIFICATION REJECT"] = { "type" : "202" }
msg_list["PDU SESSION MODIFICATION COMMAND"] = { "type" : "203" }
msg_list["PDU SESSION MODIFICATION COMPLETE"] = { "type" : "204" }
msg_list["PDU SESSION MODIFICATION COMMAND REJECT"] = { "type" : "205" }
msg_list["PDU SESSION RELEASE REQUEST"] = { "type" : "209" }
msg_list["PDU SESSION RELEASE REJECT"] = { "type" : "210" }
msg_list["PDU SESSION RELEASE COMMAND"] = { "type" : "211" }
msg_list["PDU SESSION RELEASE COMPLETE"] = { "type" : "212" }
msg_list["5GSM STATUS"] = { "type" : "214" }
# Table number for Message List
msg_list["AUTHENTICATION REQUEST"]["table"] = 0
msg_list["AUTHENTICATION RESPONSE"]["table"] = 1
msg_list["AUTHENTICATION RESULT"]["table"] = 2
msg_list["AUTHENTICATION FAILURE"]["table"] = 3
msg_list["AUTHENTICATION REJECT"]["table"] = 4
msg_list["REGISTRATION REQUEST"]["table"] = 5
msg_list["REGISTRATION ACCEPT"]["table"] = 6
msg_list["REGISTRATION COMPLETE"]["table"] = 7
msg_list["REGISTRATION REJECT"]["table"] = 8
msg_list["UL NAS TRANSPORT"]["table"] = 9
msg_list["DL NAS TRANSPORT"]["table"] = 10
msg_list["DEREGISTRATION REQUEST FROM UE"]["table"] = 11
msg_list["DEREGISTRATION ACCEPT FROM UE"]["table"] = 12
msg_list["DEREGISTRATION REQUEST TO UE"]["table"] = 13
msg_list["DEREGISTRATION ACCEPT TO UE"]["table"] = 14
msg_list["SERVICE REQUEST"]["table"] = 15
msg_list["SERVICE ACCEPT"]["table"] = 16
msg_list["SERVICE REJECT"]["table"] = 17
msg_list["CONFIGURATION UPDATE COMMAND"]["table"] = 18
msg_list["CONFIGURATION UPDATE COMPLETE"]["table"] = 29
msg_list["IDENTITY REQUEST"]["table"] = 20
msg_list["IDENTITY RESPONSE"]["table"] = 21
msg_list["NOTIFICATION"]["table"] = 22
msg_list["NOTIFICATION RESPONSE"]["table"] = 23
msg_list["SECURITY MODE COMMAND"]["table"] = 24
msg_list["SECURITY MODE COMPLETE"]["table"] = 25
msg_list["SECURITY MODE REJECT"]["table"] = 26
msg_list["5GMM STATUS"]["table"] = 28
msg_list["PDU SESSION ESTABLISHMENT REQUEST"]["table"] = 29
msg_list["PDU SESSION ESTABLISHMENT ACCEPT"]["table"] = 30
msg_list["PDU SESSION ESTABLISHMENT REJECT"]["table"] = 31
msg_list["PDU SESSION AUTHENTICATION COMMAND"]["table"] = 32
msg_list["PDU SESSION AUTHENTICATION COMPLETE"]["table"] = 33
msg_list["PDU SESSION AUTHENTICATION RESULT"]["table"] = 34
msg_list["PDU SESSION MODIFICATION REQUEST"]["table"] = 35
msg_list["PDU SESSION MODIFICATION REJECT"]["table"] = 36
msg_list["PDU SESSION MODIFICATION COMMAND"]["table"] = 37
msg_list["PDU SESSION MODIFICATION COMPLETE"]["table"] = 38
msg_list["PDU SESSION MODIFICATION COMMAND REJECT"]["table"] = 39
msg_list["PDU SESSION RELEASE REQUEST"]["table"] = 40
msg_list["PDU SESSION RELEASE REJECT"]["table"] = 41
msg_list["PDU SESSION RELEASE COMMAND"]["table"] = 42
msg_list["PDU SESSION RELEASE COMPLETE"]["table"] = 43
msg_list["5GSM STATUS"]["table"] = 44
for key in msg_list.keys():
if "table" not in msg_list[key].keys():
continue;
d_info("[" + key + "]")
cachefile = cachedir + "nas-msg-" + msg_list[key]["type"] + ".py"
if os.path.isfile(cachefile) and os.access(cachefile, os.R_OK):
execfile(cachefile)
print "Read from " + cachefile
else:
document = Document(filename)
f = open(cachefile, 'w')
ies = []
write_file(f, "ies = []\n")
table = document.tables[msg_list[key]["table"]]
start_row = 0
for start_row, row in enumerate(table.rows):
cells = get_cells(row.cells);
if cells["type"].find('Message type') != -1:
break
if cells["type"].find('KSI and sequence number') != -1:
start_row -= 1
break
assert start_row <= 4, "Can't find message type"
half_length = True;
for row in table.rows[start_row+1:]:
cells = get_cells(row.cells)
if cells is None:
continue
if cells["length"] == "1/2":
if half_length is True:
half_length = False;
else:
half_length = True;
continue;
ies.append(cells)
write_cells_to_file("ies", cells)
msg_list[key]["ies"] = ies
write_file(f, "msg_list[key][\"ies\"] = ies\n")
f.close()
tmp = [(k, v["type"]) for k, v in msg_list.items()]
sorted_msg_list = sorted(tmp, key=lambda tup: float(tup[1]))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
for ie in msg_list[k]["ies"]:
key = ie["type"]
if key in type_list.keys() and (type_list[key]["presence"] != ie["presence"] or type_list[key]["format"] != ie["format"] or type_list[key]["length"] != ie["length"]):
d_print("KEY type different : %s\n" % key)
d_print("%s.%s %s %s %s\n" % (v_lower(type_list[key]["message"]), type_list[key]["value"], type_list[key]["presence"], type_list[key]["format"], type_list[key]["length"]))
d_print("%s.%s %s %s %s\n\n" % (v_lower(k), ie["value"], ie["presence"], ie["format"], ie["length"]))
continue
type_list[key] = { "reference" : ie["reference"], "presence" : ie["presence"], "format" : ie["format"], "length" : ie["length"], "message" : k, "value" : ie["value"] }
d_info("[Type List]")
typefile = currentdir + "type-list.py"
if os.path.isfile(typefile) and os.access(typefile, os.R_OK):
execfile(typefile)
print "Read from " + typefile
tmp = [(k, v["reference"]) for k, v in type_list.items()]
sorted_type_list = sorted(tmp, key=lambda tup: tup[1])
f = open(outdir + 'ies.h', 'w')
output_header_to_file(f)
f.write("""#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_IES_H
#define OGS_NAS_5GS_IES_H
#ifdef __cplusplus
extern "C" {
#endif
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
""")
for (k, v) in sorted_type_list:
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf);\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("\n")
for (k, v) in sorted_type_list:
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s);\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("\n")
f.write("""#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_IES_H */
""")
f.close()
f = open(outdir + 'ies.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type)
{
uint16_t size = sizeof(uint8_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &type, size);
return size;
}
""")
for (k, v) in sorted_type_list:
# d_print("%s = %s\n" % (k, type_list[k]))
f.write("/* %s %s\n" % (type_list[k]["reference"], k))
f.write(" * %s %s %s */\n" % (type_list[k]["presence"], type_list[k]["format"], type_list[k]["length"]))
if (type_list[k]["format"] == "TV" or type_list[k]["format"] == "T") and type_list[k]["length"] == "1":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" memcpy(%s, pkbuf->data - 1, 1);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);\n\n");
f.write(" return 0;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, %s, size);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
elif type_list[k]["format"] == "TV" or type_list[k]["format"] == "V":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" uint16_t size = 3;\n\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" uint16_t size = 3;\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n" % v_lower(k))
f.write(" ogs_nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, size);\n" % get_value(k))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
elif (type_list[k]["format"] == "LV-E" or type_list[k]["format"] == "TLV-E") and type_list[k]["value"] != "5GS mobile identity":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = be16toh(source->length);\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" %s->buffer = pkbuf->data - size + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, (void*)%s->buffer, %s->length);\n\n" % (get_value(k), get_value(k)));
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" uint16_t target;\n\n")
f.write(" ogs_assert(%s);\n" % get_value(k))
f.write(" ogs_assert(%s->buffer);\n\n" % get_value(k))
f.write(" size = sizeof(%s->length);\n" % get_value(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" target = htobe16(%s->length);\n" % get_value(k))
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" size = %s->length;\n" % get_value(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, %s->buffer, size);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return %s->length + sizeof(%s->length);\n" % (get_value(k), get_value(k)))
f.write("}\n\n");
else:
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = source->length;\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = %s->length + sizeof(%s->length);\n" % (get_value(k), get_value(k)))
f.write(" ogs_nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, sizeof(ogs_nas_%s_t));\n" % (get_value(k), v_lower(k)))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n");
f.close()
f = open(outdir + 'message.h', 'w')
output_header_to_file(f)
f.write("""#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_MESSAGE_H
#define OGS_NAS_5GS_MESSAGE_H
#ifdef __cplusplus
extern "C" {
#endif
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
* When calculating AES_CMAC, we need to use the headroom of the packet. */
#define OGS_NAS_HEADROOM 16
#define OGS_NAS_SECURITY_HEADER_PLAIN_NAS_MESSAGE 0
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED 1
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED 2
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT 3
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHTERD_WITH_NEW_INTEGRITY_CONTEXT 4
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_PARTICALLY_CIPHTERD 5
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM 0x2e
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM 0x7e
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
#define OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
typedef struct ogs_nas_5gmm_header_s {
uint8_t extended_protocol_discriminator;
uint8_t security_header_type;
uint8_t message_type;
} __attribute__ ((packed)) ogs_nas_5gmm_header_t;
typedef struct ogs_nas_5gsm_header_s {
uint8_t extended_protocol_discriminator;
uint8_t pdu_session_identity;
uint8_t procedure_transaction_identity;
uint8_t message_type;
} __attribute__ ((packed)) ogs_nas_5gsm_header_t;
typedef struct ogs_nas_security_header_s {
uint8_t extended_protocol_discriminator;
uint8_t security_header_type;
uint32_t message_authentication_code;
uint8_t sequence_number;
} __attribute__ ((packed)) ogs_nas_security_header_t;
""")
for (k, v) in sorted_msg_list:
if k.find("TO UE") == -1:
f.write("#define OGS_NAS_" + v_upper(k) + " " + v.split('.')[0] + "\n")
f.write("\n")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
f.write("\n/*******************************************************\n")
f.write(" * %s\n" % k)
f.write(" ******************************************************/")
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
f.write("\n#define OGS_NAS_%s_%s_PRESENT ((uint64_t)1<<%d)" % (v_upper(k), v_upper(ie["value"]), i))
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
f.write("\n#define OGS_NAS_%s_%s_TYPE 0x%s" % (v_upper(k), v_upper(ie["value"]), re.sub('-', '0', ie["iei"])))
f.write("\n\ntypedef struct ogs_nas_%s_s {\n" % v_lower(k))
mandatory_fields = False;
optional_fields = False;
for ie in msg_list[k]["ies"]:
if ie["presence"] == "M" and mandatory_fields is False:
f.write(" /* Mandatory fields */\n")
mandatory_fields = True;
if ie["presence"] == "O" and optional_fields is False:
f.write("\n /* Optional fields */\n")
f.write(" uint64_t presencemask;\n");
optional_fields = True;
f.write(" ogs_nas_" + v_lower(ie["type"]) + "_t " + \
get_value(ie["value"]) + ";\n")
f.write("} ogs_nas_%s_t;\n\n" % v_lower(k))
f.write("\n")
f.write("""typedef struct ogs_nas_5gmm_message_s {
ogs_nas_5gmm_header_t h;
union {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t %s;\n" % (v_lower(k), get_value(k)))
f.write(""" };
} ogs_nas_5gmm_message_t;
typedef struct ogs_nas_5gsm_message_s {
ogs_nas_5gsm_header_t h;
union {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" ogs_nas_%s_t %s;\n" % (v_lower(k), get_value(k)))
f.write(""" };
} ogs_nas_5gsm_message_t;
typedef struct ogs_nas_message_s {
ogs_nas_security_header_t h;
union {
ogs_nas_5gmm_message_t gmm;
ogs_nas_5gsm_message_t gsm;
};
} ogs_nas_message_t;
ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_message_t *message);
ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_message_t *message);
int ogs_nas_5gmm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);
int ogs_nas_5gsm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);
ogs_pkbuf_t *ogs_nas_plain_encode(ogs_nas_message_t *message);
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_MESSAGE_H */
""")
f.close()
f = open(outdir + 'decoder.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_decode_%s(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);\n" % v_lower(k))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_decode_%s(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)\n{\n" % v_lower(k))
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t *%s = &message->gmm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
else:
f.write(" ogs_nas_%s_t *%s = &message->gsm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
f.write(" int decoded = 0;\n")
f.write(" int size = 0;\n\n")
f.write(" ogs_trace(\"[NAS] Decode %s\\n\");\n\n" % v_upper(k))
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n\n")
optional_fields = False;
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
if optional_fields is False:
f.write(""" while (pkbuf->len > 0) {
uint8_t *buffer = pkbuf->data;
uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer);
size = sizeof(uint8_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
decoded += size;
switch(type) {
""")
optional_fields = True;
f.write(" case OGS_NAS_%s_%s_TYPE:\n" % (v_upper(k), v_upper(ie["value"])))
f.write(" size = ogs_nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" %s->presencemask |= OGS_NAS_%s_%s_PRESENT;\n" % (get_value(k), v_upper(k), v_upper(ie["value"])))
f.write(" decoded += size;\n")
f.write(" break;\n")
if [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
f.write(""" default:
ogs_warn("Unknown type(0x%x) or not implemented\\n", type);
break;
}
}
""")
f.write(""" return decoded;
}
""")
f.write("""int ogs_nas_5gmm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)
{
int size = 0;
uint16_t decoded = 0;
ogs_assert(pkbuf);
ogs_assert(pkbuf->data);
ogs_assert(pkbuf->len);
memset(message, 0, sizeof(ogs_nas_message_t));
size = sizeof(ogs_nas_5gmm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(&message->gmm.h, pkbuf->data - size, size);
decoded += size;
switch(message->gmm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) < 192 and k.find("TO UE") == -1:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gmm.h.message_type);
break;
}
ogs_assert(ogs_pkbuf_push(pkbuf, decoded));
return OGS_OK;
}
""")
f.write("""int ogs_nas_5gsm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)
{
int size = 0;
uint16_t decoded = 0;
ogs_assert(pkbuf);
ogs_assert(pkbuf->data);
ogs_assert(pkbuf->len);
memset(message, 0, sizeof(ogs_nas_message_t));
size = sizeof(ogs_nas_5gsm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(&message->gsm.h, pkbuf->data - size, size);
decoded += size;
switch(message->gsm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gsm.h.message_type);
break;
}
ogs_assert(ogs_pkbuf_push(pkbuf, decoded));
return OGS_OK;
}
""")
f.close()
f = open(outdir + 'encoder.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_message_t *message);\n" % v_lower(k))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_message_t *message)\n{\n" % v_lower(k))
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t *%s = &message->gmm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
else:
f.write(" ogs_nas_%s_t *%s = &message->gsm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
f.write(" int encoded = 0;\n")
f.write(" int size = 0;\n\n")
f.write(" ogs_trace(\"[NAS] Encode %s\");\n\n" % v_upper(k))
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n\n")
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
f.write(" if (%s->presencemask & OGS_NAS_%s_%s_PRESENT) {\n" % (get_value(k), v_upper(k), v_upper(ie["value"])))
if ie["length"] == "1" and ie["format"] == "TV":
f.write(" %s->%s.type = (OGS_NAS_%s_%s_TYPE >> 4);\n\n" % (get_value(k), get_value(ie["value"]), v_upper(k), v_upper(ie["value"])))
elif ie["length"] == "1" and ie["format"] == "T":
f.write(" %s->%s.type = OGS_NAS_%s_%s_TYPE;\n\n" % (get_value(k), get_value(ie["value"]), v_upper(k), v_upper(ie["value"])))
else:
f.write(" size = ogs_nas_encode_optional_type(pkbuf, OGS_NAS_%s_%s_TYPE);\n" % (v_upper(k), v_upper(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n\n")
f.write(" size = ogs_nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" }\n\n")
f.write(""" return encoded;
}
""")
f.write("""ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_message_t *message)
{
ogs_pkbuf_t *pkbuf = NULL;
int size = 0;
int encoded = 0;
ogs_assert(message);
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
* When calculating AES_CMAC, we need to use the headroom of the packet. */
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
ogs_assert(pkbuf);
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
size = sizeof(ogs_nas_5gmm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &message->gmm.h, size);
encoded += size;
switch(message->gmm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) < 192 and k.find("FROM UE") == -1:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_encode_%s(pkbuf, message);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gmm.h.message_type);
ogs_pkbuf_free(pkbuf);
return NULL;
}
ogs_assert(ogs_pkbuf_push(pkbuf, encoded));
pkbuf->len = encoded;
return pkbuf;
}
""")
f.write("""ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_message_t *message)
{
ogs_pkbuf_t *pkbuf = NULL;
int size = 0;
int encoded = 0;
ogs_assert(message);
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
* When calculating AES_CMAC, we need to use the headroom of the packet. */
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
ogs_assert(pkbuf);
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
size = sizeof(ogs_nas_5gsm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &message->gsm.h, size);
encoded += size;
switch(message->gsm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_encode_%s(pkbuf, message);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gsm.h.message_type);
ogs_pkbuf_free(pkbuf);
return NULL;
}
ogs_assert(ogs_pkbuf_push(pkbuf, encoded));
pkbuf->len = encoded;
return pkbuf;
}
ogs_pkbuf_t *ogs_nas_plain_encode(ogs_nas_message_t *message)
{
ogs_assert(message);
ogs_assert(message->gmm.h.extended_protocol_discriminator ==
message->gsm.h.extended_protocol_discriminator);
if (message->gmm.h.extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM)
return ogs_nas_5gmm_encode(message);
else if (message->gmm.h.extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM)
return ogs_nas_5gsm_encode(message);
return NULL;
}
""")
f.close()

View File

@ -0,0 +1,53 @@
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
type_list["5GS tracking area identity"]["decode"] = \
" tracking_area_identity->tac = be16toh(tracking_area_identity->tac);\n\n"
type_list["5GS tracking area identity"]["encode"] = \
" target.tac = htobe16(tracking_area_identity->tac);\n\n"
type_list["5GS mobile identity"]["decode"] = \
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
" mobile_identity->guti.m_tmsi = be32toh(mobile_identity->guti.m_tmsi);\n" \
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
" mobile_identity->s_tmsi.m_tmsi = be32toh(mobile_identity->s_tmsi.m_tmsi);\n" \
" }\n\n"
type_list["5GS mobile identity"]["encode"] = \
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
" target.guti.m_tmsi = htobe32(mobile_identity->guti.m_tmsi);\n" \
" target.guti._0xf = 0xf;\n" \
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
" target.s_tmsi.m_tmsi = htobe32(mobile_identity->s_tmsi.m_tmsi);\n" \
" target.s_tmsi._0xf = 0xf;\n" \
" }\n\n"
type_list["Header compression configuration"]["decode"] = \
" header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);\n\n"
type_list["Header compression configuration"]["encode"] = \
" target.max_cid = htobe16(header_compression_configuration->max_cid);\n\n"
type_list["DNN"]["decode"] = \
" {\n" \
" char data_network_name[OGS_MAX_DNN_LEN];\n" \
" dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length);\n" \
" ogs_cpystrn(dnn->value, data_network_name, ogs_min(dnn->length, OGS_MAX_DNN_LEN) + 1);\n" \
" }\n\n"
type_list["DNN"]["encode"] = \
" target.length = ogs_fqdn_build(target.value, dnn->value, dnn->length);\n" \
" size = target.length + sizeof(target.length);\n\n"

959
lib/nas/5gs/types.h Normal file
View File

@ -0,0 +1,959 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_TYPES_H
#define OGS_NAS_5GS_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/* 9.11.2.1A DNN
* O TLV 3-102 */
typedef struct ogs_nas_dnn_s {
uint8_t length;
char value[OGS_MAX_DNN_LEN];
} ogs_nas_dnn_t;
/* 9.11.2.2 EAP message
* O TLV-E 7-1503 */
typedef struct ogs_nas_eap_message_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_eap_message_t;
/* 9.11.2.8.1 S-NSSAI
* O TLV 3-10 */
#define OGS_NAS_S_NSSAI_SST_LEN 1
#define OGS_NAS_S_NSSAI_SST_AND_MAPPED_HPLMN_SST_LEN 2
#define OGS_NAS_S_NSSAI_SST_AND_SD 4
#define OGS_NAS_S_NSSAI_SST_SD_AND_MAPPED_HPLMN_SST_LEN 5
#define OGS_NAS_MAX_S_NSSAI_LEN 8
typedef struct ogs_nas_s_nssai_s {
uint8_t length;
uint32_t sst_sd;
uint32_t mapped_sst_sd;
} __attribute__ ((packed)) ogs_nas_s_nssai_t;
/* 9.11.3.1 5GMM capability
* O TLV 3-15 */
typedef struct ogs_nas_5gmm_capability_s {
uint8_t length;
ED4(uint8_t spare:5;,
uint8_t lpp:1;,
uint8_t ho:1;,
uint8_t s1:1;)
} __attribute__ ((packed)) ogs_nas_5gmm_capability_t;
/* 9.11.3.2 5GMM cause
* M V 1 */
#define OGS_NAS_GMM_ILLEGAL_UE 3
#define OGS_NAS_GMM_PEI_NOT_ACCEPTED 5
#define OGS_NAS_GMM_ILLEGAL_ME 6
#define OGS_NAS_GMM_5GS_SERVICES_NOT_ALLOWED 7
#define OGS_NAS_GMM_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9
#define OGS_NAS_GMM_IMPLICITLY_DE_REGISTERED 10
#define OGS_NAS_GMM_PLMN_NOT_ALLOWED 11
#define OGS_NAS_GMM_TRACKING_AREA_NOT_ALLOWED 12
#define OGS_NAS_GMM_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13
#define OGS_NAS_GMM_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15
#define OGS_NAS_GMM_MAC_FAILURE 20
#define OGS_NAS_GMM_SYNCH_FAILURE 21
#define OGS_NAS_GMM_CONGESTION 22
#define OGS_NAS_GMM_UE_SECURITY_CAPABILITIES_MISMATCH 23
#define OGS_NAS_GMM_SECURITY_MODE_REJECTED_UNSPECIFIED 24
#define OGS_NAS_GMM_NON_5G_AUTHENTICATION_UNACCEPTABLE 26
#define OGS_NAS_GMM_N1_MODE_NOT_ALLOWED 27
#define OGS_NAS_GMM_RESTRICTED_SERVICE_AREA 28
#define OGS_NAS_GMM_LADN_NOT_AVAILABLE 43
#define OGS_NAS_GMM_MAXIMUM_NUMBER_OF_PDU_SESSIONS_REACHED 65
#define OGS_NAS_GMM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
#define OGS_NAS_GMM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
#define OGS_NAS_GMM_NGKSI_ALREADY_IN_USE 71
#define OGS_NAS_GMM_NON_3GPP_ACCESS_TO_5GCN_NOT_ALLOWED 72
#define OGS_NAS_GMM_SERVING_NETWORK_NOT_AUTHORIZED 73
#define OGS_NAS_GMM_PAYLOAD_WAS_NOT_FORWARDED 90
#define OGS_NAS_GMM_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE 91
#define OGS_NAS_GMM_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION 92
#define OGS_NAS_GMM_SEMANTICALLY_INCORRECT_MESSAGE 95
#define OGS_NAS_GMM_INVALID_MANDATORY_INFORMATION 96
#define OGS_NAS_GMM_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
#define OGS_NAS_GMM_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
#define OGS_NAS_GMM_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99
#define OGS_NAS_GMM_CONDITIONAL_IE_ERROR 100
#define OGS_NAS_GMM_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
#define OGS_NAS_GMM_PROTOCOL_ERROR_UNSPECIFIED 111
typedef uint8_t ogs_nas_5gmm_cause_t;
/* 9.11.3.2A 5GS DRX parameters
* O TLV 3 */
#define OGS_NAS_DRX_CYCLE_PARAMETER_T_32 1
#define OGS_NAS_DRX_CYCLE_PARAMETER_T_64 2
#define OGS_NAS_DRX_CYCLE_PARAMETER_T_128 3
#define OGS_NAS_DRX_CYCLE_PARAMETER_T_256 4
typedef struct ogs_nas_5gs_drx_parameters_s {
uint8_t length;
ED2(uint8_t spare:4;,
uint8_t value:4;)
} __attribute__ ((packed)) ogs_nas_5gs_drx_parameters_t;
/* 9.11.3.3 5GS identity type
* M V 1/2 */
#define OGS_NAS_5GS_MOBILE_IDENTITY_IS_NOT_AVAILABLE 0
#define OGS_NAS_5GS_MOBILE_IDENTITY_SUCI 1
#define OGS_NAS_5GS_MOBILE_IDENTITY_GUTI 2
#define OGS_NAS_5GS_MOBILE_IDENTITY_IMEI 3
#define OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI 4
#define OGS_NAS_5GS_MOBILE_IDENTITY_IMEISV 5
typedef struct ogs_nas_5gs_identity_type_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_5gs_identity_type_t;
/* 9.11.3.4 5GS mobile identity
* M LV-E 6-n */
#define OGS_NAS_GET_AMF_SET_ID(_iDentity) \
((_iDentity)->amf_set_id2 + ((_iDentity)->amf_set_id1 << 2))
#define OGS_NAS_SET_AMF_SET_ID(_iDentity, _aMFSetId) \
do { \
ogs_assert((_iDentity)); \
(_iDentity)->amf_set_id1 = (_aMFSetId >> 2) & 0x000f; \
(_iDentity)->amf_set_id2 = _aMFSetId & 0x0003; \
} while(0)
typedef struct ogs_nas_5gs_mobile_identity_guti_s {
ED3(uint8_t _0xf:4;,
uint8_t spare:1;,
uint8_t type:3;)
ogs_nas_plmn_id_t nas_plmn_id;
uint16_t amf_region_id;
uint8_t amf_set_id1;
ED2(uint8_t amf_set_id2:2;,
uint8_t amf_pointer:6;)
uint32_t m_tmsi;
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_guti_t;
typedef struct ogs_nas_5gs_mobile_identity_s_tmsi_s {
ED3(uint8_t _0xf:4;,
uint8_t spare:1;,
uint8_t type:3;)
uint16_t amf_region_id;
uint8_t amf_set_id1;
ED2(uint8_t amf_set_id2:2;,
uint8_t amf_pointer:6;)
uint32_t m_tmsi;
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_s_tmsi_t;
typedef struct ogs_nas_5gs_mobile_identity_s {
uint16_t length;
union {
ogs_nas_mobile_identity_imsi_t imsi;
ogs_nas_5gs_mobile_identity_guti_t guti;
ogs_nas_5gs_mobile_identity_s_tmsi_t s_tmsi;
ogs_nas_mobile_identity_imei_t imei;
ogs_nas_mobile_identity_imeisv_t imeisv;
};
} ogs_nas_5gs_mobile_identity_t;
/* 9.11.3.5 5GS network feature support
* M LV 2 */
typedef struct ogs_nas_5gs_network_feature_support_s {
uint8_t length;
ED6(uint8_t mpsi:1;,
uint8_t iwk_n26:1;,
uint8_t emf:2;,
uint8_t msc:2;,
uint8_t ims_vops_n3gpp:1;,
uint8_t ims_vops_3gpp:1;)
ED3(uint8_t spare:6;,
uint8_t mcsi:1;,
uint8_t emcn :1;)
} ogs_nas_5gs_network_feature_support_t;
/* 9.11.3.6 5GS registration result
* O TLV 3-5 */
#define OGS_NAS_5GS_REGISTRATION_TYPE_3GPP_ACCESS 0
#define OGS_NAS_5GS_REGISTRATION_TYPE_NON_3GPP_ACCESS 1
#define OGS_NAS_5GS_REGISTRATION_TYPE_3GPP_AND_NON_3GPP_ACCESS 2
typedef struct ogs_nas_5gs_registration_result_s {
uint8_t length;
ED3(uint8_t spare:4;,
uint8_t sms_allowed:1;,
uint8_t value:3;)
} ogs_nas_5gs_registration_result_t;
/* 9.11.3.7 5GS registration type
* M V 1/2 */
#define OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL 1
#define OGS_NAS_5GS_REGISTRATION_TYPE_MOBILITY_UPDATING 2
#define OGS_NAS_5GS_REGISTRATION_TYPE_PERIODIC_UPDATING 3
#define OGS_NAS_5GS_REGISTRATION_TYPE_EMERGENCY 4
typedef struct ogs_nas_5gs_registration_type_s {
ED3(uint8_t type:4;,
uint8_t follow_on_request:1;,
uint8_t value:3;)
} ogs_nas_5gs_registration_type_t;
/* 9.11.3.8 5GS tracking area identity
* O TV 6 */
typedef ogs_nas_tracking_area_identity_t ogs_nas_5gs_tracking_area_identity_t;
/* 9.11.3.9 5GS tracking area identity list
* O TLV 9-114 */
typedef ogs_nas_tracking_area_identity_list_t ogs_nas_5gs_tracking_area_identity_list_t;
/* 9.11.3.9A 5GS update type
* O TLV 3 */
typedef struct ogs_nas_5gs_update_type_s {
uint8_t length;
ED6(uint8_t spare:2;,
uint8_t pnb_ciot_eps:1;,
uint8_t pnb_ciot_5gs:1;,
uint8_t ng_ran_rcu:1;,
uint8_t sms_requested:1;,
uint8_t amf_pointer_value:2;)
} __attribute__ ((packed)) ogs_nas_5gs_update_type_t;
/* 9.11.3.10 ABBA
* M LV 3-n */
#define OGS_NAS_ABBA_LEN 255
typedef struct ogs_nas_abba_s {
uint8_t length;
uint8_t abba[OGS_NAS_ABBA_LEN];
} ogs_nas_abba_t;
/* 9.11.3.11 Access Type
* M V 1/2 */
#define OGS_NAS_NOTIFICATION_ACCESS_TYPE_3GPP 1
#define OGS_NAS_NOTIFICATION_ACCESS_TYPE_NON_3GPP 2
typedef struct ogs_nas_access_type_s {
ED2(uint8_t spare:5;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_access_type_t;
/* 9.11.3.12 Additional 5G security information
* O TLV 3 */
typedef struct ogs_nas_additional_5g_security_information_s {
uint8_t length;
ED3(uint8_t spare:6;,
uint8_t rinmr:1;,
uint8_t hdr:1;)
} __attribute__ ((packed)) ogs_nas_additional_5g_security_information_t;
/* 9.11.3.12A Additional information requested
* O TLV 3 */
typedef struct ogs_nas_additional_information_requested_s {
uint8_t length;
ED2(uint8_t spare:7;,
uint8_t cipher_key:1;)
} ogs_nas_additional_information_requested_t;
/* 9.11.3.13 Allowed PDU session status
* O TLV 4-34 */
typedef struct ogs_nas_allowed_pdu_session_status_s {
uint8_t length;
ED8(uint8_t psi7:1;,
uint8_t psi6:1;,
uint8_t psi5:1;,
uint8_t psi4:1;,
uint8_t psi3:1;,
uint8_t psi2:1;,
uint8_t psi1:1;,
uint8_t hdr0:1;)
ED8(uint8_t psi15:1;,
uint8_t psi14:1;,
uint8_t psi13:1;,
uint8_t psi12:1;,
uint8_t psi11:1;,
uint8_t psi10:1;,
uint8_t psi9:1;,
uint8_t psi8:1;)
} __attribute__ ((packed)) ogs_nas_allowed_pdu_session_status_t;
/* 9.11.3.18 Configuration update indication
* O TV 1 */
typedef struct ogs_nas_configuration_update_indication_s {
ED4(uint8_t type:4;,
uint8_t spare:2;,
uint8_t red:1;,
uint8_t ack:1;)
} __attribute__ ((packed)) ogs_nas_configuration_update_indication_t;
/* 9.11.3.18A CAG information list
* O TLV-E 3-n */
typedef struct ogs_nas_cag_information_list_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_cag_information_list_t;
/* 9.11.3.18B CIoT small data container
* O TLV 4-257 */
#define OGS_NAS_MAX_CIOT_SMALL_DATA_CONTAINER_LEN 254
typedef struct ogs_nas_ciot_small_data_container_s {
uint8_t length;
ED3(uint8_t data_type:3;,
uint8_t ddx:2;,
uint8_t pdu_session_identity:1;)
uint8_t buffer[OGS_NAS_MAX_CIOT_SMALL_DATA_CONTAINER_LEN];
} __attribute__ ((packed)) ogs_nas_ciot_small_data_container_t;
/* 9.11.3.18C Ciphering key data
* O TLV-E x-n */
typedef struct ogs_nas_ciphering_key_data_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_ciphering_key_data_t;
/* 9.11.3.18D Control plane service type
* M V 1/2 */
typedef struct ogs_nas_control_plane_service_type_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:1;)
} __attribute__ ((packed)) ogs_nas_control_plane_service_type_t;
/* 9.11.3.20 De-registration type
* M V 1/2 */
typedef struct ogs_nas_de_registration_type_s {
ED4(uint8_t type:4;,
uint8_t switch_off:1;,
uint8_t re_registration_required:1;,
uint8_t value:1;)
} __attribute__ ((packed)) ogs_nas_de_registration_type_t;
/* 9.11.3.24 EPS NAS message container
* O TLV-E 4-n */
typedef struct ogs_nas_eps_nas_message_container_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_eps_nas_message_container_t;
/* 9.11.3.25 EPS NAS security algorithms
* O TV 2 */
#define OGS_NAS_SECURITY_ALGORITHMS_EIA0 0
#define OGS_NAS_SECURITY_ALGORITHMS_128_EIA1 1
#define OGS_NAS_SECURITY_ALGORITHMS_128_EIA2 2
#define OGS_NAS_SECURITY_ALGORITHMS_128_EIA3 3
#define OGS_NAS_SECURITY_ALGORITHMS_EEA0 0
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA1 1
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA2 2
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA3 3
typedef struct ogs_nas_eps_nas_security_algorithms_s {
ED4(uint8_t spare1:1;,
uint8_t type_of_ciphering_algorithm:3;,
uint8_t spare2:1;,
uint8_t type_of_integrity_protection_algorithm:3;)
} __attribute__ ((packed)) ogs_nas_eps_nas_security_algorithms_t;
/* 9.11.3.29 LADN indication
* O TLV-E 3-811 */
typedef struct ogs_nas_ladn_indication_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_ladn_indication_t;
/* 9.11.3.30 LADN information
* O TLV-E 12-1715 */
typedef struct ogs_nas_ladn_information_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_ladn_information_t;
/* 9.11.3.31 MICO indication
* O TV 1 */
typedef struct ogs_nas_mico_indication_s {
ED3(uint8_t type:4;,
uint8_t spare:3;,
uint8_t raai:1;)
} __attribute__ ((packed)) ogs_nas_mico_indication_t;
/* 9.11.3.31A MA PDU session information
* O TV 1 */
typedef struct ogs_nas_ma_pdu_session_information_s {
ED2(uint8_t type:4;,
uint8_t value:4;)
} __attribute__ ((packed)) ogs_nas_ma_pdu_session_information_t;
/* 9.11.3.31B Mapped NSSAI
* O TLV 3-42 */
#define OGS_NAS_MAX_MAPPED_NSSAI_LEN 40
typedef struct ogs_nas_mapped_nssai_s {
uint8_t length;
uint8_t buffer[OGS_NAS_MAX_MAPPED_NSSAI_LEN];
} ogs_nas_mapped_nssai_t;
/* 9.11.3.33 message container
* O TLV-E 4-n */
typedef struct ogs_nas_message_container_s {
uint16_t length;
uint8_t *buffer;
} __attribute__ ((packed)) ogs_nas_message_container_t;
/* 9.11.3.34 security algorithms
* M V 1 */
#define OGS_NAS_SECURITY_ALGORITHMS_IA0 0
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA1 1
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA2 2
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA3 3
#define OGS_NAS_SECURITY_ALGORITHMS_IA4 4
#define OGS_NAS_SECURITY_ALGORITHMS_IA5 5
#define OGS_NAS_SECURITY_ALGORITHMS_IA6 6
#define OGS_NAS_SECURITY_ALGORITHMS_IA7 7
#define OGS_NAS_SECURITY_ALGORITHMS_EA0 0
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA1 1
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA2 2
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA3 3
#define OGS_NAS_SECURITY_ALGORITHMS_EA4 4
#define OGS_NAS_SECURITY_ALGORITHMS_EA5 5
#define OGS_NAS_SECURITY_ALGORITHMS_EA6 6
#define OGS_NAS_SECURITY_ALGORITHMS_EA7 7
typedef struct ogs_nas_security_algorithms_s {
ED4(uint8_t spare1:1;,
uint8_t type_of_ciphering_algorithm:3;,
uint8_t spare2:1;,
uint8_t type_of_integrity_protection_algorithm:3;)
} __attribute__ ((packed)) ogs_nas_security_algorithms_t;
/* 9.11.3.36 Network slicing indication
* O TV 1 */
typedef struct ogs_nas_network_slicing_indication_s {
ED4(uint8_t type:4;,
uint8_t spare:2;,
uint8_t dcni:1;,
uint8_t nssci:1;)
} __attribute__ ((packed)) ogs_nas_network_slicing_indication_t;
/* 9.11.3.37 NSSAI
* O TLV 4-72 */
#define MAX_NAS_NSSAI_LEN 72
typedef struct ogs_nas_nssai_s {
uint8_t length;
uint8_t buffer[MAX_NAS_NSSAI_LEN];
} __attribute__ ((packed)) ogs_nas_nssai_t;
/* 9.11.3.37A NSSAI inclusion mode
* O TV 1 */
#define OGS_NAS_NSSAI_INCLUSION_MODE_A 0
#define OGS_NAS_NSSAI_INCLUSION_MODE_B 1
#define OGS_NAS_NSSAI_INCLUSION_MODE_C 2
#define OGS_NAS_NSSAI_INCLUSION_MODE_D 3
typedef struct ogs_nas_nssai_inclusion_mode_s {
ED3(uint8_t type:4;,
uint8_t spare:2;,
uint8_t value:2;)
} __attribute__ ((packed)) ogs_nas_nssai_inclusion_mode_t;
/* 9.11.3.38 Operator-defined access category definitions
* O TLV-E 3-n */
typedef struct ogs_nas_operator_defined_access_category_definitions_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_operator_defined_access_category_definitions_t;
/* 9.11.3.39 Payload container
* O TLV-E 4-65535 */
typedef struct ogs_nas_payload_container_s {
uint16_t length;
uint8_t *buffer;
} ogs_nas_payload_container_t;
/* 9.11.3.40 Payload container type
* O TV 1 */
typedef struct ogs_nas_payload_container_type_s {
ED2(uint8_t type:4;,
uint8_t value:4;)
} __attribute__ ((packed)) ogs_nas_payload_container_type_t;
/* 9.11.3.41 PDU session identity 2
* C TV 2 */
typedef struct ogs_nas_pdu_session_identity_2_s {
uint8_t type;
uint8_t value;
} __attribute__ ((packed)) ogs_nas_pdu_session_identity_2_t;
/* 9.11.3.42 PDU session reactivation result
* O TLV 4-34 */
typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_pdu_session_reactivation_result_t;
/* 9.11.3.43 PDU session reactivation result error cause
* O TLV-E 5-515 */
typedef struct ogs_nas_pdu_session_reactivation_result_error_cause_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_pdu_session_reactivation_result_error_cause_t;
/* 9.11.3.44 PDU session status
* O TLV 4-34 */
typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_pdu_session_status_t;
/* 9.11.3.46 Rejected NSSAI
* O TLV 4-42 */
#define OGS_MAX_NAS_REJECTED_NSSAI_LEN 40
typedef struct ogs_nas_rejected_nssai_s {
uint8_t length;
uint8_t buffer[OGS_MAX_NAS_REJECTED_NSSAI_LEN];
} ogs_nas_rejected_nssai_t;
/* 9.11.3.47 Request type
* O TV 1 */
#define OGS_NAS_REQUEST_TYPE_INITIAL 1
#define OGS_NAS_REQUEST_TYPE_EXISTING_PDU_SESSION 2
#define OGS_NAS_REQUEST_TYPE_INITIAL_EMERGENCY 3
#define OGS_NAS_REQUEST_TYPE_EXISTING_PDU_SESSION_EMERGENCY 4
#define OGS_NAS_REQUEST_TYPE_MODIFICATION 5
typedef struct ogs_nas_request_type_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_request_type_t;
/* 9.11.3.49 Service area list
* O TLV 6-114 */
#define OGS_NAS_MAX_SERVICE_AREA_LIST_LEN 112
typedef struct ogs_nas_service_area_list_s {
uint8_t length;
uint8_t buffer[112];
} ogs_nas_service_area_list_t;
/* 9.11.3.50 Service type
* M V 1/2 */
#define OGS_NAS_SERVICE_TYPE_SIGNALLING 0
#define OGS_NAS_SERVICE_TYPE_DATA 1
#define OGS_NAS_SERVICE_TYPE_MOBILE_TERMINATED_SERVICES 2
#define OGS_NAS_SERVICE_TYPE_EMERGENCY_SERVICES 3
#define OGS_NAS_SERVICE_TYPE_EMERGENCY_SERVICES_FALLBACK 4
#define OGS_NAS_SERVICE_TYPE_HIGH_PRIORITY_ACCESS 5
#define OGS_NAS_SERVICE_TYPE_ELEVATED_SIGNALLING 6
/* 7(unused) shall be interpreted as "signalling", if received by the network
* 8(unused) shall be interpreted as "signalling", if received by the network
* 9(unused) shall be interpreted as "signalling", if received by the network
* 10(unused) shall be interpreted as "data", if received by the network
* 11(unused) shall be interpreted as "data", if received by the network */
typedef struct ogs_nas_service_type_s {
ED2(uint8_t type:4;,
uint8_t value:4;)
} __attribute__ ((packed)) ogs_nas_service_type_t;
/* 9.11.3.50A SMS indication
* O TV 1 */
typedef struct ogs_nas_sms_indication_s {
ED2(uint8_t type:4;,
uint8_t sai:4;)
} ogs_nas_sms_indication_t;
/* 9.11.3.51 SOR transparent container
* O TLV-E 20-n */
typedef struct ogs_nas_sor_transparent_container_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_sor_transparent_container_t;
/* 9.11.3.54 UE security capability
* O TLV 4-10 */
typedef struct ogs_nas_ue_security_capability_s {
uint8_t length;
union {
struct {
ED8(uint8_t ea0_5g:1;,
uint8_t ea1_5g_128:1;,
uint8_t ea2_5g_128:1;,
uint8_t ea3_5g_128:1;,
uint8_t ea4_5g:1;,
uint8_t ea5_5g:1;,
uint8_t ea6_5g:1;,
uint8_t ea7_5g:1;)
};
uint8_t ea_5g;
};
union {
struct {
ED8(uint8_t ia0_5g:1;,
uint8_t ia1_5g_128:1;,
uint8_t ia2_5g_128:1;,
uint8_t ia3_5g_128:1;,
uint8_t ia4_5g:1;,
uint8_t ia5_5g:1;,
uint8_t ia6_5g:1;,
uint8_t ia7_5g:1;)
};
uint8_t ia_5g;
};
union {
struct {
ED8(uint8_t eea0:1;,
uint8_t eea1_128:1;,
uint8_t eea2_128:1;,
uint8_t eea3_128:1;,
uint8_t eea4:1;,
uint8_t eea5:1;,
uint8_t eea6:1;,
uint8_t eea7:1;)
};
uint8_t ea;
};
union {
struct {
ED8(uint8_t eia0:1;,
uint8_t eia1_128:1;,
uint8_t eia2_128:1;,
uint8_t eia3_128:1;,
uint8_t eia4:1;,
uint8_t eia5:1;,
uint8_t eia6:1;,
uint8_t eia7:1;)
};
uint8_t ia;
};
} __attribute__ ((packed)) ogs_nas_ue_security_capability_t;
/* 9.11.3.55 UE usage setting
* O TLV 3 */
typedef struct ogs_nas_ue_usage_setting_s {
uint8_t length;
ED2(uint8_t spare:6;,
uint8_t value:2;)
} __attribute__ ((packed)) ogs_nas_ue_usage_setting_t;
/* 9.11.3.56 UE status
* O TLV 3 */
typedef struct ogs_nas_ue_status_s {
uint8_t length;
ED3(uint8_t spare:6;,
uint8_t n1:1;,
uint8_t s1:1;)
} __attribute__ ((packed)) ogs_nas_ue_status_t;
/* 9.11.3.57 Uplink data status
* O TLV 4-34 */
typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_uplink_data_status_t;
/* 9.11.3.68 UE radio capability ID
* O TLV 3-n */
#define OGS_NAS_MAX_UE_RADIO_CAPABILITY_ID_LEN 255
typedef struct ogs_nas_ue_radio_capability_id_s {
uint8_t length;
uint8_t buffer[OGS_NAS_MAX_UE_RADIO_CAPABILITY_ID_LEN];
} ogs_nas_ue_radio_capability_id_t;
/* 9.11.3.69 UE radio capability ID deletion infication
* O TV 1 */
typedef struct ogs_nas_ue_radio_capability_id_deletion_indication_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_ue_radio_capability_id_deletion_indication_t;
/* 9.11.3.70 Truncated 5G-S-TMSI configuration
* O TLV 3 */
typedef struct ogs_nas_truncated_5g_s_tmsi_configuration_s {
uint8_t length;
ED2(uint8_t amf_set_id:4;,
uint8_t amf_pointer_value:4;)
} __attribute__ ((packed)) ogs_nas_truncated_5g_s_tmsi_configuration_t;
/* 9.11.4.1 5GSM capability
* O TLV 3-15 */
typedef struct ogs_nas_5gsm_capability_s {
uint8_t length;
ED3(uint8_t spare:6;,
uint8_t mh6_pdu:1;,
uint8_t rqos:1;)
} __attribute__ ((packed)) ogs_nas_5gsm_capability_t;
/* 9.11.4.2 5GSM cause
* O TV 2 */
#define OGS_NAS_GSM_OPERATOR_DETERMINED_BARRING 8
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES 26
#define OGS_NAS_GSM_MISSING_OR_UNKNOWN_DNN 27
#define OGS_NAS_GSM_UNKNOWN_PDU_SESSION_TYPE 28
#define OGS_NAS_GSM_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED 29
#define OGS_NAS_GSM_REQUEST_REJECTED_UNSPECIFIED 31
#define OGS_NAS_GSM_SERVICE_OPTION_NOT_SUPPORTED 32
#define OGS_NAS_GSM_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33
#define OGS_NAS_GSM_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34
#define OGS_NAS_GSM_PTI_ALREADY_IN_USE 35
#define OGS_NAS_GSM_REGULAR_DEACTIVATION 36
#define OGS_NAS_GSM_NETWORK_FAILURE 38
#define OGS_NAS_GSM_REACTIVATION_REQUESTED 39
#define OGS_NAS_GSM_INVALID_PDU_SESSION_IDENTITY 43
#define OGS_NAS_GSM_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44
#define OGS_NAS_GSM_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45
#define OGS_NAS_GSM_OUT_OF_LADN_SERVICE_AREA 46
#define OGS_NAS_GSM_PTI_MISMATCH 47
#define OGS_NAS_GSM_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED 50
#define OGS_NAS_GSM_PDU_SESSION_TYPE_IPV6_ONLY_ALLOWED 51
#define OGS_NAS_GSM_PDU_SESSION_DOES_NOT_EXIST 54
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
#define OGS_NAS_GSM_NOT_SUPPORTED_SSC_MODE 68
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
#define OGS_NAS_GSM_MISSING_OR_UNKNOWN_DNN_IN_A_SLICE 70
#define OGS_NAS_GSM_INVALID_PTI_VALUE 81
#define OGS_NAS_GSM_MAXIMUM_DATA_RATE_PER_UE_FOR_USER_PLANE_INTEGRITY_PROTECTION_IS_TOO_LOW 82
#define OGS_NAS_GSM_SEMANTIC_ERROR_IN_THE_QOS_OPERATION 83
#define OGS_NAS_GSM_SYNTACTICAL_ERROR_IN_THE_QOS_OPERATION 84
#define OGS_NAS_GSM_INVALID_MAPPED_EPS_BEARER_IDENTITY 85
#define OGS_NAS_GSM_SEMANTICALLY_INCORRECT_MESSAGE 95
#define OGS_NAS_GSM_INVALID_MANDATORY_INFORMATION 96
#define OGS_NAS_GSM_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
#define OGS_NAS_GSM_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
#define OGS_NAS_GSM_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT IMPLEMENTED 99
#define OGS_NAS_GSM_CONDITIONAL_IE_ERROR 100
#define OGS_NAS_GSM_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
#define OGS_NAS_GSM_PROTOCOL_ERROR_UNSPECIFIED 111
typedef uint8_t ogs_nas_5gsm_cause_t;
/* 9.11.4.21 5GSM congestion re-attempt indicator
* O TLV 3 */
typedef struct ogs_nas_5gsm_congestion_re_attempt_indicator_s {
uint8_t length;
ED2(uint8_t spare:7;,
uint8_t abo:1;)
} __attribute__ ((packed)) ogs_nas_5gsm_congestion_re_attempt_indicator_t;
/* 9.11.4.3 Always-on PDU session indication
* O TV 1 */
typedef struct ogs_nas_always_on_pdu_session_indication_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t apsi:3;)
} __attribute__ ((packed)) ogs_nas_always_on_pdu_session_indication_t;
/* 9.11.4.4 Always-on PDU session requested
* O TV 1 */
typedef struct ogs_nas_always_on_pdu_session_requested_s {
ED3(uint8_t type:4;,
uint8_t spare:3;,
uint8_t apsr:1;)
} __attribute__ ((packed)) ogs_nas_always_on_pdu_session_requested_t;
/* 9.11.4.5 Allowed SSC mode
* O TV 1 */
typedef struct ogs_nas_allowed_ssc_mode_s {
ED5(uint8_t type:4;,
uint8_t spare:1;,
uint8_t ssc3:1;,
uint8_t ssc2:1;,
uint8_t ssc1:1;)
} __attribute__ ((packed)) ogs_nas_allowed_ssc_mode_t;
/* 9.11.4.7 Integrity protection maximum data rate
* M V 2 */
typedef struct ogs_nas_integrity_protection_maximum_data_rate_s {
uint8_t ul;
uint8_t dl;
} __attribute__ ((packed)) ogs_nas_integrity_protection_maximum_data_rate_t;
/* 9.11.4.8 Mapped EPS bearer contexts
* O TLV-E 7-65535 */
typedef struct ogs_nas_mapped_eps_bearer_contexts_s {
uint8_t length;
uint8_t *buffer;
} __attribute__ ((packed)) ogs_nas_mapped_eps_bearer_contexts_t;
/* 9.11.4.9 Maximum number of supported packet filters
* O TV 3 */
typedef struct ogs_nas_maximum_number_of_supported_packet_filters_s {
uint8_t max1;
ED2(uint8_t max2:3;,
uint8_t spare:5;)
} __attribute__ ((packed)) ogs_nas_maximum_number_of_supported_packet_filters_t;
/* 9.11.4.10 PDU address
* O TLV 7, 11 or 15 */
#define OGS_NAS_PDU_ADDRESS_TYPE_IPV4 1
#define OGS_NAS_PDU_ADDRESS_TYPE_IPV6 2
#define OGS_NAS_PDU_ADDRESS_TYPE_IPV4V6 3
typedef struct ogs_nas_pdu_address_s {
uint8_t length;
ED2(uint8_t reserved:5;,
uint8_t type:3;)
union {
uint32_t addr;
struct {
uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */
};
struct {
uint8_t addr6[OGS_IPV6_LEN>>1]; /* Interface Identifer Only */
uint32_t addr;
} both;
};
} __attribute__ ((packed)) ogs_nas_pdu_address_t;
/* 9.11.4.11 PDU session type
* O TV 1 */
#define OGS_NAS_PDU_SESSION_TYPE_IPV4 1
#define OGS_NAS_PDU_SESSION_TYPE_IPV6 2
#define OGS_NAS_PDU_SESSION_TYPE_IPV4V6 3
#define OGS_NAS_PDU_SESSION_TYPE_UNSTRUCTURED 4
#define OGS_NAS_PDU_SESSION_TYPE_ETHERNET 5
typedef struct ogs_nas_pdu_session_type_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_pdu_session_type_t;
/* 9.11.4.12 QoS flow descriptions
* O TLV-E 6-65535 */
typedef struct ogs_nas_qos_flow_descriptions_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_qos_flow_descriptions_t;
/* 9.11.4.13 QoS rules
* M LV-E 6-65535 */
typedef struct ogs_nas_qos_rules_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_qos_rules_t;
/* 9.11.4.14 Session-AMBR
* M LV 7 */
#define OGS_NAS_BR_UNIT_1K 1
#define OGS_NAS_BR_UNIT_4K 2
#define OGS_NAS_BR_UNIT_16K 3
#define OGS_NAS_BR_UNIT_64K 4
#define OGS_NAS_BR_UNIT_256K 5
#define OGS_NAS_BR_UNIT_1M 6
#define OGS_NAS_BR_UNIT_4M 7
#define OGS_NAS_BR_UNIT_16M 8
#define OGS_NAS_BR_UNIT_64M 9
#define OGS_NAS_BR_UNIT_256M 10
#define OGS_NAS_BR_UNIT_1G 11
#define OGS_NAS_BR_UNIT_4G 12
#define OGS_NAS_BR_UNIT_16G 13
#define OGS_NAS_BR_UNIT_64G 14
#define OGS_NAS_BR_UNIT_256G 15
#define OGS_NAS_BR_UNIT_1T 16
#define OGS_NAS_BR_UNIT_4T 17
#define OGS_NAS_BR_UNIT_16T 18
#define OGS_NAS_BR_UNIT_64T 19
#define OGS_NAS_BR_UNIT_256T 20
#define OGS_NAS_BR_UNIT_1P 21
#define OGS_NAS_BR_UNIT_4P 22
#define OGS_NAS_BR_UNIT_16P 23
#define OGS_NAS_BR_UNIT_64P 24
#define OGS_NAS_BR_UNIT_256P 25
typedef struct ogs_nas_session_ambr_s {
uint8_t length;
struct {
uint8_t unit;
uint16_t br;
} dl;
struct {
uint8_t unit;
uint16_t br;
} ul;
} __attribute__ ((packed)) ogs_nas_session_ambr_t;
/* 9.11.4.15 SM PDU DN request container
* O TLV 3-255 */
#define OGS_NAX_MAX_SM_PDU_DN_REQUESTER_CONTAINER 255
typedef struct ogs_nas_sm_pdu_dn_request_container_s {
uint8_t length;
uint8_t buffer[OGS_NAX_MAX_SM_PDU_DN_REQUESTER_CONTAINER];
} ogs_nas_sm_pdu_dn_request_container_t;
/* 9.11.4.16 SSC mode
* O TV 1 */
#define OGS_NAS_SSC_MODE_1 1
#define OGS_NAS_SSC_MODE_2 2
#define OGS_NAS_SSC_MODE_3 3
/* 4(unused) shall be interpreted as "SSC mode 1", if received by the network */
/* 5(unused) shall be interpreted as "SSC mode 2", if received by the network */
/* 6(unused) shall be interpreted as "SSC mode 3", if received by the network */
typedef struct ogs_nas_ssc_mode_s {
ED3(uint8_t type:4;,
uint8_t spare:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_ssc_mode_t;
/* 9.11.4.18 5GSM network feature support
* O TLV 3-15 */
typedef struct ogs_nas_5gsm_network_feature_support_s {
uint8_t length;
ED2(uint8_t spare:7;,
uint8_t s1:1;)
} __attribute__ ((packed)) ogs_nas_5gsm_network_feature_support_t;
/* 9.11.4.22 ATSSS container
* O TLV-E 3-65535 */
typedef struct ogs_nas_atsss_container_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_atsss_container_t;
/* 9.9.4.25 Release assistance indication
* O TV 1
*
* Release assistance indication value
*
* Downlink data expected (DDX)
*
* Bits
* 0 0 No information regarding DDX is conveyed by the information element.
* If received it shall be interpreted as 'neither value "01" nor "10"
* applies
* 0 1 No further uplink or downlink data transmission subsequent to the
* uplink data transmission is expected
* 1 0 Only a single downlink data transmission and no further uplink data
* transmission subsequent to the uplink data transmission is expected
* 1 1 reserved */
typedef struct ogs_nas_release_assistance_indication_s {
ED3(uint8_t type:4;,
uint8_t spare:2;,
uint8_t value:2;)
} __attribute__ ((packed)) ogs_nas_release_assistance_indication_t;
/* 9.11.4.25 DS-TT Ethernet port MAC address
* O TLV 8 */
#define OGS_NAX_MAX_EHTERNET_MAC_ADDRESS_LEN 6
typedef struct ogs_nas_ds_tt_ethernet_port_mac_address_s {
uint8_t length;
uint8_t buffer[OGS_NAX_MAX_EHTERNET_MAC_ADDRESS_LEN];
} ogs_nas_ds_tt_ethernet_port_mac_address_t;
/* 9.11.4.26 UE-DS-TT residence time
* O TLV 10 */
#define OGS_NAS_MAX_UE_DS_TT_REDISENCE_TIME_LEN 8
typedef struct ogs_nas_ue_ds_tt_residence_time_s {
uint8_t length;
uint8_t buffer[OGS_NAS_MAX_UE_DS_TT_REDISENCE_TIME_LEN];
} ogs_nas_ue_ds_tt_residence_time_t;
/* 9.11.4.27 Port management information container
* O TLV-E 4-65535 */
typedef struct ogs_nas_port_management_information_container_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_port_management_information_container_t;
/* 9.11.3.72 N5GC indication
* O T 1 */
typedef struct ogs_nas_n5gc_indication_s {
uint8_t type;
} ogs_nas_n5gc_indication_t;
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_TYPES_H */

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ogs-nas.h"
#include "ogs-nas-common.h"
void ogs_nas_imsi_to_bcd(
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd)

View File

@ -21,10 +21,10 @@
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_CONV_H
#define OGS_NAS_CONV_H
#ifndef OGS_NAS_COMMON_CONV_H
#define OGS_NAS_COMMON_CONV_H
#include "ogs-nas.h"
#include "ogs-nas-common.h"
#ifdef __cplusplus
extern "C" {
@ -44,5 +44,5 @@ void ogs_nas_imeisv_to_bcd(
}
#endif
#endif /* OGS_NAS_CONV_H */
#endif /* OGS_NAS_COMMON_CONV_H */

View File

@ -0,0 +1,36 @@
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
libnas_common_sources = files('''
conv.c
types.c
'''.split())
libnas_common_inc = include_directories('.')
libnas_common = library('ogsnas-common',
sources : libnas_common_sources,
version : libogslib_version,
c_args : '-DOGS_NAS_COMPILATION',
include_directories : [libnas_common_inc, libcrypt_inc, libinc],
dependencies : libcore_dep,
install : true)
libnas_common_dep = declare_dependency(
link_with : libnas_common,
include_directories : [libnas_common_inc, libcrypt_inc, libinc],
dependencies : libcore_dep)

View File

@ -17,18 +17,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef OGS_NAS_H
#define OGS_NAS_H
#ifndef OGS_NAS_COMMON_H
#define OGS_NAS_COMMON_H
#include "ogs-core.h"
#include "ogs-crypt.h"
#define OGS_NAS_INSIDE
#include "nas/types.h"
#include "nas/conv.h"
#include "nas/ies.h"
#include "nas/message.h"
#include "nas/common/types.h"
#include "nas/common/conv.h"
#undef OGS_NAS_INSIDE
@ -45,4 +43,4 @@ extern int __ogs_nas_domain;
}
#endif
#endif /* OGS_NAS_H */
#endif /* OGS_NAS_COMMON_H */

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ogs-nas.h"
#include "ogs-nas-common.h"
int __ogs_nas_domain;

763
lib/nas/common/types.h Normal file
View File

@ -0,0 +1,763 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_COMMON_TYPES_H
#define OGS_NAS_COMMON_TYPES_H
#include "ogs-core.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OGS_NAS_CLEAR_DATA(__dATA) \
do { \
ogs_assert((__dATA)); \
if ((__dATA)->buffer) { \
ogs_free((__dATA)->buffer); \
(__dATA)->buffer = NULL; \
(__dATA)->length = 0; \
} \
} while(0)
#define OGS_NAS_STORE_DATA(__dST, __sRC) \
do { \
ogs_assert((__sRC)); \
ogs_assert((__sRC)->buffer); \
ogs_assert((__dST)); \
OGS_NAS_CLEAR_DATA(__dST); \
(__dST)->length = (__sRC)->length; \
(__dST)->buffer = ogs_calloc((__dST)->length, sizeof(uint8_t)); \
memcpy((__dST)->buffer, (__sRC)->buffer, (__dST)->length); \
} while(0)
#define OGS_NAS_KSI_NO_KEY_IS_AVAILABLE 0x7
/**********************************
* NAS PLMN_ID Structure */
typedef struct ogs_nas_plmn_id_s {
ED2(uint8_t mcc2:4;,
uint8_t mcc1:4;)
ED2(uint8_t mnc3:4;,
uint8_t mcc3:4;)
ED2(uint8_t mnc2:4;,
uint8_t mnc1:4;)
} __attribute__ ((packed)) ogs_nas_plmn_id_t;
void *ogs_nas_from_plmn_id(
ogs_nas_plmn_id_t *ogs_nas_plmn_id, ogs_plmn_id_t *plmn_id);
void *ogs_nas_to_plmn_id(
ogs_plmn_id_t *plmn_id, ogs_nas_plmn_id_t *ogs_nas_plmn_id);
typedef struct ogs_nas_guti_s {
ogs_nas_plmn_id_t nas_plmn_id;
uint16_t mme_gid;
uint8_t mme_code;
uint32_t m_tmsi;
} __attribute__ ((packed)) ogs_nas_guti_t;
/* 9.9.2.0 Additional information
* O TLV 3-n */
#define NAX_MAX_ADDITIONAL_INFORMATION_LEN 255
typedef struct ogs_nas_additional_information_s {
uint8_t length;
uint8_t buffer[NAX_MAX_ADDITIONAL_INFORMATION_LEN];
} __attribute__ ((packed)) ogs_nas_additional_information_t;
/* 9.9.2.1 EPS bearer context status
* O TLV 4 */
typedef struct ogs_nas_eps_bearer_context_status_s {
uint8_t length;
ED8(uint8_t ebi7:1;,
uint8_t ebi6:1;,
uint8_t ebi5:1;,
uint8_t ebi4:1;,
uint8_t ebi3:1;,
uint8_t ebi2:1;,
uint8_t ebi1:1;,
uint8_t ebi0:1;)
ED8(uint8_t ebi15:1;,
uint8_t ebi14:1;,
uint8_t ebi13:1;,
uint8_t ebi12:1;,
uint8_t ebi11:1;,
uint8_t ebi10:1;,
uint8_t ebi9:1;,
uint8_t ebi8:1;)
} __attribute__ ((packed)) ogs_nas_eps_bearer_context_status_t;
/* 9.9.2.3 Mobile identity
* See subclause 10.5.1.4 in 3GPP TS 24.008 [13].
* O TLV 7-10 */
#define OGS_NAS_MOBILE_IDENTITY_NONE 0
#define OGS_NAS_MOBILE_IDENTITY_IMSI 1
#define OGS_NAS_MOBILE_IDENTITY_IMEI 2
#define OGS_NAS_MOBILE_IDENTITY_IMEISV 3
#define OGS_NAS_MOBILE_IDENTITY_TMSI 4
#define OGS_NAS_MOBILE_IDENTITY_TMGI 5
#define OGS_NAS_MOBILE_IDENTITY_GUTI 6
#define OGS_NAS_MOBILE_IDENTITY_EVEN 0
#define OGS_NAS_MOBILE_IDENTITY_ODD 1
typedef struct ogs_nas_mobile_identity_imsi_s {
ED3(uint8_t digit1:4;,
uint8_t odd_even:1;,
uint8_t type:3;)
ED2(uint8_t digit3:4;,
uint8_t digit2:4;)
ED2(uint8_t digit5:4;,
uint8_t digit4:4;)
ED2(uint8_t digit7:4;,
uint8_t digit6:4;)
ED2(uint8_t digit9:4;,
uint8_t digit8:4;)
ED2(uint8_t digit11:4;,
uint8_t digit10:4;)
ED2(uint8_t digit13:4;,
uint8_t digit12:4;)
ED2(uint8_t digit15:4;,
uint8_t digit14:4;)
} __attribute__ ((packed)) ogs_nas_mobile_identity_imsi_t;
typedef ogs_nas_mobile_identity_imsi_t ogs_nas_mobile_identity_imei_t;
typedef struct ogs_nas_mobile_identity_tmsi_s {
ED3(uint8_t spare:4;,
uint8_t odd_even:1;,
uint8_t type:3;)
uint32_t tmsi;
} __attribute__ ((packed)) ogs_nas_mobile_identity_tmsi_t;
typedef struct ogs_nas_mobile_identity_tmgi_s {
ED5(uint8_t spare:2;,
uint8_t mbms_session_id:1;,
uint8_t mcc_mnc:1;,
uint8_t odd_even:1;,
uint8_t type:3;)
uint8_t mbms_servicec_id[3];
ogs_nas_plmn_id_t nas_plmn_id;
uint8_t mbms_session_identity;
} __attribute__ ((packed)) ogs_nas_mobile_identity_tmgi_t;
typedef struct ogs_nas_mobile_identity_imeisv_s {
ED3(uint8_t digit1:4;,
uint8_t odd_even:1;,
uint8_t type:3;)
ED2(uint8_t digit3:4;,
uint8_t digit2:4;)
ED2(uint8_t digit5:4;,
uint8_t digit4:4;)
ED2(uint8_t digit7:4;,
uint8_t digit6:4;)
ED2(uint8_t digit9:4;,
uint8_t digit8:4;)
ED2(uint8_t digit11:4;,
uint8_t digit10:4;)
ED2(uint8_t digit13:4;,
uint8_t digit12:4;)
ED2(uint8_t digit15:4;,
uint8_t digit14:4;)
ED2(uint8_t digit17:4;,
uint8_t digit16:4;)
} __attribute__ ((packed)) ogs_nas_mobile_identity_imeisv_t;
typedef struct ogs_nas_mobile_identity_s {
uint8_t length;
union {
ogs_nas_mobile_identity_imsi_t imsi;
ogs_nas_mobile_identity_tmsi_t tmsi;
ogs_nas_mobile_identity_tmgi_t tmgi;
ogs_nas_mobile_identity_imeisv_t imeisv;
};
} ogs_nas_mobile_identity_t;
/* 9.9.2.4 Mobile station classmark 2
* See subclause 10.5.1.6 in 3GPP TS 24.008
* O TLV 5 */
#define OGS_NAS_MS_CLASSMARK_2_REVISION_GSM_PHASE1 0
#define OGS_NAS_MS_CLASSMARK_2_REVISION_GSM_PHASE2 1
#define OGS_NAS_MS_CLASSMARK_2_REVISION_R99 2
#define OGS_NAS_MS_CLASSMARK_2_REVISION_RESERVED 2
#define OGS_NAS_MS_CLASSMARK_2_RF_CLASS1 0
#define OGS_NAS_MS_CLASSMARK_2_RF_CLASS2 1
#define OGS_NAS_MS_CLASSMARK_2_RF_CLASS3 2
#define OGS_NAS_MS_CLASSMARK_2_RF_CLASS4 3
#define OGS_NAS_MS_CLASSMARK_2_RF_CLASS5 4
#define OGS_NAS_MS_CLASSMARK_2_RF_IRRELEVANT 7
typedef struct ogs_nas_mobile_station_classmark_2_t {
uint8_t length;
ED5(uint8_t spare1:1;,
uint8_t revision_level:2;,
uint8_t es_ind:1;,
uint8_t a5_1:1;,
uint8_t rf_power_capability:3;)
ED7(uint8_t spare:1;,
uint8_t ps_capa:1;,
uint8_t ss_screen_indicator:2;,
uint8_t sm_capabi:1;,
uint8_t vbs:1;,
uint8_t vgcs:1;,
uint8_t fc:1;)
ED8(uint8_t cm3:1;,
uint8_t spare2:1;,
uint8_t lcsva_cap:1;,
uint8_t ucs2:1;,
uint8_t solsa:1;,
uint8_t cmsp:1;,
uint8_t a5_3:1;,
uint8_t a5_2:1;)
} __attribute__ ((packed)) ogs_nas_mobile_station_classmark_2_t;
/* 9.9.2.8 PLMN list
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
* O TLV 5-47 */
#define OGS_NAS_MAX_PLMN 15
typedef struct ogs_nas_plmn_list_s {
uint8_t length;
ogs_nas_plmn_id_t nas_plmn_id[OGS_NAS_MAX_PLMN];
} __attribute__ ((packed)) ogs_nas_plmn_list_t;
/* 9.9.2.10 Supported codec list
* See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
* O TLV 5-n */
typedef struct ogs_nas_supported_codec_item_s {
uint8_t system_identification;
uint8_t length_of_bitmap;
uint16_t codec_bitmap;
} __attribute__ ((packed)) ogs_nas_supported_codec_item_t;
#define OGS_NAS_MAX_SUPPORTED_CODECS 8
typedef struct ogs_nas_supported_codec_list_s {
uint8_t length;
ogs_nas_supported_codec_item_t item[OGS_NAS_MAX_SUPPORTED_CODECS];
} __attribute__ ((packed)) ogs_nas_supported_codec_list_t;
/* 9.9.3.1 Authentication failure parameter
* See subclause 10.5.3.2.2 in 3GPP TS 24.008 [13].
* O TLV 16 */
typedef struct ogs_nas_authentication_failure_parameter_s {
uint8_t length;
uint8_t auts[OGS_AUTS_LEN];
} __attribute__ ((packed)) ogs_nas_authentication_failure_parameter_t;
/* 9.9.3.2 Authentication parameter AUTN
* See subclause 10.5.3.1.1 in 3GPP TS 24.008 [13].
* M LV 17 */
typedef struct ogs_nas_authentication_parameter_autn_s {
uint8_t length;
uint8_t autn[OGS_AUTN_LEN];
} ogs_nas_authentication_parameter_autn_t;
/* 9.9.3.3 Authentication parameter RAND
* See subclause 10.5.3.1 in 3GPP TS 24.008 [13].
* M V 16 */
typedef struct ogs_nas_authentication_parameter_rand_s {
uint8_t rand[OGS_RAND_LEN];
} ogs_nas_authentication_parameter_rand_t;
/* 9.9.3.4 Authentication response parameter
* M LV 5-17 */
typedef struct ogs_nas_authentication_response_parameter_s {
uint8_t length;
uint8_t res[OGS_MAX_RES_LEN];
} ogs_nas_authentication_response_parameter_t;
/* 9.9.3.6 Daylight saving time
* See subclause 10.5.3.12 in 3GPP TS 24.008 [13].
* O TLV 3 */
#define OGS_NAS_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 0
#define OGS_NAS_PLUS_1_HOUR_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 1
#define OGS_NAS_PLUS_2_HOURS_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 2
typedef struct ogs_nas_daylight_saving_time_s {
uint8_t length;
ED2(uint8_t spare:6;,
uint8_t value:2;)
} __attribute__ ((packed)) ogs_nas_daylight_saving_time_t;
/* 9.9.3.16 GPRS timer
* See subclause 10.5.7.3 in 3GPP TS 24.008 [13].
* M V 1 or O TV 2 */
#define OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_2_SS 0
#define OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM 1
#define OGS_NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2
#define OGS_NAS_GRPS_TIMER_UNIT_DEACTIVATED 7
typedef struct ogs_nas_gprs_timer_s {
ED2(uint8_t unit:3;,
uint8_t value:5;)
} __attribute__ ((packed)) ogs_nas_gprs_timer_t;
/* 9.9.3.16A GPRS timer 2
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
* O TLV 3 */
typedef struct ogs_nas_gprs_timer_2_s {
uint8_t length;
uint8_t gprs_timer_2_value;
} __attribute__ ((packed)) ogs_nas_gprs_timer_2_t;
/* 9.9.3.16B GPRS timer 3
* See subclause 10.5.7.4a in 3GPP TS 24.008 [13].
* O TLV 3 */
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_10_MM 0
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_1_HH 1
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_10_HH 2
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_2_SS 3
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_30_SS 4
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_1_MM 5
#define OGS_NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_320_HH 6
#define OGS_NAS_GRPS_TIMER_3_UNIT_DEACTIVATED 7
typedef struct ogs_nas_gprs_timer_3_s {
uint8_t length;
ED2(uint8_t unit:3;,
uint8_t timer_value:5;)
} __attribute__ ((packed)) ogs_nas_gprs_timer_3_t;
/* 9.9.3.18 IMEISV request
* See subclause 10.5.5.10 in 3GPP TS 24.008 [13].
* O TV 1 */
typedef struct ogs_nas_imeisv_request_s {
#define OGS_NAS_IMEISV_TYPE 0xc
ED3(uint8_t type:4;,
uint8_t spare:1;,
#define OGS_NAS_IMEISV_NOT_REQUESTED 0
#define OGS_NAS_IMEISV_REQUESTED 1
uint8_t imeisv_request_value:3;)
} __attribute__ ((packed)) ogs_nas_imeisv_request_t;
/* 9.9.3.21 NAS key set identifier
* M V 1/2
* 9.9.2.9 Spare half octet
* M V 1/2 */
typedef struct ogs_nas_key_set_identifier_s {
ED3(uint8_t type:4;,
uint8_t tsc:1;,
uint8_t value:3;)
} __attribute__ ((packed)) ogs_nas_key_set_identifier_t;
/* 9.9.3.24 Network name
* See subclause 10.5.3.5a in 3GPP TS 24.008 [13].
* O TLV 3-n */
#define OGS_NAS_MAX_NETWORK_NAME_LEN 255
typedef struct ogs_nas_network_name_s {
uint8_t length;
ED4(uint8_t ext:1;,
uint8_t coding_scheme:3;,
uint8_t add_ci:1;,
uint8_t number_of_spare_bits_in_last_octet:3;)
uint8_t name[OGS_NAS_MAX_NETWORK_NAME_LEN];
} __attribute__ ((packed)) ogs_nas_network_name_t;
/* 9.9.3.29 Time zone
* See subclause 10.5.3.8 in 3GPP TS 24.008 [13].
* O TV 2 */
typedef uint8_t ogs_nas_time_zone_t;
/* 9.9.3.30 Time zone and time
* See subclause 10.5.3.9 in 3GPP TS 24.008 [13].
* 9.2.3.11 TPServiceCentreTimeStamp (TPSCTS) in 3GPP TS 23.040 [90]
* O TV 8 */
#define OGS_OGS_NAS_TIME_TO_BCD(x) OGS_TIME_TO_BCD(x)
typedef struct ogs_nas_time_zone_and_time_s {
uint8_t year;
uint8_t mon;
uint8_t mday;
uint8_t hour;
uint8_t min;
uint8_t sec;
/* The Time Zone indicates the difference, expressed in quarters of an hour,
* between the local time and GMT. In the first of the two semi-octets,
* the first bit (bit 3 of the seventh octet of
* the TP-Service-Centre-Time-Stamp field) represents
* the algebraic sign of this difference (0: positive, 1: negative). */
uint8_t timezone;
} ogs_nas_time_zone_and_time_t;
/* 9.9.3.32 Tracking area identity
* O TV 6 */
typedef struct ogs_nas_tracking_area_identity_s {
ogs_nas_plmn_id_t nas_plmn_id;
uint16_t tac;
} __attribute__ ((packed)) ogs_nas_tracking_area_identity_t;
typedef ogs_nas_tracking_area_identity_t ogs_nas_tai_t;
/* 9.9.3.33 Tracking area identity list
* M LV 7-97 */
#define OGS_NAS_MAX_TAI_LIST_LEN 96
#define TAI0_TYPE 0
#define TAI1_TYPE 1
#define TAI2_TYPE 2
typedef struct tai0_list_s {
struct {
ED3(uint8_t spare:1;,
uint8_t type:2;,
uint8_t num:5;)
/*
* Do not change 'ogs_plmn_id_t' to 'ogs_nas_plmn_id_t'.
* Use 'ogs_plmn_id_t' for easy implementation.
* ogs_nas_tai_list_build() changes to NAS format(ogs_nas_plmn_id_t)
* and is sent to the UE.
*/
ogs_plmn_id_t plmn_id;
uint16_t tac[OGS_MAX_NUM_OF_TAI];
} __attribute__ ((packed)) tai[OGS_MAX_NUM_OF_TAI];
} __attribute__ ((packed)) tai0_list_t;
typedef struct tai2_list_s {
ED3(uint8_t spare:1;,
uint8_t type:2;,
uint8_t num:5;)
/*
* Do not change 'ogs_tai_t' to 'ogs_nas_tracking_area_identity_t'.
* Use 'ogs_tai_t' for easy implementation.
* ogs_nas_tai_list_build() changes to NAS
* format(ogs_nas_tracking_area_identity_t)
* and is sent to the UE.
*/
ogs_tai_t tai[OGS_MAX_NUM_OF_TAI];
} __attribute__ ((packed)) tai2_list_t;
typedef struct ogs_nas_tracking_area_identity_list_s {
uint8_t length;
uint8_t buffer[OGS_NAS_MAX_TAI_LIST_LEN];
} __attribute__ ((packed)) ogs_nas_tracking_area_identity_list_t;
void ogs_nas_tai_list_build(
ogs_nas_tracking_area_identity_list_t *target,
tai0_list_t *source0, tai2_list_t *source2);
/* 9.9.3.34 UE network capability
* M LV 3-14 */
typedef struct ogs_nas_s1_ue_network_capability_s {
uint8_t length;
union {
struct {
ED8(uint8_t eea0:1;,
uint8_t eea1:1;,
uint8_t eea2:1;,
uint8_t eea3:1;,
uint8_t eea4:1;,
uint8_t eea5:1;,
uint8_t eea6:1;,
uint8_t eea7:1;)
};
uint8_t eea;
};
union {
struct {
ED8(uint8_t eia0:1;,
uint8_t eia1:1;,
uint8_t eia2:1;,
uint8_t eia3:1;,
uint8_t eia4:1;,
uint8_t eia5:1;,
uint8_t eia6:1;,
uint8_t eia7:1;)
};
uint8_t eia;
};
union {
struct {
ED8(uint8_t uea0:1;,
uint8_t uea1:1;,
uint8_t uea2:1;,
uint8_t uea3:1;,
uint8_t uea4:1;,
uint8_t uea5:1;,
uint8_t uea6:1;,
uint8_t uea7:1;)
};
uint8_t uea;
};
union {
struct {
ED8(uint8_t ucs2:1;,
uint8_t uia1:1;,
uint8_t uia2:1;,
uint8_t uia3:1;,
uint8_t uia4:1;,
uint8_t uia5:1;,
uint8_t uia6:1;,
uint8_t uia7:1;)
};
uint8_t uia;
};
ED8(uint8_t prose_dd:1;,
uint8_t prose:1;,
uint8_t h_245_ash:1;,
uint8_t acc_csfb:1;,
uint8_t lpp:1;,
uint8_t lcs:1;,
uint8_t srvcc:1;,
uint8_t nf:1;)
ED8(uint8_t epco:1;,
uint8_t hc_cp_ciot:1;,
uint8_t erw_opdn:1;,
uint8_t s1u_data:1;,
uint8_t up_ciot:1;,
uint8_t cp_ciot:1;,
uint8_t prose_relay:1;,
uint8_t prose_dc:1;)
ED2(uint8_t spare:7;,
uint8_t multiple_drb:1;)
} __attribute__ ((packed)) ogs_nas_s1_ue_network_capability_t;
/* 9.9.3.36 UE security capability
* M LV 3-6 */
typedef struct ogs_nas_s1_ue_security_capability_s {
uint8_t length;
union {
struct {
ED8(uint8_t eea0:1;,
uint8_t eea1:1;,
uint8_t eea2:1;,
uint8_t eea3:1;,
uint8_t eea4:1;,
uint8_t eea5:1;,
uint8_t eea6:1;,
uint8_t eea7:1;)
};
uint8_t eea;
};
union {
struct {
ED8(uint8_t eia0:1;,
uint8_t eia1:1;,
uint8_t eia2:1;,
uint8_t eia3:1;,
uint8_t eia4:1;,
uint8_t eia5:1;,
uint8_t eia6:1;,
uint8_t eia7:1;)
};
uint8_t eia;
};
union {
struct {
ED8(uint8_t uea0:1;,
uint8_t uea1:1;,
uint8_t uea2:1;,
uint8_t uea3:1;,
uint8_t uea4:1;,
uint8_t uea5:1;,
uint8_t uea6:1;,
uint8_t uea7:1;)
};
uint8_t uea;
};
union {
struct {
ED8(uint8_t spare1:1;,
uint8_t uia1:1;,
uint8_t uia2:1;,
uint8_t uia3:1;,
uint8_t uia4:1;,
uint8_t uia5:1;,
uint8_t uia6:1;,
uint8_t uia7:1;)
};
uint8_t uia;
};
union {
struct {
ED8(uint8_t spare2:1;,
uint8_t gea1:1;,
uint8_t gea2:1;,
uint8_t gea3:1;,
uint8_t gea4:1;,
uint8_t gea5:1;,
uint8_t gea6:1;,
uint8_t gea7:1;)
};
uint8_t gea;
};
} __attribute__ ((packed)) ogs_nas_s1_ue_security_capability_t;
/* 9.9.3.62 WUS assistance information
* O TLV 3-n */
#define OGS_MAX_NAS_WUS_ASSISTANCE_INFORAMTION_LEN 255
typedef struct ogs_nas_wus_assistance_information_s {
uint8_t length;
uint8_t buffer[OGS_MAX_NAS_WUS_ASSISTANCE_INFORAMTION_LEN];
} ogs_nas_wus_assistance_information_t;
/* 9.11.3.36A Non-3GPP NW provided policies
* See subclause 10.5.5.37 in 3GPP TS 24.008 [12].
* O TV 1 */
typedef struct ogs_nas_non_3gpp_nw_provided_policies_s {
ED3(uint8_t type:4;,
uint8_t apre:3;,
uint8_t value:3;)
} ogs_nas_non_3gpp_nw_provided_policies_t;
/* buffer : 9.9.3.37 Emergency number list
* See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
* O TLV 5-50 */
#define OGS_NAS_MAX_EMERGENCY_NUMBER_LIST_LEN 48
typedef struct ogs_nas_emergency_number_list_s {
uint16_t length;
uint8_t buffer[OGS_NAS_MAX_EMERGENCY_NUMBER_LIST_LEN];
} __attribute__ ((packed)) ogs_nas_emergency_number_list_t;
/* 9.9.3.37A Extended emergency number list
* O TLV-E 7-65535 */
typedef struct ogs_nas_extended_emergency_number_list_s {
uint8_t length;
uint8_t *buffer;
} ogs_nas_extended_emergency_number_list_t;
/* 9.9.3.46 Extended DRX parameters
* See subclause 10.5.5.32 in 3GPP TS 24.008 [13].
* O TLV 3 */
typedef struct ogs_nas_extended_drx_parameters_s {
uint8_t length;
ED2(uint8_t paging_time_window:4;,
uint8_t e_drx_value:4;)
} __attribute__ ((packed)) ogs_nas_extended_drx_parameters_t;
/* 9.9.4.2 APN aggregate maximum bit rate
* O TLV 4-8 */
typedef struct ogs_nas_apn_aggregate_maximum_bit_rate_s {
uint8_t length;
uint8_t dl_apn_ambr;
uint8_t ul_apn_ambr;
uint8_t dl_apn_ambr_extended;
uint8_t ul_apn_ambr_extended;
uint8_t dl_apn_ambr_extended2;
uint8_t ul_apn_ambr_extended2;
} __attribute__ ((packed)) ogs_nas_apn_aggregate_maximum_bit_rate_t;
void apn_ambr_build(
ogs_nas_apn_aggregate_maximum_bit_rate_t * apn_aggregate_maximum_bit_rate,
uint32_t dl_ambr, uint32_t ul_ambr);
/* 9.9.4.3 EPS quality of service
* M LV 2-14 */
typedef struct ogs_nas_eps_quality_of_service_s {
uint8_t length;
uint8_t qci;
uint8_t ul_mbr;
uint8_t dl_mbr;
uint8_t ul_gbr;
uint8_t dl_gbr;
uint8_t ul_mbr_extended;
uint8_t dl_mbr_extended;
uint8_t ul_gbr_extended;
uint8_t dl_gbr_extended;
uint8_t ul_mbr_extended2;
uint8_t dl_mbr_extended2;
uint8_t ul_gbr_extended2;
uint8_t dl_gbr_extended2;
} ogs_nas_eps_quality_of_service_t;
void eps_qos_build(ogs_nas_eps_quality_of_service_t *eps_qos,
uint8_t qci,
uint64_t dl_mbr, uint64_t ul_mbr, uint64_t dl_gbr, uint64_t ul_gbr);
/* 9.9.4.13A Re-attempt indicator
* O TLV 3 */
typedef struct ogs_nas_re_attempt_indicator_s {
uint8_t length;
ED3(uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */
uint8_t eplmnc:1;, /* allowed in an equivalent PLMN */
uint8_t ratc:1;)
} __attribute__ ((packed)) ogs_nas_re_attempt_indicator_t;
/* 9.9.4.19 NBIFOM container
* See subclause 10.5.6.21 in 3GPP TS 24.008 [4].
* O TLV 3-257 */
#define MAX_OGS_NAS_NBIFOM_CONTAINER_LEN 255
typedef struct ogs_nas_nbifom_container_s {
uint8_t length;
uint8_t buffer[MAX_OGS_NAS_NBIFOM_CONTAINER_LEN];
} __attribute__ ((packed)) ogs_nas_nbifom_container_t;
/* 9.9.4.22 Header compression configuration
* O TLV 5-257 */
#define MAX_OGS_NAS_HEADER_COMPRESSION_CONTAINER_LEN 251
typedef struct ogs_nas_header_compression_configuration_s {
uint8_t length;
ED8(uint8_t spare:1;,
uint8_t profile0x0104:1;,
uint8_t profile0x0103:1;,
uint8_t profile0x0102:1;,
uint8_t profile0x0006:1;,
uint8_t profile0x0004:1;,
uint8_t profile0x0003:1;,
uint8_t profile0x0002:1;)
uint16_t max_cid;
#define OGS_NAS_HEADER_COMPRESSION_NO_COMPRESSION 0
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0002_UDP_IP 1
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0003_ESP_IP 2
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0004 3
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0006 4
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0102_UDP_IP 5
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0103_ESP_IP 6
#define OGS_NAS_HEADER_COMPRESSION_PROFILE_0x0104_IP 7
uint8_t type;
uint8_t container[MAX_OGS_NAS_NBIFOM_CONTAINER_LEN];
} __attribute__ ((packed)) ogs_nas_header_compression_configuration_t;
/* 9.9.4.23 Control plane only indication
* O TV 1 */
typedef struct ogs_nas_control_plane_only_indication_s {
ED3(uint8_t type:4;,
uint8_t spare:3;,
uint8_t ciot_eps_optimization:1;)
} __attribute__ ((packed)) ogs_nas_control_plane_only_indication_t;
/* 9.9.4.26 Extended protocol configuration options
* See subclause 10.5.6.3A in 3GPP TS 24.008 [12]
* O TLV-E 4-65538 */
typedef struct ogs_nas_extended_protocol_configuration_options_s {
uint16_t length;
uint8_t *buffer;
} __attribute__ ((packed)) ogs_nas_extended_protocol_configuration_options_t;
/* 9.9.4.28 Serving PLMN rate control
* O TLV 4 */
typedef struct ogs_nas_serving_plmn_rate_control_s {
uint8_t length;
ED8(uint8_t ebi7:1;,
uint8_t ebi6:1;,
uint8_t ebi5:1;,
uint8_t ebi4:1;,
uint8_t ebi3:1;,
uint8_t ebi2:1;,
uint8_t ebi1:1;,
uint8_t ebi0:1;)
ED8(uint8_t ebi15:1;,
uint8_t ebi14:1;,
uint8_t ebi13:1;,
uint8_t ebi12:1;,
uint8_t ebi11:1;,
uint8_t ebi10:1;,
uint8_t ebi9:1;,
uint8_t ebi8:1;)
} __attribute__ ((packed)) ogs_nas_serving_plmn_rate_control_t;
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_COMMON_TYPES_H */

File diff suppressed because it is too large Load Diff

2953
lib/nas/eps/decoder.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,11 +28,11 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-04-24 08:50:31.629657 by acetcom
* Created on: 2020-05-21 20:07:15.937289 by acetcom
* from 24301-d80.docx
******************************************************************************/
#include "ogs-nas.h"
#include "ogs-nas-eps.h"
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type)
{
@ -217,8 +217,7 @@ int ogs_nas_decode_mobile_identity(ogs_nas_mobile_identity_t *mobile_identity, o
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(mobile_identity, pkbuf->data - size, size);
if (mobile_identity->tmsi.type == OGS_NAS_MOBILE_IDENTITY_TMSI)
{
if (mobile_identity->tmsi.type == OGS_NAS_MOBILE_IDENTITY_TMSI) {
mobile_identity->tmsi.tmsi = be32toh(mobile_identity->tmsi.tmsi);
}
@ -234,8 +233,7 @@ int ogs_nas_encode_mobile_identity(ogs_pkbuf_t *pkbuf, ogs_nas_mobile_identity_t
ogs_nas_mobile_identity_t target;
memcpy(&target, mobile_identity, sizeof(ogs_nas_mobile_identity_t));
if (mobile_identity->tmsi.type == OGS_NAS_MOBILE_IDENTITY_TMSI)
{
if (mobile_identity->tmsi.type == OGS_NAS_MOBILE_IDENTITY_TMSI) {
target.tmsi.tmsi = htobe32(mobile_identity->tmsi.tmsi);
target.tmsi.spare = 0xf;
}
@ -508,8 +506,7 @@ int ogs_nas_decode_eps_mobile_identity(ogs_nas_eps_mobile_identity_t *eps_mobile
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(eps_mobile_identity, pkbuf->data - size, size);
if (eps_mobile_identity->guti.type == OGS_NAS_EPS_MOBILE_IDENTITY_GUTI)
{
if (eps_mobile_identity->guti.type == OGS_NAS_EPS_MOBILE_IDENTITY_GUTI) {
eps_mobile_identity->guti.mme_gid = be16toh(eps_mobile_identity->guti.mme_gid);
eps_mobile_identity->guti.m_tmsi = be32toh(eps_mobile_identity->guti.m_tmsi);
}
@ -526,8 +523,7 @@ int ogs_nas_encode_eps_mobile_identity(ogs_pkbuf_t *pkbuf, ogs_nas_eps_mobile_id
ogs_nas_eps_mobile_identity_t target;
memcpy(&target, eps_mobile_identity, sizeof(ogs_nas_eps_mobile_identity_t));
if (target.guti.type == OGS_NAS_EPS_MOBILE_IDENTITY_GUTI)
{
if (target.guti.type == OGS_NAS_EPS_MOBILE_IDENTITY_GUTI) {
target.guti.spare = 0xf;
target.guti.mme_gid = htobe16(eps_mobile_identity->guti.mme_gid);
target.guti.m_tmsi = htobe32(eps_mobile_identity->guti.m_tmsi);

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-04-24 08:50:31.627584 by acetcom
* Created on: 2020-05-21 20:07:15.935158 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -36,8 +36,8 @@
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_IES_H
#define OGS_NAS_IES_H
#ifndef OGS_NAS_EPS_IES_H
#define OGS_NAS_EPS_IES_H
#ifdef __cplusplus
extern "C" {
@ -231,5 +231,5 @@ int ogs_nas_encode_pdn_address(ogs_pkbuf_t *pkbuf, ogs_nas_pdn_address_t *pdn_ad
}
#endif
#endif /* OGS_NAS_IES_H */
#endif /* OGS_NAS_EPS_IES_H */

37
lib/nas/eps/meson.build Normal file
View File

@ -0,0 +1,37 @@
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
libnas_eps_sources = files('''
ies.c
decoder.c
encoder.c
'''.split())
libnas_eps_inc = include_directories('.')
libnas_eps = library('ogsnas-eps',
sources : libnas_eps_sources,
version : libogslib_version,
c_args : '-DOGS_NAS_COMPILATION',
include_directories : libnas_eps_inc,
dependencies : libnas_common_dep,
install : true)
libnas_eps_dep = declare_dependency(
link_with : libnas_eps,
include_directories : libnas_eps_inc,
dependencies : libnas_common_dep)

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-04-24 08:50:31.635873 by acetcom
* Created on: 2020-05-21 20:07:15.943424 by acetcom
* from 24301-d80.docx
******************************************************************************/
@ -36,8 +36,8 @@
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_MESSAGE_H
#define OGS_NAS_MESSAGE_H
#ifndef OGS_NAS_EPS_MESSAGE_H
#define OGS_NAS_EPS_MESSAGE_H
#ifdef __cplusplus
extern "C" {
@ -1425,4 +1425,4 @@ ogs_pkbuf_t *ogs_nas_plain_encode(ogs_nas_message_t *message);
}
#endif
#endif /* OGS_NAS_MESSAGE_H */
#endif /* OGS_NAS_EPS_MESSAGE_H */

41
lib/nas/eps/ogs-nas-eps.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef OGS_NAS_EPS_H
#define OGS_NAS_EPS_H
#include "ogs-nas-common.h"
#define OGS_NAS_INSIDE
#include "nas/eps/types.h"
#include "nas/eps/ies.h"
#include "nas/eps/message.h"
#undef OGS_NAS_INSIDE
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_EPS_H */

Some files were not shown because too many files have changed in this diff Show More