Commit b3829736 authored by Lionel Gauthier's avatar Lionel Gauthier

For EPC, tested scenario is IMSI attach with EURECOM NAS UE, (not GUTI)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5282 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 72fd579b
......@@ -5,7 +5,6 @@
// Messages files used between tasks
#include "gtpv1_u_messages_def.h"
#include "ip_forward_messages_def.h"
#include "mme_app_messages_def.h"
#include "nas_messages_def.h"
#include "s11_messages_def.h"
#include "s1ap_messages_def.h"
......@@ -13,3 +12,4 @@
#include "sctp_messages_def.h"
#include "sgw_lite_def.h"
#include "udp_messages_def.h"
#include "mme_app_messages_def.h"
......@@ -15,7 +15,6 @@
#include "gtpv1_u_messages_types.h"
#include "ip_forward_messages_types.h"
#include "mme_app_messages_types.h"
#include "s11_messages_types.h"
#include "s1ap_messages_types.h"
#include "nas_messages_types.h"
......@@ -23,5 +22,6 @@
#include "sctp_messages_types.h"
#include "sgw_lite_messages_types.h"
#include "udp_messages_types.h"
#include "mme_app_messages_types.h"
#endif /* MESSAGES_TYPES_H_ */
//WARNING: Do not include this header directly. Use intertask_interface.h instead.
MESSAGE_DEF(MME_APP_CONNECTION_ESTABLISHMENT_IND , MESSAGE_PRIORITY_MED, mme_app_connection_establishment_ind_t , mme_app_connection_establishment_ind)
MESSAGE_DEF(MME_APP_CONNECTION_ESTABLISHMENT_CNF , MESSAGE_PRIORITY_MED, mme_app_connection_establishment_cnf_t , mme_app_connection_establishment_cnf)
MESSAGE_DEF(MME_APP_INITIAL_CONTEXT_SETUP_RSP , MESSAGE_PRIORITY_MED, mme_app_initial_context_setup_rsp_t , mme_app_initial_context_setup_rsp)
......@@ -2,5 +2,38 @@
#define MME_APP_MESSAGES_TYPES_H_
#define MME_APP_CONNECTION_ESTABLISHMENT_IND(mSGpTR) (mSGpTR)->ittiMsg.mme_app_connection_establishment_ind
#define MME_APP_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.mme_app_connection_establishment_cnf
#define MME_APP_INITIAL_CONTEXT_SETUP_RSP(mSGpTR) (mSGpTR)->ittiMsg.mme_app_initial_context_setup_rsp
typedef struct mme_app_connection_establishment_ind_s {
uint32_t mme_ue_s1ap_id;
nas_establish_ind_t nas;
/* Transparent message from s1ap to be forwarded to MME_APP or
* to S1AP if connection establishment is rejected by NAS.
*/
s1ap_initial_ue_message_t transparent;
} mme_app_connection_establishment_ind_t;
typedef struct mme_app_connection_establishment_cnf_s {
ebi_t eps_bearer_id;
FTeid_t bearer_s1u_sgw_fteid;
qci_t bearer_qos_qci;
priority_level_t bearer_qos_prio_level;
pre_emp_vulnerability_t bearer_qos_pre_emp_vulnerability;
pre_emp_capability_t bearer_qos_pre_emp_capability;
ambr_t ambr;
nas_conn_est_cnf_t nas_conn_est_cnf;
} mme_app_connection_establishment_cnf_t;
typedef struct mme_app_initial_context_setup_rsp_s {
uint32_t mme_ue_s1ap_id;
ebi_t eps_bearer_id;
FTeid_t bearer_s1u_enb_fteid;
} mme_app_initial_context_setup_rsp_t;
#endif /* MME_APP_MESSAGES_TYPES_H_ */
......@@ -35,9 +35,10 @@ MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, nas_rab_
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_REQ, MESSAGE_PRIORITY_MED, nas_auth_param_req_t, nas_auth_param_req)
/* MME app -> NAS layer messages */
MESSAGE_DEF(NAS_BEARER_PARAM, MESSAGE_PRIORITY_MED, nas_bearer_param_t, nas_bearer_param)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail)
MESSAGE_DEF(NAS_PDN_CONNECTIVITY_RSP, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_rsp_t, nas_pdn_connectivity_rsp)
MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_fail_t, nas_pdn_connectivity_fail)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail)
#if defined(DISABLE_USE_NAS)
MESSAGE_DEF(NAS_ATTACH_REQ, MESSAGE_PRIORITY_MED, nas_attach_req_t, nas_attach_req)
......
......@@ -24,6 +24,8 @@
#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf
#define NAS_PDN_CONNECTIVITY_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_req
#define NAS_PDN_CONNECTIVITY_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_rsp
#define NAS_PDN_CONNECTIVITY_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_fail
#define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind
#define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
......@@ -34,6 +36,8 @@
#define NAS_DATA_LENGHT_MAX 256
typedef enum {
EMM_MSG_HEADER = 1,
EMM_MSG_ATTACH_REQUEST,
......@@ -67,6 +71,8 @@ typedef enum {
EMM_MSG_CS_SERVICE_NOTIFICATION,
} emm_message_ids_t;
typedef enum {
ESM_MSG_HEADER = 1,
ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
......@@ -93,50 +99,103 @@ typedef enum {
ESM_MSG_ESM_STATUS,
} esm_message_ids_t;
typedef struct nas_raw_msg_s {
uint32_t lenght;
uint8_t data[NAS_DATA_LENGHT_MAX];
} nas_raw_msg_t;
typedef struct nas_emm_plain_msg_s {
emm_message_ids_t present;
EMM_msg choice;
} nas_emm_plain_msg_t;
typedef struct nas_emm_protected_msg_s {
nas_message_security_header_t header;
emm_message_ids_t present;
EMM_msg choice;
} nas_emm_protected_msg_t;
typedef struct nas_esm_plain_msg_s {
esm_message_ids_t present;
ESM_msg choice;
} nas_esm_plain_msg_t;
typedef struct nas_esm_protected_msg_s {
nas_message_security_header_t header;
esm_message_ids_t present;
ESM_msg choice;
} nas_esm_protected_msg_t;
typedef struct nas_paging_ind_s {
} nas_paging_ind_t;
typedef struct nas_pdn_connectivity_req_s {
char imsi[16];
uint8_t imsi_length;
OctetString apn;
OctetString pdn_addr;
int mme_pdn_index;
network_qos_t esm_qos;
int is_emergency;
int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry
unsigned ue_id; // nas ref
char imsi[16];
uint8_t imsi_length;
network_qos_t qos;
OctetString apn;
OctetString pdn_addr;
int pdn_type;
void *proc_data;
int request_type;
} nas_pdn_connectivity_req_t;
typedef struct nas_pdn_connectivity_rsp_s {
int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry
unsigned ue_id; // nas ref
network_qos_t qos;
OctetString apn;
OctetString pdn_addr;
int pdn_type;
void *proc_data;
int request_type;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* Key eNB */
uint8_t keNB[32];
ambr_t ambr;
ambr_t apn_ambr;
/* EPS bearer ID */
unsigned ebi:4;
/* QoS */
qci_t qci;
priority_level_t prio_level;
pre_emp_vulnerability_t pre_emp_vulnerability;
pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */
Teid_t sgw_s1u_teid;
/* S-GW IP address for User-Plane */
ip_address_t sgw_s1u_address;
} nas_pdn_connectivity_rsp_t;
typedef struct nas_pdn_connectivity_fail_s {
unsigned ue_id; // nas ref
} nas_pdn_connectivity_fail_t;
typedef struct nas_conn_est_ind_s {
nas_establish_ind_t nas;
......@@ -146,8 +205,10 @@ typedef struct nas_conn_est_ind_s {
s1ap_initial_ue_message_t transparent;
} nas_conn_est_ind_t;
typedef nas_establish_rsp_t nas_conn_est_rej_t;
#if defined(DISABLE_USE_NAS)
typedef struct nas_conn_est_cnf_s {
uint32_t ue_id;
......@@ -160,56 +221,35 @@ typedef struct nas_conn_est_cnf_s {
typedef nas_establish_cnf_t nas_conn_est_cnf_t;
#endif
typedef struct nas_bearer_param_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* Key eNB */
uint8_t keNB[32];
ambr_t ambr;
ambr_t apn_ambr;
/* EPS bearer ID */
unsigned ebi:4;
/* QoS */
qci_t qci;
priority_level_t prio_level;
pre_emp_vulnerability_t pre_emp_vulnerability;
pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */
uint32_t sgw_s1u_teid;
/* S-GW IP address for User-Plane */
ip_address_t sgw_s1u_address;
} nas_bearer_param_t;
typedef struct nas_conn_rel_ind_s {
} nas_conn_rel_ind_t;
typedef ul_info_transfer_ind_t nas_ul_data_ind_t;
typedef dl_info_transfer_req_t nas_dl_data_req_t;
typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t;
typedef struct nas_non_del_ind_s {
} nas_non_del_ind_t;
typedef struct nas_rab_est_req_s {
} nas_rab_est_req_t;
typedef struct nas_rab_est_rsp_s {
} nas_rab_est_rsp_t;
typedef struct nas_rab_rel_req_s {
} nas_rab_rel_req_t;
typedef struct nas_attach_req_s {
/* TODO: Set the correct size */
char apn[100];
......@@ -219,6 +259,7 @@ typedef struct nas_attach_req_s {
s1ap_initial_ue_message_t transparent;
} nas_attach_req_t;
typedef struct nas_auth_req_s {
/* UE imsi */
char imsi[16];
......@@ -229,6 +270,7 @@ typedef struct nas_auth_req_s {
int cause;
} nas_auth_req_t;
typedef struct nas_auth_resp_s {
char imsi[16];
} nas_auth_resp_t;
......@@ -244,10 +286,11 @@ typedef struct nas_auth_param_req_s {
/* Indicates whether the procedure corresponds to a new connection or not */
uint8_t initial_req:1;
uint8_t re_synchronization:1;
uint8_t auts[14];
uint8_t re_synchronization:1;
uint8_t auts[14];
} nas_auth_param_req_t;
typedef struct nas_auth_param_rsp_s {
/* UE identifier */
uint32_t ue_id;
......@@ -267,6 +310,7 @@ typedef struct nas_auth_param_fail_s {
nas_cause_t cause;
} nas_auth_param_fail_t;
#if defined(DISABLE_USE_NAS)
typedef struct nas_attach_accept_s {
s1ap_initial_ctxt_setup_req_t transparent;
......
......@@ -5,23 +5,23 @@
#define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req
typedef struct s1ap_initial_ue_message_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
cgi_t e_utran_cgi;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
cgi_t e_utran_cgi;
} s1ap_initial_ue_message_t;
typedef struct s1ap_initial_ctxt_setup_req_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* Key eNB */
uint8_t keNB[32];
uint8_t keNB[32];
ambr_t ambr;
ambr_t apn_ambr;
ambr_t ambr;
ambr_t apn_ambr;
/* EPS bearer ID */
unsigned ebi:4;
unsigned ebi:4;
/* QoS */
qci_t qci;
......@@ -30,16 +30,16 @@ typedef struct s1ap_initial_ctxt_setup_req_s {
pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */
uint32_t teid;
Teid_t teid;
/* S-GW IP address for User-Plane */
ip_address_t s_gw_address;
ip_address_t s_gw_address;
} s1ap_initial_ctxt_setup_req_t;
typedef struct s1ap_ue_cap_ind_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
uint8_t radio_capabilities[100];
uint32_t radio_capabilities_length;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
uint8_t radio_capabilities[100];
uint32_t radio_capabilities_length;
} s1ap_ue_cap_ind_t;
#define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20
......
......@@ -5,23 +5,37 @@
typedef struct s6a_update_location_req_s {
#define SKIP_SUBSCRIBER_DATA (0x1)
unsigned skip_subsriber_data:1;
unsigned skip_subscriber_data:1;
#define INITIAL_ATTACH (0x1)
unsigned initial_attach:1;
char imsi[IMSI_DIGITS_MAX + 1];
uint8_t imsi_length;
plmn_t visited_plmn;
rat_type_t rat_type;
char imsi[IMSI_DIGITS_MAX + 1]; // username
uint8_t imsi_length; // username
plmn_t visited_plmn; // visited plmn id
rat_type_t rat_type; // rat type
// missing // origin host
// missing // origin realm
// missing // destination host
// missing // destination realm
} s6a_update_location_req_t;
typedef struct s6a_update_location_ans_s {
s6a_result_t result; // Result of the update location request procedure
subscription_data_t subscription_data; // subscriber status,
// Maximum Requested Bandwidth Uplink, downlink
// access restriction data
// msisdn
apn_config_profile_t apn_config_profile;// APN configuration profile
network_access_mode_t access_mode;
rau_tau_timer_t rau_tau_timer;
char imsi[IMSI_DIGITS_MAX + 1];
uint8_t imsi_length;
/* Result of the update location request procedure */
s6a_result_t result;
subscription_data_t subscription_data;
} s6a_update_location_ans_t;
typedef struct s6a_auth_info_req_s {
......
This diff is collapsed.
......@@ -535,6 +535,9 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
int i;
ebi_t eps_bearer_id = 0;
int ipv4_addr = 0;
int ip_offset = 0;
in_addr_t in_addr;
int addrs_length_in_bytes= 0;
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP);
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).ue_index = create_tunnel_req_pP->ue_index;
......@@ -542,6 +545,7 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).num_tunnels = 0;
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
ip_offset = 0;
eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i];
GTPU_DEBUG("Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue_index %u eps bearer id %u\n",
create_tunnel_req_pP->ue_index, eps_bearer_id);
......@@ -564,36 +568,44 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
// PDCP->GTPV1U mapping
//-----------------------
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, (void **)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t));
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index;
gtpv1u_ue_data_p->instance_id = 0; // TO DO
memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
&gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t));
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
AssertFatal(create_tunnel_req_pP->sgw_addr[i].length == 4, "Bad transport layer address for next operation, TO DO");
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
if ((hash_rc == HASH_TABLE_KEY_NOT_EXISTS) || (hash_rc == HASH_TABLE_OK)) {
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i];
hash_rc = hashtable_insert(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, gtpv1u_ue_data_p);
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = s1u_teid;
} else if (hash_rc == HASH_TABLE_OK) {
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t));
hash_rc = hashtable_insert(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, gtpv1u_ue_data_p);
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
}
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index;
gtpv1u_ue_data_p->instance_id = 0; // TO DO
memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
&gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t));
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
gtpv1u_ue_data_p->instance_id = 0; // TO DO
memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
&gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t));
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
addrs_length_in_bytes = create_tunnel_req_pP->sgw_addr[i].length / 8;
AssertFatal((addrs_length_in_bytes == 4) ||
(addrs_length_in_bytes == 16) ||
(addrs_length_in_bytes == 20),
"Bad transport layer address length %d (bits) %d (bytes)",
create_tunnel_req_pP->sgw_addr[i].length, addrs_length_in_bytes);
if ((addrs_length_in_bytes == 4) ||
(addrs_length_in_bytes == 20)) {
in_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
ip_offset = 4;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = in_addr;
}
if ((addrs_length_in_bytes == 16) ||
(addrs_length_in_bytes == 20)) {
memcpy(gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip6_addr.s6_addr,
&create_tunnel_req_pP->sgw_addr[i].buffer[ip_offset],
16);
}
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i];
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = s1u_teid;
} else {
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = 0;
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0xFF;
......
......@@ -68,10 +68,11 @@ typedef struct gtpv1u_teid_data_s {
typedef struct gtpv1u_bearer_s {
/* TEID used in dl and ul */
teid_t teid_eNB; ///< eNB TEID
teid_t teid_sgw; ///< Remote TEID
in_addr_t sgw_ip_addr;
tcp_udp_port_t port;
teid_t teid_eNB; ///< eNB TEID
teid_t teid_sgw; ///< Remote TEID
in_addr_t sgw_ip_addr;
struct in6_addr sgw_ip6_addr;
tcp_udp_port_t port;
//NwGtpv1uStackSessionHandleT stack_session;
bearer_state_t state;
} gtpv1u_bearer_t;
......
......@@ -167,22 +167,24 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
data_ind_p->local_S1u_teid = pUlpApi->apiInfo.recvMsgInfo.teid;
if (data_ind_p->buffer == NULL) {
GTPU_ERROR("Failed to allocate new buffer\n");
free(message_p);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
message_p = NULL;
} else {
memcpy(data_ind_p->buffer, buffer, buffer_len);
data_ind_p->length = buffer_len;
if (itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p) < 0) {
GTPU_ERROR("Failed to send message to task\n");
free(message_p);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
message_p = NULL;
}
}
}
break;
case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT:{
}
break;
default: {
GTPU_ERROR("Received undefined UlpApi (%02x) from gtpv1u stack!\n",
pUlpApi->apiType);
......@@ -222,13 +224,12 @@ static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP)
memset(gtpv1u_teid2enb_info, 0, sizeof(gtpv1u_teid2enb_info_t));
gtpv1u_teid2enb_info->state = BEARER_IN_CONFIG;
#warning !!! hack because missing modify session request, so force enb address
gtpv1u_teid2enb_info->enb_ip_addr.pdn_type = IPv4;
gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[0] = 192;
gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[1] = 168;
gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[2] = 1;
gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[3] = 2;
gtpv1u_teid2enb_info->state = BEARER_IN_CONFIG;
//#warning !!! hack because missing modify session request, so force enb address
// gtpv1u_teid2enb_info->enb_ip_addr.pdn_type = IPv4;
// gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[0] = 192;
// gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[1] = 168;
// gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[2] = 1;
// gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[3] = 2;
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_CREATE_TUNNEL_RESP);
......@@ -384,7 +385,7 @@ static void *gtpv1u_thread(void *args)
case UDP_DATA_IND: {
udp_data_ind_t *udp_data_ind_p;
udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind;
nwGtpv1uProcessUdpReq(gtpv1u_sgw_data.gtpv1u_stack,
nwGtpv1uProcessUdpReq(gtpv1u_sgw_data.gtpv1u_stack,
udp_data_ind_p->buffer,
udp_data_ind_p->buffer_length,
udp_data_ind_p->peer_port,
......@@ -407,7 +408,7 @@ static void *gtpv1u_thread(void *args)
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
/*
* typedef struct
* typedef struct
{
NW_IN NwU32T teid;
NW_IN NwU32T ipAddr;
......@@ -470,7 +471,7 @@ static void *gtpv1u_thread(void *args)
}
break;
}
free(received_message_p);
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p);
received_message_p = NULL;
}
return NULL;
......
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
......@@ -309,10 +309,9 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
......@@ -368,3 +367,4 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
......@@ -19,10 +19,12 @@ noinst_LTLIBRARIES = libmmeapp.la
libmmeapp_la_LDFLAGS = -all-static
libmmeapp_la_SOURCES = \
mme_app_capabilities.c \
mme_app_context.c \
mme_app_main.c mme_app_defs.h \
mme_app_bearer.c \
mme_app_authentication.c \
mme_app_location.c \
mme_app_statistics.c mme_app_statistics.h \
mme_app_defs.h mme_app_extern.h \
mme_app_itti_messaging.h \
......
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
/*! \file mme_app_bearer.c
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "intertask_interface.h"
#include "mme_config.h"
#include "mme_app_extern.h"
#include "mme_app_ue_context.h"
#include "mme_app_defs.h"
#include "secu_defs.h"
#include "assertions.h"
#include "common_types.h"
int
mme_app_handle_s1ap_ue_capabilities_ind(
const s1ap_ue_cap_ind_t const * s1ap_ue_cap_ind_pP)
{
DevAssert(s1ap_ue_cap_ind_pP != NULL);
//unsigned eNB_ue_s1ap_id:24;
//uint32_t mme_ue_s1ap_id;
//uint8_t radio_capabilities[100];
//uint32_t radio_capabilities_length;
return 0;
}
This diff is collapsed.
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
/*! \file mme_app_config.h
* \brief
* \author Lionel GAUTHIER
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#ifndef MME_APP_CONFIG_H_
#define MME_APP_CONFIG_H_
#endif /* MME_APP_CONFIG_H_ */
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#include <pthread.h>
......@@ -62,6 +64,11 @@ RB_GENERATE(ue_context_map, ue_context_s, rb_entry,
static inline int ue_context_compare_identifiers(
struct ue_context_s *p1, struct ue_context_s *p2)
{
MME_APP_DEBUG(" ue_context_compare_identifiers IMSI %"SCNu64"\n", p1->imsi);
MME_APP_DEBUG(" ue_context_compare_identifiers mme_s11_teid %08x\n" , p1->mme_s11_teid);
MME_APP_DEBUG(" ue_context_compare_identifiers mme_ue_s1ap_id %08x\n" , p1->mme_ue_s1ap_id);
MME_APP_DEBUG(" ue_context_compare_identifiers ue_id %08x\n" , p1->ue_id);
if (p1->imsi > 0) {
/* if IMSI provided */
if (p1->imsi > p2->imsi) {
......@@ -78,6 +85,23 @@ static inline int ue_context_compare_identifiers(
if (p1->mme_s11_teid < p2->mme_s11_teid) {
return -1;
}
} else if (p1->mme_ue_s1ap_id > 0) {
MME_APP_DEBUG(" with mme_ue_s1ap_id %d\n" , p2->mme_ue_s1ap_id);
/* if s1ap ue id provided */
if (p1->mme_ue_s1ap_id > p2->mme_ue_s1ap_id) {
return 1;
}
if (p1->mme_ue_s1ap_id < p2->mme_ue_s1ap_id) {
return -1;
}
} else if (p1->ue_id > 0) {
/* if nas ue_id provided */
if (p1->ue_id > p2->ue_id) {
return 1;
}
if (p1->ue_id < p2->ue_id) {
return -1;
}
} else {
uint16_t mcc1;
uint16_t mnc1;
......@@ -144,14 +168,44 @@ struct ue_context_s *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_con
DevAssert(mme_ue_context != NULL);
memset(&reference, 0, sizeof(struct ue_context_s));
reference.imsi = 0;
reference.mme_s11_teid = teid;
return RB_FIND(ue_context_map, &mme_ue_context->ue_context_tree,
&reference);
}
inline
struct ue_context_s *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(
mme_ue_context_t *mme_ue_context,
uint32_t mme_ue_s1ap_id)
{
struct ue_context_s reference;
DevAssert(mme_ue_context != NULL);
memset(&reference, 0, sizeof(struct ue_context_s));
reference.mme_ue_s1ap_id = mme_ue_s1ap_id;
return RB_FIND(ue_context_map, &mme_ue_context->ue_context_tree,
&reference);
}
inline
ue_context_t *mme_ue_context_exists_nas_ue_id(
mme_ue_context_t *mme_ue_context,
uint32_t nas_ue_id)
{
struct ue_context_s reference;
DevAssert(mme_ue_context != NULL);
memset(&reference, 0, sizeof(struct ue_context_s));
reference.ue_id = nas_ue_id;
return RB_FIND(ue_context_map, &mme_ue_context->ue_context_tree,
&reference);
}
inline
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti)
{
struct ue_context_s reference;
......
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
/* This file contains definitions related to mme applicative layer and should
......@@ -56,22 +58,37 @@ typedef struct {
extern mme_app_desc_t mme_app_desc;
int mme_app_create_bearer(s6a_update_location_ans_t *ula_p);
#if defined(DISABLE_USE_NAS)
int mme_app_handle_attach_req(nas_attach_req_t *attach_req_p);
#endif
int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p);
int mme_app_handle_s1ap_ue_capabilities_ind (const s1ap_ue_cap_ind_t const * s1ap_ue_cap_ind_pP);
int mme_app_send_s11_create_session_req (struct ue_context_s * const ue_context_pP);
int mme_app_send_s6a_update_location_req (struct ue_context_s * const ue_context_pP);
int mme_app_handle_s6a_update_location_ans (const s6a_update_location_ans_t * const ula_pP);
int mme_app_handle_nas_pdn_connectivity_req ( nas_pdn_connectivity_req_t * const nas_pdn_connectivity_req_p);
void mme_app_handle_conn_est_cnf (const nas_conn_est_cnf_t * const nas_conn_est_cnf_pP);
void mme_app_handle_conn_est_ind (const mme_app_connection_establishment_ind_t * const conn_est_ind_pP);
int mme_app_handle_create_sess_resp (const SgwCreateSessionResponse * const create_sess_resp_pP);
int mme_app_handle_establish_ind (const nas_establish_ind_t * const nas_establish_ind_pP);
int mme_app_handle_establish_ind(nas_establish_ind_t *nas_establish_ind_p);
int mme_app_handle_authentication_info_answer(const s6a_auth_info_ans_t * const s6a_auth_info_ans_pP);
int mme_app_handle_authentication_info_answer(s6a_auth_info_ans_t *s6a_auth_info_ans_p);
int mme_app_handle_nas_auth_resp (const nas_auth_resp_t * const nas_auth_resp_pP);
int mme_app_handle_nas_auth_resp(nas_auth_resp_t *nas_auth_resp_p);
nas_cause_t s6a_error_2_nas_cause (const uint32_t s6a_errorP, const int experimentalP);
nas_cause_t s6a_error_2_nas_cause(uint32_t s6a_error, int experimental);
void mme_app_handle_nas_auth_param_req (const nas_auth_param_req_t * const nas_auth_param_req_pP);
void mme_app_handle_nas_auth_param_req(nas_auth_param_req_t *nas_auth_param_req);
void mme_app_handle_initial_context_setup_rsp(const mme_app_initial_context_setup_rsp_t * const initial_ctxt_setup_rsp_pP);
#endif /* MME_APP_DEFS_H_ */
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#ifndef MME_APP_EXTERN_H_
......
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#ifndef MME_APP_ITTI_MESSAGING_H_
#define MME_APP_ITTI_MESSAGING_H_
static inline void mme_app_itti_auth_fail(uint32_t ue_id, nas_cause_t cause)
static inline void
mme_app_itti_auth_fail(
const uint32_t ue_id,
const nas_cause_t cause)
{
MessageDef *message_p;
......@@ -43,8 +48,12 @@ static inline void mme_app_itti_auth_fail(uint32_t ue_id, nas_cause_t cause)
itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
}
static inline void mme_app_itti_auth_rsp(uint32_t ue_id, uint8_t nb_vectors,
eutran_vector_t *vector)
static inline void mme_app_itti_auth_rsp(
const uint32_t ue_id,
const uint8_t nb_vectors,
const eutran_vector_t * const vector)
{
MessageDef *message_p;
......
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
/*! \file mme_app_location.c
* \brief
* \author Sebastien ROUX, Lionel GAUTHIER
* \version 1.0
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "intertask_interface.h"
#include "mme_config.h"
#include "mme_app_extern.h"
#include "mme_app_ue_context.h"
#include "mme_app_defs.h"
#include "secu_defs.h"
#include "assertions.h"
#include "common_types.h"
int
mme_app_send_s6a_update_location_req(
struct ue_context_s * const ue_context_pP)
{
struct ue_context_s *ue_context_p = NULL;
uint64_t imsi = 0;
MessageDef *message_p = NULL;
s6a_update_location_req_t *s6a_ulr_p = NULL;
MME_APP_STRING_TO_IMSI((char *)ue_context_pP->pending_pdn_connectivity_req_imsi, &imsi);
MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi);
if ((ue_context_p = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts,
imsi)) == NULL) {
MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n");
return -1;
}
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_UPDATE_LOCATION_REQ);
if (message_p == NULL) {
return -1;
}
s6a_ulr_p = &message_p->ittiMsg.s6a_update_location_req;
memset((void*)s6a_ulr_p, 0, sizeof(s6a_update_location_req_t));
MME_APP_IMSI_TO_STRING(imsi, s6a_ulr_p->imsi);
s6a_ulr_p->imsi_length = strlen(s6a_ulr_p->imsi);
s6a_ulr_p->initial_attach = INITIAL_ATTACH;
memcpy(&s6a_ulr_p->visited_plmn, &ue_context_p->guti.gummei.plmn, sizeof(plmn_t));
s6a_ulr_p->rat_type = RAT_EUTRAN;
/* Check if we already have UE data */
s6a_ulr_p->skip_subscriber_data = 0;
return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p);
}
int
mme_app_handle_s6a_update_location_ans(
const s6a_update_location_ans_t * const ula_pP)
{
uint64_t imsi = 0;
struct ue_context_s *ue_context_p = NULL;
DevAssert(ula_pP != NULL);
if (ula_pP->result.present == S6A_RESULT_BASE) {
if (ula_pP->result.choice.base != DIAMETER_SUCCESS) {
/* The update location procedure has failed. Notify the NAS layer
* and don't initiate the bearer creation on S-GW side.
*/
DevMessage("ULR/ULA procedure returned non success\n");
}
} else {
/* The update location procedure has failed. Notify the NAS layer
* and don't initiate the bearer creation on S-GW side.
*/
DevMessage("ULR/ULA procedure returned non success\n");
}
MME_APP_STRING_TO_IMSI((char *)ula_pP->imsi, &imsi);
MME_APP_DEBUG("%s Handling imsi %"IMSI_FORMAT"\n", __FUNCTION__, imsi);
if ((ue_context_p = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi)) == NULL) {
MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n");
return -1;
}
ue_context_p->subscription_known = SUBSCRIPTION_KNOWN;
ue_context_p->sub_status = ula_pP->subscription_data.subscriber_status;
ue_context_p->access_restriction_data = ula_pP->subscription_data.access_restriction;
/* Copy the subscribed ambr to the sgw create session request message */
memcpy(&ue_context_p->subscribed_ambr, &ula_pP->subscription_data.subscribed_ambr,
sizeof(ambr_t));
memcpy(
ue_context_p->msisdn,
ula_pP->subscription_data.msisdn,
ula_pP->subscription_data.msisdn_length);
ue_context_p->msisdn_length = ula_pP->subscription_data.msisdn_length;
AssertFatal(ula_pP->subscription_data.msisdn_length != 0, "MSISDN LENGTH IS 0");
AssertFatal(ula_pP->subscription_data.msisdn_length <= MSISDN_LENGTH, "MSISDN LENGTH is too high %u", MSISDN_LENGTH);
ue_context_p->msisdn[ue_context_p->msisdn_length] = '\0';
ue_context_p->rau_tau_timer = ula_pP->subscription_data.rau_tau_timer;
ue_context_p->access_mode = ula_pP->subscription_data.access_mode;
memcpy(&ue_context_p->apn_profile, &ula_pP->subscription_data.apn_config_profile,
sizeof(apn_config_profile_t));
return mme_app_send_s11_create_session_req(ue_context_p);
}
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#include <stdio.h>
......@@ -71,13 +73,18 @@ void *mme_app_thread(void *args)
case S6A_UPDATE_LOCATION_ANS: {
/* We received the update location answer message from HSS -> Handle it */
mme_app_create_bearer(&received_message_p->ittiMsg.s6a_update_location_ans);
mme_app_handle_s6a_update_location_ans(&received_message_p->ittiMsg.s6a_update_location_ans);
} break;
case SGW_CREATE_SESSION_RESPONSE: {
mme_app_handle_create_sess_resp(&received_message_p->ittiMsg.sgwCreateSessionResponse);
} break;
case SGW_MODIFY_BEARER_RESPONSE: {
MME_APP_DEBUG(" TO DO HANDLE SGW_MODIFY_BEARER_RESPONSE");
// TO DO
} break;
#if defined(DISABLE_USE_NAS)
case NAS_ATTACH_REQ: {
mme_app_handle_attach_req(&received_message_p->ittiMsg.nas_attach_req);
......@@ -91,6 +98,24 @@ void *mme_app_thread(void *args)
mme_app_handle_nas_auth_param_req(&received_message_p->ittiMsg.nas_auth_param_req);
} break;
#endif
case NAS_PDN_CONNECTIVITY_REQ: {
mme_app_handle_nas_pdn_connectivity_req(&received_message_p->ittiMsg.nas_pdn_connectivity_req);
} break;
//case NAS_CONNECTION_ESTABLISHMENT_CNF: {
case NAS_CONNECTION_ESTABLISHMENT_CNF: {
mme_app_handle_conn_est_cnf(&NAS_CONNECTION_ESTABLISHMENT_CNF(received_message_p));
} break;
case MME_APP_CONNECTION_ESTABLISHMENT_IND: {
mme_app_handle_conn_est_ind(&MME_APP_CONNECTION_ESTABLISHMENT_IND(received_message_p));
} break;
case MME_APP_INITIAL_CONTEXT_SETUP_RSP: {
mme_app_handle_initial_context_setup_rsp(&MME_APP_INITIAL_CONTEXT_SETUP_RSP(received_message_p));
} break;
case TIMER_HAS_EXPIRED: {
/* Check if it is the statistic timer */
if (received_message_p->ittiMsg.timer_has_expired.timer_id ==
......@@ -105,7 +130,7 @@ void *mme_app_thread(void *args)
} break;
case S1AP_UE_CAPABILITIES_IND: {
// TO DO;
mme_app_handle_s1ap_ue_capabilities_ind(&received_message_p->ittiMsg.s1ap_ue_cap_ind);
} break;
default: {
......
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
......@@ -7,7 +38,8 @@
#include "mme_app_defs.h"
#include "mme_app_statistics.h"
int mme_app_statistics_display(void)
int
mme_app_statistics_display(void)
{
fprintf(stdout, "================== Statistics ==================\n");
fprintf(stdout, " | Global | Since last display |\n");
......
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#ifndef MME_APP_STATISTICS_H_
#define MME_APP_STATISTICS_H_
......
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
/*! \file mme_app_ue_context.h
......@@ -42,6 +44,8 @@
#include <inttypes.h> /* For sscanf formats */
#include <time.h> /* to provide time_t */
#include "nas_messages_types.h"
#include "s6a_messages_types.h"
#include "security_types.h"
#include "tree.h"
......@@ -67,13 +71,13 @@ typedef uint64_t mme_app_imsi_t;
*/
typedef struct bearer_context_s {
/* S-GW Tunnel Endpoint for User-Plane */
uint32_t s_gw_teid;
Teid_t s_gw_teid;
/* S-GW IP address for User-Plane */
ip_address_t s_gw_address;
/* P-GW Tunnel Endpoint for User-Plane */
uint32_t p_gw_teid;
Teid_t p_gw_teid;
/* P-GW IP address for User-Plane */
ip_address_t p_gw_address;
......@@ -98,47 +102,48 @@ typedef struct ue_context_s {
/* Basic identifier for ue. IMSI is encoded on maximum of 15 digits of 4 bits,
* so usage of an unsigned integer on 64 bits is necessary.
*/
mme_app_imsi_t imsi;
mme_app_imsi_t imsi; // set by nas_auth_param_req_t
#define IMSI_UNAUTHENTICATED (0x0)
#define IMSI_AUTHENTICATED (0x1)
/* Indicator to show the IMSI authentication state */
unsigned imsi_auth:1;
unsigned imsi_auth:1; // set by nas_auth_resp_t
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* ue_id is equal to mme_ue_s1ap_id */
uint32_t ue_id;
uint8_t nb_of_vectors;
uint32_t ue_id; // set by nas_auth_param_req_t
uint8_t nb_of_vectors; // updated by S6A AUTHENTICATION ANSWER
/* List of authentication vectors for E-UTRAN */
eutran_vector_t *vector_list;
eutran_vector_t *vector_in_use;
eutran_vector_t *vector_list; // updated by S6A AUTHENTICATION ANSWER
// pointer in vector_list
eutran_vector_t *vector_in_use; // updated by S6A AUTHENTICATION ANSWER
#define SUBSCRIPTION_UNKNOWN 0x0
#define SUBSCRIPTION_KNOWN 0x1
unsigned subscription_known:1;
unsigned subscription_known:1; // set by S6A UPDATE LOCATION ANSWER
uint8_t msisdn[MSISDN_LENGTH+1]; // set by S6A UPDATE LOCATION ANSWER
uint8_t msisdn_length; // set by S6A UPDATE LOCATION ANSWER
uint8_t msisdn[MSISDN_LENGTH+1];
uint8_t msisdn_length;
mm_state_t mm_state;
mm_state_t mm_state; // not set/read
/* Globally Unique Temporary Identity */
GUTI_t guti;
me_identity_t me_identity;
GUTI_t guti; // guti.gummei.plmn set by nas_auth_param_req_t
// read by S6A UPDATE LOCATION REQUEST
me_identity_t me_identity; // not set/read except read by display utility
/* TODO: Add TAI list */
/* Last known cell identity */
cgi_t e_utran_cgi;
cgi_t e_utran_cgi; // set by nas_attach_req_t
// read for S11 CREATE_SESSION_REQUEST
/* Time when the cell identity was acquired */
time_t cell_age;
time_t cell_age; // set by nas_auth_param_req_t
/* TODO: add csg_id */
/* TODO: add csg_membership */
network_access_mode_t access_mode;
network_access_mode_t access_mode; // set by S6A UPDATE LOCATION ANSWER
/* TODO: add ue radio cap, ms classmarks, supported codecs */
......@@ -147,27 +152,37 @@ typedef struct ue_context_s {
/* TODO: add DRX parameter */
apn_config_profile_t apn_profile;
ard_t access_restriction_data;
apn_config_profile_t apn_profile; // set by S6A UPDATE LOCATION ANSWER
ard_t access_restriction_data; // set by S6A UPDATE LOCATION ANSWER
subscriber_status_t sub_status; // set by S6A UPDATE LOCATION ANSWER
ambr_t subscribed_ambr; // set by S6A UPDATE LOCATION ANSWER
ambr_t used_ambr;
subscriber_status_t sub_status;
ambr_t subscribed_ambr;
ambr_t used_ambr;
rau_tau_timer_t rau_tau_timer;
rau_tau_timer_t rau_tau_timer; // set by S6A UPDATE LOCATION ANSWER
/* Store the radio capabilities as received in S1AP UE capability indication
* message.
*/
char *ue_radio_capabilities;
int ue_radio_cap_length;
uint32_t mme_s11_teid;
uint32_t sgw_s11_teid;
bearer_context_t eps_bearers[BEARERS_PER_UE];
char *ue_radio_capabilities; // not set/read
int ue_radio_cap_length; // not set/read
Teid_t mme_s11_teid; // set by mme_app_send_s11_create_session_req
Teid_t sgw_s11_teid; // set by S11 CREATE_SESSION_RESPONSE
PAA_t paa; // set by S11 CREATE_SESSION_RESPONSE
// temp
char pending_pdn_connectivity_req_imsi[16];
uint8_t pending_pdn_connectivity_req_imsi_length;
OctetString pending_pdn_connectivity_req_apn;
OctetString pending_pdn_connectivity_req_pdn_addr;
int pending_pdn_connectivity_req_pti;
unsigned pending_pdn_connectivity_req_ue_id;
network_qos_t pending_pdn_connectivity_req_qos;
void *pending_pdn_connectivity_req_proc_data;
int pending_pdn_connectivity_req_request_type;
ebi_t default_bearer_id;
bearer_context_t eps_bearers[BEARERS_PER_UE];
} ue_context_t;
typedef struct {
......@@ -199,12 +214,28 @@ inline
ue_context_t *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
uint32_t teid);
/** \brief Retrieve an UE context by selecting the provided mme_ue_s1ap_id
* \param mme_ue_s1ap_id The UE id identifier used in S1AP MME (and NAS)
* @returns an UE context matching the mme_ue_s1ap_id or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(mme_ue_context_t *mme_ue_context,
uint32_t mme_ue_s1ap_id);
/** \brief Retrieve an UE context by selecting the provided nas_ue_id
* \param nas_ue_id The UE id identifier used in S1AP MME and NAS
* @returns an UE context matching the nas_ue_id or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_nas_ue_id(mme_ue_context_t *mme_ue_context,
uint32_t nas_ue_id);
/** \brief Retrieve an UE context by selecting the provided guti
* \param guti The GUTI used by the UE
* @returns an UE context matching the guti or NULL if the context doesn't exists
**/
inline
struct ue_context_s *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti);
/** \brief Insert a new UE context in the tree of known UEs.
......
/*******************************************************************************
Eurecom OpenAirInterface Core Network
Copyright(c) 1999 - 2014 Eurecom
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : EURECOM,
Campus SophiaTech,
450 Route des Chappes,
CS 50193
06904 Biot Sophia Antipolis cedex,
FRANCE
*******************************************************************************/
#include "as_message.h"
......
......@@ -220,14 +220,22 @@ int emm_proc_attach(emm_proc_attach_type_t type)
/* Check whether the selected PLMN is neither the registered PLMN
* nor in the list of equivalent PLMNs */
if ( (!_emm_data.is_rplmn) && (!_emm_data.is_eplmn) ) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI");
/* Include the IMSI */
emm_as->UEid.imsi = _emm_data.imsi;
} else {
LOG_TRACE(INFO,
"EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d",
_emm_data.is_rplmn,
_emm_data.is_eplmn);
}
} else if (_emm_data.guti) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI");
/* Include a valid GUTI and the last visited registered TAI */
emm_as->UEid.guti = _emm_data.guti;
emm_as->UEid.tai = _emm_data.tai;
} else if (!_emm_data.is_emergency) {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI");
/* Include the IMSI if no valid GUTI is available */
emm_as->UEid.imsi = _emm_data.imsi;
} else {
......@@ -235,8 +243,10 @@ int emm_proc_attach(emm_proc_attach_type_t type)
* does not hold a valid GUTI */
if (_emm_data.imsi) {
/* Include the IMSI if valid (USIM is present) */
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI");
emm_as->UEid.imsi = _emm_data.imsi;
} else {
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI");
/* Include the IMEI if the IMSI is not valid */
emm_as->UEid.imei = _emm_data.imei;
}
......@@ -2118,7 +2128,7 @@ static int _emm_attach(void *args)
/* Assign the TAI list the UE is registered to */
/* Allocate parameters of the retransmission timer callback */
attach_data_t *data = (attach_data_t *)malloc(sizeof(attach_data_t));
attach_data_t *data = (attach_data_t *)calloc(1,sizeof(attach_data_t));
if (data != NULL) {
/* Setup ongoing EMM procedure callback functions */
......@@ -2134,6 +2144,7 @@ static int _emm_attach(void *args)
data->ueid = emm_ctx->ueid;
/* Reset the retransmission counter */
data->retransmission_count = 0;
#if defined(ORIGINAL_CODE)
/* Setup the ESM message container */
data->esm_msg.value = (uint8_t *)malloc(esm_sap.send.length);
if (data->esm_msg.value) {
......@@ -2156,6 +2167,9 @@ static int _emm_attach(void *args)
rc = emm_sap_send(&emm_sap);
}
}
#else
rc = RETURNok;
#endif
}
} else if (esm_sap.err != ESM_SAP_DISCARDED) {
/*
......@@ -2196,6 +2210,10 @@ static int _emm_attach(void *args)
LOG_FUNC_RETURN (rc);
}
int emm_cn_wrapper_attach_accept(emm_data_context_t *emm_ctx, void *data)
{
return _emm_attach_accept(emm_ctx,(attach_data_t *)data);
}
/****************************************************************************
** **
** Name: _emm_attach_accept() **
......@@ -2228,13 +2246,13 @@ static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data)
/* Implicit GUTI reallocation;
* include the new assigned GUTI in the Attach Accept message */
emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->old_guti;
emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
} else {
emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti;
emm_sap.u.emm_as.u.establish.new_guti = NULL;
emm_sap.u.emm_as.u.establish.new_guti = NULL;
}
emm_sap.u.emm_as.u.establish.n_tacs = emm_ctx->n_tacs;
emm_sap.u.emm_as.u.establish.tac = emm_ctx->tac;
emm_sap.u.emm_as.u.establish.n_tacs = emm_ctx->n_tacs;
emm_sap.u.emm_as.u.establish.tac = emm_ctx->tac;
emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_ATTACH;
/* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx,
......@@ -2242,6 +2260,9 @@ static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data)
/* Get the activate default EPS bearer context request message to
* transfer within the ESM container of the attach accept message */
emm_sap.u.emm_as.u.establish.NASmsg = data->esm_msg;
LOG_TRACE(INFO,"EMM-PROC - NASmsg src size = %d NASmsg dst size = %d ",
data->esm_msg.length, emm_sap.u.emm_as.u.establish.NASmsg.length);
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
......
......@@ -509,7 +509,8 @@ int emm_proc_initialize(void)
* When switched on, the UE will try to automatically register
* to each previous PLMN within the ordered list of available
* PLMNs regardless of the network selection mode of operation */
_emm_plmn_list.hplmn = _emm_plmn_list.n_plmns;
_emm_plmn_list.hplmn = _emm_plmn_list.n_plmns - 1;
// LG_emm_plmn_list.hplmn = _emm_plmn_list.n_plmns;
/* Add the highest priority PLMN in the list of "equivalent HPLMNs"
if present and not empty, or the HPLMN derived from the IMSI */
......@@ -891,9 +892,11 @@ int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat)
if (_emm_plmn_list.splmn != -1) {
if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) {
/* The selected PLMN is the registered PLMN */
LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is the registered PLMN");
_emm_data.is_rplmn = TRUE;
} else if (_emm_plmn_list.splmn < _emm_plmn_list.hplmn) {
/* The selected PLMN is in the list of equivalent PLMNs */
LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is in the list of equivalent PLMNs");
_emm_data.is_eplmn = TRUE;
}
/*
......
......@@ -326,30 +326,30 @@ typedef struct emm_data_context_s {
RB_ENTRY(emm_data_context_s) entries;
#endif
unsigned int ueid; /* UE identifier */
int is_dynamic; /* Dynamically allocated context indicator */
int is_attached; /* Attachment indicator */
int is_emergency; /* Emergency bearer services indicator */
imsi_t *imsi; /* The IMSI provided by the UE or the MME */
imei_t *imei; /* The IMEI provided by the UE */
int guti_is_new; /* New GUTI indicator */
GUTI_t *guti; /* The GUTI assigned to the UE */
GUTI_t *old_guti; /* The old GUTI */
int n_tacs; /* Number of concecutive tracking areas the UE is
* registered to */
tac_t tac; /* Code of the first tracking area the UE is
* registered to */
int ksi; /* Security key set identifier provided by the UE */
int eea; /* EPS encryption algorithms supported by the UE */
int eia; /* EPS integrity algorithms supported by the UE */
auth_vector_t vector; /* EPS authentication vector */
emm_security_context_t *security; /* Current EPS NAS security context */
OctetString esm_msg; /* ESM message contained within the initial request */
int emm_cause; /* EMM failure cause code */
emm_fsm_state_t _emm_fsm_status;
unsigned int ueid; /* UE identifier */
int is_dynamic; /* Dynamically allocated context indicator */
int is_attached; /* Attachment indicator */
int is_emergency;/* Emergency bearer services indicator */
imsi_t *imsi; /* The IMSI provided by the UE or the MME */
imei_t *imei; /* The IMEI provided by the UE */
int guti_is_new; /* New GUTI indicator */
GUTI_t *guti; /* The GUTI assigned to the UE */
GUTI_t *old_guti; /* The old GUTI */
int n_tacs; /* Number of consecutive tracking areas the UE is
* registered to */
tac_t tac; /* Code of the first tracking area the UE is
* registered to */
int ksi; /* Security key set identifier provided by the UE */
int eea; /* EPS encryption algorithms supported by the UE */
int eia; /* EPS integrity algorithms supported by the UE */
auth_vector_t vector;/* EPS authentication vector */
emm_security_context_t *security; /* Current EPS NAS security context */
OctetString esm_msg; /* ESM message contained within the initial request*/
int emm_cause; /* EMM failure cause code */
emm_fsm_state_t _emm_fsm_status;
esm_data_context_t esm_data_ctx;
} emm_data_context_t;
......
......@@ -6,6 +6,7 @@
#include "assertions.h"
#include "tree.h"
#include "emmData.h"
#include "nas_log.h"
static inline
int emm_data_ctxt_compare_ueid(struct emm_data_context_s *p1,
......@@ -48,11 +49,13 @@ struct emm_data_context_s *emm_data_context_get(
struct emm_data_context_s *emm_data_context_remove(
emm_data_t *emm_data, struct emm_data_context_s *elm)
{
LOG_TRACE(INFO, "EMM-CTX - Remove in context %p UE id %u", elm, elm->ueid);
return RB_REMOVE(emm_data_context_map, &emm_data->ctx_map, elm);
}
void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm)
{
LOG_TRACE(INFO, "EMM-CTX - Add in context %p UE id %u", elm, elm->ueid);
RB_INSERT(emm_data_context_map, &emm_data->ctx_map, elm);
}
......
......@@ -157,39 +157,45 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
int encoded = 0;
int encode_result = 0;
LOG_FUNC_IN;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_ACCEPT_MINIMUM_LENGTH, len);
*(buffer + encoded) = (encode_u8_eps_attach_result(&attach_accept->epsattachresult) & 0x0f);
encoded++;
if ((encode_result = encode_gprs_timer(&attach_accept->t3412value, 0, buffer
+ encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
+ encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((encode_result =
encode_tracking_area_identity_list(&attach_accept->tailist, 0, buffer
+ encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
+ encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_tracking_area_identity_list");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((encode_result =
encode_esm_message_container(&attach_accept->esmmessagecontainer, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
buffer + encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_esm_message_container");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((attach_accept->presencemask & ATTACH_ACCEPT_GUTI_PRESENT)
== ATTACH_ACCEPT_GUTI_PRESENT)
{
if ((encode_result = encode_eps_mobile_identity(&attach_accept->guti,
ATTACH_ACCEPT_GUTI_IEI, buffer + encoded, len - encoded)) < 0)
ATTACH_ACCEPT_GUTI_IEI, buffer + encoded, len - encoded)) < 0) {
// Return in case of error
return encode_result;
else
LOG_TRACE(WARNING, "Failed encode_eps_mobile_identity");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -199,10 +205,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
if ((encode_result =
encode_location_area_identification(&attach_accept->locationareaidentification,
ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, buffer + encoded,
len - encoded)) < 0)
len - encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_location_area_identification");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -211,10 +218,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
{
if ((encode_result = encode_mobile_identity(&attach_accept->msidentity,
ATTACH_ACCEPT_MS_IDENTITY_IEI, buffer + encoded, len - encoded)) <
0)
0) {
LOG_TRACE(WARNING, "Failed encode_mobile_identity");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -223,10 +231,10 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
{
if ((encode_result = encode_emm_cause(&attach_accept->emmcause,
ATTACH_ACCEPT_EMM_CAUSE_IEI, buffer + encoded, len - encoded)) <
0)
0) {
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -235,10 +243,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
{
if ((encode_result = encode_gprs_timer(&attach_accept->t3402value,
ATTACH_ACCEPT_T3402_VALUE_IEI, buffer + encoded, len - encoded)) <
0)
0) {
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -247,10 +256,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
{
if ((encode_result = encode_gprs_timer(&attach_accept->t3423value,
ATTACH_ACCEPT_T3423_VALUE_IEI, buffer + encoded, len - encoded)) <
0)
0) {
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -259,10 +269,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
{
if ((encode_result = encode_plmn_list(&attach_accept->equivalentplmns,
ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + encoded, len -
encoded)) < 0)
encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_plmn_list");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -272,10 +283,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
if ((encode_result =
encode_emergency_number_list(&attach_accept->emergencynumberlist,
ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + encoded, len -
encoded)) < 0)
encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_emergency_number_list");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -285,10 +297,11 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
if ((encode_result =
encode_eps_network_feature_support(&attach_accept->epsnetworkfeaturesupport,
ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, buffer + encoded,
len - encoded)) < 0)
len - encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_eps_network_feature_support");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
......@@ -298,13 +311,14 @@ int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
if ((encode_result =
encode_additional_update_result(&attach_accept->additionalupdateresult,
ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer + encoded, len
- encoded)) < 0)
- encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_additional_update_result");
// Return in case of error
return encode_result;
else
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
return encoded;
LOG_FUNC_RETURN(encoded);
}
......@@ -1708,6 +1708,8 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
/* Setup the initial NAS information message */
if (emm_msg != NULL) switch (msg->NASinfo) {
case EMM_AS_NAS_INFO_ATTACH:
LOG_TRACE(WARNING, "EMMAS-SAP - emm_as_establish.nasMSG.length"\
"=%d", msg->NASmsg.length);
size = emm_send_attach_accept(msg, &emm_msg->attach_accept);
break;
......
......@@ -12,7 +12,7 @@ Product NAS stack
Subsystem EPS Core Network
Author Sebastien Roux
Author Sebastien Roux, Lionel GAUTHIER
Description
......@@ -30,6 +30,26 @@ Description
#include "emm_proc.h"
#include "emm_cause.h"
#include "esm_send.h" // LG
#include "esm_proc.h" // LG
#include "esm_cause.h" // LG
#include "assertions.h"// LG
#include "emmData.h" // LG
#include "esm_sap.h" // LG
#include "EmmCommon.h" // LG
extern int emm_cn_wrapper_attach_accept(emm_data_context_t *emm_ctx, void *data);
/*
* Internal data used for attach procedure
*/
typedef struct {
unsigned int ueid; /* UE identifier */
#define ATTACH_COUNTER_MAX 5
unsigned int retransmission_count; /* Retransmission counter */
OctetString esm_msg; /* ESM message to be sent within
* the Attach Accept message */
} attach_data_t;
/*
* String representation of EMMCN-SAP primitives
*/
......@@ -37,8 +57,13 @@ static const char *_emm_cn_primitive_str[] = {
"EMM_CN_AUTHENTICATION_PARAM_RES",
"EMM_CN_AUTHENTICATION_PARAM_FAIL",
"EMM_CN_DEREGISTER_UE",
"EMM_CN_PDN_CONNECTIVITY_RES",
"EMM_CN_PDN_CONNECTIVITY_FAIL",
};
#define EMM_CN_SAP_BUFFER_SIZE 4096
static char _emm_cn_sap_buffer[EMM_CN_SAP_BUFFER_SIZE];
static int _emm_cn_authentication_res(const emm_cn_auth_res_t *msg)
{
emm_data_context_t *emm_ctx = NULL;
......@@ -111,6 +136,183 @@ static int _emm_cn_deregister_ue(const UInt32_t ue_id)
LOG_FUNC_RETURN (rc);
}
static int _emm_cn_pdn_connectivity_res(const emm_cn_pdn_res_t *msg_pP)
{
int rc = RETURNok;
struct emm_data_context_s *emm_ctx_p = NULL;
esm_proc_pdn_type_t esm_pdn_type = ESM_PDN_TYPE_IPV4;
esm_proc_data_t *esm_proc_data_p = NULL;
ESM_msg esm_msg;
EpsQualityOfService qos;
OctetString rsp = { 0, NULL};
int is_standalone = 0; // warning hardcoded
int triggered_by_ue = 1; // warning hardcoded
attach_data_t *data_p = NULL;
int esm_cause = ESM_CAUSE_SUCCESS;
int pid = 0;
unsigned int new_ebi = 0;
LOG_FUNC_IN;
emm_ctx_p = emm_data_context_get(&_emm_data, msg_pP->ue_id);
if (emm_ctx_p == NULL) {
LOG_TRACE(ERROR, "EMMCN-SAP - "
"Failed to find UE associated to id %u...", msg_pP->ue_id);
LOG_FUNC_RETURN (rc);
}
memset(&esm_msg, 0 , sizeof(ESM_msg));
switch (msg_pP->pdn_type) {
case IPv4:
esm_pdn_type = ESM_PDN_TYPE_IPV4;
break;
case IPv6:
esm_pdn_type = ESM_PDN_TYPE_IPV6;
break;
case IPv4_AND_v6:
esm_pdn_type = ESM_PDN_TYPE_IPV4V6;
break;
default:
esm_pdn_type = ESM_PDN_TYPE_IPV4;
}
qos.bitRatesPresent = 1;
qos.bitRatesExtPresent = 0;
qos.qci = msg_pP->qos.qci;
qos.bitRates.maxBitRateForUL = msg_pP->qos.mbrUL;
qos.bitRates.maxBitRateForDL = msg_pP->qos.mbrDL;
qos.bitRates.guarBitRateForUL = msg_pP->qos.gbrUL;
qos.bitRates.guarBitRateForDL = msg_pP->qos.gbrDL;
qos.bitRatesExt.maxBitRateForUL = 0;
qos.bitRatesExt.maxBitRateForDL = 0;
qos.bitRatesExt.guarBitRateForUL = 0;
qos.bitRatesExt.guarBitRateForDL = 0;
/*************************************************************************/
/* CODE THAT WAS IN esm_recv.c/esm_recv_pdn_connectivity_request() */
/*************************************************************************/
/* Execute the PDN connectivity procedure requested by the UE */
pid = esm_proc_pdn_connectivity_request(
emm_ctx_p,
msg_pP->pti,
msg_pP->request_type,
&msg_pP->apn,
esm_pdn_type,
&msg_pP->pdn_addr,
NULL,
&esm_cause);
LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value));
if (pid != RETURNerror) {
/* Create local default EPS bearer context */
rc = esm_proc_default_eps_bearer_context(
emm_ctx_p,
pid,
&new_ebi,
&msg_pP->qos,
&esm_cause);
if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS;
}
} else {
LOG_FUNC_RETURN (rc);
}
/**************************************************************************/
/* END OF CODE THAT WAS IN esm_recv.c/esm_recv_pdn_connectivity_request() */
/**************************************************************************/
LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value));
/*************************************************************************/
/* CODE THAT WAS IN esm_sap.c/_esm_sap_recv() */
/*************************************************************************/
/* Return default EPS bearer context request message */
rc = esm_send_activate_default_eps_bearer_context_request(
msg_pP->pti,
new_ebi, //msg_pP->ebi,
&esm_msg.activate_default_eps_bearer_context_request,
&msg_pP->apn,
esm_pdn_type,
&msg_pP->pdn_addr,
&qos,
ESM_CAUSE_SUCCESS);
if (rc != RETURNerror) {
/* Encode the returned ESM response message */
int size = esm_msg_encode(&esm_msg, (uint8_t *)_emm_cn_sap_buffer,
EMM_CN_SAP_BUFFER_SIZE);
LOG_TRACE(INFO, "ESM encoded MSG size %d ", size);
if (size > 0) {
rsp.length = size;
rsp.value = (uint8_t *)(_emm_cn_sap_buffer);
}
/* Complete the relevant ESM procedure */
rc = esm_proc_default_eps_bearer_context_request(
is_standalone,
emm_ctx_p,
new_ebi, //0, //ESM_EBI_UNASSIGNED, //msg->ebi,
&rsp,
triggered_by_ue);
if (rc != RETURNok) {
/* Return indication that ESM procedure failed */
LOG_FUNC_RETURN (rc);
}
} else {
LOG_TRACE(INFO, "ESM send activate_default_eps_bearer_context_request failed");
}
/*************************************************************************/
/* END OF CODE THAT WAS IN esm_sap.c/_esm_sap_recv() */
/*************************************************************************/
LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value));
data_p = (attach_data_t *)emm_proc_common_get_args(msg_pP->ue_id);
/* Setup the ESM message container */
data_p->esm_msg.value = (uint8_t *)malloc(rsp.length);
if (data_p->esm_msg.value) {
data_p->esm_msg.length = rsp.length;
LOG_TRACE(INFO, "EMM - copy ESM MSG %d bytes", data_p->esm_msg.length);
memcpy(data_p->esm_msg.value,
rsp.value,
rsp.length);
} else {
data_p->esm_msg.length = 0;
}
/* Send attach accept message to the UE */
rc = emm_cn_wrapper_attach_accept(emm_ctx_p, data_p);
if (rc != RETURNerror) {
if (emm_ctx_p->guti_is_new && emm_ctx_p->old_guti) {
/* Implicit GUTI reallocation;
* Notify EMM that common procedure has been initiated
*/
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
emm_sap.u.emm_reg.ueid = msg_pP->ue_id;
rc = emm_sap_send(&emm_sap);
}
}
LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value));
LOG_FUNC_RETURN (rc);
}
static int _emm_cn_pdn_connectivity_fail(const emm_cn_pdn_fail_t *msg)
{
int rc = RETURNok;
LOG_FUNC_IN;
LOG_FUNC_RETURN (rc);
}
int emm_cn_send(const emm_cn_t *msg)
{
int rc = RETURNerror;
......@@ -134,6 +336,14 @@ int emm_cn_send(const emm_cn_t *msg)
rc = _emm_cn_deregister_ue(msg->u.deregister.UEid);
break;
case EMMCN_PDN_CONNECTIVITY_RES:
rc = _emm_cn_pdn_connectivity_res(msg->u.emm_cn_pdn_res);
break;
case EMMCN_PDN_CONNECTIVITY_FAIL:
rc = _emm_cn_pdn_connectivity_fail(msg->u.emm_cn_pdn_fail);
break;
default:
/* Other primitives are forwarded to the Access Stratum */
rc = RETURNerror;
......
......@@ -12,7 +12,7 @@ Product NAS stack
Subsystem EPS Core Network
Author Sebastien Roux
Author Sebastien Roux, Lionel GAUTHIER
Description
......
......@@ -12,7 +12,7 @@ Product NAS stack
Subsystem EPS Core Network
Author Sebastien Roux
Author Sebastien Roux, Lionel GAUTHIER
Description
......@@ -31,13 +31,17 @@ typedef enum emmcn_primitive_s {
_EMMCN_AUTHENTICATION_PARAM_RES,
_EMMCN_AUTHENTICATION_PARAM_FAIL,
_EMMCN_DEREGISTER_UE,
_EMMCN_PDN_CONNECTIVITY_RES, // LG
_EMMCN_PDN_CONNECTIVITY_FAIL,// LG
#endif
_EMMCN_END
} emm_cn_primitive_t;
#if defined(EPC_BUILD)
typedef nas_auth_param_rsp_t emm_cn_auth_res_t;
typedef nas_auth_param_fail_t emm_cn_auth_fail_t;
typedef nas_auth_param_rsp_t emm_cn_auth_res_t;
typedef nas_auth_param_fail_t emm_cn_auth_fail_t;
typedef nas_pdn_connectivity_rsp_t emm_cn_pdn_res_t;
typedef nas_pdn_connectivity_fail_t emm_cn_pdn_fail_t;
typedef struct emm_cn_deregister_ue_s {
UInt32_t UEid;
......@@ -49,6 +53,8 @@ typedef struct emm_mme_ul_s {
emm_cn_auth_res_t *auth_res;
emm_cn_auth_fail_t *auth_fail;
emm_cn_deregister_ue_t deregister;
emm_cn_pdn_res_t *emm_cn_pdn_res;
emm_cn_pdn_fail_t *emm_cn_pdn_fail;
} u;
} emm_cn_t;
#endif
......
......@@ -110,7 +110,9 @@ typedef enum {
#ifdef EPC_BUILD
EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES,
EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL,
EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE
EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE,
EMMCN_PDN_CONNECTIVITY_RES = _EMMCN_PDN_CONNECTIVITY_RES,
EMMCN_PDN_CONNECTIVITY_FAIL = _EMMCN_PDN_CONNECTIVITY_FAIL
#endif
} emm_primitive_t;
......
......@@ -177,6 +177,7 @@ int emm_send_attach_request(const emm_as_establish_t *msg,
/* Mandatory - EPS mobile identity */
size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH;
if (msg->UEid.guti) {
LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with GUTI");
/* Set GUTI mobile identity */
GutiEpsMobileIdentity_t *guti = &emm_msg->oldgutiorimsi.guti;
guti->typeofidentity = EPS_MOBILE_IDENTITY_GUTI;
......@@ -191,6 +192,7 @@ int emm_send_attach_request(const emm_as_establish_t *msg,
guti->mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2;
guti->mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3;
} else if (msg->UEid.imsi) {
LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with IMSI");
/* Set IMSI mobile identity */
ImsiEpsMobileIdentity_t *imsi = &emm_msg->oldgutiorimsi.imsi;
imsi->typeofidentity = EPS_MOBILE_IDENTITY_IMSI;
......@@ -211,6 +213,7 @@ int emm_send_attach_request(const emm_as_establish_t *msg,
imsi->digit14 = msg->UEid.imsi->u.num.digit14;
imsi->digit15 = msg->UEid.imsi->u.num.digit15;
} else if (msg->UEid.imei) {
LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with IMEI");
/* Set IMEI mobile identity */
ImeiEpsMobileIdentity_t *imei = &emm_msg->oldgutiorimsi.imei;
imei->typeofidentity = EPS_MOBILE_IDENTITY_IMEI;
......@@ -897,6 +900,8 @@ int emm_send_attach_accept(const emm_as_establish_t *msg,
int size = EMM_HEADER_MAXIMUM_LENGTH;
LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Accept message");
LOG_TRACE(INFO, "EMMAS-SAP - size = EMM_HEADER_MAXIMUM_LENGTH(%d)",
size);
/* Mandatory - Message type */
emm_msg->messagetype = ATTACH_ACCEPT;
......@@ -908,6 +913,8 @@ int emm_send_attach_accept(const emm_as_establish_t *msg,
/* Mandatory - T3412 value */
size += GPRS_TIMER_MAXIMUM_LENGTH;
emm_msg->t3412value.unit = GPRS_TIMER_UNIT_0S;
LOG_TRACE(INFO, "EMMAS-SAP - size += GPRS_TIMER_MAXIMUM_LENGTH(%d) (%d)",
GPRS_TIMER_MAXIMUM_LENGTH, size);
/* Mandatory - Tracking area identity list */
size += TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH;
......@@ -921,10 +928,20 @@ int emm_send_attach_accept(const emm_as_establish_t *msg,
emm_msg->tailist.mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2;
emm_msg->tailist.mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3;
emm_msg->tailist.tac = msg->tac;
LOG_TRACE(INFO,
"EMMAS-SAP - size += "\
"TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH(%d) (%d)",
TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH,
size);
/* Mandatory - ESM message container */
size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length;
emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg;
LOG_TRACE(INFO,
"EMMAS-SAP - size += "\
"ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH(%d) (%d)",
ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH,
size);
/* Optional - GUTI */
if (msg->new_guti) {
......@@ -941,6 +958,11 @@ int emm_send_attach_accept(const emm_as_establish_t *msg,
emm_msg->guti.guti.mncdigit1 = msg->new_guti->gummei.plmn.MNCdigit1;
emm_msg->guti.guti.mncdigit2 = msg->new_guti->gummei.plmn.MNCdigit2;
emm_msg->guti.guti.mncdigit3 = msg->new_guti->gummei.plmn.MNCdigit3;
LOG_TRACE(INFO,
"EMMAS-SAP - size += "\
"EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH(%d) (%d)",
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH,
size);
}
LOG_FUNC_RETURN (size);
}
......
......@@ -177,13 +177,16 @@ int esm_proc_default_eps_bearer_context_request(int is_standalone,
LOG_FUNC_IN;
LOG_TRACE(INFO,"ESM-PROC - Initiate default EPS bearer context activation "
"(ueid=%u, ebi=%d)", ctx->ueid, ebi);
if (is_standalone) {
/* Send activate default EPS bearer context request message and
* start timer T3485 */
LOG_TRACE(INFO,"ESM-PROC - Initiate standalone default EPS bearer context activation "
"(ueid=%u, ebi=%d)", ctx->ueid, ebi);
rc = _default_eps_bearer_activate(ctx, ebi, msg);
} else {
LOG_TRACE(INFO,"ESM-PROC - Initiate non standalone default EPS bearer context activation "
"(ueid=%u, ebi=%d)", ctx->ueid, ebi);
}
if (rc != RETURNerror) {
......
......@@ -617,10 +617,11 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - PDN connectivity requested by the UE "
"(ueid=%u, pti=%d) PDN type = %s, APN = %s", ctx->ueid, pti,
"(ueid=%u, pti=%d) PDN type = %s, APN = %s pdn addr = %s", ctx->ueid, pti,
(pdn_type == ESM_PDN_TYPE_IPV4)? "IPv4" :
(pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6",
(apn) ? (char *)(apn->value) : "null");
(apn) ? (char *)(apn->value) : "null",
(pdn_addr) ? (char *)(pdn_addr->value) : "null");
#if !defined(EPC_BUILD)
/* UE identifier sanity check */
......@@ -634,6 +635,9 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
* Check network IP capabilities
*/
*esm_cause = ESM_CAUSE_SUCCESS;
LOG_TRACE(INFO, "ESM-PROC - _esm_data.conf.features %08x", _esm_data.conf.features);
#warning "Uncomment code about _esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6) later"
#if defined(ORIGINAL_CODE)
switch (_esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6)) {
case (MME_API_IPV4 | MME_API_IPV6):
/* The network supports both IPv4 and IPv6 connection */
......@@ -660,11 +664,19 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
rc = RETURNok;
}
break;
}
default:
LOG_TRACE(ERROR,
"ESM-PROC - _esm_data.conf.features incorrect value (no IPV4 or IPV6 ) %X",
_esm_data.conf.features);
}
#else
rc = RETURNok;
#endif
if (rc != RETURNerror) {
mme_api_ip_version_t mme_pdn_index;
int is_emergency = (request_type == ESM_PDN_REQUEST_EMERGENCY);
#if defined(ORIGINAL_CODE)
mme_api_ip_version_t mme_pdn_index;
mme_api_qos_t qos;
switch (pdn_type)
......@@ -692,20 +704,21 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
*esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
LOG_FUNC_RETURN (RETURNerror);
}
#endif
/* Create new PDN connection */
pid = _pdn_connectivity_create(ctx, pti, apn, pdn_type,
pdn_addr, is_emergency);
#if defined(ORIGINAL_CODE)
/* Setup ESM QoS parameters */
if (esm_qos) {
esm_qos->gbrUL = qos.gbr[MME_API_UPLINK];
esm_qos->gbrDL = qos.gbr[MME_API_DOWNLINK];
esm_qos->mbrUL = qos.mbr[MME_API_UPLINK];
esm_qos->mbrDL = qos.mbr[MME_API_DOWNLINK];
esm_qos->qci = qos.qci;
esm_qos->qci = qos.qci;
}
#endif
if (pid < 0) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to create PDN connection");
*esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
......
......@@ -358,6 +358,8 @@ int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg
LOG_FUNC_IN;
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_TRACE(ERROR, "ESM-FSM - Retransmission timer bad ebi %d",
ebi);
LOG_FUNC_RETURN (RETURNerror);
}
......@@ -365,6 +367,7 @@ int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg
ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN];
if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned");
LOG_FUNC_RETURN (RETURNerror);
}
......@@ -401,6 +404,10 @@ int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg
LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in "
"%ld seconds", ebr_ctx->timer.id, ebr_ctx->timer.sec);
LOG_FUNC_RETURN (RETURNok);
} else {
LOG_TRACE(ERROR, "ESM-FSM - ebr_ctx->args == NULL(%p) or ebr_ctx->timer.id == NAS_TIMER_INACTIVE_ID == -1 (%d)" ,
ebr_ctx->args,
ebr_ctx->timer.id);
}
LOG_FUNC_RETURN (RETURNerror);
}
......
......@@ -34,6 +34,14 @@ Description Defines functions used to handle EPS bearer contexts.
# include "assertions.h"
#endif
#ifdef NAS_UE
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -184,6 +192,88 @@ int esm_ebr_context_create(
if (pdn->is_emergency) {
esm_ctx->emergency = TRUE;
}
#ifdef NAS_UE
// LG ADD TEMP
{
char *tmp = NULL;
char ipv4_addr[INET_ADDRSTRLEN];
char ipv6_addr[INET6_ADDRSTRLEN];
char *netmask = NULL;
char broadcast[INET_ADDRSTRLEN];
struct in_addr in_addr;
char command_line[128];
int res;
switch (pdn->type) {
case NET_PDN_TYPE_IPV4V6:
ipv6_addr[0] = pdn->ip_addr[4];
// etc
case NET_PDN_TYPE_IPV4:
in_addr.s_addr = pdn->ip_addr[0] << 24;
in_addr.s_addr |= pdn->ip_addr[1] << 16;
in_addr.s_addr |= pdn->ip_addr[2] << 8;
in_addr.s_addr |= pdn->ip_addr[3] ;
tmp = inet_ntoa(in_addr);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy(ipv4_addr, tmp);
if (IN_CLASSA(in_addr.s_addr)) {
netmask = "255.0.0.0";
in_addr.s_addr = pdn->ip_addr[0] << 24;
in_addr.s_addr |= 255 << 16;
in_addr.s_addr |= 255 << 8;
in_addr.s_addr |= 255 ;
tmp = inet_ntoa(in_addr);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy(broadcast, tmp);
} else if (IN_CLASSB(in_addr.s_addr)) {
netmask = "255.255.0.0";
in_addr.s_addr = pdn->ip_addr[0] << 24;
in_addr.s_addr |= pdn->ip_addr[1] << 16;
in_addr.s_addr |= 255 << 8;
in_addr.s_addr |= 255 ;
tmp = inet_ntoa(in_addr);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy(broadcast, tmp);
} else if (IN_CLASSC(in_addr.s_addr)) {
netmask = "255.255.255.0";
in_addr.s_addr = pdn->ip_addr[0] << 24;
in_addr.s_addr |= pdn->ip_addr[1] << 16;
in_addr.s_addr |= pdn->ip_addr[2] << 8;
in_addr.s_addr |= 255 ;
tmp = inet_ntoa(in_addr);
// AssertFatal(tmp ,
// "error in PDN IPv4 address %x",
// in_addr.s_addr);
strcpy(broadcast, tmp);
} else {
netmask = "255.255.255.255";
strcpy(broadcast, ipv4_addr);
}
res = sprintf(command_line,
"ifconfig oip1 %s netmask %s broadcast %s up",
ipv4_addr, netmask, broadcast);
// AssertFatal((res > 0) && (res < 128),
// "error in system command line");
LOG_TRACE(INFO, "ESM-PROC - executing %s ",
command_line);
system(command_line);
break;
case NET_PDN_TYPE_IPV6:
break;
default:
break;
}
}
// AssertFatal(0, "Forced stop in NAS UE");
#endif
}
/* Return the EPS bearer identity of the default EPS bearer
......
......@@ -219,10 +219,12 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
/* First encode the ESM message header */
header_result = _esm_msg_encode_header(&msg->header, buffer, len);
if (header_result < 0) {
LOG_TRACE(ERROR, "ESM-MSG - Failed to encode ESM message header "
"(%d)", header_result);
LOG_FUNC_RETURN(header_result);
LOG_TRACE(ERROR, "ESM-MSG - Failed to encode ESM message header "
"(%d)", header_result);
LOG_FUNC_RETURN(header_result);
}
LOG_TRACE(INFO, "ESM-MSG - Encoded ESM message header "
"(%d)", header_result);
buffer += header_result;
len -= header_result;
......@@ -299,6 +301,7 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
LOG_TRACE(ERROR, "ESM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE;
break;
}
if (encode_result < 0) {
......@@ -390,13 +393,14 @@ static int _esm_msg_encode_header(const esm_msg_header_t *header,
/* Check the buffer length */
if (len < sizeof(esm_msg_header_t)) {
return (TLV_ENCODE_BUFFER_TOO_SHORT);
LOG_TRACE(ERROR, "ESM-MSG - buffer too short");
return (TLV_ENCODE_BUFFER_TOO_SHORT);
}
/* Check the protocol discriminator */
else if (header->protocol_discriminator != EPS_SESSION_MANAGEMENT_MESSAGE) {
LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x",
header->protocol_discriminator);
return (TLV_ENCODE_PROTOCOL_NOT_SUPPORTED);
LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x",
header->protocol_discriminator);
return (TLV_ENCODE_PROTOCOL_NOT_SUPPORTED);
}
/* Encode the EPS bearer identity and the protocol discriminator */
......
This diff is collapsed.
......@@ -138,7 +138,8 @@ int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len);
int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res);
int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail);
int nas_proc_deregister_ue(UInt32_t ue_id);
int nas_proc_bearer_param(nas_bearer_param_t *nas_bearer_param_pP);
int nas_proc_pdn_connectivity_res(nas_pdn_connectivity_rsp_t *nas_pdn_connectivity_rsp);
int nas_proc_pdn_connectivity_fail(nas_pdn_connectivity_fail_t *nas_pdn_connectivity_fail);
#endif
#endif /* __NAS_PROC_H__*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment