nas message parsing

This commit is contained in:
Sukchan Lee 2017-03-20 23:43:52 +09:00
parent 199ee253fb
commit 642250e72c
6 changed files with 249 additions and 115 deletions

View File

@ -4,7 +4,7 @@
#include "core_lib.h"
#include "nas_ies.h"
c_int32_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type)
c_int16_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type)
{
c_uint16_t size = 0;
@ -19,7 +19,7 @@ c_int32_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type)
/* 9.9.2.0A Device properties
* See subclause 10.5.7.8 in 3GPP TS 24.008 [13].
* O TV 1 */
c_int32_t nas_decode_device_properties(
c_int16_t nas_decode_device_properties(
nas_device_properties_t *device_properties, pkbuf_t *pkbuf)
{
memcpy(device_properties, pkbuf->payload - 1, 1);
@ -29,7 +29,7 @@ c_int32_t nas_decode_device_properties(
/* 9.9.2.2 Location area identification
* See subclause 10.5.1.3 in 3GPP TS 24.008 [13]
* O TV 6 */
c_int32_t nas_decode_location_area_identification(
c_int16_t nas_decode_location_area_identification(
nas_location_area_identification_t *location_area_identification,
pkbuf_t *pkbuf)
{
@ -46,7 +46,7 @@ c_int32_t nas_decode_location_area_identification(
return size;
}
c_int32_t nas_encode_location_area_identification(
c_int16_t nas_encode_location_area_identification(
pkbuf_t *pkbuf,
nas_location_area_identification_t *location_area_identification)
{
@ -70,7 +70,7 @@ c_int32_t nas_encode_location_area_identification(
/* 9.9.2.3 Mobile identity
* See subclause 10.5.1.4 in 3GPP TS 24.008 [13].
* O TLV 7-10 */
c_int32_t nas_encode_mobile_identity(
c_int16_t nas_encode_mobile_identity(
pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity)
{
c_uint16_t size = 0;
@ -93,7 +93,7 @@ c_int32_t nas_encode_mobile_identity(
return size;
}
c_int32_t nas_decode_mobile_identity(
c_int16_t nas_decode_mobile_identity(
nas_mobile_identity_t *mobile_identity, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -112,7 +112,7 @@ c_int32_t nas_decode_mobile_identity(
/* 9.9.2.4 Mobile station classmark 2
* See subclause 10.5.1.6 in 3GPP TS 24.008
* O TLV 5 */
c_int32_t nas_decode_mobile_station_classmark_2(
c_int16_t nas_decode_mobile_station_classmark_2(
nas_mobile_station_classmark_2_t *mobile_station_classmark_2,
pkbuf_t *pkbuf)
{
@ -133,7 +133,7 @@ c_int32_t nas_decode_mobile_station_classmark_2(
/*9.9.2.5 Mobile station classmark 3
* See subclause 10.5.1.7 in 3GPP TS 24.008 [13].
* O TLV 2-34 */
c_int32_t nas_decode_mobile_station_classmark_3(
c_int16_t nas_decode_mobile_station_classmark_3(
nas_mobile_station_classmark_3_t *mobile_station_classmark_3,
pkbuf_t *pkbuf)
{
@ -156,7 +156,7 @@ c_int32_t nas_decode_mobile_station_classmark_3(
/* 9.9.2.8 PLMN list
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
* O TLV 5-47 */
status_t nas_encode_plmn_list(
c_int16_t nas_encode_plmn_list(
pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list)
{
c_uint16_t size = 0;
@ -175,7 +175,7 @@ status_t nas_encode_plmn_list(
/* 9.9.2.10 Supported codec list
* See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
* O TLV 5-n */
c_int32_t nas_decode_supported_codec_list(
c_int16_t nas_decode_supported_codec_list(
nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -194,7 +194,7 @@ c_int32_t nas_decode_supported_codec_list(
return size;
}
c_int32_t nas_decode_additional_update_type(
c_int16_t nas_decode_additional_update_type(
nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf)
{
memcpy(additional_update_type, pkbuf->payload - 1, 1);
@ -203,7 +203,7 @@ c_int32_t nas_decode_additional_update_type(
/* 9.9.3.0A Additional update result
* O TV 1 */
c_int32_t nas_encode_additional_update_result(
c_int16_t nas_encode_additional_update_result(
pkbuf_t *pkbuf,
nas_additional_update_result_t *additional_update_result)
{
@ -222,7 +222,7 @@ c_int32_t nas_encode_additional_update_result(
/* 9.9.3.1 Authentication failure parameter
* See subclause 10.5.3.2.2 in 3GPP TS 24.008 [13].
* O TLV 16 */
c_int32_t nas_decode_authentication_failure_parameter(
c_int16_t nas_decode_authentication_failure_parameter(
nas_authentication_failure_parameter_t *authentication_failure_parameter,
pkbuf_t *pkbuf)
{
@ -243,7 +243,7 @@ c_int32_t nas_decode_authentication_failure_parameter(
/* 9.9.3.2 Authentication parameter AUTN
* See subclause 10.5.3.1.1 in 3GPP TS 24.008 [13].
* M LV 17 */
c_int32_t nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf,
c_int16_t nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf,
nas_authentication_parameter_autn_t *authentication_parameter_autn)
{
c_uint16_t size = 0;
@ -263,7 +263,7 @@ c_int32_t nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf,
/* 9.9.3.3 Authentication parameter RAND
* See subclause 10.5.3.1 in 3GPP TS 24.008 [13].
* M V 16 */
c_int32_t nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf,
c_int16_t nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf,
nas_authentication_parameter_rand_t *authentication_parameter_rand)
{
c_uint16_t size = 0;
@ -280,7 +280,7 @@ c_int32_t nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf,
/* 9.9.3.4 Authentication response parameter
* M LV 5-17 */
c_int32_t nas_decode_authentication_response_parameter(
c_int16_t nas_decode_authentication_response_parameter(
nas_authentication_response_parameter_t *authentication_response_parameter,
pkbuf_t *pkbuf)
{
@ -301,7 +301,7 @@ c_int32_t nas_decode_authentication_response_parameter(
/* 9.9.3.8 DRX parameter
* See subclause 10.5.5.6 in 3GPP TS 24.008
* O TV 3 */
c_int32_t nas_decode_drx_parameter(
c_int16_t nas_decode_drx_parameter(
nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -316,7 +316,7 @@ c_int32_t nas_decode_drx_parameter(
/* 9.9.3.9 EMM cause
* O TV 2 */
c_int32_t nas_encode_emm_cause(pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause)
c_int16_t nas_encode_emm_cause(pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause)
{
c_uint16_t size = 0;
@ -330,7 +330,7 @@ c_int32_t nas_encode_emm_cause(pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause)
return size;
}
c_int32_t nas_decode_emm_cause(nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf)
c_int16_t nas_decode_emm_cause(nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -344,7 +344,7 @@ c_int32_t nas_decode_emm_cause(nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf)
/* 9.9.3.10 * EPS attach result
* M V 1/2 */
c_int32_t nas_encode_eps_attach_result(
c_int16_t nas_encode_eps_attach_result(
pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result)
{
c_uint16_t size = 0;
@ -363,7 +363,7 @@ c_int32_t nas_encode_eps_attach_result(
* M V 1/2
* 9.9.3.21 NAS key set identifier
* M V 1/2 */
c_int32_t nas_decode_eps_attach_type(
c_int16_t nas_decode_eps_attach_type(
nas_eps_attach_type_t *eps_attach_type, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -378,7 +378,7 @@ c_int32_t nas_decode_eps_attach_type(
/* 9.9.3.12 EPS mobile identity
* M LV 5-12 */
c_int32_t nas_decode_eps_mobile_identity(
c_int16_t nas_decode_eps_mobile_identity(
nas_eps_mobile_identity_t *eps_mobile_identity, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -407,7 +407,7 @@ c_int32_t nas_decode_eps_mobile_identity(
return size;
}
status_t nas_encode_eps_mobile_identity(
c_int16_t nas_encode_eps_mobile_identity(
pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity)
{
c_uint16_t size = 0;
@ -435,7 +435,7 @@ status_t nas_encode_eps_mobile_identity(
/* 9.9.3.12A EPS network feature support
* O TLV 3 */
c_int32_t nas_encode_eps_network_feature_support(
c_int16_t nas_encode_eps_network_feature_support(
pkbuf_t *pkbuf,
nas_eps_network_feature_support_t *eps_network_feature_support)
{
@ -455,7 +455,7 @@ c_int32_t nas_encode_eps_network_feature_support(
/* 9.9.3.15 ESM message container
* M LV-E 5-n */
c_int32_t nas_decode_esm_message_container(
c_int16_t nas_decode_esm_message_container(
nas_esm_message_container_t *esm_message_container, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -473,7 +473,7 @@ c_int32_t nas_decode_esm_message_container(
return size;
}
c_int32_t nas_encode_esm_message_container(
c_int16_t nas_encode_esm_message_container(
pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container)
{
c_uint16_t size = 0;
@ -503,7 +503,7 @@ c_int32_t nas_encode_esm_message_container(
*
* Note : Other values shall be interpreted as multiples of 1 minute
* in this version of the protocol. */
c_int32_t nas_encode_gprs_timer(pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer)
c_int16_t nas_encode_gprs_timer(pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer)
{
c_uint16_t size = 0;
@ -520,7 +520,7 @@ c_int32_t nas_encode_gprs_timer(pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer)
/* 9.9.3.16A GPRS timer 2
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
* O TLV 3 */
c_int32_t nas_decode_gprs_timer_2(
c_int16_t nas_decode_gprs_timer_2(
nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -535,7 +535,7 @@ c_int32_t nas_decode_gprs_timer_2(
return size;
}
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_2(
c_int16_t nas_encode_gprs_timer_2(
pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2)
{
c_uint16_t size = 0;
@ -554,7 +554,7 @@ CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_2(
/* 9.9.3.16B GPRS timer 3
* See subclause 10.5.7.4a in 3GPP TS 24.008 [13].
* O TLV 3 */
c_int32_t nas_decode_gprs_timer_3(
c_int16_t nas_decode_gprs_timer_3(
nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -569,7 +569,7 @@ c_int32_t nas_decode_gprs_timer_3(
return size;
}
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_3(
c_int16_t nas_encode_gprs_timer_3(
pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3)
{
c_uint16_t size = 0;
@ -588,7 +588,7 @@ CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_3(
/* 9.9.3.18 IMEISV request
* See subclause 10.5.5.10 in 3GPP TS 24.008 [13].
* O TV 1 */
c_int32_t nas_encode_imeisv_request(
c_int16_t nas_encode_imeisv_request(
pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request)
{
memcpy(imeisv_request, pkbuf->payload - 1, 1);
@ -598,7 +598,7 @@ c_int32_t nas_encode_imeisv_request(
/* 9.9.3.20 MS network capability
* See subclause 10.5.5.12 in 3GPP TS 24.008
* O TLV 4-10 */
c_int32_t nas_decode_ms_network_capability(
c_int16_t nas_decode_ms_network_capability(
nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -617,7 +617,7 @@ c_int32_t nas_decode_ms_network_capability(
/* 9.9.3.20A MS network feature support
* See subclause 10.5.1.15 in 3GPP TS 24.008 [13].
* O TV 1 */
c_int32_t nas_decode_ms_network_feature_support(
c_int16_t nas_decode_ms_network_feature_support(
nas_ms_network_feature_support_t *ms_network_feature_support,
pkbuf_t *pkbuf)
{
@ -629,7 +629,7 @@ c_int32_t nas_decode_ms_network_feature_support(
* M V 1/2
* 9.9.2.9 Spare half octet
* M V 1/2 */
c_int32_t nas_encode_nas_key_set_identifier(
c_int16_t nas_encode_nas_key_set_identifier(
pkbuf_t *pkbuf, nas_key_set_identifier_t *nas_key_set_identifier)
{
c_uint16_t size = 0;
@ -646,7 +646,7 @@ c_int32_t nas_encode_nas_key_set_identifier(
/* 9.9.3.23 NAS security algorithms
* M V 1 */
c_int32_t nas_encode_nas_security_algorithms(
c_int16_t nas_encode_nas_security_algorithms(
pkbuf_t *pkbuf, nas_security_algorithms_t *nas_security_algorithms)
{
c_uint16_t size = 0;
@ -664,7 +664,7 @@ c_int32_t nas_encode_nas_security_algorithms(
/* 9.9.3.24A Network resource identifier container
* See subclause 10.5.5.31 in 3GPP TS 24.008 [13].
* O TLV 4 */
c_int32_t nas_decode_network_resource_identifier_container(
c_int16_t nas_decode_network_resource_identifier_container(
nas_network_resource_identifier_container_t *network_resource_identifier_container,
pkbuf_t *pkbuf)
{
@ -684,7 +684,7 @@ c_int32_t nas_decode_network_resource_identifier_container(
/* 9.9.3.25 Nonce
* O TV 5 */
c_int32_t nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce)
c_int16_t nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce)
{
c_uint16_t size = 0;
c_uint32_t target;
@ -704,7 +704,7 @@ c_int32_t nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce)
/* 9.9.3.26 P-TMSI signature
* See subclause 10.5.5.8 in 3GPP TS 24.008
* O TV 4 */
c_int32_t nas_decode_p_tmsi_signature(
c_int16_t nas_decode_p_tmsi_signature(
nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -721,7 +721,7 @@ c_int32_t nas_decode_p_tmsi_signature(
/* 9.9.3.26A Extended EMM cause
* O TV 1 */
c_int32_t nas_encode_extended_emm_cause(
c_int16_t nas_encode_extended_emm_cause(
pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause)
{
c_uint16_t size = 0;
@ -739,7 +739,7 @@ c_int32_t nas_encode_extended_emm_cause(
/* 9.9.3.31 TMSI status
* See subclause 10.5.5.4 in 3GPP TS 24.008 [13]
* O TV 1 */
c_int32_t nas_decode_tmsi_status(
c_int16_t nas_decode_tmsi_status(
nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf)
{
memcpy(tmsi_status, pkbuf->payload - 1, 1);
@ -749,7 +749,7 @@ c_int32_t nas_decode_tmsi_status(
/* 9.9.3.32 Tracking area identity
* O TV 6 */
c_int32_t nas_decode_tracking_area_identity(
c_int16_t nas_decode_tracking_area_identity(
nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -766,7 +766,7 @@ c_int32_t nas_decode_tracking_area_identity(
/* 9.9.3.33 Tracking area identity list
* M LV 7-97 */
c_int32_t nas_encode_tracking_area_identity_list(
c_int16_t nas_encode_tracking_area_identity_list(
pkbuf_t *pkbuf,
nas_tracking_area_identity_list_t *tracking_area_identity_list)
{
@ -817,7 +817,7 @@ c_int32_t nas_encode_tracking_area_identity_list(
/* 9.9.3.34 UE network capability
* M LV 3-14 */
c_int32_t nas_decode_ue_network_capability(
c_int16_t nas_decode_ue_network_capability(
nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -836,7 +836,7 @@ c_int32_t nas_decode_ue_network_capability(
/* 9.9.3.36 UE security capability
* M LV 3-6 */
c_int32_t nas_encode_ue_security_capability(
c_int16_t nas_encode_ue_security_capability(
pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability)
{
c_uint16_t size = 0;
@ -856,7 +856,7 @@ c_int32_t nas_encode_ue_security_capability(
/* TODO : 9.9.3.37 Emergency number list
* See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
* O TLV 5-50 */
c_int32_t nas_encode_emergency_number_list(
c_int16_t nas_encode_emergency_number_list(
pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list)
{
c_uint16_t size = 0;
@ -877,7 +877,7 @@ c_int32_t nas_encode_emergency_number_list(
/* 9.9.3.44 Voice domain preference and UE's usage setting
* See subclause 10.5.5.28 in 3GPP TS 24.008 [13].
* O TLV 3 */
c_int32_t nas_decode_voice_domain_preference_and_ue_usage_setting(
c_int16_t nas_decode_voice_domain_preference_and_ue_usage_setting(
nas_voice_domain_preference_and_ue_usage_setting_t *
voice_domain_preference_and_ue_usage_setting,
pkbuf_t *pkbuf)
@ -899,7 +899,7 @@ c_int32_t nas_decode_voice_domain_preference_and_ue_usage_setting(
/* 9.9.3.45 GUTI type
* O TV 1 */
c_int32_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf)
c_int16_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf)
{
memcpy(guti_type, pkbuf->payload - 1, 1);
return 0;
@ -908,7 +908,7 @@ c_int32_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf)
/* 9.9.3.46 Extended DRX parameters
* See subclause 10.5.5.32 in 3GPP TS 24.008 [13].
* O TLV 3 */
c_int32_t nas_decode_extended_drx_parameters(
c_int16_t nas_decode_extended_drx_parameters(
nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf)
{
c_uint16_t size = 0;
@ -924,7 +924,7 @@ c_int32_t nas_decode_extended_drx_parameters(
return size;
}
c_int32_t nas_encode_extended_drx_parameters(
c_int16_t nas_encode_extended_drx_parameters(
pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters)
{
c_uint16_t size = 0;

View File

@ -18,7 +18,7 @@ ED2(c_uint8_t mnc_digit2:4;,
c_uint8_t mnc_digit1:4;)
} __attribute__ ((packed)) nas_plmn_t;
CORE_DECLARE(c_int32_t) nas_encode_optional_type(
CORE_DECLARE(c_int16_t) nas_encode_optional_type(
pkbuf_t *pkbuf, c_uint8_t type);
/* 9.9.2.0A Device properties
@ -30,7 +30,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t low_priority:1;)
} __attribute__ ((packed)) nas_device_properties_t;
CORE_DECLARE(c_int32_t) nas_decode_device_properties(
CORE_DECLARE(c_int16_t) nas_decode_device_properties(
nas_device_properties_t *device_properties, pkbuf_t *pkbuf);
/* 9.9.2.2 Location area identification
@ -41,11 +41,11 @@ typedef struct _nas_location_area_identification_t {
c_uint16_t lac;
} __attribute__ ((packed)) nas_location_area_identification_t;
CORE_DECLARE(c_int32_t) nas_decode_location_area_identification(
CORE_DECLARE(c_int16_t) nas_decode_location_area_identification(
nas_location_area_identification_t *location_area_identification,
pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_location_area_identification(
CORE_DECLARE(c_int16_t) nas_encode_location_area_identification(
pkbuf_t *pkbuf,
nas_location_area_identification_t *location_area_identification);
@ -106,9 +106,9 @@ typedef struct _nas_mobile_identity_t {
};
} nas_mobile_identity_t;
CORE_DECLARE(c_int32_t) nas_encode_mobile_identity(
CORE_DECLARE(c_int16_t) nas_encode_mobile_identity(
pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity);
CORE_DECLARE(c_int32_t) nas_decode_mobile_identity(
CORE_DECLARE(c_int16_t) nas_decode_mobile_identity(
nas_mobile_identity_t *mobile_identity, pkbuf_t *pkbuf);
/* 9.9.2.4 Mobile station classmark 2
@ -149,7 +149,7 @@ ED8(c_uint8_t cm3:1;,
c_uint8_t a5_2:1;)
} __attribute__ ((packed)) nas_mobile_station_classmark_2_t;
CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_2(
CORE_DECLARE(c_int16_t) nas_decode_mobile_station_classmark_2(
nas_mobile_station_classmark_2_t *mobile_station_classmark_2,
pkbuf_t *pkbuf);
@ -158,10 +158,10 @@ CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_2(
* O TLV 2-34 */
typedef struct _nas_mobile_station_classmark_3_t {
c_uint8_t length;
/* TODO */
c_uint8_t todo[34];
} __attribute__ ((packed)) nas_mobile_station_classmark_3_t;
CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_3(
CORE_DECLARE(c_int16_t) nas_decode_mobile_station_classmark_3(
nas_mobile_station_classmark_3_t *mobile_station_classmark_3,
pkbuf_t *pkbuf);
@ -174,7 +174,7 @@ typedef struct _nas_plmn_list_t {
nas_plmn_t plmn[NAS_MAX_PLMN];
} __attribute__ ((packed)) nas_plmn_list_t;
CORE_DECLARE(status_t) nas_encode_plmn_list(
CORE_DECLARE(c_int16_t) nas_encode_plmn_list(
pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list);
/* 9.9.2.10 Supported codec list
@ -192,7 +192,7 @@ typedef struct _nas_supported_codec_list_t {
nas_supported_codec_item_t item[NAS_MAX_SUPPORTED_CODECS];
} __attribute__ ((packed)) nas_supported_codec_list_t;
CORE_DECLARE(c_int32_t) nas_decode_supported_codec_list(
CORE_DECLARE(c_int16_t) nas_decode_supported_codec_list(
nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf);
/* 9.9.3.0A Additional update result
@ -203,7 +203,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t additional_update_result_value:2;)
} __attribute__ ((packed)) nas_additional_update_result_t;
CORE_DECLARE(c_int32_t) nas_encode_additional_update_result(
CORE_DECLARE(c_int16_t) nas_encode_additional_update_result(
pkbuf_t *pkbuf,
nas_additional_update_result_t *additional_update_result);
@ -220,7 +220,7 @@ ED4(c_uint8_t type:4;,
c_uint8_t autv:1;)
} __attribute__ ((packed)) nas_additional_update_type_t;
CORE_DECLARE(c_int32_t) nas_decode_additional_update_type(
CORE_DECLARE(c_int16_t) nas_decode_additional_update_type(
nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf);
/* 9.9.3.1 Authentication failure parameter
@ -231,7 +231,7 @@ typedef struct _nas_authentication_failure_parameter_t {
c_uint8_t parameter[14];
} __attribute__ ((packed)) nas_authentication_failure_parameter_t;
CORE_DECLARE(c_int32_t) nas_decode_authentication_failure_parameter(
CORE_DECLARE(c_int16_t) nas_decode_authentication_failure_parameter(
nas_authentication_failure_parameter_t *authentication_failure_parameter,
pkbuf_t *pkbuf);
@ -243,7 +243,7 @@ typedef struct _nas_authentication_parameter_autn_t {
c_uint8_t autn[MAX_AUTN_LEN];
} nas_authentication_parameter_autn_t;
CORE_DECLARE(c_int32_t) nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf,
CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_autn(pkbuf_t *pkbuf,
nas_authentication_parameter_autn_t *authentication_parameter_autn);
/* 9.9.3.3 Authentication parameter RAND
@ -253,7 +253,7 @@ typedef struct _nas_authentication_parameter_rand_t {
c_uint8_t rand[MAX_RAND_LEN];
} nas_authentication_parameter_rand_t;
CORE_DECLARE(c_int32_t) nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf,
CORE_DECLARE(c_int16_t) nas_encode_authentication_parameter_rand(pkbuf_t *pkbuf,
nas_authentication_parameter_rand_t *authentication_parameter_rand);
/* 9.9.3.4 Authentication response parameter
@ -263,7 +263,7 @@ typedef struct _nas_authentication_response_parameter_t {
c_uint8_t res[MAX_RES_LEN];
} nas_authentication_response_parameter_t;
CORE_DECLARE(c_int32_t) nas_decode_authentication_response_parameter(
CORE_DECLARE(c_int16_t) nas_decode_authentication_response_parameter(
nas_authentication_response_parameter_t *authentication_response_parameter,
pkbuf_t *pkbuf);
@ -290,7 +290,7 @@ ED3(c_uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode
c_uint8_t non_DRX_timer:3;)
} __attribute__ ((packed)) nas_drx_parameter_t;
CORE_DECLARE(c_int32_t) nas_decode_drx_parameter(
CORE_DECLARE(c_int16_t) nas_decode_drx_parameter(
nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf);
/* 9.9.3.9 EMM cause
@ -333,9 +333,9 @@ CORE_DECLARE(c_int32_t) nas_decode_drx_parameter(
#define NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 0b01101111
typedef c_uint8_t nas_emm_cause_t;
CORE_DECLARE(c_int32_t) nas_encode_emm_cause(
CORE_DECLARE(c_int16_t) nas_encode_emm_cause(
pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause);
CORE_DECLARE(c_int32_t) nas_decode_emm_cause(
CORE_DECLARE(c_int16_t) nas_decode_emm_cause(
nas_emm_cause_t *emm_cause, pkbuf_t *pkbuf);
/* 9.9.3.10 * EPS attach result
@ -347,7 +347,7 @@ ED2(c_uint8_t spare:5;,
c_uint8_t result:3;)
} __attribute__ ((packed)) nas_eps_attach_result_t;
CORE_DECLARE(c_int32_t) nas_encode_eps_attach_result(
CORE_DECLARE(c_int16_t) nas_encode_eps_attach_result(
pkbuf_t *pkbuf, nas_eps_attach_result_t *eps_attach_result);
/* 9.9.3.11 EPS attach type
@ -369,7 +369,7 @@ ED4(c_uint8_t tsc:1;,
c_uint8_t attach_type:3;)
} __attribute__ ((packed)) nas_eps_attach_type_t;
CORE_DECLARE(c_int32_t) nas_decode_eps_attach_type(
CORE_DECLARE(c_int16_t) nas_decode_eps_attach_type(
nas_eps_attach_type_t *eps_attach_type, pkbuf_t *pkbuf);
/* 9.9.3.12 EPS mobile identity
@ -402,9 +402,9 @@ typedef struct _nas_eps_mobile_identity_t {
};
} __attribute__ ((packed)) nas_eps_mobile_identity_t;
CORE_DECLARE(c_int32_t) nas_decode_eps_mobile_identity(
CORE_DECLARE(c_int16_t) nas_decode_eps_mobile_identity(
nas_eps_mobile_identity_t *eps_mobile_identity, pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_eps_mobile_identity(
CORE_DECLARE(c_int16_t) nas_encode_eps_mobile_identity(
pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity);
/* 9.9.3.12A EPS network feature support
@ -425,7 +425,7 @@ ED5(c_uint8_t spare:4;,
c_uint8_t up_ciot :1;)
} __attribute__ ((packed)) nas_eps_network_feature_support_t;
CORE_DECLARE(c_int32_t) nas_encode_eps_network_feature_support(
CORE_DECLARE(c_int16_t) nas_encode_eps_network_feature_support(
pkbuf_t *pkbuf,
nas_eps_network_feature_support_t *eps_network_feature_support);
@ -436,9 +436,9 @@ typedef struct _nas_esm_message_container_t {
c_uint8_t *buffer;
} nas_esm_message_container_t;
CORE_DECLARE(c_int32_t) nas_decode_esm_message_container(
CORE_DECLARE(c_int16_t) nas_decode_esm_message_container(
nas_esm_message_container_t *esm_message_container, pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_esm_message_container(
CORE_DECLARE(c_int16_t) nas_encode_esm_message_container(
pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container);
/* 9.9.3.16 GPRS timer
@ -453,7 +453,7 @@ ED2(c_uint8_t unit:3;,
c_uint8_t timer_value:5;)
} __attribute__ ((packed)) nas_gprs_timer_t;
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer(
CORE_DECLARE(c_int16_t) nas_encode_gprs_timer(
pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer);
/* 9.9.3.16A GPRS timer 2
@ -464,9 +464,9 @@ typedef struct _nas_gprs_timer_2_t {
c_uint8_t gprs_timer_2_value;
} __attribute__ ((packed)) nas_gprs_timer_2_t;
CORE_DECLARE(c_int32_t) nas_decode_gprs_timer_2(
CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_2(
nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_2(
CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_2(
pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2);
/* 9.9.3.16B GPRS timer 3
@ -487,9 +487,9 @@ ED2(c_uint8_t unit:3;,
c_uint8_t timer_value:5;)
} __attribute__ ((packed)) nas_gprs_timer_3_t;
CORE_DECLARE(c_int32_t) nas_decode_gprs_timer_3(
CORE_DECLARE(c_int16_t) nas_decode_gprs_timer_3(
nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_3(
CORE_DECLARE(c_int16_t) nas_encode_gprs_timer_3(
pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3);
/* 9.9.3.18 IMEISV request
@ -501,7 +501,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t imeisv_request_value:3;)
} __attribute__ ((packed)) nas_imeisv_request_t;
CORE_DECLARE(c_int32_t) nas_encode_imeisv_request(
CORE_DECLARE(c_int16_t) nas_encode_imeisv_request(
pkbuf_t *pkbuf, nas_imeisv_request_t *imeisv_request);
/* 9.9.3.20 MS network capability
@ -541,7 +541,7 @@ ED6(c_uint8_t user_plane_integrity_protection_support:1;,
c_uint8_t spare:3;)
} __attribute__ ((packed)) nas_ms_network_capability_t;
CORE_DECLARE(c_int32_t) nas_decode_ms_network_capability(
CORE_DECLARE(c_int16_t) nas_decode_ms_network_capability(
nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf);
/* 9.9.3.20A MS network feature support
@ -553,7 +553,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t extended_periodic_timers:1;)
} __attribute__ ((packed)) nas_ms_network_feature_support_t;
CORE_DECLARE(c_int32_t) nas_decode_ms_network_feature_support(
CORE_DECLARE(c_int16_t) nas_decode_ms_network_feature_support(
nas_ms_network_feature_support_t *ms_network_feature_support,
pkbuf_t *pkbuf);
@ -567,7 +567,7 @@ ED3(c_uint8_t spare:4;,
c_uint8_t nas_key_set_identifier:3;)
} __attribute__ ((packed)) nas_key_set_identifier_t;
CORE_DECLARE(c_int32_t) nas_encode_nas_key_set_identifier(
CORE_DECLARE(c_int16_t) nas_encode_nas_key_set_identifier(
pkbuf_t *pkbuf, nas_key_set_identifier_t *nas_key_set_identifier);
/* 9.9.3.23 NAS security algorithms
@ -587,7 +587,7 @@ ED4(c_uint8_t spare1:1;,
c_uint8_t type_of_integrity_protection_algorithm:3;)
} __attribute__ ((packed)) nas_security_algorithms_t;
CORE_DECLARE(c_int32_t) nas_encode_nas_security_algorithms(
CORE_DECLARE(c_int16_t) nas_encode_nas_security_algorithms(
pkbuf_t *pkbuf, nas_security_algorithms_t *nas_security_algorithms);
/* 9.9.3.24A Network resource identifier container
@ -600,7 +600,7 @@ ED2(c_uint8_t nri_container_value2:2;,
c_uint8_t spare:6;)
} __attribute__ ((packed)) nas_network_resource_identifier_container_t;
CORE_DECLARE(c_int32_t) nas_decode_network_resource_identifier_container(
CORE_DECLARE(c_int16_t) nas_decode_network_resource_identifier_container(
nas_network_resource_identifier_container_t *
network_resource_identifier_container,
pkbuf_t *pkbuf);
@ -609,14 +609,14 @@ CORE_DECLARE(c_int32_t) nas_decode_network_resource_identifier_container(
* O TV 5 */
typedef c_uint32_t nas_nonce_t;
CORE_DECLARE(c_int32_t) nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce);
CORE_DECLARE(c_int16_t) nas_encode_nonce(pkbuf_t *pkbuf, nas_nonce_t *nonce);
/* 9.9.3.26 P-TMSI signature
* See subclause 10.5.5.8 in 3GPP TS 24.008
* O TV 4 */
typedef c_uint32_t nas_p_tmsi_signature_t; /* TV : 4bytes */
CORE_DECLARE(c_int32_t) nas_decode_p_tmsi_signature(
CORE_DECLARE(c_int16_t) nas_decode_p_tmsi_signature(
nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf);
/* 9.9.3.26A Extended EMM cause
@ -628,7 +628,7 @@ ED4(c_uint8_t type:4;,
c_uint8_t e_utran_allowed:1;)
} nas_extended_emm_cause_t;
CORE_DECLARE(c_int32_t) nas_encode_extended_emm_cause(
CORE_DECLARE(c_int16_t) nas_encode_extended_emm_cause(
pkbuf_t *pkbuf, nas_extended_emm_cause_t *extended_emm_cause);
/* 9.9.3.31 TMSI status
@ -640,7 +640,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t tmsi_flag:1;)
} __attribute__ ((packed)) nas_tmsi_status_t;
CORE_DECLARE(c_int32_t) nas_decode_tmsi_status(
CORE_DECLARE(c_int16_t) nas_decode_tmsi_status(
nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf);
/* 9.9.3.32 Tracking area identity
@ -650,7 +650,7 @@ typedef struct _nas_tracking_area_identity_t {
c_uint16_t tac;
} __attribute__ ((packed)) nas_tracking_area_identity_t;
CORE_DECLARE(c_int32_t) nas_decode_tracking_area_identity(
CORE_DECLARE(c_int16_t) nas_decode_tracking_area_identity(
nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf);
/* 9.9.3.33 Tracking area identity list
@ -682,7 +682,7 @@ ED3(c_uint8_t spare:1;,
};
} __attribute__ ((packed)) nas_tracking_area_identity_list_t;
CORE_DECLARE(c_int32_t) nas_encode_tracking_area_identity_list(
CORE_DECLARE(c_int16_t) nas_encode_tracking_area_identity_list(
pkbuf_t *pkbuf,
nas_tracking_area_identity_list_t *tracking_area_identity_list);
@ -762,7 +762,7 @@ ED2(c_uint8_t spare:7;,
c_uint8_t multiple_drb:1;)
} __attribute__ ((packed)) nas_ue_network_capability_t;
CORE_DECLARE(c_int32_t) nas_decode_ue_network_capability(
CORE_DECLARE(c_int16_t) nas_decode_ue_network_capability(
nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf);
/* 9.9.3.36 UE security capability
@ -836,7 +836,7 @@ typedef struct _nas_ue_security_capability_t {
};
} __attribute__ ((packed)) nas_ue_security_capability_t;
CORE_DECLARE(c_int32_t) nas_encode_ue_security_capability(
CORE_DECLARE(c_int16_t) nas_encode_ue_security_capability(
pkbuf_t *pkbuf, nas_ue_security_capability_t *ue_security_capability);
/* TODO : 9.9.3.37 Emergency number list
@ -844,10 +844,10 @@ CORE_DECLARE(c_int32_t) nas_encode_ue_security_capability(
* O TLV 5-50 */
typedef struct _nas_emergency_number_list_t {
c_uint16_t length;
c_uint8_t todo[48];
c_uint8_t todo[50];
} __attribute__ ((packed)) nas_emergency_number_list_t;
CORE_DECLARE(c_int32_t) nas_encode_emergency_number_list(
CORE_DECLARE(c_int16_t) nas_encode_emergency_number_list(
pkbuf_t *pkbuf, nas_emergency_number_list_t *emergency_number_list);
/* 9.9.3.44 Voice domain preference and UE's usage setting
@ -860,7 +860,7 @@ ED3(c_uint8_t spare:5;,
c_uint8_t voice_domain_preference_for_e_utran:2;)
} __attribute__ ((packed)) nas_voice_domain_preference_and_ue_usage_setting_t;
CORE_DECLARE(c_int32_t) nas_decode_voice_domain_preference_and_ue_usage_setting(
CORE_DECLARE(c_int16_t) nas_decode_voice_domain_preference_and_ue_usage_setting(
nas_voice_domain_preference_and_ue_usage_setting_t *
voice_domain_preference_and_ue_usage_setting,
pkbuf_t *pkbuf);
@ -873,7 +873,7 @@ ED3(c_uint8_t type:4;,
c_uint8_t guti_type:1;)
} __attribute__ ((packed)) nas_guti_type_t;
CORE_DECLARE(c_int32_t) nas_decode_guti_type(
CORE_DECLARE(c_int16_t) nas_decode_guti_type(
nas_guti_type_t *guti_type, pkbuf_t *pkbuf);
/* 9.9.3.46 Extended DRX parameters
@ -885,9 +885,9 @@ ED2(c_uint8_t paging_time_window:4;,
c_uint8_t e_drx_value:4;)
} __attribute__ ((packed)) nas_extended_drx_parameters_t;
CORE_DECLARE(c_int32_t) nas_decode_extended_drx_parameters(
CORE_DECLARE(c_int16_t) nas_decode_extended_drx_parameters(
nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf);
CORE_DECLARE(c_int32_t) nas_encode_extended_drx_parameters(
CORE_DECLARE(c_int16_t) nas_encode_extended_drx_parameters(
pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters);
#ifdef __cplusplus

View File

@ -3,23 +3,23 @@ ies.append({ "iei" : "", "value" : "EPS attach type", "type" : "EPS attach type"
ies.append({ "iei" : "", "value" : "EPS mobile identity", "type" : "EPS mobile identity", "reference" : "9.9.3.12", "presence" : "M", "format" : "LV", "length" : "5-12"})
ies.append({ "iei" : "", "value" : "UE network capability", "type" : "UE network capability", "reference" : "9.9.3.34", "presence" : "M", "format" : "LV", "length" : "3-14"})
ies.append({ "iei" : "", "value" : "ESM message container", "type" : "ESM message container", "reference" : "9.9.3.15", "presence" : "M", "format" : "LV-E", "length" : "5-n"})
ies.append({ "iei" : "19", "value" : "Old P-TMSI signature", "type" : "P-TMSI signature", "reference" : "P-9.9.3.26", "presence" : "O", "format" : "TV", "length" : "4"})
ies.append({ "iei" : "19", "value" : "Old P-TMSI signature", "type" : "P-TMSI signature", "reference" : "9.9.3.26", "presence" : "O", "format" : "TV", "length" : "4"})
ies.append({ "iei" : "50", "value" : "Additional GUTI", "type" : "EPS mobile identity", "reference" : "9.9.3.12", "presence" : "O", "format" : "TLV", "length" : "13"})
ies.append({ "iei" : "52", "value" : "Last visited registered TAI", "type" : "Tracking area identity", "reference" : "9.9.3.32", "presence" : "O", "format" : "TV", "length" : "6"})
ies.append({ "iei" : "5C", "value" : "DRX parameter", "type" : "DRX parameter", "reference" : "9.9.3.8", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "31", "value" : "MS network capability", "type" : "MS network capability", "reference" : "9.9.3.20", "presence" : "O", "format" : "TLV", "length" : "4-10"})
ies.append({ "iei" : "13", "value" : "Old location area identification", "type" : "Location area identification", "reference" : "9.9.2.2", "presence" : "O", "format" : "TV", "length" : "6"})
ies.append({ "iei" : "9-", "value" : "TMSI status", "type" : "TMSI status", "reference" : "9.9.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "11", "value" : "Mobile station classmark 2", "type" : "Mobile station classmark 2", "reference" : "Mobile station classmark 29.9.2.4", "presence" : "O", "format" : "TLV", "length" : "5"})
ies.append({ "iei" : "20", "value" : "Mobile station classmark 3", "type" : "Mobile station classmark 3", "reference" : "Mobile station classmark 39.9.2.5", "presence" : "O", "format" : "TLV", "length" : "2-34"})
ies.append({ "iei" : "11", "value" : "Mobile station classmark 2", "type" : "Mobile station classmark 2", "reference" : "9.9.2.4", "presence" : "O", "format" : "TLV", "length" : "5"})
ies.append({ "iei" : "20", "value" : "Mobile station classmark 3", "type" : "Mobile station classmark 3", "reference" : "9.9.2.5", "presence" : "O", "format" : "TLV", "length" : "2-34"})
ies.append({ "iei" : "40", "value" : "Supported Codecs", "type" : "Supported Codec List", "reference" : "9.9.2.10", "presence" : "O", "format" : "TLV", "length" : "5-n"})
ies.append({ "iei" : "F-", "value" : "Additional update type", "type" : "Additional update type", "reference" : "9.9.3.0B", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "5D", "value" : "Voice domain preference and UE usage setting", "type" : "Voice domain preference and UE usage setting", "reference" : "Voice domain preference and UE'9.9.3.44", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5D", "value" : "Voice domain preference and UE usage setting", "type" : "Voice domain preference and UE usage setting", "reference" : "9.9.3.44", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "D-", "value" : "Device properties", "type" : "Device properties", "reference" : "9.9.2.0A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "E-", "value" : "Old GUTI type", "type" : "GUTI type", "reference" : "9.9.3.45", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "C- ", "value" : "MS network feature support", "type" : "MS network feature support", "reference" : "9.9.3.20A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "10", "value" : "TMSI based NRI container", "type" : "Network resource identifier container", "reference" : "9.9.3.24A", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 2", "reference" : "GPRS timer 29.9.3.16A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5E", "value" : "T3412 extended value", "type" : "GPRS timer 3", "reference" : "GPRS timer 39.9.3.16B", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 2", "reference" : "9.9.3.16A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5E", "value" : "T3412 extended value", "type" : "GPRS timer 3", "reference" : "9.9.3.16B", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6E", "value" : "Extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.9.3.46", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -13,7 +13,7 @@ ies.append({ "iei" : "4A", "value" : "Equivalent PLMNs", "type" : "PLMN list", "
ies.append({ "iei" : "34", "value" : "Emergency number list", "type" : "Emergency number list", "reference" : "9.9.3.37", "presence" : "O", "format" : "TLV", "length" : "5-50"})
ies.append({ "iei" : "64", "value" : "EPS network feature support", "type" : "EPS network feature support", "reference" : "9.9.3.12A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "F-", "value" : "Additional update result", "type" : "Additional update result", "reference" : "9.9.3.0A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "5E", "value" : "T3412 extended value", "type" : "GPRS timer 3", "reference" : "GPRS timer 39.9.3.16B", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 2", "reference" : "GPRS timer 29.9.3.16A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5E", "value" : "T3412 extended value", "type" : "GPRS timer 3", "reference" : "9.9.3.16B", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 2", "reference" : "9.9.3.16A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6E", "value" : "Extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.9.3.46", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@ -1,5 +1,5 @@
type_list["P-TMSI signature"]["decode"] = \
" target = htonl(*p_tmsi_signature);\n\n"
" *p_tmsi_signature = htonl(*p_tmsi_signature);\n\n"
type_list["P-TMSI signature"]["encode"] = \
" *p_tmsi_signature = ntohl(*p_tmsi_signature);\n\n"
@ -17,7 +17,7 @@ type_list["Mobile identity"]["decode"] = \
" if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI)\n" \
" {\n" \
" if (mobile_identity->tmsi.spare != 0xf)\n" \
" d_warn(\"Spec warning : mobile_identity->tmsi.spare = 0x%x\", eps_mobile_identity->guti.spare);\n" \
" d_warn(\"Spec warning : mobile_identity->tmsi.spare = 0x%x\", mobile_identity->tmsi.spare);\n" \
" mobile_identity->tmsi.tmsi = ntohl(mobile_identity->tmsi.tmsi);\n" \
" }\n\n"
type_list["Mobile identity"]["encode"] = \

View File

@ -111,7 +111,7 @@ def get_cells(cells):
iei = cells[0].text.encode('ascii', 'ignore')
value = re.sub("'s", "", cells[1].text).encode('ascii', 'ignore')
type = re.sub("'s", "", re.sub('\s*\n\s*[a-zA-Z0-9.]*', '', cells[2].text)).encode('ascii', 'ignore')
reference = re.sub('[a-zA-Z\s]*\n\s*', '', 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')
@ -248,6 +248,141 @@ for key in msg_list.keys():
f.close()
tmp = [(k, v["type"]) for k, v in msg_list.items()]
sorted_msg_list = sorted(tmp, key=lambda tup: int(tup[1]))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
for ie in msg_list[k]["ies"]:
type_list[ie["type"]] = { "reference" : ie["reference"], "presence" : ie["presence"], "format" : ie["format"], "length" : ie["length"] }
d_info("[Type List]")
cachefile = cachedir + "type_list.py"
if os.path.isfile(cachefile) and os.access(cachefile, os.R_OK):
execfile(cachefile)
print "Read from " + cachefile
tmp = [(k, v["reference"]) for k, v in type_list.items()]
sorted_type_list = sorted(tmp, key=lambda tup: tup[1])
f = open(outdir + 'nas_ies2.c', 'w')
output_header_to_file(f)
f.write("""#define TRACE_MODULE _nasies
#include "core_debug.h"
#include "core_lib.h"
#include "nas_ies.h"
c_int16_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type)
{
c_uint16_t size = sizeof(c_uint8_t);
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error");
memcpy(pkbuf->payload - 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]["length"] == "1/2" or type_list[k]["length"] == "1":
f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" memcpy(%s, pkbuf->payload - 1, 1);\n\n" % v_lower(k))
f.write(" return 0;\n")
f.write("}\n\n")
f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" c_uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(pkbuf->payload - size, %s, size);\n\n" % v_lower(k))
f.write(" return size;\n")
f.write("}\n\n")
elif type_list[k]["format"] == "TV" or type_list[k]["format"] == "V":
f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" c_uint16_t size = 3;\n\n")
else:
f.write(" c_uint16_t size = sizeof(nas_%s_t);\n\n" % v_lower(k))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(%s, pkbuf->payload - size, size);\n\n" % v_lower(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" return size;\n")
f.write("}\n\n")
f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" c_uint16_t size = 3;\n")
else:
f.write(" c_uint16_t size = sizeof(nas_%s_t);\n" % v_lower(k))
f.write(" nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, size);\n" % v_lower(k))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n")
f.write(" return size;\n")
f.write("}\n\n")
elif type_list[k]["format"] == "LV-E":
f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" c_uint16_t size = 0;\n")
f.write(" nas_%s_t *source = pkbuf->payload;\n\n" % v_lower(k))
f.write(" %s->length = ntohs(source->length);\n" % v_lower(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" %s->buffer = pkbuf->payload - size + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" return size;\n")
f.write("}\n\n")
f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" c_uint16_t size = 0;\n")
f.write(" c_uint16_t target;\n\n")
f.write(" d_assert(%s, return -1, \"Null param\");\n" % v_lower(k))
f.write(" d_assert(%s->buffer, return -1, \"Null param\");\n\n" % v_lower(k))
f.write(" size = sizeof(%s->length);\n" % v_lower(k))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" target = htons(%s->length);\n" % v_lower(k))
f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n")
f.write(" size = %s->length;\n" % v_lower(k))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(pkbuf->payload - size, %s->buffer, size);\n\n" % v_lower(k))
f.write(" return %s->length + sizeof(%s->length);\n" % (v_lower(k), v_lower(k)))
f.write("}\n\n");
else:
f.write("c_int16_t nas_decode_%s(nas_%s_t *%s, pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" c_uint16_t size = 0;\n")
f.write(" nas_%s_t *source = pkbuf->payload;\n\n" % v_lower(k))
f.write(" %s->length = source->length;\n" % v_lower(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(%s, pkbuf->payload - size, size);\n\n" % v_lower(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" return size;\n")
f.write("}\n\n")
f.write("c_int16_t nas_encode_%s(pkbuf_t *pkbuf, nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), v_lower(k)))
f.write("{\n")
f.write(" c_uint16_t size = %s->length + sizeof(%s->length);\n" % (v_lower(k), v_lower(k)))
f.write(" nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, sizeof(nas_%s_t));\n" % (v_lower(k), v_lower(k)))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, \"pkbuf_header error\");\n")
f.write(" memcpy(pkbuf->payload - size, &target, size);\n\n")
f.write(" return size;\n")
f.write("}\n\n");
f.close()
f = open(outdir + 'nas_message2.h', 'w')
output_header_to_file(f)
f.write("""#ifndef __NAS_MESSAGE_H__
@ -290,8 +425,6 @@ ED2(c_uint8_t security_header_type:4;,
""")
tmp = [(k, v["type"]) for k, v in msg_list.items()]
sorted_msg_list = sorted(tmp, key=lambda tup: int(tup[1]))
for (k, v) in sorted_msg_list:
f.write("#define NAS_" + v_upper(k) + " " + v + "\n")
f.write("\n")
@ -544,3 +677,4 @@ f.write(""" default:
return CORE_OK;
""")
f.close()