forked from acouzens/open5gs
attach accept encoding done
This commit is contained in:
parent
2a6d570d69
commit
a9c26b60a3
|
@ -4,14 +4,14 @@
|
|||
#include "core_lib.h"
|
||||
#include "nas_ies.h"
|
||||
|
||||
c_int32_t nas_encode_iei(pkbuf_t *pkbuf, c_uint8_t iei)
|
||||
c_int32_t nas_encode_optional_type(pkbuf_t *pkbuf, c_uint8_t type)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
size = sizeof(c_uint8_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, &iei, size);
|
||||
memcpy(pkbuf->payload - size, &type, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -48,6 +48,53 @@ c_int32_t nas_decode_location_area_identification(
|
|||
return size;
|
||||
}
|
||||
|
||||
c_int32_t nas_encode_location_area_identification(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_location_area_identification_t *location_area_identification)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
nas_location_area_identification_t target;
|
||||
|
||||
d_assert(location_area_identification, return -1, "Null param");
|
||||
memcpy(&target, location_area_identification,
|
||||
sizeof(nas_location_area_identification_t));
|
||||
|
||||
size = sizeof(nas_location_area_identification_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
target.lac = htons(location_area_identification->lac);
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 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(
|
||||
pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
nas_mobile_identity_t target;
|
||||
|
||||
d_assert(mobile_identity, return -1, "Null param");
|
||||
memcpy(&target, mobile_identity, sizeof(nas_mobile_identity_t));
|
||||
|
||||
size = mobile_identity->length + sizeof(mobile_identity->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
if (mobile_identity->u.tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI)
|
||||
{
|
||||
target.u.tmsi.tmsi = htonl(mobile_identity->u.tmsi.tmsi);
|
||||
target.u.tmsi.spare = 0xf;
|
||||
}
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.2.4 Mobile station classmark 2
|
||||
* See subclause 10.5.1.6 in 3GPP TS 24.008
|
||||
* O TLV 5 */
|
||||
|
@ -92,6 +139,25 @@ c_int32_t nas_decode_mobile_station_classmark_3(
|
|||
return size;
|
||||
}
|
||||
|
||||
/* 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(
|
||||
pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(plmn_list, return -1, "Null param");
|
||||
|
||||
size = plmn_list->length + sizeof(plmn_list->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
memcpy(pkbuf->payload - size, plmn_list, size);
|
||||
|
||||
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 */
|
||||
|
@ -123,6 +189,24 @@ c_int32_t nas_decode_additional_update_type(
|
|||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.0A Additional update result
|
||||
* O TV 1 */
|
||||
c_int32_t nas_encode_additional_update_result(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_additional_update_result_t *additional_update_result)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(additional_update_result, return -1, "Null param");
|
||||
|
||||
size = sizeof(nas_additional_update_result_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, additional_update_result, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.8 DRX parameter
|
||||
* See subclause 10.5.5.6 in 3GPP TS 24.008
|
||||
* O TV 3 */
|
||||
|
@ -139,6 +223,40 @@ c_int32_t nas_decode_drx_parameter(
|
|||
return size;
|
||||
}
|
||||
|
||||
/* 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_uint16_t size = 0;
|
||||
|
||||
d_assert(emm_cause, return -1, "Null param");
|
||||
|
||||
size = sizeof(nas_emm_cause_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, emm_cause, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.10 * EPS attach result
|
||||
* M V 1/2 */
|
||||
c_int32_t nas_encode_attach_result(
|
||||
pkbuf_t *pkbuf, nas_attach_result_t *attach_result)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(attach_result, return -1, "Null param");
|
||||
|
||||
size = sizeof(nas_attach_result_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, attach_result, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.11 EPS attach type
|
||||
* M V 1/2
|
||||
* 9.9.3.21 NAS key set identifier
|
||||
|
@ -170,8 +288,14 @@ c_int32_t nas_decode_eps_mobile_identity(
|
|||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
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)
|
||||
if (eps_mobile_identity->u.guti.type_of_identity ==
|
||||
NAS_EPS_MOBILE_IDENTITY_GUTI)
|
||||
{
|
||||
if (eps_mobile_identity->u.guti.spare != 0xf)
|
||||
{
|
||||
d_warn("Spec warning : eps_mobile_identy->spare = 0x%x",
|
||||
eps_mobile_identity->u.guti.spare);
|
||||
}
|
||||
eps_mobile_identity->u.guti.mme_group_id =
|
||||
ntohs(eps_mobile_identity->u.guti.mme_group_id);
|
||||
eps_mobile_identity->u.guti.m_tmsi =
|
||||
|
@ -194,9 +318,9 @@ status_t nas_encode_eps_mobile_identity(
|
|||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
if (target.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
|
||||
if (target.u.guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
|
||||
{
|
||||
target.digit1 = 0xf;
|
||||
target.u.guti.spare = 0xf;
|
||||
target.u.guti.mme_group_id =
|
||||
htons(eps_mobile_identity->u.guti.mme_group_id);
|
||||
target.u.guti.m_tmsi =
|
||||
|
@ -207,6 +331,25 @@ status_t nas_encode_eps_mobile_identity(
|
|||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.12A EPS network feature support
|
||||
* O TLV 3 */
|
||||
c_int32_t nas_encode_eps_network_feature_support(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_eps_network_feature_support_t *eps_network_feature_support)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(eps_network_feature_support, return -1, "Null param");
|
||||
|
||||
size = eps_network_feature_support->length +
|
||||
sizeof(eps_network_feature_support->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
memcpy(pkbuf->payload - size, eps_network_feature_support, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.15 ESM message container
|
||||
* M LV-E 5-n */
|
||||
|
@ -252,6 +395,26 @@ c_int32_t nas_encode_esm_message_container(
|
|||
sizeof(esm_message_container->length);
|
||||
}
|
||||
|
||||
/* 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
|
||||
*
|
||||
* 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_uint16_t size = 0;
|
||||
|
||||
d_assert(gprs_timer, return -1, "Null param");
|
||||
|
||||
size = sizeof(nas_gprs_timer_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, gprs_timer, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.16A GPRS timer 2
|
||||
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
|
||||
* O TLV 3 */
|
||||
|
@ -270,6 +433,21 @@ c_int32_t nas_decode_gprs_timer_2(
|
|||
|
||||
return size;
|
||||
}
|
||||
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_2(
|
||||
pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(gprs_timer_2, return -1, "Null param");
|
||||
|
||||
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
memcpy(pkbuf->payload - size, gprs_timer_2, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.16B GPRS timer 3
|
||||
* See subclause 10.5.7.4a in 3GPP TS 24.008 [13].
|
||||
|
@ -289,6 +467,21 @@ c_int32_t nas_decode_gprs_timer_3(
|
|||
|
||||
return size;
|
||||
}
|
||||
CORE_DECLARE(c_int32_t) nas_encode_gprs_timer_3(
|
||||
pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(gprs_timer_3, return -1, "Null param");
|
||||
|
||||
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
memcpy(pkbuf->payload - size, gprs_timer_3, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.20 MS network capability
|
||||
* See subclause 10.5.5.12 in 3GPP TS 24.008
|
||||
|
@ -391,6 +584,57 @@ c_int32_t nas_decode_tracking_area_identity(
|
|||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.33 Tracking area identity list
|
||||
* M LV 7-97 */
|
||||
c_int32_t nas_encode_tracking_area_identity_list(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_tracking_area_identity_list_t *tracking_area_identity_list)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
int i = 0;
|
||||
nas_tracking_area_identity_list_t target;
|
||||
|
||||
d_assert(tracking_area_identity_list, return -1, "Null param");
|
||||
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 (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)
|
||||
{
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1&&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
target.u.type0.tac[i] =
|
||||
htons(tracking_area_identity_list->u.type0.tac[i]);
|
||||
}
|
||||
}
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)
|
||||
{
|
||||
target.u.type1.tac = htons(tracking_area_identity_list->u.type1.tac);
|
||||
}
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)
|
||||
{
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 &&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
target.u.type2.tai[i].tac =
|
||||
htons(tracking_area_identity_list->u.type2.tai[i].tac);
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.34 UE network capability
|
||||
* M LV 3-14 */
|
||||
c_int32_t nas_decode_ue_network_capability(
|
||||
|
@ -462,87 +706,19 @@ c_int32_t nas_decode_extended_drx_parameters(
|
|||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 9.9.3.10 * EPS attach result
|
||||
* M V 1/2 */
|
||||
c_int32_t nas_encode_attach_result(
|
||||
pkbuf_t *pkbuf, nas_attach_result_t *attach_result)
|
||||
c_int32_t nas_encode_extended_drx_parameters(
|
||||
pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
|
||||
d_assert(attach_result, return -1, "Null param");
|
||||
d_assert(extended_drx_parameters, return -1, "Null param");
|
||||
|
||||
size = sizeof(nas_attach_result_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, attach_result, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 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
|
||||
*
|
||||
* 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_uint16_t size = 0;
|
||||
|
||||
size = sizeof(nas_gprs_timer_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
memcpy(pkbuf->payload - size, gprs_timer, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
c_int32_t nas_encode_tracking_area_identity_list(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_tracking_area_identity_list_t *tracking_area_identity_list)
|
||||
{
|
||||
c_uint16_t size = 0;
|
||||
int i = 0;
|
||||
nas_tracking_area_identity_list_t target;
|
||||
|
||||
d_assert(tracking_area_identity_list, return -1, "Null param");
|
||||
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);
|
||||
size = extended_drx_parameters->length +
|
||||
sizeof(extended_drx_parameters->length);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return -1, "pkbuf_header error");
|
||||
|
||||
if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)
|
||||
{
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1&&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
target.u.type0.tac[i] =
|
||||
htons(tracking_area_identity_list->u.type0.tac[i]);
|
||||
}
|
||||
}
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)
|
||||
{
|
||||
target.u.type1.tac = htons(tracking_area_identity_list->u.type1.tac);
|
||||
}
|
||||
else if (tracking_area_identity_list->type_of_list ==
|
||||
NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)
|
||||
{
|
||||
for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 &&
|
||||
i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)
|
||||
{
|
||||
target.u.type2.tai[i].tac =
|
||||
htons(tracking_area_identity_list->u.type2.tai[i].tac);
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
memcpy(pkbuf->payload - size, &target, size);
|
||||
memcpy(pkbuf->payload - size, extended_drx_parameters, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_iei(pkbuf_t *pkbuf, c_uint8_t iei);
|
||||
CORE_DECLARE(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].
|
||||
|
@ -38,6 +39,75 @@ CORE_DECLARE(c_int32_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(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_location_area_identification_t *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 */
|
||||
#define NAS_MOBILE_IDENTITY_NONE 0
|
||||
#define NAS_MOBILE_IDENTITY_IMSI 1
|
||||
#define NAS_MOBILE_IDENTITY_IMEI 2
|
||||
#define NAS_MOBILE_IDENTITY_IMEISV 3
|
||||
#define NAS_MOBILE_IDENTITY_TMSI 4
|
||||
#define NAS_MOBILE_IDENTITY_TMGI 5
|
||||
#define NAS_MOBILE_IDENTITY_GUTI 6
|
||||
typedef struct _nas_mobile_identity_imsi {
|
||||
ED3(c_uint8_t digit1:4;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
ED2(c_uint8_t digit3:4;,
|
||||
c_uint8_t digit2:4;)
|
||||
ED2(c_uint8_t digit5:4;,
|
||||
c_uint8_t digit4:4;)
|
||||
ED2(c_uint8_t digit7:4;,
|
||||
c_uint8_t digit6:4;)
|
||||
ED2(c_uint8_t digit9:4;,
|
||||
c_uint8_t digit8:4;)
|
||||
ED2(c_uint8_t digit11:4;,
|
||||
c_uint8_t digit10:4;)
|
||||
ED2(c_uint8_t digit13:4;,
|
||||
c_uint8_t digit12:4;)
|
||||
ED2(c_uint8_t digit15:4;,
|
||||
c_uint8_t digit14:4;)
|
||||
} __attribute__ ((packed)) nas_mobile_identity_imsi_t;
|
||||
|
||||
typedef struct _nas_mobile_identity_tmsi {
|
||||
ED3(c_uint8_t spare:4;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
c_uint32_t tmsi;
|
||||
} __attribute__ ((packed)) nas_mobile_identity_tmsi_t;
|
||||
|
||||
typedef struct _nas_mobile_identity_tmgi {
|
||||
ED5(c_uint8_t spare:2;,
|
||||
c_uint8_t mbms_session_id:1;,
|
||||
c_uint8_t mcc_mnc:1;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
c_uint8_t mbms_servicec_id[3];
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
c_uint8_t mbms_session_identity;
|
||||
} __attribute__ ((packed)) nas_mobile_identity_tmgi_t;
|
||||
|
||||
typedef struct _nas_mobile_identity_t {
|
||||
c_uint8_t length;
|
||||
union {
|
||||
nas_mobile_identity_imsi_t imsi;
|
||||
nas_mobile_identity_tmsi_t tmsi;
|
||||
nas_mobile_identity_tmgi_t tmgi;
|
||||
} u;
|
||||
} nas_mobile_identity_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_mobile_identity(
|
||||
pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity);
|
||||
|
||||
/* 9.9.2.4 Mobile station classmark 2
|
||||
* See subclause 10.5.1.6 in 3GPP TS 24.008
|
||||
* O TLV 5 */
|
||||
|
@ -92,6 +162,27 @@ CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_3(
|
|||
nas_mobile_station_classmark_3_t *mobile_station_classmark_3,
|
||||
pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.2.8 PLMN list
|
||||
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
|
||||
* O TLV 5-47 */
|
||||
#define NAS_MAX_PLMN 15
|
||||
typedef struct _nas_plmn_t {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
} __attribute__ ((packed)) nas_plmn_t;
|
||||
|
||||
typedef struct _nas_plmn_list_t {
|
||||
c_uint8_t length;
|
||||
nas_plmn_t plmn[NAS_MAX_PLMN];
|
||||
} __attribute__ ((packed)) nas_plmn_list_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_encode_plmn_list(
|
||||
pkbuf_t *pkbuf, nas_plmn_list_t *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 */
|
||||
|
@ -110,6 +201,18 @@ typedef struct _nas_supported_codec_list_t {
|
|||
CORE_DECLARE(c_int32_t) nas_decode_supported_codec_list(
|
||||
nas_supported_codec_list_t *supported_codec_list, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.0A Additional update result
|
||||
* O TV 1 */
|
||||
typedef struct _nas_additional_update_result_t {
|
||||
ED3(c_uint8_t type:4;,
|
||||
c_uint8_t spare:2;,
|
||||
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(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_additional_update_result_t *additional_update_result);
|
||||
|
||||
/* 9.9.3.0B Additional update type
|
||||
* O TV 1 */
|
||||
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_NONE 0
|
||||
|
@ -152,6 +255,61 @@ ED3(c_uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode
|
|||
CORE_DECLARE(c_int32_t) nas_decode_drx_parameter(
|
||||
nas_drx_parameter_t *drx_parameter, pkbuf_t *pkbuf);
|
||||
|
||||
/* 9.9.3.9 EMM cause
|
||||
* O TV 2 */
|
||||
#define NAS_EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 0b00000010
|
||||
#define NAS_EMM_CAUSE_ILLEGAL_UE 0b00000011
|
||||
#define NAS_EMM_CAUSE_IMEI_NOT_ACCEPTED 0b00000101
|
||||
#define NAS_EMM_CAUSE_ILLEGAL_ME 0b00000110
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED 0b00000111
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED 0b00001000
|
||||
#define NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 0b00001001
|
||||
#define NAS_EMM_CAUSE_IMPLICITLY_DETACHED 0b00001010
|
||||
#define NAS_EMM_CAUSE_PLMN_NOT_ALLOWED 0b00001011
|
||||
#define NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 0b00001100
|
||||
#define NAS_EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 0b00001101
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN 0b00001110
|
||||
#define NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 0b00001111
|
||||
#define NAS_EMM_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE 0b00010000
|
||||
#define NAS_EMM_CAUSE_NETWORK_FAILURE 0b00010001
|
||||
#define NAS_EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 0b00010010
|
||||
#define NAS_EMM_CAUSE_ESM_FAILURE 0b00010011
|
||||
#define NAS_EMM_CAUSE_MAC_FAILURE 0b00010100
|
||||
#define NAS_EMM_CAUSE_SYNCH_FAILURE 0b00010101
|
||||
#define NAS_EMM_CAUSE_CONGESTION 0b00010110
|
||||
#define NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 0b00010111
|
||||
#define NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 0b00011000
|
||||
#define NAS_EMM_CAUSE_NOT_AUTHORIZED_FOR_THIS_CSG 0b00011001
|
||||
#define NAS_EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE 0b00011010
|
||||
#define NAS_EMM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_AUTHORIZED_IN_THIS_PLMN 0b00100011
|
||||
#define NAS_EMM_CAUSE_CS_SERVICE_TEMPORARILY_NOT_AVAILABLE 0b00100111
|
||||
#define NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED 0b00101000
|
||||
#define NAS_EMM_CAUSE_SEVERE_NETWORK_FAILURE 0b00101010
|
||||
#define NAS_EMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 0b01011111
|
||||
#define NAS_EMM_CAUSE_INVALID_MANDATORY_INFORMATION 0b01100000
|
||||
#define NAS_EMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 0b01100001
|
||||
#define NAS_EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 0b01100010
|
||||
#define NAS_EMM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 0b01100011
|
||||
#define NAS_EMM_CAUSE_CONDITIONAL_IE_ERROR 0b01100100
|
||||
#define NAS_EMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 0b01100101
|
||||
#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(
|
||||
pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause);
|
||||
|
||||
/* 9.9.3.10 * EPS attach result
|
||||
* M V 1/2 */
|
||||
#define NAS_ATTACH_RESULT_EPS_ONLY 1
|
||||
#define NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH 2
|
||||
typedef struct _nas_attach_result_t {
|
||||
ED2(c_uint8_t spare:5;,
|
||||
c_uint8_t result:3;)
|
||||
} __attribute__ ((packed)) nas_attach_result_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_attach_result(
|
||||
pkbuf_t *pkbuf, nas_attach_result_t *attach_result);
|
||||
|
||||
/* 9.9.3.11 EPS attach type
|
||||
* M V 1/2
|
||||
* 9.9.3.21 NAS key set identifier
|
||||
|
@ -183,6 +341,9 @@ CORE_DECLARE(c_int32_t) nas_decode_attach_type(
|
|||
#define NAS_EPS_MOBILE_IDENTITY_EVEN 0
|
||||
#define NAS_EPS_MOBILE_IDENTITY_ODD 1
|
||||
typedef struct _nas_eps_mobile_identity_guti_t {
|
||||
ED3(c_uint8_t spare:4;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
|
@ -195,29 +356,29 @@ ED2(c_uint8_t mnc_digit2:4;,
|
|||
} __attribute__ ((packed)) nas_eps_mobile_identity_guti_t;
|
||||
|
||||
typedef struct _nas_eps_mobile_identity_imsi_t {
|
||||
ED2(c_uint8_t digit2:4;,
|
||||
c_uint8_t digit3:4;)
|
||||
ED2(c_uint8_t digit4:4;,
|
||||
c_uint8_t digit5:4;)
|
||||
ED2(c_uint8_t digit6:4;,
|
||||
c_uint8_t digit7:4;)
|
||||
ED2(c_uint8_t digit8:4;,
|
||||
c_uint8_t digit9:4;)
|
||||
ED2(c_uint8_t digit10:4;,
|
||||
c_uint8_t digit11:4;)
|
||||
ED2(c_uint8_t digit12:4;,
|
||||
c_uint8_t digit13:4;)
|
||||
ED2(c_uint8_t digit14:4;,
|
||||
c_uint8_t digit15:4;)
|
||||
ED3(c_uint8_t digit1:4;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
ED2(c_uint8_t digit3:4;,
|
||||
c_uint8_t digit2:4;)
|
||||
ED2(c_uint8_t digit5:4;,
|
||||
c_uint8_t digit4:4;)
|
||||
ED2(c_uint8_t digit7:4;,
|
||||
c_uint8_t digit6:4;)
|
||||
ED2(c_uint8_t digit9:4;,
|
||||
c_uint8_t digit8:4;)
|
||||
ED2(c_uint8_t digit11:4;,
|
||||
c_uint8_t digit10:4;)
|
||||
ED2(c_uint8_t digit13:4;,
|
||||
c_uint8_t digit12:4;)
|
||||
ED2(c_uint8_t digit15:4;,
|
||||
c_uint8_t digit14:4;)
|
||||
} __attribute__ ((packed)) nas_eps_mobile_identity_imsi_t;
|
||||
|
||||
typedef nas_eps_mobile_identity_imsi_t nas_eps_mobile_identity_imei_t;
|
||||
|
||||
typedef struct _nas_eps_mobile_identity_t {
|
||||
c_uint8_t length;
|
||||
ED3(c_uint8_t digit1:4;,
|
||||
c_uint8_t odd_even:1;,
|
||||
c_uint8_t type_of_identity:3;)
|
||||
union {
|
||||
nas_eps_mobile_identity_imsi_t imsi;
|
||||
nas_eps_mobile_identity_guti_t guti;
|
||||
|
@ -230,6 +391,28 @@ CORE_DECLARE(c_int32_t) nas_decode_eps_mobile_identity(
|
|||
CORE_DECLARE(c_int32_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
|
||||
* O TLV 3 */
|
||||
typedef struct _nas_eps_network_feature_support_t {
|
||||
c_uint8_t length;
|
||||
ED7(c_uint8_t cp_ciot:1;,
|
||||
c_uint8_t erw_opdn:1;,
|
||||
c_uint8_t esr_ps:1;,
|
||||
c_uint8_t cs_lcs:2;,
|
||||
c_uint8_t epc_lcs:1;,
|
||||
c_uint8_t emc_bs:1;,
|
||||
c_uint8_t ims_vops:1;)
|
||||
ED5(c_uint8_t spare:4;,
|
||||
c_uint8_t e_pco:1;,
|
||||
c_uint8_t hc_cp_ciot:1;,
|
||||
c_uint8_t s1_u_data:1;,
|
||||
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(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_eps_network_feature_support_t *eps_network_feature_support);
|
||||
|
||||
/* 9.9.3.15 ESM message container
|
||||
* M LV-E 5-n */
|
||||
typedef struct _nas_esm_message_container_t {
|
||||
|
@ -242,6 +425,21 @@ CORE_DECLARE(c_int32_t) nas_decode_esm_message_container(
|
|||
CORE_DECLARE(c_int32_t) nas_encode_esm_message_container(
|
||||
pkbuf_t *pkbuf, nas_esm_message_container_t *esm_message_container);
|
||||
|
||||
/* 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 NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_2_SS 0
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM 1
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2
|
||||
#define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7
|
||||
typedef struct _nas_gprs_timer_t {
|
||||
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(
|
||||
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 */
|
||||
|
@ -252,6 +450,8 @@ typedef struct _nas_gprs_timer_2_t {
|
|||
|
||||
CORE_DECLARE(c_int32_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(
|
||||
pkbuf_t *pkbuf, nas_gprs_timer_2_t *gprs_timer_2);
|
||||
|
||||
/* 9.9.3.16B GPRS timer 3
|
||||
* See subclause 10.5.7.4a in 3GPP TS 24.008 [13].
|
||||
|
@ -273,6 +473,8 @@ ED2(c_uint8_t unit:3;,
|
|||
|
||||
CORE_DECLARE(c_int32_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(
|
||||
pkbuf_t *pkbuf, nas_gprs_timer_3_t *gprs_timer_3);
|
||||
|
||||
/* 9.9.3.20 MS network capability
|
||||
* See subclause 10.5.5.12 in 3GPP TS 24.008
|
||||
|
@ -377,6 +579,52 @@ ED2(c_uint8_t mnc_digit2:4;,
|
|||
CORE_DECLARE(c_int32_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
|
||||
* M LV 7-97 */
|
||||
#define NAS_MAX_TRACKING_AREA_IDENTITY 16
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS 0
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS 1
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS 2
|
||||
typedef struct _nas_tracking_area_identity_type0 {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
c_uint16_t tac[NAS_MAX_TRACKING_AREA_IDENTITY];
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type0;
|
||||
|
||||
typedef struct _nas_tracking_area_identity_type1 {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
c_uint16_t tac;
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type1;
|
||||
|
||||
typedef struct _nas_tracking_area_identity_type2 {
|
||||
nas_tracking_area_identity_type1 tai[NAS_MAX_TRACKING_AREA_IDENTITY];
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type2;
|
||||
|
||||
typedef struct nas_tracking_area_identity_list_t {
|
||||
c_uint8_t length;
|
||||
ED3(c_uint8_t spare:1;,
|
||||
c_uint8_t type_of_list:2;,
|
||||
c_uint8_t number_of_elements:5;)
|
||||
union {
|
||||
nas_tracking_area_identity_type0 type0;
|
||||
nas_tracking_area_identity_type1 type1;
|
||||
nas_tracking_area_identity_type2 type2;
|
||||
} u;
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_list_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_tracking_area_identity_list(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_tracking_area_identity_list_t *tracking_area_identity_list);
|
||||
|
||||
/* 9.9.3.34 UE network capability
|
||||
* M LV 3-14 */
|
||||
typedef struct _nas_ue_network_capability_t {
|
||||
|
@ -473,192 +721,8 @@ ED2(c_uint8_t paging_time_window:4;,
|
|||
|
||||
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
|
||||
* M V 1/2 */
|
||||
#define NAS_ATTACH_RESULT_EPS_ONLY 1
|
||||
#define NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH 2
|
||||
typedef struct _nas_attach_result_t {
|
||||
ED2(c_uint8_t spare:5;,
|
||||
c_uint8_t result:3;)
|
||||
} __attribute__ ((packed)) nas_attach_result_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_attach_result(
|
||||
pkbuf_t *pkbuf, nas_attach_result_t *attach_result);
|
||||
|
||||
/* 9.9.3.33 Tracking area identity list
|
||||
* M LV 7-97 */
|
||||
#define NAS_MAX_TRACKING_AREA_IDENTITY 16
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS 0
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS 1
|
||||
#define NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS 2
|
||||
typedef struct _nas_tracking_area_identity_type0 {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
c_uint16_t tac[NAS_MAX_TRACKING_AREA_IDENTITY];
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type0;
|
||||
|
||||
typedef struct _nas_tracking_area_identity_type1 {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
c_uint16_t tac;
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type1;
|
||||
|
||||
typedef struct _nas_tracking_area_identity_type2 {
|
||||
nas_tracking_area_identity_type1 tai[NAS_MAX_TRACKING_AREA_IDENTITY];
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_type2;
|
||||
|
||||
typedef struct nas_tracking_area_identity_list_t {
|
||||
c_uint8_t length;
|
||||
ED3(c_uint8_t spare:1;,
|
||||
c_uint8_t type_of_list:2;,
|
||||
c_uint8_t number_of_elements:5;)
|
||||
union {
|
||||
nas_tracking_area_identity_type0 type0;
|
||||
nas_tracking_area_identity_type1 type1;
|
||||
nas_tracking_area_identity_type2 type2;
|
||||
} u;
|
||||
} __attribute__ ((packed)) nas_tracking_area_identity_list_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_tracking_area_identity_list(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_tracking_area_identity_list_t *tracking_area_identity_list);
|
||||
|
||||
/* 9.9.3.16 GPRS timer
|
||||
* See subclause 10.5.7.3 in 3GPP TS 24.008 [13].
|
||||
* O TV 2
|
||||
*
|
||||
* Note : Other values shall be interpreted as multiples of 1 minute
|
||||
* in this version of the protocol. */
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_2_SS 0
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM 1
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM_3 3
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM_4 4
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM_5 5
|
||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM_6 6
|
||||
#define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7
|
||||
typedef struct _nas_gprs_timer_t {
|
||||
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(
|
||||
pkbuf_t *pkbuf, nas_gprs_timer_t *gprs_timer);
|
||||
|
||||
/* 9.9.2.3 Mobile identity
|
||||
* See subclause 10.5.1.4 in 3GPP TS 24.008 [13].
|
||||
* O TLV 7-10 */
|
||||
typedef nas_eps_mobile_identity_t nas_mobile_identity_t;
|
||||
|
||||
CORE_DECLARE(c_int32_t) nas_encode_mobile_identity(
|
||||
pkbuf_t *pkbuf, nas_mobile_identity_t *mobile_identity);
|
||||
|
||||
/* 9.9.3.9 EMM cause
|
||||
* O TV 2 */
|
||||
#define NAS_EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 0b00000010
|
||||
#define NAS_EMM_CAUSE_ILLEGAL_UE 0b00000011
|
||||
#define NAS_EMM_CAUSE_IMEI_NOT_ACCEPTED 0b00000101
|
||||
#define NAS_EMM_CAUSE_ILLEGAL_ME 0b00000110
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED 0b00000111
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED 0b00001000
|
||||
#define NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 0b00001001
|
||||
#define NAS_EMM_CAUSE_IMPLICITLY_DETACHED 0b00001010
|
||||
#define NAS_EMM_CAUSE_PLMN_NOT_ALLOWED 0b00001011
|
||||
#define NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 0b00001100
|
||||
#define NAS_EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 0b00001101
|
||||
#define NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN 0b00001110
|
||||
#define NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 0b00001111
|
||||
#define NAS_EMM_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE 0b00010000
|
||||
#define NAS_EMM_CAUSE_NETWORK_FAILURE 0b00010001
|
||||
#define NAS_EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 0b00010010
|
||||
#define NAS_EMM_CAUSE_ESM_FAILURE 0b00010011
|
||||
#define NAS_EMM_CAUSE_MAC_FAILURE 0b00010100
|
||||
#define NAS_EMM_CAUSE_SYNCH_FAILURE 0b00010101
|
||||
#define NAS_EMM_CAUSE_CONGESTION 0b00010110
|
||||
#define NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 0b00010111
|
||||
#define NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 0b00011000
|
||||
#define NAS_EMM_CAUSE_NOT_AUTHORIZED_FOR_THIS_CSG 0b00011001
|
||||
#define NAS_EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE 0b00011010
|
||||
#define NAS_EMM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_AUTHORIZED_IN_THIS_PLMN 0b00100011
|
||||
#define NAS_EMM_CAUSE_CS_SERVICE_TEMPORARILY_NOT_AVAILABLE 0b00100111
|
||||
#define NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED 0b00101000
|
||||
#define NAS_EMM_CAUSE_SEVERE_NETWORK_FAILURE 0b00101010
|
||||
#define NAS_EMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 0b01011111
|
||||
#define NAS_EMM_CAUSE_INVALID_MANDATORY_INFORMATION 0b01100000
|
||||
#define NAS_EMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 0b01100001
|
||||
#define NAS_EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 0b01100010
|
||||
#define NAS_EMM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 0b01100011
|
||||
#define NAS_EMM_CAUSE_CONDITIONAL_IE_ERROR 0b01100100
|
||||
#define NAS_EMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 0b01100101
|
||||
#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(
|
||||
pkbuf_t *pkbuf, nas_emm_cause_t *emm_cause);
|
||||
|
||||
/* 9.9.2.8 PLMN list
|
||||
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
|
||||
* O TLV 5-47 */
|
||||
#define NAS_MAX_PLMN 15
|
||||
typedef struct _nas_plmn_t {
|
||||
ED2(c_uint8_t mcc_digit2:4;,
|
||||
c_uint8_t mcc_digit1:4;)
|
||||
ED2(c_uint8_t mnc_digit3:4;,
|
||||
c_uint8_t mcc_digit3:4;)
|
||||
ED2(c_uint8_t mnc_digit2:4;,
|
||||
c_uint8_t mnc_digit1:4;)
|
||||
} __attribute__ ((packed)) nas_plmn_t;
|
||||
|
||||
typedef struct _nas_plmn_list_t {
|
||||
c_uint8_t length;
|
||||
nas_plmn_t plmn[NAS_MAX_PLMN];
|
||||
} __attribute__ ((packed)) nas_plmn_list_t;
|
||||
|
||||
CORE_DECLARE(status_t) nas_encode_plmn_list(
|
||||
pkbuf_t *pkbuf, nas_plmn_list_t *plmn_list);
|
||||
|
||||
/* 9.9.3.12A EPS network feature support
|
||||
* O TLV 3 */
|
||||
typedef struct _nas_eps_network_feature_support_t {
|
||||
c_uint8_t length;
|
||||
ED7(c_uint8_t cp_ciot:1;,
|
||||
c_uint8_t erw_opdn:1;,
|
||||
c_uint8_t esr_ps:1;,
|
||||
c_uint8_t cs_lcs:2;,
|
||||
c_uint8_t epc_lcs:1;,
|
||||
c_uint8_t emc_bs:1;,
|
||||
c_uint8_t ims_vops:1;)
|
||||
ED5(c_uint8_t spare:4;,
|
||||
c_uint8_t e_pco:1;,
|
||||
c_uint8_t hc_cp_ciot:1;,
|
||||
c_uint8_t s1_u_data:1;,
|
||||
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(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_eps_network_feature_support_t *eps_network_feature_support);
|
||||
|
||||
/* 9.9.3.0A Additional update result
|
||||
* O TV 1 */
|
||||
typedef struct _nas_additional_update_result_t {
|
||||
ED3(c_uint8_t type:4;,
|
||||
c_uint8_t spare:2;,
|
||||
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(
|
||||
pkbuf_t *pkbuf,
|
||||
nas_additional_update_result_t *additional_update_result);
|
||||
CORE_DECLARE(c_int32_t) nas_encode_extended_drx_parameters(
|
||||
pkbuf_t *pkbuf, nas_extended_drx_parameters_t *extended_drx_parameters);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -35,133 +35,133 @@ c_int32_t nas_decode_attach_request(nas_message_t *message, pkbuf_t *pkbuf)
|
|||
|
||||
switch(type)
|
||||
{
|
||||
case NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_IEI:
|
||||
case NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE:
|
||||
size = nas_decode_p_tmsi_signature(
|
||||
&attach_request->old_p_tmsi_signature, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_TYPE:
|
||||
size = nas_decode_eps_mobile_identity(
|
||||
&attach_request->additional_guti, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE:
|
||||
size = nas_decode_tracking_area_identity(
|
||||
&attach_request->last_visited_registered_tai, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
attach_request->presencemask |=
|
||||
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI;
|
||||
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE;
|
||||
break;
|
||||
case NAS_ATTACH_REQUEST_DRX_PARAMETER_IEI:
|
||||
case NAS_ATTACH_REQUEST_DRX_PARAMETER_TYPE:
|
||||
size = nas_decode_drx_parameter(
|
||||
&attach_request->drx_parameter, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_TYPE:
|
||||
size = nas_decode_ms_network_capability(
|
||||
&attach_request->ms_network_capability, 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_OLD_LOCATION_AREA_IDENTIFICATION_IEI:
|
||||
case NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE:
|
||||
size = nas_decode_location_area_identification(
|
||||
&attach_request->old_location_area_identification, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_TMSI_STATUS_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE:
|
||||
size = nas_decode_mobile_station_classmark_2(
|
||||
&attach_request->mobile_station_classmark_2, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE:
|
||||
size = nas_decode_mobile_station_classmark_3(
|
||||
&attach_request->mobile_station_classmark_3, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_SUPPORTED_CODECS_TYPE:
|
||||
size = nas_decode_supported_codec_list(
|
||||
&attach_request->supported_codecs, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE:
|
||||
size = nas_decode_additional_update_type(
|
||||
&attach_request->additional_update_type, pkbuf);
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_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:
|
||||
case NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_T3324_VALUE_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE:
|
||||
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:
|
||||
case NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE:
|
||||
size = nas_decode_extended_drx_parameters(
|
||||
&attach_request->extended_drx_parameters, pkbuf);
|
||||
d_assert(size >= 0, return -1, "decode failed");
|
||||
|
@ -300,7 +300,7 @@ c_int32_t nas_encode_attach_accept(pkbuf_t *pkbuf, nas_message_t *message)
|
|||
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_GUTI_PRESENT)
|
||||
{
|
||||
size = nas_encode_iei(pkbuf, NAS_ATTACH_ACCEPT_GUTI_IEI);
|
||||
size = nas_encode_optional_type(pkbuf, NAS_ATTACH_ACCEPT_GUTI_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
|
@ -311,45 +311,141 @@ c_int32_t nas_encode_attach_accept(pkbuf_t *pkbuf, nas_message_t *message)
|
|||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_location_area_identification(pkbuf,
|
||||
&attach_accept->location_area_identification);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_MS_IDENTITY_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_mobile_identity(pkbuf,
|
||||
&attach_accept->ms_identity);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_EMM_CAUSE_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_emm_cause(pkbuf, &attach_accept->emm_cause);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3402_VALUE_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_T3402_VALUE_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_gprs_timer(pkbuf, &attach_accept->t3402_value);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3423_VALUE_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_T3423_VALUE_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_gprs_timer(pkbuf, &attach_accept->t3423_value);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_plmn_list(pkbuf, &attach_accept->equivalent_plmns);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
/* 9.9.3.37 Emergency number list
|
||||
* See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
|
||||
* O TLV 5-50
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT)
|
||||
{
|
||||
}
|
||||
*/
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_eps_network_feature_support(pkbuf,
|
||||
&attach_accept->eps_network_feature_support);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT)
|
||||
{
|
||||
attach_accept->additional_update_result.type =
|
||||
(NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE >> 4);
|
||||
|
||||
size = nas_encode_additional_update_result(pkbuf,
|
||||
&attach_accept->additional_update_result);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_gprs_timer_3(pkbuf,
|
||||
&attach_accept->t3412_extended_value);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask & NAS_ATTACH_ACCEPT_T3324_VALUE_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_gprs_timer_2(pkbuf, &attach_accept->t3324_value);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
if (attach_accept->presencemask &
|
||||
NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT)
|
||||
{
|
||||
size = nas_encode_optional_type(pkbuf,
|
||||
NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
|
||||
size = nas_encode_extended_drx_parameters(pkbuf,
|
||||
&attach_accept->extended_drx_parameters);
|
||||
d_assert(size >= 0, return encoded, "decode failed");
|
||||
encoded += size;
|
||||
}
|
||||
|
||||
return encoded;
|
||||
|
|
|
@ -101,19 +101,19 @@ ED2(c_uint8_t security_header_type:4;,
|
|||
#define NAS_ATTACH_ACCEPT_T3324_VALUE_PRESENT (1<<11)
|
||||
#define NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_PRESENT (1<<12)
|
||||
|
||||
#define NAS_ATTACH_ACCEPT_GUTI_IEI 0x50
|
||||
#define NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI 0x13
|
||||
#define NAS_ATTACH_ACCEPT_MS_IDENTITY_IEI 0x23
|
||||
#define NAS_ATTACH_ACCEPT_EMM_CAUSE_IEI 0x53
|
||||
#define NAS_ATTACH_ACCEPT_T3402_VALUE_IEI 0x17
|
||||
#define NAS_ATTACH_ACCEPT_T3423_VALUE_IEI 0x59
|
||||
#define NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI 0x4A
|
||||
#define NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI 0x34
|
||||
#define NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI 0x64
|
||||
#define NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI 0xF0
|
||||
#define NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_IEI 0x5E
|
||||
#define NAS_ATTACH_ACCEPT_T3324_VALUE_IEI 0x6A
|
||||
#define NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_IEI 0x6E
|
||||
#define NAS_ATTACH_ACCEPT_GUTI_TYPE 0x50
|
||||
#define NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_TYPE 0x13
|
||||
#define NAS_ATTACH_ACCEPT_MS_IDENTITY_TYPE 0x23
|
||||
#define NAS_ATTACH_ACCEPT_EMM_CAUSE_TYPE 0x53
|
||||
#define NAS_ATTACH_ACCEPT_T3402_VALUE_TYPE 0x17
|
||||
#define NAS_ATTACH_ACCEPT_T3423_VALUE_TYPE 0x59
|
||||
#define NAS_ATTACH_ACCEPT_EQUIVALENT_PLMNS_TYPE 0x4A
|
||||
#define NAS_ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_TYPE 0x34
|
||||
#define NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_TYPE 0x64
|
||||
#define NAS_ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_TYPE 0xF0
|
||||
#define NAS_ATTACH_ACCEPT_T3412_EXTENDED_VALUE_TYPE 0x5E
|
||||
#define NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE 0x6A
|
||||
#define NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||
|
||||
|
||||
/* 8.2.1 Attach accept */
|
||||
|
@ -166,25 +166,25 @@ typedef struct _nas_attach_accept_t {
|
|||
#define NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_PRESENT (1<<17)
|
||||
#define NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_PRESENT (1<<18)
|
||||
|
||||
#define NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_IEI 0x19
|
||||
#define NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_IEI 0x50
|
||||
#define NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI 0x52
|
||||
#define NAS_ATTACH_REQUEST_DRX_PARAMETER_IEI 0x5C
|
||||
#define NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI 0x31
|
||||
#define NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI 0x13
|
||||
#define NAS_ATTACH_REQUEST_TMSI_STATUS_IEI 0x90
|
||||
#define NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI 0x11
|
||||
#define NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI 0x20
|
||||
#define NAS_ATTACH_REQUEST_SUPPORTED_CODECS_IEI 0x40
|
||||
#define NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI 0xF0
|
||||
#define NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI 0x5D
|
||||
#define NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_IEI 0xD0
|
||||
#define NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_IEI 0xE0
|
||||
#define NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_IEI 0xC0
|
||||
#define NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_IEI 0x10
|
||||
#define NAS_ATTACH_REQUEST_T3324_VALUE_IEI 0x6A
|
||||
#define NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_IEI 0x5E
|
||||
#define NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_IEI 0x6E
|
||||
#define NAS_ATTACH_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE 0x19
|
||||
#define NAS_ATTACH_REQUEST_ADDITIONAL_GUTI_TYPE 0x50
|
||||
#define NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_TYPE 0x52
|
||||
#define NAS_ATTACH_REQUEST_DRX_PARAMETER_TYPE 0x5C
|
||||
#define NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_TYPE 0x31
|
||||
#define NAS_ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_TYPE 0x13
|
||||
#define NAS_ATTACH_REQUEST_TMSI_STATUS_TYPE 0x90
|
||||
#define NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_TYPE 0x11
|
||||
#define NAS_ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_TYPE 0x20
|
||||
#define NAS_ATTACH_REQUEST_SUPPORTED_CODECS_TYPE 0x40
|
||||
#define NAS_ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_TYPE 0xF0
|
||||
#define NAS_ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_TYPE 0x5D
|
||||
#define NAS_ATTACH_REQUEST_DEVICE_PROPERTIES_TYPE 0xD0
|
||||
#define NAS_ATTACH_REQUEST_OLD_GUTI_TYPE_TYPE 0xE0
|
||||
#define NAS_ATTACH_REQUEST_MS_NETWORK_FEATURE_SUPPORT_TYPE 0xC0
|
||||
#define NAS_ATTACH_REQUEST_TMSI_BASED_NRI_CONTAINER_TYPE 0x10
|
||||
#define NAS_ATTACH_REQUEST_T3324_VALUE_TYPE 0x6A
|
||||
#define NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE 0x5E
|
||||
#define NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||
|
||||
typedef struct _nas_attach_request_t {
|
||||
/* Mandatory fields */
|
||||
|
|
|
@ -70,7 +70,7 @@ static void nas_message_test2(abts_case *tc, void *data)
|
|||
|
||||
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.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;
|
||||
|
@ -81,17 +81,31 @@ static void nas_message_test2(abts_case *tc, void *data)
|
|||
attach_accept->guti.u.guti.mme_code = 225;
|
||||
attach_accept->guti.u.guti.m_tmsi = 0x00000456;
|
||||
|
||||
attach_accept->presencemask |=
|
||||
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT;
|
||||
attach_accept->location_area_identification.mcc_digit1 = 0;
|
||||
attach_accept->location_area_identification.mcc_digit2 = 0;
|
||||
attach_accept->location_area_identification.mcc_digit3 = 1;
|
||||
attach_accept->location_area_identification.mnc_digit1 = 0;
|
||||
attach_accept->location_area_identification.mnc_digit2 = 2;
|
||||
attach_accept->location_area_identification.mnc_digit3 = 0xf;
|
||||
attach_accept->location_area_identification.lac = 0xfffd;
|
||||
|
||||
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT;
|
||||
attach_accept->ms_identity.length = 5;
|
||||
attach_accept->ms_identity.u.tmsi.type_of_identity =
|
||||
NAS_MOBILE_IDENTITY_TMSI;
|
||||
attach_accept->ms_identity.u.tmsi.tmsi = 0x00e102d4;
|
||||
|
||||
attach_accept->presencemask |=
|
||||
NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT;
|
||||
attach_accept->eps_network_feature_support.length = 1;
|
||||
attach_accept->eps_network_feature_support.esr_ps = 1;
|
||||
attach_accept->eps_network_feature_support.emc_bs = 1;
|
||||
attach_accept->eps_network_feature_support.ims_vops = 1;
|
||||
|
||||
rv = nas_encode_pdu(&pkbuf, &message);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
#if 0
|
||||
{
|
||||
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]);
|
||||
|
||||
}
|
||||
#endif
|
||||
ABTS_TRUE(tc, memcmp(pkbuf->payload, payload[0], pkbuf->len) == 0);
|
||||
|
||||
pkbuf_free(pkbuf);
|
||||
|
|
Loading…
Reference in New Issue