From 6ddd15f1bdc3fd3390e653b9d7de4622723f8ba5 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sun, 5 Mar 2017 23:36:17 +0900 Subject: [PATCH] update it --- lib/3gpp/3gpp_message.h | 4 +- lib/core/include/core_lib.h | 4 +- lib/core/src/misc.c | 2 +- lib/core/test/testmisc.c | 16 +++---- lib/nas/nas_encoder.c | 2 +- lib/nas/nas_ies.h | 84 +++++++------------------------------ lib/s1ap/s1ap_encoder.c | 14 +++---- src/hss/Makefile.am | 1 + src/hss/context.h | 2 +- src/hss/init.c | 2 +- src/mme/Makefile.am | 2 + src/mme/context.h | 3 ++ src/mme/s1ap_conv.h | 10 ++--- src/mme/s1ap_path.c | 2 +- src/mme/ue_emm_sm.c | 40 +++++++++++++++++- test/nas_message_test.c | 40 +++++++++--------- test/nas_sm_test.c | 4 +- test/s1ap_message_test.c | 6 +-- test/s1ap_sm_test.c | 4 +- test/tests1ap.c | 2 +- 20 files changed, 119 insertions(+), 125 deletions(-) diff --git a/lib/3gpp/3gpp_message.h b/lib/3gpp/3gpp_message.h index 4b20021ec..3fc0b9ad1 100644 --- a/lib/3gpp/3gpp_message.h +++ b/lib/3gpp/3gpp_message.h @@ -7,7 +7,9 @@ extern "C" { #endif /* __cplusplus */ -#define MSG_SDU_SIZE 2048 +#define MESSAGE_SDU_SIZE 2048 + +#define MAX_IMSI_LEN 15 #ifdef __cplusplus } diff --git a/lib/core/include/core_lib.h b/lib/core/include/core_lib.h index e14e7bc76..67fa9926d 100644 --- a/lib/core/include/core_lib.h +++ b/lib/core/include/core_lib.h @@ -88,8 +88,8 @@ CORE_DECLARE(status_t) core_generate_random_bytes( c_uint8_t *buf, int length); CORE_DECLARE(void *) core_ascii_to_hex(char *in, int len, void *out); -CORE_DECLARE(void *) core_uint64_to_buffer(c_uint64_t num, - c_uint8_t *buffer, int size); +CORE_DECLARE(void *) core_uint64_to_buffer(c_uint64_t num, int size, + c_uint8_t *buffer); /** @} */ diff --git a/lib/core/src/misc.c b/lib/core/src/misc.c index 411a72ddb..55fd9ce60 100644 --- a/lib/core/src/misc.c +++ b/lib/core/src/misc.c @@ -29,7 +29,7 @@ void *core_ascii_to_hex(char *in, int len, void *out) return out; } -void *core_uint64_to_buffer(c_uint64_t num, c_uint8_t *buffer, int size) +void *core_uint64_to_buffer(c_uint64_t num, int size, c_uint8_t *buffer) { int i; for (i = 0; i < size; i++) diff --git a/lib/core/test/testmisc.c b/lib/core/test/testmisc.c index 27dd5b627..cb88597e0 100644 --- a/lib/core/test/testmisc.c +++ b/lib/core/test/testmisc.c @@ -46,21 +46,21 @@ static void misc_test3(abts_case *tc, void *data) c_uint64_t num; num = 0x0123456789abcdef; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 8), 8) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 8, buf), 8) == 0); num = 0x0123456789abcd; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 7), 7) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 7, buf), 7) == 0); num = 0x0123456789ab; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 6), 6) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 6, buf), 6) == 0); num = 0x0123456789; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 5), 5) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 5, buf), 5) == 0); num = 0x01234567; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 4), 4) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 4, buf), 4) == 0); num = 0x012345; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 3), 3) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 3, buf), 3) == 0); num = 0x0123; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 2), 2) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 2, buf), 2) == 0); num = 0x01; - ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, buf, 1), 1) == 0); + ABTS_TRUE(tc, memcmp(tmp, core_uint64_to_buffer(num, 1, buf), 1) == 0); } abts_suite *testmisc(abts_suite *suite) diff --git a/lib/nas/nas_encoder.c b/lib/nas/nas_encoder.c index 44e37b5e3..cf70b40aa 100644 --- a/lib/nas/nas_encoder.c +++ b/lib/nas/nas_encoder.c @@ -250,7 +250,7 @@ status_t nas_encode_pdu(pkbuf_t **pkbuf, nas_message_t *message) d_assert(message, return CORE_ERROR, "Null param"); - *pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + *pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); d_assert(*pkbuf, return -1, "Null Param"); size = sizeof(nas_header_t); diff --git a/lib/nas/nas_ies.h b/lib/nas/nas_ies.h index b8df7093b..805a62153 100644 --- a/lib/nas/nas_ies.h +++ b/lib/nas/nas_ies.h @@ -7,6 +7,15 @@ extern "C" { #endif /* __cplusplus */ +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; + CORE_DECLARE(c_int32_t) nas_encode_optional_type( pkbuf_t *pkbuf, c_uint8_t type); @@ -26,12 +35,7 @@ CORE_DECLARE(c_int32_t) nas_decode_device_properties( * See subclause 10.5.1.3 in 3GPP TS 24.008 [13] * O TV 6 */ typedef struct _nas_location_area_identification_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;) + nas_plmn_t plmn; c_uint16_t lac; } __attribute__ ((packed)) nas_location_area_identification_t; @@ -87,12 +91,7 @@ ED5(c_uint8_t spare:2;, 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;) + nas_plmn_t plmn; c_uint8_t mbms_session_identity; } __attribute__ ((packed)) nas_mobile_identity_tmgi_t; @@ -166,15 +165,6 @@ CORE_DECLARE(c_int32_t) nas_decode_mobile_station_classmark_3( * 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]; @@ -344,37 +334,13 @@ 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;, - c_uint8_t mcc_digit3:4;) -ED2(c_uint8_t mnc_digit2:4;, - c_uint8_t mnc_digit1:4;) + nas_plmn_t plmn; c_uint16_t mme_group_id; c_uint8_t mme_code; c_uint32_t m_tmsi; } __attribute__ ((packed)) nas_eps_mobile_identity_guti_t; -typedef struct _nas_eps_mobile_identity_imsi_t { -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_mobile_identity_imsi_t 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 { @@ -579,12 +545,7 @@ CORE_DECLARE(c_int32_t) nas_decode_tmsi_status( /* 9.9.3.32 Tracking area identity * O TV 6 */ typedef struct _nas_tracking_area_identity_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;) + nas_plmn_t plmn; c_uint16_t tac; } __attribute__ ((packed)) nas_tracking_area_identity_t; @@ -598,24 +559,11 @@ CORE_DECLARE(c_int32_t) nas_decode_tracking_area_identity( #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;) + nas_plmn_t plmn; 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 nas_tracking_area_identity_t nas_tracking_area_identity_type1; typedef struct _nas_tracking_area_identity_type2 { nas_tracking_area_identity_type1 tai[NAS_MAX_TRACKING_AREA_IDENTITY]; diff --git a/lib/s1ap/s1ap_encoder.c b/lib/s1ap/s1ap_encoder.c index 15564045c..9cddd228d 100644 --- a/lib/s1ap/s1ap_encoder.c +++ b/lib/s1ap/s1ap_encoder.c @@ -36,7 +36,7 @@ int s1ap_encode_pdu(pkbuf_t **pkb, s1ap_message *message_p) d_assert (message_p, return -1, "Null param"); - *pkb = pkbuf_alloc(0, MSG_SDU_SIZE); + *pkb = pkbuf_alloc(0, MESSAGE_SDU_SIZE); d_assert(*pkb, return -1, "Null Param"); switch (message_p->direction) @@ -181,7 +181,7 @@ static inline int s1ap_encode_initial_context_setup_request( td, &initialContextSetupRequest); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &initialContextSetupRequest); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); @@ -218,7 +218,7 @@ static inline int s1ap_encode_s1setup_request( ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, &s1SetupRequest); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupRequest); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); @@ -256,7 +256,7 @@ static inline int s1ap_encode_s1setup_response( td, &s1SetupResponse); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupResponse); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); @@ -294,7 +294,7 @@ static inline int s1ap_encode_s1setup_failure( td, &s1SetupFailure); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupFailure); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); @@ -332,7 +332,7 @@ static inline int s1ap_encode_downlink_nas_transport( td, &downlinkNasTransport); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &downlinkNasTransport); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); @@ -372,7 +372,7 @@ static inline int s1ap_encode_ue_context_release_command( td, &ueContextReleaseCommand); enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU, - &pdu, pkbuf->payload, MSG_SDU_SIZE); + &pdu, pkbuf->payload, MESSAGE_SDU_SIZE); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &ueContextReleaseCommand); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu); diff --git a/src/hss/Makefile.am b/src/hss/Makefile.am index a6a45404d..1e3411eee 100644 --- a/src/hss/Makefile.am +++ b/src/hss/Makefile.am @@ -18,6 +18,7 @@ libhss_la_LIBADD = \ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/core/include \ + -I$(top_srcdir)/lib/3gpp \ -I$(top_srcdir)/lib/s6a AM_CFLAGS = \ diff --git a/src/hss/context.h b/src/hss/context.h index 68f2339b2..41ba7d409 100644 --- a/src/hss/context.h +++ b/src/hss/context.h @@ -3,6 +3,7 @@ #include "core_list.h" #include "core_errno.h" +#include "3gpp_message.h" #ifdef __cplusplus extern "C" { @@ -10,7 +11,6 @@ extern "C" { #define SIZE_OF_UE_POOL 128 -#define MAX_IMSI_LEN 15 #define MAX_KEY_LEN 16 #define MAX_AMF_LEN 2 diff --git a/src/hss/init.c b/src/hss/init.c index 35f4fcd7c..1a95a8fa4 100644 --- a/src/hss/init.c +++ b/src/hss/init.c @@ -74,7 +74,7 @@ static int hss_air_cb( struct msg **msg, struct avp *avp, core_generate_random_bytes(ue->rand, MAX_KEY_LEN); milenage_opc(ue->k, ue->op, ue->opc); milenage_generate(ue->opc, ue->amf, ue->k, - core_uint64_to_buffer(ue->sqn, sqn, MAX_SQN_LEN), ue->rand, + core_uint64_to_buffer(ue->sqn, MAX_SQN_LEN, sqn), ue->rand, autn, ik, ck, ak, xres, &xres_len); derive_kasme(ck, ik, hdr->avp_value->os.data, sqn, ak, kasme); diff --git a/src/mme/Makefile.am b/src/mme/Makefile.am index 80c7210fe..7604bbe6a 100644 --- a/src/mme/Makefile.am +++ b/src/mme/Makefile.am @@ -5,12 +5,14 @@ noinst_LTLIBRARIES = libmme.la libmme_la_SOURCES = \ event.h context.h \ s1ap_build.h s1ap_conv.h s1ap_path.h \ + nas_conv.h \ s6a_message.h \ sm.h nodist_libmme_la_SOURCES = \ init.c event.c context.c \ s1ap_build.c s1ap_conv.c s1ap_path.c \ + nas_conv.c \ s6a_init.c s6a_auth_info.c \ mme_sm.c enb_s1ap_sm.c ue_emm_sm.c diff --git a/src/mme/context.h b/src/mme/context.h index 46c082058..a9964d219 100644 --- a/src/mme/context.h +++ b/src/mme/context.h @@ -6,6 +6,7 @@ #include "core_net.h" #include "plmn_id.h" +#include "3gpp_message.h" #include "sm.h" #ifdef __cplusplus @@ -64,6 +65,8 @@ typedef struct _ue_ctx_t { c_uint32_t enb_ue_s1ap_id; /** eNB-UE-S1AP-ID received from eNB */ c_uint32_t mme_ue_s1ap_id; /** MME-UE-S1AP-ID received from MME */ + c_uint8_t imsi[MAX_IMSI_LEN+1]; + c_uint8_t imsi_len; ue_emm_sm_t emm_sm; diff --git a/src/mme/s1ap_conv.h b/src/mme/s1ap_conv.h index 1a591f3d6..a3cb4007e 100644 --- a/src/mme/s1ap_conv.h +++ b/src/mme/s1ap_conv.h @@ -1,8 +1,8 @@ -#ifndef _S1AP_CONV_H__ -#define _S1AP_CONV_H__ +#ifndef __S1AP_CONV_H__ +#define __S1AP_CONV_H__ +#include "plmn_id.h" #include "s1ap_message.h" -#include "context.h" #ifdef __cplusplus extern "C" { @@ -19,7 +19,7 @@ CORE_DECLARE(void) s1ap_plmn_id_to_TBCD_STRING( plmn_id_t *plmn_id, S1ap_TBCD_STRING_t *tbcd_string); CORE_DECLARE(void) s1ap_uint32_to_ENB_ID( - S1ap_ENB_ID_PR present, c_uint32_t enb_id, S1ap_ENB_ID_t *eNB_ID); + S1ap_ENB_ID_PR present, c_uint32_t enb_id, S1ap_ENB_ID_t *eNB_ID); CORE_DECLARE(void) s1ap_ENB_ID_to_uint32( S1ap_ENB_ID_t *eNB_ID, c_uint32_t *uint32); @@ -27,5 +27,5 @@ CORE_DECLARE(void) s1ap_ENB_ID_to_uint32( } #endif /* __cplusplus */ -#endif +#endif /* __S1AP_CONV_H__ */ diff --git a/src/mme/s1ap_path.c b/src/mme/s1ap_path.c index 4058f0136..9324b5239 100644 --- a/src/mme/s1ap_path.c +++ b/src/mme/s1ap_path.c @@ -113,7 +113,7 @@ int _s1ap_recv_cb(net_sock_t *net_sock, void *data) d_assert(net_sock, return -1, "Null param"); d_assert(queue_id, return -1, "Null param"); - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); d_assert(pkbuf, return -1, "Can't allocate pkbufuf"); r = net_read(net_sock, pkbuf->payload, pkbuf->len, 0); diff --git a/src/mme/ue_emm_sm.c b/src/mme/ue_emm_sm.c index 2aeb13be8..5c3e3583c 100644 --- a/src/mme/ue_emm_sm.c +++ b/src/mme/ue_emm_sm.c @@ -3,6 +3,7 @@ #include "core_debug.h" #include "nas_message.h" +#include "nas_conv.h" #include "sm.h" #include "context.h" @@ -62,7 +63,44 @@ void ue_emm_state_operational(ue_emm_sm_t *s, event_t *e) { case NAS_ATTACH_REQUEST: { - d_info("Received ATTACH_REQUEST"); + nas_attach_request_t *attach_request = + &message.emm.attach_request; + nas_eps_mobile_identity_t *eps_mobile_identity = + &attach_request->eps_mobile_identity; + + switch(eps_mobile_identity->imsi.type_of_identity) + { + case NAS_EPS_MOBILE_IDENTITY_IMSI: + { + c_uint8_t plmn_id[PLMN_ID_LEN]; + + plmn_id_to_buffer(&mme_self()->plmn_id, plmn_id); + if (attach_request->presencemask & + NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) + { + nas_tracking_area_identity_t + *last_visited_registered_tai = + &attach_request->last_visited_registered_tai; + + nas_plmn_bcd_to_buffer( + &last_visited_registered_tai->plmn, + plmn_id); + } + + nas_imsi_bcd_to_buffer( + &eps_mobile_identity->imsi, + eps_mobile_identity->length, + ue->imsi, &ue->imsi_len); + break; + } + default: + { + d_warn("Not implemented(type:%d)", + eps_mobile_identity->imsi.type_of_identity); + + break; + } + } break; } default: diff --git a/test/nas_message_test.c b/test/nas_message_test.c index 460777aed..c6f1b45ee 100644 --- a/test/nas_message_test.c +++ b/test/nas_message_test.c @@ -19,7 +19,7 @@ static void nas_message_test1(abts_case *tc, void *data) pkbuf_t *pkbuf; status_t rv; - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); ABTS_PTR_NOTNULL(tc, pkbuf); core_ascii_to_hex(payload, strlen(payload), pkbuf->payload); pkbuf->len = 59; @@ -64,12 +64,12 @@ 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.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.plmn.mcc_digit1 = 4; + attach_accept->tai_list.type0.plmn.mcc_digit2 = 1; + attach_accept->tai_list.type0.plmn.mcc_digit3 = 7; + attach_accept->tai_list.type0.plmn.mnc_digit1 = 9; + attach_accept->tai_list.type0.plmn.mnc_digit2 = 9; + attach_accept->tai_list.type0.plmn.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 = @@ -78,24 +78,24 @@ 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.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.plmn.mcc_digit1 = 4; + attach_accept->guti.guti.plmn.mcc_digit2 = 1; + attach_accept->guti.guti.plmn.mcc_digit3 = 7; + attach_accept->guti.guti.plmn.mnc_digit1 = 9; + attach_accept->guti.guti.plmn.mnc_digit2 = 9; + attach_accept->guti.guti.plmn.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; - 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.plmn.mcc_digit1 = 0; + attach_accept->location_area_identification.plmn.mcc_digit2 = 0; + attach_accept->location_area_identification.plmn.mcc_digit3 = 1; + attach_accept->location_area_identification.plmn.mnc_digit1 = 0; + attach_accept->location_area_identification.plmn.mnc_digit2 = 2; + attach_accept->location_area_identification.plmn.mnc_digit3 = 0xf; attach_accept->location_area_identification.lac = 0xfffd; attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT; @@ -129,7 +129,7 @@ static void nas_message_test3(abts_case *tc, void *data) pkbuf_t *pkbuf; status_t rv; - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); ABTS_PTR_NOTNULL(tc, pkbuf); core_ascii_to_hex(payload, strlen(payload), pkbuf->payload); pkbuf->len = 7; diff --git a/test/nas_sm_test.c b/test/nas_sm_test.c index 7b9c93c9f..c7e2aa9c0 100644 --- a/test/nas_sm_test.c +++ b/test/nas_sm_test.c @@ -28,7 +28,7 @@ static void nas_sm_test1(abts_case *tc, void *data) pkbuf_free(sendbuf); /* Receive S1-Setup Response */ - recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); rc = tests1ap_enb_read(sock, recvbuf); ABTS_INT_NEQUAL(tc, 0, rc); rv = s1ap_decode_pdu(&message, recvbuf); @@ -45,7 +45,7 @@ static void nas_sm_test1(abts_case *tc, void *data) /* Receive XXXX */ #if 0 - recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); rc = tests1ap_enb_read(sock, recvbuf); ABTS_INT_NEQUAL(tc, 0, rc); rv = s1ap_decode_pdu(&message, recvbuf); diff --git a/test/s1ap_message_test.c b/test/s1ap_message_test.c index 5273d3f09..a0830cca9 100644 --- a/test/s1ap_message_test.c +++ b/test/s1ap_message_test.c @@ -21,7 +21,7 @@ static void s1ap_message_test1(abts_case *tc, void *data) pkbuf_t *pkbuf; int result; - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); ABTS_PTR_NOTNULL(tc, pkbuf); core_ascii_to_hex(payload, strlen(payload), pkbuf->payload); pkbuf->len = 49; @@ -50,7 +50,7 @@ static void s1ap_message_test2(abts_case *tc, void *data) pkbuf_t *pkbuf; int result; - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); ABTS_PTR_NOTNULL(tc, pkbuf); core_ascii_to_hex(payload, strlen(payload), pkbuf->payload); pkbuf->len = 115; @@ -74,7 +74,7 @@ static void s1ap_message_test3(abts_case *tc, void *data) pkbuf_t *pkbuf; int result; - pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); ABTS_PTR_NOTNULL(tc, pkbuf); core_ascii_to_hex(payload, strlen(payload), pkbuf->payload); pkbuf->len = 41; diff --git a/test/s1ap_sm_test.c b/test/s1ap_sm_test.c index 09cb33283..399a18799 100644 --- a/test/s1ap_sm_test.c +++ b/test/s1ap_sm_test.c @@ -14,7 +14,7 @@ static void s1ap_sm_test1(abts_case *tc, void *data) status_t rv; net_sock_t *sock[NUM_OF_TEST_DUPLICATED_ENB]; pkbuf_t *sendbuf; - pkbuf_t *recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf_t *recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); s1ap_message message; int rc; int i; @@ -62,7 +62,7 @@ static void s1ap_sm_test2(abts_case *tc, void *data) status_t rv; net_sock_t *sock[NUM_OF_TEST_ENB]; pkbuf_t *sendbuf; - pkbuf_t *recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + pkbuf_t *recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); s1ap_message message; int rc; int i; diff --git a/test/tests1ap.c b/test/tests1ap.c index e72b3a5eb..4dd7a3a8b 100644 --- a/test/tests1ap.c +++ b/test/tests1ap.c @@ -122,7 +122,7 @@ status_t tests1ap_build_initial_ue_msg( "00004300060000f1 105ba00064400800" "00f1101079baf000 86400130"; - *pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE); + *pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE); if (!(*pkbuf)) return CORE_ERROR; core_ascii_to_hex(payload, strlen(payload), (*pkbuf)->payload);