update it
This commit is contained in:
parent
4c2b1e34ea
commit
c1b6750b90
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "plmn_id.h"
|
||||
|
||||
#include "context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
@ -14,8 +16,7 @@ extern struct session_handler *s6a_mme_reg;
|
|||
CORE_DECLARE(status_t) s6a_mme_init(void);
|
||||
CORE_DECLARE(void) s6a_mme_final(void);
|
||||
|
||||
CORE_DECLARE(int) s6a_send_auth_info_req(
|
||||
c_uint8_t *imsi, c_uint8_t imsi_len, c_uint8_t *plmn_id);
|
||||
CORE_DECLARE(int) s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "context.h"
|
||||
#include "event.h"
|
||||
|
||||
static void ue_emm_handle_attachrequest(ue_ctx_t *ue, nas_message_t *message);
|
||||
|
||||
void ue_emm_state_initial(ue_emm_sm_t *s, event_t *e)
|
||||
{
|
||||
d_assert(s, return, "Null param");
|
||||
|
@ -64,47 +66,7 @@ void ue_emm_state_operational(ue_emm_sm_t *s, event_t *e)
|
|||
{
|
||||
case NAS_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);
|
||||
|
||||
s6a_send_auth_info_req(
|
||||
ue->imsi, ue->imsi_len, plmn_id);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
d_warn("Not implemented(type:%d)",
|
||||
eps_mobile_identity->imsi.type_of_identity);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
ue_emm_handle_attachrequest(ue, &message);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -150,3 +112,43 @@ void ue_emm_state_exception(ue_emm_sm_t *s, event_t *e)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ue_emm_handle_attachrequest(ue_ctx_t *ue, nas_message_t *message)
|
||||
{
|
||||
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);
|
||||
|
||||
s6a_send_auth_info_req(ue, plmn_id);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
d_warn("Not implemented(type:%d)",
|
||||
eps_mobile_identity->imsi.type_of_identity);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ struct sess_state {
|
|||
static void s6a_aia_cb(void *data, struct msg **msg);
|
||||
|
||||
/* Cb called when an answer is received */
|
||||
int s6a_send_auth_info_req(
|
||||
c_uint8_t *imsi, c_uint8_t imsi_len, c_uint8_t *plmn_id)
|
||||
int s6a_send_auth_info_req(ue_ctx_t *ue, c_uint8_t *plmn_id)
|
||||
{
|
||||
struct msg *req = NULL;
|
||||
struct avp *avp;
|
||||
|
@ -22,6 +21,8 @@ int s6a_send_auth_info_req(
|
|||
union avp_value val;
|
||||
struct sess_state *mi = NULL, *svg;
|
||||
struct session *sess = NULL;
|
||||
|
||||
d_assert(ue, return -1, "Null Param");
|
||||
|
||||
/* Create the random value to store with the session */
|
||||
mi = malloc(sizeof(struct sess_state));
|
||||
|
@ -58,8 +59,8 @@ int s6a_send_auth_info_req(
|
|||
|
||||
/* Set the User-Name AVP if needed*/
|
||||
d_assert(fd_msg_avp_new(s6a_user_name, 0, &avp) == 0, goto out,);
|
||||
val.os.data = imsi;
|
||||
val.os.len = imsi_len;
|
||||
val.os.data = ue->imsi;
|
||||
val.os.len = ue->imsi_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,);
|
||||
|
||||
|
|
Loading…
Reference in New Issue