Commit 2d5d6107 authored by Cedric Roux's avatar Cedric Roux

- Work in progress

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4589 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 167455d2
......@@ -11,11 +11,14 @@ MESSAGE_DEF(NAS_NON_DELIVERY_IND, MESSAGE_PRIORITY_MED, nas_non_del_
MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_REQ, MESSAGE_PRIORITY_MED, nas_rab_est_req_t, nas_rab_est_req)
MESSAGE_DEF(NAS_RAB_ESTABLISHMENT_RESP, MESSAGE_PRIORITY_MED, nas_rab_est_rsp_t, nas_rab_est_rsp)
MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, nas_rab_rel_req_t, nas_rab_rel_req)
MESSAGE_DEF(NAS_AUTHENTICATION_REQ, MESSAGE_PRIORITY_MED, nas_auth_req_t, nas_auth_req)
MESSAGE_DEF(NAS_AUTHENTICATION_RESP, MESSAGE_PRIORITY_MED, nas_auth_resp_t, nas_auth_resp)
/* NAS layer -> MME app messages */
MESSAGE_DEF(NAS_AUTHENTICATION_REQ, MESSAGE_PRIORITY_MED, nas_auth_req_t, nas_auth_req)
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_RESP, MESSAGE_PRIORITY_MED, nas_auth_resp_t, nas_auth_resp)
#if defined(DISABLE_USE_NAS)
MESSAGE_DEF(NAS_ATTACH_REQ, MESSAGE_PRIORITY_MED, nas_attach_req_t, nas_attach_req)
......
......@@ -3,11 +3,14 @@
#ifndef NAS_MESSAGES_TYPES_H_
#define NAS_MESSAGES_TYPES_H_
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind
#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_CONN_EST_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
#define NAS_UL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_ind
#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_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind
#define NAS_CONN_EST_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
#define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req
#define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_param_req
typedef struct {
......@@ -90,17 +93,28 @@ typedef struct {
} nas_attach_req_t;
typedef struct {
/* UE imsi */
char imsi[16];
#define NAS_FAILURE_OK 0x0
#define NAS_FAILURE_IND 0x1
unsigned failure:1;
int cause;
} nas_auth_req_t;
typedef struct {
char imsi[16];
} nas_auth_resp_t;
typedef struct nas_auth_param_req_s {
uint8_t imsi_length;
char imsi[15];
uint8_t initial_req:1;
} nas_auth_param_req_t;
typedef struct nas_attach_accept_s {
} nas_attach_accept_t;
#endif /* NAS_MESSAGES_TYPES_H_ */
/*****************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom
Source mme_api.h
Source mme_api.h
Version 0.1
Version 0.1
Date 2013/02/28
Date 2013/02/28
Product NAS stack
Product NAS stack
Subsystem Application Programming Interface
Subsystem Application Programming Interface
Author Frederic Maurel
Author Frederic Maurel
Description Implements the API used by the NAS layer running in the MME
to interact with a Mobility Management Entity
Description Implements the API used by the NAS layer running in the MME
to interact with a Mobility Management Entity
*****************************************************************************/
#ifndef __MME_API_H__
......@@ -35,35 +35,35 @@ Description Implements the API used by the NAS layer running in the MME
/****************************************************************************/
/* Maximum number of UEs the MME may simultaneously support */
#define MME_API_NB_UE_MAX 1
#define MME_API_NB_UE_MAX 1
#ifdef NAS_MME
/* Features supported by the MME */
typedef enum {
MME_API_NO_FEATURE_SUPPORTED = 0,
MME_API_EMERGENCY_ATTACH = (1<<0),
MME_API_UNAUTHENTICATED_IMSI = (1<<1),
MME_API_IPV4 = (1<<2),
MME_API_IPV6 = (1<<3),
MME_API_SINGLE_ADDR_BEARERS = (1<<4),
typedef enum mme_api_feature_s {
MME_API_NO_FEATURE_SUPPORTED = 0,
MME_API_EMERGENCY_ATTACH = (1<<0),
MME_API_UNAUTHENTICATED_IMSI = (1<<1),
MME_API_IPV4 = (1<<2),
MME_API_IPV6 = (1<<3),
MME_API_SINGLE_ADDR_BEARERS = (1<<4),
} mme_api_feature_t;
/*
* EPS Mobility Management configuration data
* ------------------------------------------
*/
typedef struct {
mme_api_feature_t features; /* Supported features */
gummei_t gummei; /* EPS Globally Unique MME Identity */
typedef struct mme_api_emm_config_s {
mme_api_feature_t features; /* Supported features */
gummei_t gummei; /* EPS Globally Unique MME Identity */
} mme_api_emm_config_t;
/*
* EPS Session Management configuration data
* -----------------------------------------
*/
typedef struct {
mme_api_feature_t features; /* Supported features */
typedef struct mme_api_esm_config_s {
mme_api_feature_t features; /* Supported features */
} mme_api_esm_config_t;
/****************************************************************************/
......@@ -71,17 +71,17 @@ typedef struct {
/****************************************************************************/
/* EPS subscribed QoS profile */
typedef struct {
#define MME_API_UPLINK 0
#define MME_API_DOWNLINK 1
#define MME_API_DIRECTION 2
int gbr[MME_API_DIRECTION]; /* Guaranteed Bit Rate */
int mbr[MME_API_DIRECTION]; /* Maximum Bit Rate */
int qci; /* QoS Class Identifier */
typedef struct mme_api_qos_s {
#define MME_API_UPLINK 0
#define MME_API_DOWNLINK 1
#define MME_API_DIRECTION 2
int gbr[MME_API_DIRECTION]; /* Guaranteed Bit Rate */
int mbr[MME_API_DIRECTION]; /* Maximum Bit Rate */
int qci; /* QoS Class Identifier */
} mme_api_qos_t;
/* Traffic Flow Template */
typedef struct {
typedef struct mme_api_tft_s {
} mme_api_tft_t;
/****************************************************************************/
......@@ -93,19 +93,21 @@ typedef struct {
/****************************************************************************/
#if defined(EPC_BUILD)
int mme_api_get_emm_config(mme_api_emm_config_t* config, mme_config_t *mme_config_p);
int mme_api_get_emm_config(mme_api_emm_config_t *config,
mme_config_t *mme_config_p);
#else
int mme_api_get_emm_config(mme_api_emm_config_t* config);
int mme_api_get_emm_config(mme_api_emm_config_t *config);
#endif
int mme_api_get_esm_config(mme_api_esm_config_t* config);
int mme_api_get_esm_config(mme_api_esm_config_t *config);
int mme_api_identify_guti(const GUTI_t* guti, auth_vector_t* vector);
int mme_api_identify_imsi(const imsi_t* imsi, auth_vector_t* vector);
int mme_api_identify_imei(const imei_t* imei, auth_vector_t* vector);
int mme_api_new_guti(const imsi_t* imsi, GUTI_t* guti, tac_t* tac, int* n_tacs);
int mme_api_identify_guti(const GUTI_t *guti, auth_vector_t *vector);
int mme_api_identify_imsi(const imsi_t *imsi, auth_vector_t *vector);
int mme_api_identify_imei(const imei_t *imei, auth_vector_t *vector);
int mme_api_new_guti(const imsi_t *imsi, GUTI_t *guti, tac_t *tac, int *n_tacs);
int mme_api_subscribe(OctetString* apn, OctetString* pdn_addr, int is_emergency, mme_api_qos_t* qos);
int mme_api_unsubscribe(OctetString* apn);
int mme_api_subscribe(OctetString *apn, OctetString *pdn_addr,
int is_emergency, mme_api_qos_t *qos);
int mme_api_unsubscribe(OctetString *apn);
#endif // NAS_MME
......
......@@ -47,6 +47,9 @@ Description Defines the attach related EMM procedure executed by the
#ifdef NAS_MME
#include "mme_api.h"
# if defined(EPC_BUILD)
# include "nas_itti_messaging.h"
# endif
#endif
#include <string.h> // memcmp, memcpy
......@@ -1835,6 +1838,10 @@ static int _emm_attach_identify(void *args)
emm_ctx->ueid, (emm_ctx->imsi)? "IMSI" : (emm_ctx->guti)? "GUTI" :
(emm_ctx->imei)? "IMEI" : "none");
#if defined(EPC_BUILD)
nas_itti_auth_info_req(emm_ctx->imsi, 1);
#endif
/*
* UE's identification
* -------------------
......
......@@ -529,15 +529,15 @@ int emm_proc_authentication(unsigned int ueid, int ksi,
emm_common_failure_callback_t failure)
{
LOG_FUNC_IN;
int rc = RETURNerror;
authentication_data_t *data;
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMM-PROC - Initiate authentication KSI = %d", ksi);
/* Allocate parameters of the retransmission timer callback */
authentication_data_t *data =
(authentication_data_t *)malloc(sizeof(authentication_data_t));
data = (authentication_data_t *)malloc(sizeof(authentication_data_t));
if (data != NULL) {
/* Setup ongoing EMM procedure callback functions */
......
......@@ -320,6 +320,10 @@ typedef struct {
* ---------------------------------------------------------------------------
*/
typedef struct emm_data_context_s {
#if defined(EPC_BUILD)
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 */
......@@ -344,10 +348,6 @@ typedef struct emm_data_context_s {
int emm_cause; /* EMM failure cause code */
emm_fsm_state_t _emm_fsm_status;
#if defined(EPC_BUILD)
RB_ENTRY(emm_data_context_s) entries;
#endif
} emm_data_context_t;
/*
......
/*******************************************************************************
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
*******************************************************************************/
#ifndef NAS_DEFS_H_
#define NAS_DEFS_H_
......
......@@ -28,6 +28,8 @@
*******************************************************************************/
#include <string.h>
#include "intertask_interface.h"
#include "nas_itti_messaging.h"
......
......@@ -28,6 +28,9 @@
*******************************************************************************/
#include "intertask_interface.h"
#include "conversions.h"
#ifndef NAS_ITTI_MESSAGING_H_
#define NAS_ITTI_MESSAGING_H_
......@@ -37,4 +40,19 @@ int nas_itti_dl_data_req(const uint32_t ue_id, void * const data,
void nas_itti_establish_cnf(const nas_error_code_t error_code, void * const data,
const uint32_t length);
static inline void nas_itti_auth_info_req(const imsi_t * const imsi,
uint8_t initial_req)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_PARAM_REQ);
hexa_to_ascii((uint8_t *)imsi->u.value, NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi,
imsi->length);
NAS_AUTHENTICATION_PARAM_REQ(message_p).initial_req = initial_req;
NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi_length = imsi->length - imsi->u.num.parity;
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
}
#endif /* NAS_ITTI_MESSAGING_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
*******************************************************************************/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -29,6 +29,7 @@
*******************************************************************************/
#include <stdint.h>
#include <string.h>
#include "intertask_interface.h"
......@@ -38,10 +39,30 @@
int s1ap_mme_itti_send_sctp_request(uint8_t *buffer, uint32_t length,
uint32_t assoc_id, uint16_t stream);
int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer,
int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t *const buffer,
const uint32_t length);
int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id,
nas_error_code_t error_code);
static inline void s1ap_mme_itti_nas_establish_ind(
const uint32_t ue_id, uint8_t * const nas_msg, const uint32_t nas_msg_length,
const long cause, const uint16_t tac)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, NAS_CONNECTION_ESTABLISHMENT_IND);
NAS_CONN_EST_IND(message_p).nas.UEid = ue_id;
/* Mapping between asn1 definition and NAS definition */
NAS_CONN_EST_IND(message_p).nas.asCause = cause + 1;
NAS_CONN_EST_IND(message_p).nas.tac = tac;
NAS_CONN_EST_IND(message_p).nas.initialNasMsg.length = nas_msg_length;
NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data = malloc(sizeof(uint8_t) * nas_msg_length);
memcpy(NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data, nas_msg, nas_msg_length);
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
#endif /* S1AP_MME_ITTI_MESSAGING_H_ */
......@@ -75,7 +75,11 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assoc_id, uint32_t stream,
S1AP_DEBUG("New Initial UE message received with eNB UE S1AP ID: 0x%06x\n",
eNB_ue_s1ap_id);
if ((ue_ref = s1ap_is_ue_eNB_id_in_list(eNB_ref, eNB_ue_s1ap_id)) == NULL) {
ue_ref = s1ap_is_ue_eNB_id_in_list(eNB_ref, eNB_ue_s1ap_id);
if (ue_ref == NULL)
{
uint16_t tac = 0;
/* This UE eNB Id has currently no known s1 association.
* Create new UE context by associating new mme_ue_s1ap_id.
* Update eNB UE list.
......@@ -115,57 +119,21 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assoc_id, uint32_t stream,
/* TODO: should take the first available mme_ue_s1ap_id instead of
* the mme_ue_s1ap_id variable.
*/
assert(0);
DevMessage("mme ue s1ap id has wrapped -> case not handled\n");
}
s1ap_dump_eNB(ue_ref->eNB);
{
/* We received the first NAS transport message: initial UE message.
* The containt of the NAS pdu should be forwarded to NAS for processing
*/
MessageDef *message_p;
nas_establish_ind_t *con_ind_p;
s1ap_initial_ue_message_t *s1ap_p;
message_p = itti_alloc_new_message(TASK_S1AP, NAS_CONNECTION_ESTABLISHMENT_IND);
/* We failed to allocate a new message... */
if (message_p == NULL) {
return -1;
}
con_ind_p = &message_p->ittiMsg.nas_conn_est_ind.nas;
s1ap_p = &message_p->ittiMsg.nas_conn_est_ind.transparent;
s1ap_p->eNB_ue_s1ap_id = eNB_ue_s1ap_id;
s1ap_p->mme_ue_s1ap_id = ue_ref->mme_ue_s1ap_id;
#if !defined(DISABLE_USE_NAS)
con_ind_p->UEid = ue_ref->mme_ue_s1ap_id;
#endif
s1ap_dump_eNB(ue_ref->eNB);
BIT_STRING_TO_CELL_IDENTITY(&initialUEMessage_p->eutran_cgi.cell_ID,
s1ap_p->e_utran_cgi.cell_identity);
TBCD_TO_PLMN_T(&initialUEMessage_p->eutran_cgi.pLMNidentity,
&s1ap_p->e_utran_cgi.plmn);
OCTET_STRING_TO_TAC(&initialUEMessage_p->tai.tAC, tac);
#if !defined(DISABLE_USE_NAS)
/* Copy the TAI */
// TBCD_TO_PLMN_T(&initialUEMessage_p->tai.pLMNidentity, &con_ind_p->tai.plmn);
OCTET_STRING_TO_INT16(&initialUEMessage_p->tai.tAC, con_ind_p->tac);
#else
/* TODO: copy the TAC */
// TBCD_TO_PLMN_T(&initialUEMessage_p->tai.pLMNidentity, &con_ind_p->tai.plmn);
OCTET_STRING_TO_INT16(&initialUEMessage_p->tai.tAC, con_ind_p->tac);
#endif
/* Copy the NAS payload */
con_ind_p->initialNasMsg.length = initialUEMessage_p->nas_pdu.size;
con_ind_p->initialNasMsg.data = malloc(sizeof(con_ind_p->initialNasMsg.data) *
initialUEMessage_p->nas_pdu.size);
memcpy(con_ind_p->initialNasMsg.data, initialUEMessage_p->nas_pdu.buf,
initialUEMessage_p->nas_pdu.size);
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
/* We received the first NAS transport message: initial UE message.
* Send a NAS ESTABLISH IND to NAS layer
*/
s1ap_mme_itti_nas_establish_ind(ue_ref->mme_ue_s1ap_id,
initialUEMessage_p->nas_pdu.buf,
initialUEMessage_p->nas_pdu.size,
initialUEMessage_p->rrC_Establishment_Cause,
tac);
}
return 0;
}
......
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