update it

This commit is contained in:
Sukchan Lee 2017-03-05 18:09:34 +09:00
parent 2f544fdc4b
commit fbc6d9cb5f
5 changed files with 69 additions and 46 deletions

View File

@ -83,10 +83,10 @@ c_int32_t nas_encode_mobile_identity(
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)
if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI)
{
target.u.tmsi.tmsi = htonl(mobile_identity->u.tmsi.tmsi);
target.u.tmsi.spare = 0xf;
target.tmsi.tmsi = htonl(mobile_identity->tmsi.tmsi);
target.tmsi.spare = 0xf;
}
memcpy(pkbuf->payload - size, &target, size);
@ -284,18 +284,18 @@ 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->u.guti.type_of_identity ==
if (eps_mobile_identity->guti.type_of_identity ==
NAS_EPS_MOBILE_IDENTITY_GUTI)
{
if (eps_mobile_identity->u.guti.spare != 0xf)
if (eps_mobile_identity->guti.spare != 0xf)
{
d_warn("Spec warning : eps_mobile_identy->spare = 0x%x",
eps_mobile_identity->u.guti.spare);
eps_mobile_identity->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 =
ntohl(eps_mobile_identity->u.guti.m_tmsi);
eps_mobile_identity->guti.mme_group_id =
ntohs(eps_mobile_identity->guti.mme_group_id);
eps_mobile_identity->guti.m_tmsi =
ntohl(eps_mobile_identity->guti.m_tmsi);
}
return size;
@ -314,13 +314,13 @@ status_t nas_encode_eps_mobile_identity(
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
return -1, "pkbuf_header error");
if (target.u.guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
if (target.guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)
{
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 =
htonl(eps_mobile_identity->u.guti.m_tmsi);
target.guti.spare = 0xf;
target.guti.mme_group_id =
htons(eps_mobile_identity->guti.mme_group_id);
target.guti.m_tmsi =
htonl(eps_mobile_identity->guti.m_tmsi);
}
memcpy(pkbuf->payload - size, &target, size);
@ -619,14 +619,14 @@ c_int32_t nas_encode_tracking_area_identity_list(
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]);
target.type0.tac[i] =
htons(tracking_area_identity_list->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);
target.type1.tac = htons(tracking_area_identity_list->type1.tac);
}
else if (tracking_area_identity_list->type_of_list ==
NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)
@ -634,8 +634,8 @@ c_int32_t nas_encode_tracking_area_identity_list(
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);
target.type2.tai[i].tac =
htons(tracking_area_identity_list->type2.tai[i].tac);
}
}
else

View File

@ -102,7 +102,7 @@ typedef struct _nas_mobile_identity_t {
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(
@ -383,7 +383,7 @@ typedef struct _nas_eps_mobile_identity_t {
nas_eps_mobile_identity_imsi_t imsi;
nas_eps_mobile_identity_guti_t guti;
nas_eps_mobile_identity_imei_t imei;
} u;
};
} __attribute__ ((packed)) nas_eps_mobile_identity_t;
CORE_DECLARE(c_int32_t) nas_decode_eps_mobile_identity(
@ -630,7 +630,7 @@ ED3(c_uint8_t spare:1;,
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(

View File

@ -54,11 +54,12 @@ void enb_s1ap_state_operational(enb_s1ap_sm_t *s, event_t *e)
s1ap_message message;
status_t rv;
pkbuf_t *recvbuf = (pkbuf_t *)event_get_param2(e);
d_assert(recvbuf, break, "Null param");
rv = s1ap_decode_pdu(&message, recvbuf);
if (rv != CORE_OK)
{
d_error("Can't parse S1AP_PDU in EVT_ENB_S1APAP_INF");
d_error("Can't parse S1AP_PDU");
break;
}

View File

@ -2,6 +2,8 @@
#include "core_debug.h"
#include "nas_message.h"
#include "sm.h"
#include "context.h"
#include "event.h"
@ -44,11 +46,31 @@ void ue_emm_state_operational(ue_emm_sm_t *s, event_t *e)
}
case EVT_MSG_UE_EMM:
{
nas_message_t message;
status_t rv;
pkbuf_t *recvbuf = (pkbuf_t *)event_get_param2(e);
d_assert(recvbuf, break, "Null param");
d_print_hex(recvbuf->payload, recvbuf->len);
d_info("Received EVT_MSG_UE_EMM");
rv = nas_decode_pdu(&message, recvbuf);
if (rv != CORE_OK)
{
d_error("Can't parse NAS_PDU");
break;
}
switch(message.h.message_type)
{
case NAS_ATTACH_REQUEST:
{
d_info("Received ATTACH_REQUEST");
break;
}
default:
{
d_warn("Not implemented(type:%d)", message.h.message_type);
break;
}
}
pkbuf_free(recvbuf);
break;

View File

@ -64,29 +64,29 @@ static void nas_message_test2(abts_case *tc, void *data)
NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM;
attach_accept->t3412_value.timer_value = 3;
attach_accept->tai_list.length = 6;
attach_accept->tai_list.u.type0.mcc_digit1 = 4;
attach_accept->tai_list.u.type0.mcc_digit2 = 1;
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_digit3 = 0xf;
attach_accept->tai_list.u.type0.tac[0] = 12345;
attach_accept->tai_list.type0.mcc_digit1 = 4;
attach_accept->tai_list.type0.mcc_digit2 = 1;
attach_accept->tai_list.type0.mcc_digit3 = 7;
attach_accept->tai_list.type0.mnc_digit1 = 9;
attach_accept->tai_list.type0.mnc_digit2 = 9;
attach_accept->tai_list.type0.mnc_digit3 = 0xf;
attach_accept->tai_list.type0.tac[0] = 12345;
attach_accept->esm_message_container.length = sizeof(esm_buffer);
attach_accept->esm_message_container.buffer =
core_ascii_to_hex(esm_payload, strlen(esm_payload), esm_buffer);
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT;
attach_accept->guti.length = 11;
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;
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;
attach_accept->guti.guti.type_of_identity = NAS_EPS_MOBILE_IDENTITY_GUTI;
attach_accept->guti.guti.mcc_digit1 = 4;
attach_accept->guti.guti.mcc_digit2 = 1;
attach_accept->guti.guti.mcc_digit3 = 7;
attach_accept->guti.guti.mnc_digit1 = 9;
attach_accept->guti.guti.mnc_digit2 = 9;
attach_accept->guti.guti.mnc_digit3 = 0xf;
attach_accept->guti.guti.mme_group_id = 9029;
attach_accept->guti.guti.mme_code = 225;
attach_accept->guti.guti.m_tmsi = 0x00000456;
attach_accept->presencemask |=
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT;
@ -100,9 +100,9 @@ static void nas_message_test2(abts_case *tc, void *data)
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT;
attach_accept->ms_identity.length = 5;
attach_accept->ms_identity.u.tmsi.type_of_identity =
attach_accept->ms_identity.tmsi.type_of_identity =
NAS_MOBILE_IDENTITY_TMSI;
attach_accept->ms_identity.u.tmsi.tmsi = 0x00e102d4;
attach_accept->ms_identity.tmsi.tmsi = 0x00e102d4;
attach_accept->presencemask |=
NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT;