update it

This commit is contained in:
Sukchan Lee 2017-03-24 23:01:44 +09:00
parent 7685e8a72c
commit 857dde66cd
10 changed files with 27 additions and 49 deletions

View File

@ -8,21 +8,21 @@
#define PLMN_ID_DIGIT2(x) (((x) / 10) % 10)
#define PLMN_ID_DIGIT3(x) ((x) % 10)
c_uint16_t plmn_id_mcc(plmn_t *plmn_id)
c_uint16_t plmn_id_mcc(plmn_id_t *plmn_id)
{
return plmn_id->mcc1 * 100 + plmn_id->mcc2 * 10 + plmn_id->mcc3;
}
c_uint16_t plmn_id_mnc(plmn_t *plmn_id)
c_uint16_t plmn_id_mnc(plmn_id_t *plmn_id)
{
return plmn_id->mnc1 == 0xf ? plmn_id->mnc2 * 10 + plmn_id->mnc3 :
plmn_id->mnc1 * 100 + plmn_id->mnc2 * 10 + plmn_id->mnc3;
}
c_uint16_t plmn_id_mnc_len(plmn_t *plmn_id)
c_uint16_t plmn_id_mnc_len(plmn_id_t *plmn_id)
{
return plmn_id->mnc1 == 0xf ? 2 : 3;
}
void plmn_id_build(plmn_t *plmn_id,
void plmn_id_build(plmn_id_t *plmn_id,
c_uint16_t mcc, c_uint16_t mnc, c_uint16_t mnc_len)
{
plmn_id->mcc1 = PLMN_ID_DIGIT1(mcc);

View File

@ -7,11 +7,11 @@
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(c_uint16_t) plmn_id_mcc(plmn_t *plmn_id);
CORE_DECLARE(c_uint16_t) plmn_id_mnc(plmn_t *plmn_id);
CORE_DECLARE(c_uint16_t) plmn_id_mnc_len(plmn_t *plmn_id);
CORE_DECLARE(c_uint16_t) plmn_id_mcc(plmn_id_t *plmn_id);
CORE_DECLARE(c_uint16_t) plmn_id_mnc(plmn_id_t *plmn_id);
CORE_DECLARE(c_uint16_t) plmn_id_mnc_len(plmn_id_t *plmn_id);
CORE_DECLARE(void) plmn_id_build(plmn_t *plmn_id,
CORE_DECLARE(void) plmn_id_build(plmn_id_t *plmn_id,
c_uint16_t mcc, c_uint16_t mnc, c_uint16_t mnc_len);
#ifdef __cplusplus

View File

@ -7,23 +7,14 @@
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;
typedef struct _plmn_t {
typedef struct _plmn_id_t {
ED2(c_uint8_t mcc2:4;,
c_uint8_t mcc1:4;)
ED2(c_uint8_t mnc1:4;,
c_uint8_t mcc3:4;)
ED2(c_uint8_t mnc3:4;,
c_uint8_t mnc2:4;)
} __attribute__ ((packed)) plmn_t;
} __attribute__ ((packed)) plmn_id_t;
#ifdef __cplusplus
}

View File

@ -21,7 +21,7 @@ ED3(c_uint8_t type:4;,
* See subclause 10.5.1.3 in 3GPP TS 24.008 [13]
* O TV 6 */
typedef struct _nas_location_area_identification_t {
nas_plmn_t plmn;
plmn_id_t plmn_id;
c_uint16_t lac;
} __attribute__ ((packed)) nas_location_area_identification_t;
@ -69,7 +69,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];
nas_plmn_t plmn;
plmn_id_t plmn_id;
c_uint8_t mbms_session_identity;
} __attribute__ ((packed)) nas_mobile_identity_tmgi_t;
@ -134,7 +134,7 @@ typedef struct _nas_mobile_station_classmark_3_t {
#define NAS_MAX_PLMN 15
typedef struct _nas_plmn_list_t {
c_uint8_t length;
nas_plmn_t plmn[NAS_MAX_PLMN];
plmn_id_t plmn_id[NAS_MAX_PLMN];
} __attribute__ ((packed)) nas_plmn_list_t;
/* 9.9.2.10 Supported codec list
@ -306,7 +306,7 @@ 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;)
nas_plmn_t plmn;
plmn_id_t plmn_id;
c_uint16_t mme_group_id;
c_uint8_t mme_code;
c_uint32_t m_tmsi;
@ -521,7 +521,7 @@ ED3(c_uint8_t type:4;,
/* 9.9.3.32 Tracking area identity
* O TV 6 */
typedef struct _nas_tracking_area_identity_t {
plmn_t plmn_id;
plmn_id_t plmn_id;
c_uint16_t tac;
} __attribute__ ((packed)) nas_tracking_area_identity_t;
@ -532,7 +532,7 @@ typedef struct _nas_tracking_area_identity_t {
#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 {
nas_plmn_t plmn;
plmn_id_t plmn_id;
c_uint16_t tac[NAS_MAX_TRACKING_AREA_IDENTITY];
} __attribute__ ((packed)) nas_tracking_area_identity_type0;

View File

@ -22,7 +22,7 @@ typedef list_t rab_list_t;
typedef struct _served_gummei {
c_uint32_t num_of_plmn_id;
plmn_t plmn_id[MAX_PLMN_ID];
plmn_id_t plmn_id[MAX_PLMN_ID];
c_uint32_t num_of_mme_gid;
c_uint16_t mme_gid[GRP_PER_MME];
@ -45,7 +45,7 @@ typedef struct _mme_ctx_t {
tm_service_t tm_service;
c_uint32_t mme_ue_s1ap_id; /** mme_ue_s1ap_id generator */
plmn_t plmn_id;
plmn_id_t plmn_id;
/* defined in 'nas_ies.h'
* #define NAS_SECURITY_ALGORITHMS_EIA0 0

View File

@ -22,7 +22,7 @@ pool_declare(sess_state_pool, struct sess_state, SIZE_OF_SESS_STATE_POOL);
static void s6a_aia_cb(void *data, struct msg **msg);
/* Cb called when an answer is received */
int s6a_send_auth_info_req(ue_ctx_t *ue, plmn_t *plmn_id)
int s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id)
{
struct msg *req = NULL;
struct avp *avp;

View File

@ -12,7 +12,7 @@ extern "C" {
CORE_DECLARE(status_t) s6a_sm_init(void);
CORE_DECLARE(void) s6a_sm_final(void);
CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, plmn_t *plmn_id);
CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, plmn_id_t *plmn_id);
#ifdef __cplusplus
}

View File

@ -159,7 +159,7 @@ static void ue_emm_handle_attach_request(
{
case NAS_EPS_MOBILE_IDENTITY_IMSI:
{
plmn_t *plmn_id = &mme_self()->plmn_id;
plmn_id_t *plmn_id = &mme_self()->plmn_id;
if (attach_request->presencemask &
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)

View File

@ -10,7 +10,7 @@
static void _3gpp_test1(abts_case *tc, void *data)
{
status_t rv;
plmn_t plmn_id;
plmn_id_t plmn_id;
c_uint8_t *buffer = (c_uint8_t *)&plmn_id;
plmn_id_build(&plmn_id, 1, 1, 2);

View File

@ -3,6 +3,7 @@
#include "testutil.h"
#include "3gpp_conv.h"
#include "nas_message.h"
#include "nas_security.h"
@ -64,12 +65,7 @@ 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.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;
plmn_id_build(&attach_accept->tai_list.type0.plmn_id, 417, 99, 2);
attach_accept->tai_list.type0.tac[0] = 12345;
attach_accept->esm_message_container.length = sizeof(esm_buffer);
attach_accept->esm_message_container.buffer =
@ -79,24 +75,15 @@ 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.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;
plmn_id_build(&attach_accept->guti.guti.plmn_id, 417, 99, 2);
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.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;
plmn_id_build(
&attach_accept->location_area_identification.plmn_id, 1, 2, 2);
attach_accept->location_area_identification.lac = 0xfffd;
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT;