intermediate
This commit is contained in:
parent
d8eec46c03
commit
d55ea75638
|
@ -7,19 +7,19 @@
|
|||
/* 9.9.2.0A Device properties
|
||||
* See subclause 10.5.7.8 in 3GPP TS 24.008 [13].
|
||||
* O TV 1 */
|
||||
status_t nas_decode_device_properties(
|
||||
c_int32_t nas_decode_device_properties(
|
||||
nas_device_properties_t *device_properties, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 1;
|
||||
|
||||
memcpy(device_properties, pkbuf->payload - size, size);
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.2.2 Location area identification
|
||||
* See subclause 10.5.1.3 in 3GPP TS 24.008 [13]
|
||||
* O TV 6 */
|
||||
status_t nas_decode_location_area_identification(
|
||||
c_int32_t nas_decode_location_area_identification(
|
||||
nas_location_area_identification_t *location_area_identification,
|
||||
pkbuf_t *pkbuf)
|
||||
{
|
||||
|
@ -27,19 +27,19 @@ status_t nas_decode_location_area_identification(
|
|||
|
||||
size = sizeof(nas_location_area_identification_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(location_area_identification, pkbuf->payload - size, size);
|
||||
|
||||
location_area_identification->lac =
|
||||
ntohs(location_area_identification->lac);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.2.4 Mobile station classmark 2
|
||||
* See subclause 10.5.1.6 in 3GPP TS 24.008
|
||||
* O TLV 5 */
|
||||
status_t nas_decode_mobile_station_classmark_2(
|
||||
c_int32_t nas_decode_mobile_station_classmark_2(
|
||||
nas_mobile_station_classmark_2_t *mobile_station_classmark_2,
|
||||
pkbuf_t *pkbuf)
|
||||
{
|
||||
|
@ -51,16 +51,16 @@ status_t nas_decode_mobile_station_classmark_2(
|
|||
sizeof(mobile_station_classmark_2->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(mobile_station_classmark_2, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/*9.9.2.5 Mobile station classmark 3
|
||||
* See subclause 10.5.1.7 in 3GPP TS 24.008 [13].
|
||||
* O TLV 2-34 */
|
||||
status_t nas_decode_mobile_station_classmark_3(
|
||||
c_int32_t nas_decode_mobile_station_classmark_3(
|
||||
nas_mobile_station_classmark_3_t *mobile_station_classmark_3,
|
||||
pkbuf_t *pkbuf)
|
||||
{
|
||||
|
@ -72,18 +72,18 @@ status_t nas_decode_mobile_station_classmark_3(
|
|||
sizeof(mobile_station_classmark_3->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
/* TODO
|
||||
memcpy(mobile_station_classmark_3, pkbuf->payload - size, size);
|
||||
*/
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.2.10 Supported codec list
|
||||
* See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
|
||||
* O TLV 5-n */
|
||||
status_t nas_decode_supported_codec_list(
|
||||
c_int32_t nas_decode_supported_codec_list(
|
||||
nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -94,59 +94,59 @@ status_t nas_decode_supported_codec_list(
|
|||
sizeof(supported_codec_list->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
memcpy(supported_codec_list, pkbuf->payload - size,
|
||||
c_min(size, sizeof(nas_supported_codec_list_t)));
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
status_t nas_decode_additional_update_type(
|
||||
c_int32_t nas_decode_additional_update_type(
|
||||
nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 1;
|
||||
|
||||
memcpy(additional_update_type, pkbuf->payload - size, size);
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.8 DRX parameter
|
||||
* See subclause 10.5.5.6 in 3GPP TS 24.008
|
||||
* O TV 3 */
|
||||
status_t nas_decode_drx_parameter(
|
||||
c_int32_t nas_decode_drx_parameter(
|
||||
nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
size = sizeof(nas_drx_parameter_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(drx_parameter, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.11 EPS attach type
|
||||
* M V 1/2
|
||||
* 9.9.3.21 NAS key set identifier
|
||||
* M V 1/2 */
|
||||
status_t nas_decode_attach_type(
|
||||
c_int32_t nas_decode_attach_type(
|
||||
nas_attach_type_t *attach_type, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
size = sizeof(nas_attach_type_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(attach_type, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.12 EPS mobile identity
|
||||
* M LV 5-12 */
|
||||
status_t nas_decode_eps_mobile_identity(
|
||||
c_int32_t nas_decode_eps_mobile_identity(
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -156,7 +156,7 @@ status_t nas_decode_eps_mobile_identity(
|
|||
size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(eps_mobile_identity, pkbuf->payload - size, size);
|
||||
if (eps_mobile_identity->type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
|
||||
{
|
||||
|
@ -166,12 +166,39 @@ status_t nas_decode_eps_mobile_identity(
|
|||
ntohl(eps_mobile_identity->u.guti.m_tmsi);
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
status_t nas_encode_eps_mobile_identity(
|
||||
pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
nas_eps_mobile_identity_t target;
|
||||
|
||||
d_assert(eps_mobile_identity, return -1, "Null param");
|
||||
memcpy(&target, eps_mobile_identity, sizeof(nas_eps_mobile_identity_t));
|
||||
|
||||
size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
if (target.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
|
||||
{
|
||||
target.digit1 = 0xf;
|
||||
target.u.guti.mme_group_id =
|
||||
htons(eps_mobile_identity->u.guti.mme_group_id);
|
||||
target.u.guti.m_tmsi =
|
||||
htonl(eps_mobile_identity->u.guti.m_tmsi);
|
||||
}
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
/* 9.9.3.15 ESM message container
|
||||
* M LV-E 5-n */
|
||||
status_t nas_decode_esm_message_container(
|
||||
c_int32_t nas_decode_esm_message_container(
|
||||
nas_esm_message_container_t *esm_message_container, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -182,18 +209,18 @@ status_t nas_decode_esm_message_container(
|
|||
sizeof(esm_message_container->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
esm_message_container->buffer = pkbuf->payload - size +
|
||||
sizeof(esm_message_container->length);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
c_int32_t nas_encode_esm_message_container(
|
||||
pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
c_uint16_t tmp;
|
||||
c_uint16_t target;
|
||||
|
||||
d_assert(esm_message_container, return -1, "Null param");
|
||||
d_assert(esm_message_container->buffer, return -1, "Null param");
|
||||
|
@ -201,8 +228,8 @@ c_int32_t nas_encode_esm_message_container(
|
|||
size = sizeof(esm_message_container->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
tmp = htons(esm_message_container->length);
|
||||
memcpy(pkbuf->payload - size, &tmp, size);
|
||||
target = htons(esm_message_container->length);
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
size = esm_message_container->length;
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
|
@ -216,7 +243,7 @@ c_int32_t nas_encode_esm_message_container(
|
|||
/* 9.9.3.16A GPRS timer 2
|
||||
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
|
||||
* O TLV 3 */
|
||||
status_t nas_decode_gprs_timer_2(
|
||||
c_int32_t nas_decode_gprs_timer_2(
|
||||
nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -226,16 +253,16 @@ status_t nas_decode_gprs_timer_2(
|
|||
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(gprs_timer_2, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.16B GPRS timer 3
|
||||
* See subclause 10.5.7.4a in 3GPP TS 24.008 [13].
|
||||
* O TLV 3 */
|
||||
CORE_DECLARE(status_t) nas_decode_gprs_timer_3(
|
||||
c_int32_t nas_decode_gprs_timer_3(
|
||||
nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -245,16 +272,16 @@ CORE_DECLARE(status_t) nas_decode_gprs_timer_3(
|
|||
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(gprs_timer_3, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.20 MS network capability
|
||||
* See subclause 10.5.5.12 in 3GPP TS 24.008
|
||||
* O TLV 4-10 */
|
||||
status_t nas_decode_ms_network_capability(
|
||||
c_int32_t nas_decode_ms_network_capability(
|
||||
nas_ms_network_capability_t *ms_network_capability, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -264,30 +291,30 @@ status_t nas_decode_ms_network_capability(
|
|||
size = ms_network_capability->length + sizeof(ms_network_capability->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(ms_network_capability, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.20A MS network feature support
|
||||
* See subclause 10.5.1.15 in 3GPP TS 24.008 [13].
|
||||
* O TV 1 */
|
||||
|
||||
status_t nas_decode_ms_network_feature_support(
|
||||
c_int32_t nas_decode_ms_network_feature_support(
|
||||
nas_ms_network_feature_support_t *ms_network_feature_support,
|
||||
pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 1;
|
||||
|
||||
memcpy(ms_network_feature_support, pkbuf->payload - size, size);
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.24A Network resource identifier container
|
||||
* See subclause 10.5.5.31 in 3GPP TS 24.008 [13].
|
||||
* O TLV 4 */
|
||||
status_t nas_decode_network_resource_identifier_container(
|
||||
c_int32_t nas_decode_network_resource_identifier_container(
|
||||
nas_network_resource_identifier_container_t *network_resource_identifier_container,
|
||||
pkbuf_t *pkbuf)
|
||||
{
|
||||
|
@ -299,62 +326,62 @@ status_t nas_decode_network_resource_identifier_container(
|
|||
sizeof(network_resource_identifier_container->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(network_resource_identifier_container, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.26 P-TMSI signature
|
||||
* See subclause 10.5.5.8 in 3GPP TS 24.008
|
||||
* O TV 4 */
|
||||
status_t nas_decode_p_tmsi_signature(
|
||||
c_int32_t nas_decode_p_tmsi_signature(
|
||||
nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
size = 3;
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(p_tmsi_signature, pkbuf->payload - size, size);
|
||||
|
||||
*p_tmsi_signature = ntohl(*p_tmsi_signature);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.31 TMSI status
|
||||
* See subclause 10.5.5.4 in 3GPP TS 24.008 [13]
|
||||
* O TV 1 */
|
||||
status_t nas_decode_tmsi_status(
|
||||
c_int32_t nas_decode_tmsi_status(
|
||||
nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 1;
|
||||
|
||||
memcpy(tmsi_status, pkbuf->payload - size, size);
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.32 Tracking area identity
|
||||
* O TV 6 */
|
||||
status_t nas_decode_tracking_area_identity(
|
||||
c_int32_t nas_decode_tracking_area_identity(
|
||||
nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
size = sizeof(nas_tracking_area_identity_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(tracking_area_identity, pkbuf->payload - size, size);
|
||||
|
||||
tracking_area_identity->tac = ntohs(tracking_area_identity->tac);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.34 UE network capability
|
||||
* M LV 3-14 */
|
||||
status_t nas_decode_ue_network_capability(
|
||||
c_int32_t nas_decode_ue_network_capability(
|
||||
nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -365,16 +392,16 @@ status_t nas_decode_ue_network_capability(
|
|||
sizeof(ue_network_capability->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(ue_network_capability, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
status_t nas_decode_voice_domain_preference_and_ue_usage_setting(
|
||||
c_int32_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)
|
||||
|
@ -387,27 +414,27 @@ status_t nas_decode_voice_domain_preference_and_ue_usage_setting(
|
|||
sizeof(voice_domain_preference_and_ue_usage_setting->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(voice_domain_preference_and_ue_usage_setting,
|
||||
pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.45 GUTI type
|
||||
* O TV 1 */
|
||||
status_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf)
|
||||
c_int32_t nas_decode_guti_type(nas_guti_type_t *guti_type, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 1;
|
||||
|
||||
memcpy(guti_type, pkbuf->payload - size, size);
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.46 Extended DRX parameters
|
||||
* See subclause 10.5.5.32 in 3GPP TS 24.008 [13].
|
||||
* O TLV 3 */
|
||||
status_t nas_decode_extended_drx_parameters(
|
||||
c_int32_t nas_decode_extended_drx_parameters(
|
||||
nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
@ -418,10 +445,10 @@ status_t nas_decode_extended_drx_parameters(
|
|||
sizeof(extended_drx_parameters->length);
|
||||
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(extended_drx_parameters, pkbuf->payload - size, size);
|
||||
|
||||
return CORE_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.10 * EPS attach result
|
||||
|
@ -465,44 +492,45 @@ c_int32_t nas_encode_tracking_area_identity_list(
|
|||
{
|
||||
c_uint16_t size = 0;
|
||||
int i = 0;
|
||||
nas_tracking_area_identity_list_t tmp;
|
||||
nas_tracking_area_identity_list_t target;
|
||||
|
||||
d_assert(tracking_area_identity_list, return -1, "Null param");
|
||||
|
||||
memcpy(&tmp, tracking_area_identity_list,
|
||||
memcpy(&target, tracking_area_identity_list,
|
||||
sizeof(nas_tracking_area_identity_list_t));
|
||||
|
||||
size = tracking_area_identity_list->length +
|
||||
sizeof(tracking_area_identity_list->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
if (tmp.type_of_list ==
|
||||
|
||||
if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)
|
||||
{
|
||||
for (i = 0; i < tmp.number_of_elements + 1&&
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1&&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
tmp.u.type0.tac[i] = htons(tmp.u.type0.tac[i]);
|
||||
target.u.type0.tac[i] =
|
||||
htons(tracking_area_identity_list->u.type0.tac[i]);
|
||||
}
|
||||
}
|
||||
else if (tmp.type_of_list ==
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)
|
||||
{
|
||||
tmp.u.type1.tac = htons(tmp.u.type1.tac);
|
||||
target.u.type1.tac = htons(tracking_area_identity_list->u.type1.tac);
|
||||
}
|
||||
else if (tmp.type_of_list ==
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)
|
||||
{
|
||||
for (i = 0; i < tmp.number_of_elements + 1 &&
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 &&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
tmp.u.type2.tai[i].tac = htons(tmp.u.type2.tai[i].tac);
|
||||
target.u.type2.tai[i].tac =
|
||||
htons(tracking_area_identity_list->u.type2.tai[i].tac);
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
||||
memcpy(pkbuf->payload - size, &tmp, size);
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ ED3(c_uint8_t type:4;,
|
|||
c_uint8_t low_priority:1;)
|
||||
} __attribute__ ((packed)) nas_device_properties_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_device_properties(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_device_properties(
|
||||
nas_device_properties_t *device_properties, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.2.2 Location area identification
|
||||
|
@ -32,7 +32,7 @@ ED2(c_uint8_t mnc_digit2:4;,
|
|||
c_uint16_t lac;
|
||||
} __attribute__ ((packed)) nas_location_area_identification_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_location_area_identification(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_location_area_identification(
|
||||
nas_location_area_identification_t *location_area_identification,
|
||||
pkbuf_t *pkbuf);
|
||||
|
||||
|
@ -74,7 +74,7 @@ ED8(c_uint8_t cm3:1;,
|
|||
c_uint8_t a5_2:1;)
|
||||
} __attribute__ ((packed)) nas_mobile_station_classmark_2_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_mobile_station_classmark_2(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_2(
|
||||
nas_mobile_station_classmark_2_t *mobile_station_classmark_2,
|
||||
pkbuf_t *pkbuf);
|
||||
|
||||
|
@ -86,7 +86,7 @@ typedef struct _nas_mobile_station_classmark_3_t {
|
|||
/* TODO */
|
||||
} __attribute__ ((packed)) nas_mobile_station_classmark_3_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_mobile_station_classmark_3(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_3(
|
||||
nas_mobile_station_classmark_3_t *mobile_station_classmark_3,
|
||||
pkbuf_t *pkbuf);
|
||||
|
||||
|
@ -105,7 +105,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(status_t) nas_decode_supported_codec_list(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_supported_codec_list(
|
||||
nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.0B Additional update type
|
||||
|
@ -121,7 +121,7 @@ ED4(c_uint8_t type:4;,
|
|||
c_uint8_t autv:1;)
|
||||
} __attribute__ ((packed)) nas_additional_update_type_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_additional_update_type(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_additional_update_type(
|
||||
nas_additional_update_type_t *additional_update_type, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.8 DRX parameter
|
||||
|
@ -147,7 +147,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(status_t) nas_decode_drx_parameter(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_drx_parameter(
|
||||
nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.11 EPS attach type
|
||||
|
@ -169,7 +169,7 @@ ED4(c_uint8_t tsc:1;,
|
|||
c_uint8_t attach_type:3;)
|
||||
} __attribute__ ((packed)) nas_attach_type_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_attach_type(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_attach_type(
|
||||
nas_attach_type_t *attach_type, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.12 EPS mobile identity
|
||||
|
@ -223,8 +223,10 @@ ED3(c_uint8_t digit1:4;,
|
|||
} u;
|
||||
} __attribute__ ((packed)) nas_eps_mobile_identity_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_eps_mobile_identity(
|
||||
CORE_DECLARE(c_int32_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(
|
||||
pkbuf_t *pkbuf, nas_eps_mobile_identity_t *eps_mobile_identity);
|
||||
|
||||
/* 9.9.3.15 ESM message container
|
||||
* M LV-E 5-n */
|
||||
|
@ -233,7 +235,7 @@ typedef struct _nas_esm_message_container_t {
|
|||
c_uint8_t *buffer;
|
||||
} nas_esm_message_container_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_esm_message_container(
|
||||
CORE_DECLARE(c_int32_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(
|
||||
pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container);
|
||||
|
@ -246,7 +248,7 @@ typedef struct _nas_gprs_timer_2_t {
|
|||
c_uint8_t gprs_timer_2_value;
|
||||
} __attribute__ ((packed)) nas_gprs_timer_2_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_gprs_timer_2(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_gprs_timer_2(
|
||||
nas_gprs_timer_2_t *gprs_timer_2, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.16B GPRS timer 3
|
||||
|
@ -267,7 +269,7 @@ ED2(c_uint8_t unit:3;,
|
|||
c_uint8_t timer_value:6;)
|
||||
} __attribute__ ((packed)) nas_gprs_timer_3_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_gprs_timer_3(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_gprs_timer_3(
|
||||
nas_gprs_timer_3_t *gprs_timer_3, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.20 MS network capability
|
||||
|
@ -307,7 +309,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(status_t) nas_decode_ms_network_capability(
|
||||
CORE_DECLARE(c_int32_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
|
||||
|
@ -319,7 +321,7 @@ ED3(c_uint8_t type:4;,
|
|||
c_uint8_t extended_periodic_timers:1;)
|
||||
} __attribute__ ((packed)) nas_ms_network_feature_support_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_ms_network_feature_support(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_ms_network_feature_support(
|
||||
nas_ms_network_feature_support_t *ms_network_feature_support,
|
||||
pkbuf_t *pkbuf);
|
||||
|
||||
|
@ -333,7 +335,7 @@ ED2(c_uint8_t nri_container_value2:2;,
|
|||
c_uint8_t spare:6;)
|
||||
} __attribute__ ((packed)) nas_network_resource_identifier_container_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_network_resource_identifier_container(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_network_resource_identifier_container(
|
||||
nas_network_resource_identifier_container_t *
|
||||
network_resource_identifier_container,
|
||||
pkbuf_t *pkbuf);
|
||||
|
@ -343,7 +345,7 @@ CORE_DECLARE(status_t) nas_decode_network_resource_identifier_container(
|
|||
* O TV 4 */
|
||||
typedef c_uint32_t nas_p_tmsi_signature_t; /* TV : 4bytes */
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_p_tmsi_signature(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_p_tmsi_signature(
|
||||
nas_p_tmsi_signature_t *p_tmsi_signature, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.31 TMSI status
|
||||
|
@ -355,7 +357,7 @@ ED3(c_uint8_t type:4;,
|
|||
c_uint8_t tmsi_flag:1;)
|
||||
} __attribute__ ((packed)) nas_tmsi_status_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_tmsi_status(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_tmsi_status(
|
||||
nas_tmsi_status_t *tmsi_status, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.32 Tracking area identity
|
||||
|
@ -370,7 +372,7 @@ ED2(c_uint8_t mnc_digit2:4;,
|
|||
c_uint16_t tac;
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_tracking_area_identity(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_tracking_area_identity(
|
||||
nas_tracking_area_identity_t *tracking_area_identity, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.34 UE network capability
|
||||
|
@ -429,7 +431,7 @@ ED2(c_uint8_t spare:7;,
|
|||
c_uint8_t multiple_drb:1;)
|
||||
} __attribute__ ((packed)) nas_ue_network_capability_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_ue_network_capability(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_ue_network_capability(
|
||||
nas_ue_network_capability_t *ue_network_capability, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.44 Voice domain preference and UE's usage setting
|
||||
|
@ -442,7 +444,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(status_t) nas_decode_voice_domain_preference_and_ue_usage_setting(
|
||||
CORE_DECLARE(c_int32_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);
|
||||
|
@ -455,7 +457,7 @@ ED3(c_uint8_t type:4;,
|
|||
c_uint8_t guti_type:1;)
|
||||
} __attribute__ ((packed)) nas_guti_type_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_guti_type(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_guti_type(
|
||||
nas_guti_type_t *guti_type, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.46 Extended DRX parameters
|
||||
|
@ -467,7 +469,7 @@ ED2(c_uint8_t paging_time_window:4;,
|
|||
c_uint8_t e_drx_value:4;)
|
||||
} __attribute__ ((packed)) nas_extended_drx_parameters_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_decode_extended_drx_parameters(
|
||||
CORE_DECLARE(c_int32_t) nas_decode_extended_drx_parameters(
|
||||
nas_extended_drx_parameters_t *extended_drx_parameters, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.10 * EPS attach result
|
||||
|
|
|
@ -3,25 +3,27 @@
|
|||
#include "core_debug.h"
|
||||
#include "nas_message.h"
|
||||
|
||||
status_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf)
|
||||
c_int32_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf)
|
||||
{
|
||||
nas_attach_request_t *attach_request = &message->emm.attach_request;
|
||||
c_uint16_t decoded = pkbuf->len;
|
||||
c_int32_t size = 0;
|
||||
status_t rv;
|
||||
|
||||
rv = nas_decode_attach_type(&attach_request->attach_type, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
size = nas_decode_attach_type(&attach_request->attach_type, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
|
||||
rv = nas_decode_eps_mobile_identity(
|
||||
size = nas_decode_eps_mobile_identity(
|
||||
&attach_request->eps_mobile_identity, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
|
||||
rv = nas_decode_ue_network_capability(
|
||||
size = nas_decode_ue_network_capability(
|
||||
&attach_request->ue_network_capability, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
|
||||
rv = nas_decode_esm_message_container(
|
||||
size = nas_decode_esm_message_container(
|
||||
&attach_request->esm_message_container, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
|
||||
while(pkbuf->len > 0)
|
||||
{
|
||||
|
@ -29,142 +31,151 @@ status_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf)
|
|||
c_uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer);
|
||||
|
||||
rv = pkbuf_header(pkbuf, -(c_int16_t)(sizeof(c_uint8_t)));
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error");
|
||||
d_assert(rv == CORE_OK, return -1, "pkbuf_header error");
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_IEI:
|
||||
rv = nas_decode_p_tmsi_signature(
|
||||
size = nas_decode_p_tmsi_signature(
|
||||
&attach_request->old_p_tmsi_signature, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_IEI:
|
||||
rv = nas_decode_eps_mobile_identity(
|
||||
size = nas_decode_eps_mobile_identity(
|
||||
&attach_request->additional_guti, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI:
|
||||
rv = nas_decode_tracking_area_identity(
|
||||
size = nas_decode_tracking_area_identity(
|
||||
&attach_request->last_visited_registered_tai, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_DRX_PARAMETER_IEI:
|
||||
rv = nas_decode_drx_parameter(
|
||||
size = nas_decode_drx_parameter(
|
||||
&attach_request->drx_parameter, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_DRX_PARAMETER_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI:
|
||||
rv = nas_decode_ms_network_capability(
|
||||
size = nas_decode_ms_network_capability(
|
||||
&attach_request->ms_network_capability, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI:
|
||||
rv = nas_decode_location_area_identification(
|
||||
size = nas_decode_location_area_identification(
|
||||
&attach_request->old_location_area_identification, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_TMSI_STATUS_IEI:
|
||||
rv = nas_decode_tmsi_status(
|
||||
size = nas_decode_tmsi_status(
|
||||
&attach_request->tmsi_status, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_TMSI_STATUS_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI:
|
||||
rv = nas_decode_mobile_station_classmark_2(
|
||||
size = nas_decode_mobile_station_classmark_2(
|
||||
&attach_request->mobile_station_classmark_2, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI:
|
||||
rv = nas_decode_mobile_station_classmark_3(
|
||||
size = nas_decode_mobile_station_classmark_3(
|
||||
&attach_request->mobile_station_classmark_3, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_SUPPORTED_CODECS_IEI:
|
||||
rv = nas_decode_supported_codec_list(
|
||||
size = nas_decode_supported_codec_list(
|
||||
&attach_request->supported_codecs, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI:
|
||||
rv = nas_decode_additional_update_type(
|
||||
size = nas_decode_additional_update_type(
|
||||
&attach_request->additional_update_type, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode failed");
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI:
|
||||
rv = nas_decode_voice_domain_preference_and_ue_usage_setting(
|
||||
size = nas_decode_voice_domain_preference_and_ue_usage_setting(
|
||||
&attach_request->voice_domain_preference_and_ue_usage_setting, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_IEI:
|
||||
rv = nas_decode_device_properties(
|
||||
size = nas_decode_device_properties(
|
||||
&attach_request->device_properties, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_IEI:
|
||||
rv = nas_decode_guti_type(
|
||||
size = nas_decode_guti_type(
|
||||
&attach_request->old_guti_type, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI:
|
||||
rv = nas_decode_ms_network_feature_support(
|
||||
size = nas_decode_ms_network_feature_support(
|
||||
&attach_request->ms_network_feature_support, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_IEI:
|
||||
rv = nas_decode_network_resource_identifier_container(
|
||||
size = nas_decode_network_resource_identifier_container(
|
||||
&attach_request->tmsi_based_nri_container, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_T3324_VALUE_IEI:
|
||||
rv = nas_decode_gprs_timer_2(
|
||||
size = nas_decode_gprs_timer_2(
|
||||
&attach_request->t3324_value, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_T3324_VALUE_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_IEI:
|
||||
rv = nas_decode_gprs_timer_3(
|
||||
size = nas_decode_gprs_timer_3(
|
||||
&attach_request->t3412_extended_value, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_PRESENT;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_IEI:
|
||||
rv = nas_decode_extended_drx_parameters(
|
||||
size = nas_decode_extended_drx_parameters(
|
||||
&attach_request->extended_drx_parameters, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT;
|
||||
break;
|
||||
default:
|
||||
d_error("Unknown type(0x%x) or not implemented\n", type);
|
||||
return CORE_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
return decoded;
|
||||
}
|
||||
|
||||
status_t nas_decode_pdu(nas_message_t *message, pkbuf_t *pkbuf)
|
||||
|
@ -195,8 +206,8 @@ status_t nas_decode_pdu(nas_message_t *message, pkbuf_t *pkbuf)
|
|||
switch(message->h.message_type)
|
||||
{
|
||||
case NAS_ATTACH_REQUEST:
|
||||
rv = nas_decode_attach_request(message, pkbuf);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "decode error");
|
||||
size = nas_decode_attach_request(message, pkbuf);
|
||||
d_assert(size >= CORE_OK, return CORE_ERROR, "decode error");
|
||||
break;
|
||||
case NAS_ATTACH_ACCEPT:
|
||||
case NAS_ATTACH_COMPLETE:
|
||||
|
@ -287,6 +298,56 @@ c_int32_t nas_encode_attach_accept(pkbuf_t *pkbuf, nas_message_t *message)
|
|||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_GUTI_PRESENT)
|
||||
{
|
||||
size = nas_encode_eps_mobile_identity(pkbuf, &attach_accept->guti);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3402_VALUE_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3423_VALUE_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3324_VALUE_PRESENT)
|
||||
{
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT)
|
||||
{
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
@ -377,5 +438,7 @@ status_t nas_encode_pdu(pkbuf_t **pkbuf, nas_message_t *message)
|
|||
rv = pkbuf_header(*pkbuf, encoded);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "pkbuf_header error");
|
||||
|
||||
(*pkbuf)->len = encoded;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -220,8 +220,8 @@ typedef struct _nas_attach_request_t {
|
|||
typedef struct _nas_message_t {
|
||||
nas_header_t h;
|
||||
union {
|
||||
nas_attach_request_t attach_request;
|
||||
nas_attach_accept_t attach_accept;
|
||||
nas_attach_request_t attach_request;
|
||||
} emm;
|
||||
} nas_message_t;
|
||||
|
||||
|
|
|
@ -63,13 +63,34 @@ static void nas_message_test2(abts_case *tc, void *data)
|
|||
attach_accept->tai_list.u.type0.mcc_digit3 = 7;
|
||||
attach_accept->tai_list.u.type0.mnc_digit1 = 9;
|
||||
attach_accept->tai_list.u.type0.mnc_digit2 = 9;
|
||||
attach_accept->tai_list.u.type0.mnc_digit2 = 0xf;
|
||||
attach_accept->tai_list.u.type0.mnc_digit3 = 0xf;
|
||||
attach_accept->tai_list.u.type0.tac[0] = 12345;
|
||||
attach_accept->esm_message_container.length = 50;
|
||||
attach_accept->esm_message_container.buffer = (c_uint8_t*)esm_payload[0];
|
||||
|
||||
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT;
|
||||
attach_accept->guti.length = 11;
|
||||
attach_accept->guti.type_of_identity = NAS_EPS_MOBILE_IDENTITY_GUTI;
|
||||
attach_accept->guti.u.guti.mcc_digit1 = 4;
|
||||
attach_accept->guti.u.guti.mcc_digit2 = 1;
|
||||
attach_accept->guti.u.guti.mcc_digit3 = 7;
|
||||
attach_accept->guti.u.guti.mnc_digit1 = 9;
|
||||
attach_accept->guti.u.guti.mnc_digit2 = 9;
|
||||
attach_accept->guti.u.guti.mnc_digit3 = 0xf;
|
||||
attach_accept->guti.u.guti.mme_group_id = 9029;
|
||||
attach_accept->guti.u.guti.mme_code = 225;
|
||||
attach_accept->guti.u.guti.m_tmsi = 0x00000456;
|
||||
|
||||
rv = nas_encode_pdu(&pkbuf, &message);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
{
|
||||
int i = 0;
|
||||
unsigned char *p = pkbuf->payload;
|
||||
for (i = 0; i < pkbuf->len; i++)
|
||||
printf("0x%x, 0x%x\n", payload[0][i], p[i]);
|
||||
|
||||
}
|
||||
ABTS_TRUE(tc, memcmp(pkbuf->payload, payload, pkbuf->len) == 0);
|
||||
|
||||
pkbuf_free(pkbuf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue