update it

This commit is contained in:
Sukchan Lee 2017-03-24 22:52:55 +09:00
parent a6512e7a6c
commit 7685e8a72c
14 changed files with 30 additions and 61 deletions

View File

@ -8,21 +8,6 @@
#define PLMN_ID_DIGIT2(x) (((x) / 10) % 10)
#define PLMN_ID_DIGIT3(x) ((x) % 10)
void *s1ap_plmn_id_to_buffer(plmn_id_t *plmn_id, c_uint8_t *buf)
{
buf[0] = (PLMN_ID_DIGIT2(plmn_id->mcc) << 4) | PLMN_ID_DIGIT1(plmn_id->mcc);
if (plmn_id->mnc_len == 2)
buf[1] = (0xf << 4);
else
buf[1] = (PLMN_ID_DIGIT1(plmn_id->mnc) << 4);
buf[1] |= PLMN_ID_DIGIT3(plmn_id->mcc);
buf[2] = (PLMN_ID_DIGIT3(plmn_id->mnc) << 4) | PLMN_ID_DIGIT2(plmn_id->mnc);
return buf;
}
c_uint16_t plmn_id_mcc(plmn_t *plmn_id)
{
return plmn_id->mcc1 * 100 + plmn_id->mcc2 * 10 + plmn_id->mcc3;

View File

@ -7,9 +7,6 @@
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(void *) s1ap_plmn_id_to_buffer(
plmn_id_t *plmn_id, c_uint8_t *buf);
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);

View File

@ -7,12 +7,6 @@
extern "C" {
#endif /* __cplusplus */
typedef struct _plmn_id_t {
c_uint16_t mcc;
c_uint16_t mnc;
c_uint16_t mnc_len;
} plmn_id_t;
typedef struct _nas_plmn_t {
ED2(c_uint8_t mcc_digit2:4;,
c_uint8_t mcc_digit1:4;)

View File

@ -520,7 +520,7 @@ ED3(c_uint8_t type:4;,
/* 9.9.3.32 Tracking area identity
* O TV 6 */
typedef struct _nas_tracking_area_identity_t {
nas_plmn_t plmn;
plmn_t plmn_id;
c_uint16_t tac;
} __attribute__ ((packed)) nas_tracking_area_identity_t;

View File

@ -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 {
nas_plmn_t plmn;
plmn_t plmn_id;
c_uint16_t tac;
} __attribute__ ((packed)) nas_tracking_area_identity_t;

View File

@ -5,6 +5,7 @@
#include "core_rwlock.h"
#include "core_index.h"
#include "3gpp_conv.h"
#include "context.h"
#include "nas_ies.h"
#include "s1ap_message.h"
@ -51,17 +52,15 @@ status_t mme_ctx_init()
self.s11_local_port = S11_UDP_PORT;
self.s11_remote_port = S11_UDP_PORT + 1;
self.plmn_id.mnc_len = 2;
self.plmn_id.mcc = 1; /* 001 */
self.plmn_id.mnc = 1; /* 01 */
/* MCC : 001, MNC : 01 */
plmn_id_build(&self.plmn_id, 1, 1, 2);
self.tracking_area_code = 12345;
self.default_paging_drx = S1ap_PagingDRX_v64;
self.relative_capacity = 0xff;
self.srvd_gummei.num_of_plmn_id = 1;
self.srvd_gummei.plmn_id[0].mnc_len = 2;
self.srvd_gummei.plmn_id[0].mcc = 1; /* 001 */
self.srvd_gummei.plmn_id[0].mnc = 1; /* 01 */
/* MCC : 001, MNC : 01 */
plmn_id_build(&self.srvd_gummei.plmn_id[0], 1, 1, 2);
self.srvd_gummei.num_of_mme_gid = 1;
self.srvd_gummei.mme_gid[0] = 2;

View File

@ -22,7 +22,7 @@ typedef list_t rab_list_t;
typedef struct _served_gummei {
c_uint32_t num_of_plmn_id;
plmn_id_t plmn_id[MAX_PLMN_ID];
plmn_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_id_t plmn_id;
plmn_t plmn_id;
/* defined in 'nas_ies.h'
* #define NAS_SECURITY_ALGORITHMS_EIA0 0

View File

@ -32,18 +32,16 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf)
for (j = 0; j < srvd_gummei->num_of_plmn_id; j++)
{
plmnIdentity = (S1ap_PLMNidentity_t *)
core_calloc(srvd_gummei->num_of_plmn_id,
sizeof(S1ap_PLMNidentity_t));
s1ap_plmn_id_to_TBCD_STRING(
&srvd_gummei->plmn_id[j], plmnIdentity);
core_calloc(1, sizeof(S1ap_PLMNidentity_t));
s1ap_buffer_to_OCTET_STRING(
&srvd_gummei->plmn_id[j], PLMN_ID_LEN, plmnIdentity);
ASN_SEQUENCE_ADD(&servedGUMMEI->servedPLMNs, plmnIdentity);
}
for (j = 0; j < srvd_gummei->num_of_mme_gid; j++)
{
mmeGroupId = (S1ap_MME_Group_ID_t *)
core_calloc(srvd_gummei->num_of_mme_gid,
sizeof(S1ap_MME_Group_ID_t));
core_calloc(1, sizeof(S1ap_MME_Group_ID_t));
s1ap_uint16_to_OCTET_STRING(
srvd_gummei->mme_gid[j], mmeGroupId);
ASN_SEQUENCE_ADD(&servedGUMMEI->servedGroupIDs, mmeGroupId);
@ -52,8 +50,7 @@ status_t s1ap_build_setup_rsp(pkbuf_t **pkbuf)
for (j = 0; j < srvd_gummei->num_of_mme_code; j++)
{
mmeCode = (S1ap_MME_Code_t *)
core_calloc(srvd_gummei->num_of_mme_code,
sizeof(S1ap_MME_Code_t));
core_calloc(1, sizeof(S1ap_MME_Code_t));
s1ap_uint8_to_OCTET_STRING(
srvd_gummei->mme_code[j], mmeCode);
ASN_SEQUENCE_ADD(&servedGUMMEI->servedMMECs, mmeCode);

View File

@ -33,14 +33,13 @@ void s1ap_uint32_to_OCTET_STRING(c_uint32_t uint32, OCTET_STRING_t *octet_string
octet_string->buf[0] = uint32;
}
void s1ap_plmn_id_to_TBCD_STRING(
plmn_id_t *plmn_id, S1ap_TBCD_STRING_t *tbcd_string)
void s1ap_buffer_to_OCTET_STRING(
void *buf, int size, S1ap_TBCD_STRING_t *tbcd_string)
{
tbcd_string->size = 3;
tbcd_string->size = size;
tbcd_string->buf = core_calloc(tbcd_string->size, sizeof(c_uint8_t));
s1ap_plmn_id_to_buffer(plmn_id, tbcd_string->buf);
memcpy(tbcd_string->buf, buf, size);
}
void s1ap_uint32_to_ENB_ID(

View File

@ -15,8 +15,8 @@ CORE_DECLARE(void) s1ap_uint16_to_OCTET_STRING(
CORE_DECLARE(void) s1ap_uint32_to_OCTET_STRING(
c_uint32_t uint32, OCTET_STRING_t *octet_string);
CORE_DECLARE(void) s1ap_plmn_id_to_TBCD_STRING(
plmn_id_t *plmn_id, S1ap_TBCD_STRING_t *tbcd_string);
CORE_DECLARE(void) s1ap_buffer_to_OCTET_STRING(
void *buf, int size, 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);

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, c_uint8_t *plmn_id)
int s6a_send_auth_info_req(ue_ctx_t *ue, plmn_t *plmn_id)
{
struct msg *req = NULL;
struct avp *avp;
@ -91,7 +91,7 @@ int s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id)
/* Set the Visited-PLMN-Id AVP if needed*/
d_assert(fd_msg_avp_new(s6a_visited_plmn_id, 0, &avp) == 0, goto out,);
val.os.data = plmn_id;
val.os.data = (c_uint8_t *)plmn_id;
val.os.len = PLMN_ID_LEN;
d_assert(fd_msg_avp_setvalue(avp, &val) == 0, goto out,);
d_assert(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp) == 0, goto out,);

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, c_uint8_t *plmn_id);
CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, plmn_t *plmn_id);
#ifdef __cplusplus
}

View File

@ -159,17 +159,15 @@ static void ue_emm_handle_attach_request(
{
case NAS_EPS_MOBILE_IDENTITY_IMSI:
{
c_uint8_t plmn_id[PLMN_ID_LEN];
plmn_t *plmn_id = &mme_self()->plmn_id;
s1ap_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;
memcpy(plmn_id,
&last_visited_registered_tai->plmn, PLMN_ID_LEN);
plmn_id = &last_visited_registered_tai->plmn_id;
}
nas_imsi_bcd_to_buffer(
&eps_mobile_identity->imsi, eps_mobile_identity->length,

View File

@ -77,9 +77,9 @@ status_t tests1ap_build_setup_req(pkbuf_t **pkbuf, c_uint32_t enb_id)
ies = &message.s1ap_S1SetupRequestIEs;
s1ap_uint32_to_ENB_ID(S1ap_ENB_ID_PR_macroENB_ID, enb_id,
&ies->global_ENB_ID.eNB_ID);
s1ap_plmn_id_to_TBCD_STRING(
&mme_self()->plmn_id, &ies->global_ENB_ID.pLMNidentity);
&ies->global_ENB_ID.eNB_ID);
s1ap_buffer_to_OCTET_STRING(
&mme_self()->plmn_id, PLMN_ID_LEN, &ies->global_ENB_ID.pLMNidentity);
supportedTA = (S1ap_SupportedTAs_Item_t *)
core_calloc(1, sizeof(S1ap_SupportedTAs_Item_t));
@ -87,8 +87,8 @@ status_t tests1ap_build_setup_req(pkbuf_t **pkbuf, c_uint32_t enb_id)
mme_self()->tracking_area_code, &supportedTA->tAC);
plmnIdentity = (S1ap_PLMNidentity_t *)
core_calloc(1, sizeof(S1ap_PLMNidentity_t));
s1ap_plmn_id_to_TBCD_STRING(
&mme_self()->plmn_id, plmnIdentity);
s1ap_buffer_to_OCTET_STRING(
&mme_self()->plmn_id, PLMN_ID_LEN, plmnIdentity);
ASN_SEQUENCE_ADD(&supportedTA->broadcastPLMNs, plmnIdentity);
ASN_SEQUENCE_ADD(&ies->supportedTAs, supportedTA);