Commit fb09ba8e authored by Lionel Gauthier's avatar Lionel Gauthier

OK for start of MME_GW and HSS on same host

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7110 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent ecff2e01
......@@ -349,6 +349,10 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP
}
}
};
/*pr_info("GTPUAH: PACKET -> NF_HOOK NF_INET_POST_ROUTING/%s encapsulated src: %u.%u.%u.%u dst: %u.%u.%u.%u\n",
gtpuah_tg_reg[0].table,
NIPADDR(old_iph_p->saddr),
NIPADDR(old_iph_p->daddr));*/
rt = ip_route_output_key(&init_net, &fl.u.ip4);
......
......@@ -68,6 +68,7 @@ extern boolean_t pdcp_data_req(
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP);
extern unsigned char NB_eNB_INST;
static int
gtpv1u_eNB_send_init_udp(
......@@ -132,19 +133,23 @@ gtpv1u_initial_req(
int
gtpv1u_new_data_req(
uint8_t enb_idP,
uint8_t ue_idP,
uint8_t enb_module_idP,
rnti_t ue_rntiP,
uint8_t rab_idP,
uint8_t *buffer_pP,
uint32_t buf_lenP,
uint32_t buf_offsetP);
uint32_t buf_offsetP
);
static int
gtpv1u_create_s1u_tunnel(
gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP);
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP);
static int
gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP);
gtpv1u_delete_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t * const req_pP);
static int
gtpv1u_eNB_init(void);
......@@ -322,17 +327,14 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
#endif
#warning "LG eps bearer mapping to DRB id to do (offset -4)"
ctxt.enb_module_id = gtpv1u_teid_data_p->enb_id;
ctxt.ue_module_id = gtpv1u_teid_data_p->ue_id;
ctxt.frame = 0;
ctxt.enb_flag = ENB_FLAG_YES;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->enb_id, ENB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0);
result = pdcp_data_req(
&ctxt,
SRB_FLAG_NO,
(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
0, // mui
FALSE, // confirm
SDU_CONFIRM_NO, // confirm
buffer_len,
buffer,
PDCP_TRANSMISSION_MODE_DATA);
......@@ -551,8 +553,8 @@ gtpv1u_initial_req(
//-----------------------------------------------------------------------------
int
gtpv1u_new_data_req(
uint8_t enb_idP,
uint8_t ue_idP,
uint8_t enb_module_idP,
rnti_t ue_rntiP,
uint8_t rab_idP,
uint8_t *buffer_pP,
uint32_t buf_lenP,
......@@ -569,18 +571,18 @@ gtpv1u_new_data_req(
gtpv1u_data_t *gtpv1u_data_p = NULL;
memset(&ue, 0, sizeof(struct gtpv1u_ue_data_s));
ue.ue_id = ue_idP;
ue.ue_id = ue_rntiP;
AssertFatal(enb_idP >=0, "Bad parameter enb module id %u\n", enb_idP);
AssertFatal(enb_module_idP >=0, "Bad parameter enb module id %u\n", enb_module_idP);
AssertFatal((rab_idP - GTPV1U_BEARER_OFFSET)< GTPV1U_MAX_BEARERS_ID, "Bad parameter rab id %u\n", rab_idP);
AssertFatal((rab_idP - GTPV1U_BEARER_OFFSET) >= 0 , "Bad parameter rab id %u\n", rab_idP);
gtpv1u_data_p = &gtpv1u_data_g;
/* Check that UE context is present in ue map. */
hash_rc = hashtable_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_idP, (void**)&ue_inst_p);
hash_rc = hashtable_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_rntiP, (void**)&ue_inst_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS ) {
LOG_E(GTPU, "[UE %d] Trying to send data on non-existing UE context\n", ue_idP);
LOG_E(GTPU, "[UE %d] Trying to send data on non-existing UE context\n", ue_rntiP);
return -1;
}
......@@ -643,7 +645,8 @@ gtpv1u_new_data_req(
//-----------------------------------------------------------------------------
static int
gtpv1u_create_s1u_tunnel(
gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP)
const instance_t instanceP,
const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP)
{
/* Create a new nw-gtpv1-u stack req using API */
NwGtpv1uUlpApiT stack_req;
......@@ -662,15 +665,15 @@ gtpv1u_create_s1u_tunnel(
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;
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).rnti = create_tunnel_req_pP->rnti;
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0;
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];
LOG_D(GTPU, "Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue_index %u eps bearer id %u\n",
create_tunnel_req_pP->ue_index, eps_bearer_id);
LOG_D(GTPU, "Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue rnti %x eps bearer id %u\n",
create_tunnel_req_pP->rnti, eps_bearer_id);
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
stack_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT;
......@@ -689,17 +692,17 @@ gtpv1u_create_s1u_tunnel(
//-----------------------
// PDCP->GTPV1U mapping
//-----------------------
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, (void **)&gtpv1u_ue_data_p);
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->rnti, (void **)&gtpv1u_ue_data_p);
if ((hash_rc == HASH_TABLE_KEY_NOT_EXISTS) || (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);
hash_rc = hashtable_insert(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->rnti, 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->ue_id = create_tunnel_req_pP->rnti;
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,
......@@ -748,7 +751,7 @@ gtpv1u_create_s1u_tunnel(
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
gtpv1u_teid_data_p = calloc (1, sizeof(gtpv1u_teid_data_t));
gtpv1u_teid_data_p->enb_id = 0; // TO DO
gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->ue_index;
gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti;
gtpv1u_teid_data_p->eps_bearer_id = eps_bearer_id;
hash_rc = hashtable_insert(gtpv1u_data_g.teid_mapping, s1u_teid, gtpv1u_teid_data_p);
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting teid mapping in GTPV1U hashtable");
......@@ -758,16 +761,18 @@ gtpv1u_create_s1u_tunnel(
}
}
LOG_D(GTPU, "Tx GTPV1U_ENB_CREATE_TUNNEL_RESP ue_index %u status %d\n",
create_tunnel_req_pP->ue_index,
LOG_D(GTPU, "Tx GTPV1U_ENB_CREATE_TUNNEL_RESP ue rnti %x status %d\n",
create_tunnel_req_pP->rnti,
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status);
return itti_send_msg_to_task(TASK_RRC_ENB, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_RRC_ENB, instanceP, message_p);
}
//-----------------------------------------------------------------------------
static int gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP)
static int gtpv1u_delete_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t * const req_pP)
{
NwGtpv1uUlpApiT stack_req;
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
......@@ -779,18 +784,18 @@ static int gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP)
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_DELETE_TUNNEL_RESP);
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).ue_index = req_pP->ue_index;
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti;
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status = 0;
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, req_pP->ue_index, (void**)&gtpv1u_ue_data_p);
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, req_pP->rnti, (void**)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_OK) {
for (erab_index = 0; erab_index < req_pP->num_erab; erab_index++) {
teid_eNB = gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_eNB;
LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user index %u eNB S1U teid %u eps bearer id %u\n",
req_pP->ue_index, teid_eNB, req_pP->eps_bearer_id[erab_index]);
LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user rnti %x eNB S1U teid %u eps bearer id %u\n",
req_pP->rnti, teid_eNB, req_pP->eps_bearer_id[erab_index]);
{
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
......@@ -821,8 +826,8 @@ static int gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP)
gtpv1u_ue_data_p->num_bearers -= 1;
if (gtpv1u_ue_data_p->num_bearers == 0) {
hash_rc = hashtable_remove(gtpv1u_data_g.ue_mapping, req_pP->ue_index);
LOG_D(GTPU, "Removed user index %u,no more bearers configured\n", req_pP->ue_index);
hash_rc = hashtable_remove(gtpv1u_data_g.ue_mapping, req_pP->rnti);
LOG_D(GTPU, "Removed user rnti %x,no more bearers configured\n", req_pP->rnti);
}
//-----------------------
......@@ -831,17 +836,17 @@ static int gtpv1u_delete_s1u_tunnel(gtpv1u_enb_delete_tunnel_req_t *req_pP)
hash_rc = hashtable_remove(gtpv1u_data_g.teid_mapping, teid_eNB);
if (hash_rc != HASH_TABLE_OK) {
LOG_D(GTPU, "Removed user index %u , enb S1U teid %u not found\n", req_pP->ue_index, teid_eNB);
LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", req_pP->rnti, teid_eNB);
}
}
}// else silently do nothing
LOG_D(GTPU, "Tx GTPV1U_ENB_DELETE_TUNNEL_RESP user index %u eNB S1U teid %u status %u\n",
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).ue_index,
LOG_D(GTPU, "Tx GTPV1U_ENB_DELETE_TUNNEL_RESP user rnti %x eNB S1U teid %u status %u\n",
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti,
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).enb_S1u_teid,
GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status);
return itti_send_msg_to_task(TASK_RRC_ENB, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_RRC_ENB, instanceP, message_p);
}
//-----------------------------------------------------------------------------
......@@ -947,7 +952,10 @@ static int gtpv1u_eNB_init(void)
//-----------------------------------------------------------------------------
void *gtpv1u_eNB_task(void *args)
{
int rc = 0;
int rc = 0;
instance_t instance;
const char *msg_name_p;
rc = gtpv1u_eNB_init();
AssertFatal(rc == 0, "gtpv1u_eNB_init Failed");
itti_mark_task_ready(TASK_GTPV1_U);
......@@ -962,14 +970,17 @@ void *gtpv1u_eNB_task(void *args)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_IN);
DevAssert(received_message_p != NULL);
instance = ITTI_MSG_INSTANCE(received_message_p);
msg_name_p = ITTI_MSG_NAME(received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
case GTPV1U_ENB_CREATE_TUNNEL_REQ: {
gtpv1u_create_s1u_tunnel(&received_message_p->ittiMsg.Gtpv1uCreateTunnelReq);
gtpv1u_create_s1u_tunnel(instance, &received_message_p->ittiMsg.Gtpv1uCreateTunnelReq);
}
break;
case GTPV1U_ENB_DELETE_TUNNEL_REQ: {
gtpv1u_delete_s1u_tunnel(&received_message_p->ittiMsg.Gtpv1uDeleteTunnelReq);
gtpv1u_delete_s1u_tunnel(instance, &received_message_p->ittiMsg.Gtpv1uDeleteTunnelReq);
}
break;
......@@ -989,7 +1000,7 @@ void *gtpv1u_eNB_task(void *args)
// DATA TO BE SENT TO UDP
case GTPV1U_ENB_TUNNEL_DATA_REQ: {
gtpv1u_enb_tunnel_data_req_t *data_req_p = NULL;
NwGtpv1uUlpApiT stack_req;
NwGtpv1uUlpApiT stack_req;
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
......@@ -1005,10 +1016,10 @@ void *gtpv1u_eNB_task(void *args)
#endif
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, (uint64_t)data_req_p->ue_index, (void**)&gtpv1u_ue_data_p);
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, (uint64_t)data_req_p->rnti, (void**)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue_index %u in hashtable ue_mapping\n", data_req_p->ue_index);
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti);
} else {
if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_DRB_Identity)) {
enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB;
......
......@@ -58,7 +58,7 @@ typedef enum {
typedef struct gtpv1u_teid_data_s {
/* UE identifier for oaisim stack */
module_id_t enb_id;
module_id_t ue_id;
rnti_t ue_id;
ebi_t eps_bearer_id;
} gtpv1u_teid_data_t;
......@@ -76,7 +76,7 @@ typedef struct gtpv1u_bearer_s {
typedef struct gtpv1u_ue_data_s {
/* UE identifier for oaisim stack */
module_id_t ue_id;
rnti_t ue_id;
/* Unique identifier used between PDCP and GTP-U to distinguish UEs */
uint32_t instance_id;
......@@ -121,12 +121,13 @@ typedef struct gtpv1u_data_s {
int
gtpv1u_new_data_req(
uint8_t enb_id,
uint8_t ue_id,
uint8_t rab_id,
uint8_t *buffer,
uint32_t buf_len,
uint32_t buf_offset);
uint8_t enb_module_idP,
rnti_t ue_rntiP,
uint8_t rab_idP,
uint8_t *buffer_pP,
uint32_t buf_lenP,
uint32_t buf_offsetP
);
int
gtpv1u_initial_req(
......
......@@ -54,7 +54,9 @@
//static NwGtpv1uStackHandleT gtpv1u_stack = 0;
static gtpv1u_data_t gtpv1u_sgw_data;
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
static int gtpv1u_send_init_udp(uint16_t port_number);
#endif
static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP);
static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP);
static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP);
......@@ -147,6 +149,7 @@ void gtpu_print_hex_octets(unsigned char* dataP, unsigned long sizeP)
}
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
static int gtpv1u_send_init_udp(uint16_t port_number)
{
// Create and alloc new message
......@@ -168,6 +171,7 @@ static int gtpv1u_send_init_udp(uint16_t port_number)
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
#endif
NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
NwU32T logLevel,
......@@ -179,6 +183,7 @@ NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
return NW_GTPV1U_OK;
}
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
NwGtpv1uRcT gtpv1u_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
NwU8T *buffer,
......@@ -203,7 +208,7 @@ NwGtpv1uRcT gtpv1u_send_udp_msg(
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
#endif
/* Callback called when a gtpv1u message arrived on UDP interface */
NwGtpv1uRcT gtpv1u_process_stack_req(
NwGtpv1uUlpHandleT hUlp,
......
......@@ -128,6 +128,7 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
//NwU32T header_len = 0;
NwU32T msgExtraLen = 0;
if(gpGtpv1uMsgPool) {
......
......@@ -45,19 +45,20 @@
#include "assertions.h"
static
int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
int mme_app_request_authentication_info(const char *imsi,
const uint8_t nb_of_vectors,
const plmn_t *plmn,
const uint8_t *auts);
static
int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
int mme_app_request_authentication_info(const char *imsi,
const uint8_t nb_of_vectors,
const plmn_t *plmn,
const uint8_t *auts)
{
s6a_auth_info_req_t *auth_info_req = NULL;
MessageDef *message_p = NULL;
int imsi_length = strlen(imsi);
DevAssert(plmn != NULL);
......@@ -66,7 +67,9 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
auth_info_req = &message_p->ittiMsg.s6a_auth_info_req;
memset(auth_info_req, 0, sizeof(*auth_info_req));
auth_info_req->imsi_length = MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
strncpy(auth_info_req->imsi, imsi, imsi_length);
auth_info_req->imsi_length = imsi_length;
//MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
MME_APP_DEBUG("%s visited_plmn MCC %X%X%X MNC %X%X%X\n",
......@@ -214,122 +217,7 @@ mme_app_handle_authentication_info_answer(
return 0;
}
#if defined(DISABLE_USE_NAS)
int mme_app_handle_attach_req(nas_attach_req_t *attach_req_p)
{
/* An attach request has been received from NAS layer.
* If the UE authentication vectors for the UE are known within MME then the
* authentication procedure should be triggered only if the request is an
* initial attach, otherwise an update location should be sent to the HSS
* and default bearer should be established for the provided APN.
* In case of initial attach procedure, the default APN retrieved from the
* HSS will be used to establish the default bearer within EPC.
* The default APN is the one that matches the context-identifier
*/
struct ue_context_s *ue_context;
uint64_t imsi = 0;
DevAssert(attach_req_p != NULL);
MME_APP_STRING_TO_IMSI((char *)attach_req_p->imsi, &imsi);
MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi);
ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi);
if (ue_context == NULL) {
/* The MME doesn't know this IMSI.
* Insert the UE to the list of known equipements and
* Retrieve the authentication vector from HSS.
*/
MME_APP_DEBUG("UE context doesn't exist -> create one\n");
if ((ue_context = mme_create_new_ue_context()) == NULL) {
/* Error during ue context malloc */
/* TODO */
DevMessage("mme_create_new_ue_context");
return -1;
}
ue_context->imsi = imsi;
ue_context->eNB_ue_s1ap_id = attach_req_p->transparent.eNB_ue_s1ap_id;
ue_context->mme_ue_s1ap_id = attach_req_p->transparent.mme_ue_s1ap_id;
ue_context->ue_id = attach_req_p->transparent.mme_ue_s1ap_id;
// STAILQ_INIT(&ue_context->vector_list);
DevAssert(mme_insert_ue_context(&mme_app_desc.mme_ue_contexts, ue_context) == 0);
goto request_auth;
} else {
/* MME knows this IMSI, check if UE is authenticated and authentication
* vectors are known.
*/
MME_APP_DEBUG("UE context already exists, use it\n");
/* Update mme ue s1ap id */
ue_context->mme_ue_s1ap_id = attach_req_p->transparent.mme_ue_s1ap_id;
if ((ue_context->imsi_auth == IMSI_AUTHENTICATED) &&
(attach_req_p->initial != INITIAL_REQUEST)) {
/* We have to send an update location request to the HSS */
MME_APP_DEBUG("UE is authenticated\n");
} else {
MME_APP_DEBUG("UE is not authenticated\n");
/* UE is not authenticated or an initial request */
// if (STAILQ_EMPTY(&ue_context->vector_list))
if (ue_context->nb_of_vectors == 0)
request_auth: {
/* We have no vector for this UE, send an authentication request
* to the HSS.
*/
AssertFatal(0, "Hardcoded MCC/MNC");
plmn_t plmn = {
.MCCdigit2 = 0,
.MCCdigit1 = 8,
.MCCdigit3 = 2,
.MNCdigit1 = 0,
.MNCdigit2 = 4,
.MNCdigit3 = 3,
};
memcpy(&ue_context->e_utran_cgi, &attach_req_p->transparent.e_utran_cgi,
sizeof(cgi_t));
/* Acquire the current time */
time(&ue_context->cell_age);
/* Some random values for GUTI */
ue_context->guti.m_tmsi = 0x24568956;
ue_context->guti.gummei.MMEcode = 0x01;
ue_context->guti.gummei.MMEgid = 0x5691;
memcpy(&ue_context->guti.gummei.plmn, &plmn, sizeof(plmn_t));
MME_APP_DEBUG("and we have no auth. vector for it, request"
" authentication information\n");
// mme_app_dump_ue_contexts();
mme_app_request_authentication_info(imsi, 1, &plmn, NULL);
} else {
nas_auth_req_t *nas_auth_req_p;
MessageDef *message_p;
/* We have a vector... USE it */
MME_APP_DEBUG("but we have an auth. vector for it, request"
" authentication from NAS\n");
message_p = itti_alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_PARAM_FAIL);
nas_auth_req_p = &message_p->ittiMsg.nas_auth_req;
MME_APP_IMSI_TO_STRING(imsi, nas_auth_req_p->imsi);
nas_auth_req_p->failure = NAS_FAILURE_OK;
return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
}
}
}
return 0;
}
#else
void
mme_app_handle_nas_auth_param_req(
const nas_auth_param_req_t * const nas_auth_param_req_pP)
......@@ -354,13 +242,14 @@ mme_app_handle_nas_auth_param_req(
visited_plmn_from_req.MCCdigit2 = nas_auth_param_req_pP->imsi[1];
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[2];
mnc_length = find_mnc_length(nas_auth_param_req_pP->imsi[0],
nas_auth_param_req_pP->imsi[1],
nas_auth_param_req_pP->imsi[2],
nas_auth_param_req_pP->imsi[3],
nas_auth_param_req_pP->imsi[4],
nas_auth_param_req_pP->imsi[5]
);
mnc_length = find_mnc_length(
nas_auth_param_req_pP->imsi[0],
nas_auth_param_req_pP->imsi[1],
nas_auth_param_req_pP->imsi[2],
nas_auth_param_req_pP->imsi[3],
nas_auth_param_req_pP->imsi[4],
nas_auth_param_req_pP->imsi[5]
);
if (mnc_length == 2) {
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
......@@ -439,11 +328,10 @@ mme_app_handle_nas_auth_param_req(
memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
MME_APP_DEBUG("and we have no auth. vector for it, request"
" authentication information\n");
mme_app_request_authentication_info(imsi, 1, visited_plmn, NULL);
mme_app_request_authentication_info(nas_auth_param_req_pP->imsi, 1, visited_plmn, NULL);
} else {
memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
mme_app_request_authentication_info(imsi, 1, visited_plmn, nas_auth_param_req_pP->auts);
mme_app_request_authentication_info(nas_auth_param_req_pP->imsi, 1, visited_plmn, nas_auth_param_req_pP->auts);
}
}
#endif
......@@ -50,8 +50,8 @@
#include "mme_app_ue_context.h"
#include "mme_app_defs.h"
static inline int ue_context_compare_identifiers(struct ue_context_s *p1,
struct ue_context_s *p2);
int ue_context_compare_identifiers(struct ue_context_s *p1,
struct ue_context_s *p2);
RB_PROTOTYPE(ue_context_map, ue_context_s, rb_entry,
ue_context_compare_identifiers);
......@@ -59,7 +59,7 @@ RB_PROTOTYPE(ue_context_map, ue_context_s, rb_entry,
RB_GENERATE(ue_context_map, ue_context_s, rb_entry,
ue_context_compare_identifiers);
static inline int ue_context_compare_identifiers(
extern 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);
......@@ -68,6 +68,8 @@ static inline int ue_context_compare_identifiers(
MME_APP_DEBUG(" ue_context_compare_identifiers ue_id %08x\n" , p1->ue_id);
if (p1->imsi > 0) {
MME_APP_DEBUG(" with IMSI %"SCNu64"\n", p2->imsi);
/* if IMSI provided */
if (p1->imsi > p2->imsi) {
return 1;
......@@ -77,6 +79,8 @@ static inline int ue_context_compare_identifiers(
return -1;
}
} else if (p1->mme_s11_teid > 0) {
MME_APP_DEBUG(" with mme_s11_teid %08x\n", p2->mme_s11_teid);
/* if s11 teid provided */
if (p1->mme_s11_teid > p2->mme_s11_teid) {
return 1;
......@@ -86,7 +90,7 @@ static inline int ue_context_compare_identifiers(
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);
MME_APP_DEBUG(" with mme_ue_s1ap_id %08x\n", p2->mme_ue_s1ap_id);
/* if s1ap ue id provided */
if (p1->mme_ue_s1ap_id > p2->mme_ue_s1ap_id) {
......@@ -97,6 +101,8 @@ static inline int ue_context_compare_identifiers(
return -1;
}
} else if (p1->ue_id > 0) {
MME_APP_DEBUG(" with ue_id %08x\n", p2->ue_id);
/* if nas ue_id provided */
if (p1->ue_id > p2->ue_id) {
return 1;
......@@ -152,7 +158,7 @@ ue_context_t *mme_create_new_ue_context(void)
return new_p;
}
inline
struct ue_context_s *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
mme_app_imsi_t imsi)
{
......@@ -166,7 +172,7 @@ struct ue_context_s *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context
&reference);
}
inline
struct ue_context_s *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
uint32_t teid)
{
......@@ -180,7 +186,8 @@ struct ue_context_s *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_con
&reference);
}
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)
......@@ -195,7 +202,8 @@ ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(
&reference);
}
inline
ue_context_t *mme_ue_context_exists_nas_ue_id(
mme_ue_context_t *mme_ue_context,
uint32_t nas_ue_id)
......@@ -211,7 +219,8 @@ ue_context_t *mme_ue_context_exists_nas_ue_id(
}
inline
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti)
{
......
......@@ -200,7 +200,6 @@ typedef struct {
* \param imsi Imsi to find in UE map
* @returns an UE context matching the IMSI or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
mme_app_imsi_t imsi);
......@@ -208,7 +207,6 @@ ue_context_t *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
* \param teid The tunnel endpoint identifier used between MME and S-GW
* @returns an UE context matching the teid or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
uint32_t teid);
......@@ -216,7 +214,6 @@ ue_context_t *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
* \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);
......@@ -224,7 +221,6 @@ ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(mme_ue_context_t *mme_ue_cont
* \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);
......@@ -232,7 +228,6 @@ ue_context_t *mme_ue_context_exists_nas_ue_id(mme_ue_context_t *mme_ue_context,
* \param guti The GUTI used by the UE
* @returns an UE context matching the guti or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti);
......
......@@ -251,14 +251,14 @@ static int _mme_api_pdn_id = 0;
** Others: None **
** **
***************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
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)
#endif
{
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int i;
#endif
LOG_FUNC_IN;
......@@ -285,7 +285,7 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config)
config->gummei.MMEgid = mme_config_p->gummei.mme_gid[0];
config->gummei.MMEcode = mme_config_p->gummei.mmec[0];
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
/* SR: this config param comes from MME global config */
if (mme_config_p->emergency_attach_supported != 0) {
......
......@@ -47,7 +47,7 @@ Description Implements the API used by the NAS layer running in the MME
#define __MME_API_H__
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
# endif
#include "commonDef.h"
......@@ -127,7 +127,7 @@ typedef struct mme_api_tft_s {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int mme_api_get_emm_config(mme_api_emm_config_t *config,
mme_config_t *mme_config_p);
#else
......
......@@ -54,7 +54,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
#include "secu_defs.h"
......@@ -313,7 +313,6 @@ int nas_message_decrypt(
#endif
emm_security_context);
/* Check NAS message integrity */
if (mac != header->message_authentication_code) {
LOG_TRACE(DEBUG,
......@@ -425,6 +424,24 @@ int nas_message_decode(
emm_security_context
);
#define NAS_CODE_TO_BE_MODIFIED 1
#ifdef NAS_CODE_TO_BE_MODIFIED
// According to 3GPP TS 24.301 version 10.15.0 Release 10, 4.4.4.3 Integrity checking of NAS signalling messages in the MME
if ((!emm_security_context) && (mac == 0) && (msg->header.message_authentication_code != 0)) {
// force mac to be the same, but we should check for message types.
// TODO Reverse order of processing in NAS code: decode message type then check MAC
LOG_TRACE(DEBUG,
"Forced computed MAC to be the MSG MAC %04x",
msg->header.message_authentication_code);
mac = msg->header.message_authentication_code;
LOG_TRACE(DEBUG,
"Forced computed MAC to be the same as MAC in message %04x",
msg->header.message_authentication_code);
}
#endif
/* Check NAS message integrity */
if (mac != msg->header.message_authentication_code) {
LOG_TRACE(DEBUG,
......@@ -434,7 +451,7 @@ int nas_message_decode(
LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH);
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Log message header */
#endif
......@@ -566,7 +583,7 @@ int nas_message_encode(
}
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Log message header */
#endif
} else {
......@@ -970,7 +987,9 @@ static int _nas_message_decrypt(
"No decryption of message length %u according to security header type 0x%02x",
length, security_header_type);
memcpy(dest, src, length);
LOG_FUNC_RETURN (length);
DECODE_U8(dest, *(UInt8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
//LOG_FUNC_RETURN (length);
break;
case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED:
......@@ -1268,7 +1287,7 @@ static UInt32_t _nas_message_get_mac(
if (!emm_security_context) {
LOG_TRACE(DEBUG,
"No security context set for integrity protection algorithm");
#if defined(EPC_BUILD) || defined(UE_BUILD)
#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab);
......@@ -1398,7 +1417,7 @@ static UInt32_t _nas_message_get_mac(
(direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num
);
#if defined(EPC_BUILD) || defined(UE_BUILD)
#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab);
......
......@@ -49,7 +49,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include "commonDef.h"
#include "emm_msg.h"
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
#include "emmData.h"
#endif
#include "esm_msg.h"
......
......@@ -1084,7 +1084,7 @@ static int _at_response_encode_cgpaddr(char* buffer, const at_response_t* data)
if (cgpaddr->PDP_addr_2[i] != NULL) {
/* IPv6 Link-local address prefixe */
offset += sprintf(buffer+offset,
",%u.%u.%u.%u.%u.%u.%u.%u",
",%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
0xfe, 0x80, 0, 0, 0, 0, 0, 0);
/* IPv6 Link-local address */
offset += sprintf(buffer+offset,
......
......@@ -76,7 +76,7 @@ Description Defines the attach related EMM procedure executed by the
#ifdef NAS_MME
#include "mme_api.h"
#include "mme_config.h"
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "nas_itti_messaging.h"
# endif
#endif
......@@ -1075,13 +1075,18 @@ int emm_proc_attach_set_detach(void)
** Others: _emm_data **
** **
***************************************************************************/
int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
int native_ksi, int ksi, int native_guti,
GUTI_t *guti, imsi_t *imsi, imei_t *imei,
tai_t *tai,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
const OctetString *esm_msg)
int emm_proc_attach_request(
unsigned int ueid,
emm_proc_attach_type_t type,
int native_ksi, int ksi,
int native_guti,
GUTI_t *guti,
imsi_t *imsi,
imei_t *imei,
tai_t *tai,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
const OctetString *esm_msg)
{
LOG_FUNC_IN;
......@@ -1098,7 +1103,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
ue_ctx.is_dynamic = FALSE;
ue_ctx.ueid = ueid;
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
/* UE identifier sanity check */
if (ueid >= EMM_DATA_NB_UE_MAX) {
......@@ -1126,7 +1131,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
/* Get the UE's EMM context if it exists */
emm_data_context_t **emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *temp = NULL;
temp = emm_data_context_get(&_emm_data, ueid);
......@@ -1197,7 +1202,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
(*emm_ctx)->ueid = ueid;
emm_fsm_set_status(ueid, *emm_ctx, EMM_DEREGISTERED);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_add(&_emm_data, *(emm_ctx));
#endif
......@@ -1265,7 +1270,7 @@ int emm_proc_attach_reject(unsigned int ueid, int emm_cause)
ue_ctx.ueid = ueid;
/* Update the EMM cause code */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0)
#else
......@@ -1333,7 +1338,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -1670,7 +1675,7 @@ static void *_emm_attach_t3450_handler(void *args)
/* Get the UE's EMM context */
emm_data_context_t *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
#else
emm_ctx = _emm_data.ctx[data->ueid];
......@@ -1768,7 +1773,7 @@ static int _emm_attach_release(void *args)
}
/* Release the EMM context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_remove(&_emm_data, emm_ctx);
#else
free(_emm_data.ctx[ueid]);
......@@ -1903,7 +1908,7 @@ static int _emm_attach_abort(void *args)
free(data);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -1979,7 +1984,7 @@ static int _emm_attach_identify(void *args)
*/
if (emm_ctx->imsi) {
/* The UE identifies itself using an IMSI */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (!emm_ctx->security) {
/* Ask upper layer to fetch new security context */
nas_itti_auth_info_req(emm_ctx->ueid, emm_ctx->imsi, 1, NULL);
......@@ -2096,7 +2101,7 @@ static int _emm_attach_identify(void *args)
rc = _emm_attach_security(emm_ctx);
}
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
else {
/* 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a
* No EMM context exists for the UE in the network; authentication
......@@ -2145,7 +2150,7 @@ static int _emm_attach_identify(void *args)
** Others: _emm_data **
** **
***************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int emm_attach_security(void *args)
{
return _emm_attach_security(args);
......
......@@ -76,7 +76,7 @@ Description Defines the authentication EMM procedure executed by the
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "nas_itti_messaging.h"
# endif
#endif
......@@ -710,7 +710,7 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
/* Get the UE context */
emm_data_context_t *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -739,7 +739,7 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
if (emm_cause != EMM_CAUSE_SUCCESS) {
switch (emm_cause) {
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
case EMM_CAUSE_SYNCH_FAILURE:
/* USIM has detected a mismatch in SQN.
......@@ -1408,7 +1408,7 @@ int _authentication_request(authentication_data_t *data)
emm_sap.u.emm_as.u.security.autn = &data->autn;
/* TODO: check for pointer validity */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
#else
emm_ctx = _emm_data.ctx[data->ueid];
......@@ -1467,7 +1467,7 @@ static int _authentication_reject(unsigned int ueid)
emm_sap.u.emm_as.u.security.ueid = ueid;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, ueid);
#else
emm_ctx = _emm_data.ctx[ueid];
......
......@@ -456,7 +456,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
_emm_detach_type_str[type], type, ueid);
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -513,7 +513,7 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
}
/* Release the EMM context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_remove(&_emm_data, emm_ctx);
free(emm_ctx);
#else
......
......@@ -65,7 +65,7 @@ Description Defines callback functions executed within EMM common procedures
#include <string.h>
#include <assert.h>
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
# include "assertions.h"
#endif
......@@ -90,12 +90,12 @@ typedef struct emm_common_data_s {
emm_common_abort_callback_t abort;
void *args;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
RB_ENTRY(emm_common_data_s) entries;
#endif
} emm_common_data_t;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
typedef struct emm_common_data_head_s {
RB_HEAD(emm_common_data_map, emm_common_data_s) emm_common_data_root;
} emm_common_data_head_t;
......@@ -185,7 +185,7 @@ int emm_proc_common_initialize(unsigned int ueid,
struct emm_common_data_s *emm_common_data_ctx = NULL;
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
assert(ueid > 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -195,7 +195,7 @@ int emm_proc_common_initialize(unsigned int ueid,
if (emm_common_data_ctx == NULL) {
emm_common_data_ctx = (emm_common_data_t *)malloc(sizeof(emm_common_data_t));
emm_common_data_ctx->ueid = ueid;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
RB_INSERT(emm_common_data_map, &emm_common_data_head.emm_common_data_root,
emm_common_data_ctx);
#endif
......@@ -244,7 +244,7 @@ int emm_proc_common_success(unsigned int ueid)
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -259,7 +259,7 @@ int emm_proc_common_success(unsigned int ueid)
if (emm_callback) {
struct emm_data_context_s *ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -297,7 +297,7 @@ int emm_proc_common_reject(unsigned int ueid)
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -312,7 +312,7 @@ int emm_proc_common_reject(unsigned int ueid)
if (emm_callback) {
struct emm_data_context_s *ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -352,7 +352,7 @@ int emm_proc_common_failure(unsigned int ueid)
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -366,7 +366,7 @@ int emm_proc_common_failure(unsigned int ueid)
if (emm_callback) {
struct emm_data_context_s *ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -405,7 +405,7 @@ int emm_proc_common_abort(unsigned int ueid)
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -419,7 +419,7 @@ int emm_proc_common_abort(unsigned int ueid)
if (emm_callback) {
struct emm_data_context_s *ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -453,7 +453,7 @@ void *emm_proc_common_get_args(unsigned int ueid)
emm_common_data_t *emm_common_data_ctx = NULL;
LOG_FUNC_IN;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -490,7 +490,7 @@ static void _emm_common_cleanup(unsigned int ueid)
{
emm_common_data_t *emm_common_data_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevCheck(ueid > 0, ueid, 0, 0);
emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid);
#else
......@@ -503,7 +503,7 @@ static void _emm_common_cleanup(unsigned int ueid)
if (emm_common_data_ctx->ref_count == 0) {
/* Release the callback functions */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
RB_REMOVE(emm_common_data_map,
&emm_common_data_head.emm_common_data_root,
emm_common_data_ctx);
......
......@@ -147,7 +147,7 @@ int emm_proc_status(unsigned int ueid, int emm_cause)
#endif
#ifdef NAS_MME
emm_sap.u.emm_as.u.status.guti = NULL;
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
# else
ctx = _emm_data.ctx[ueid];
......
......@@ -384,7 +384,7 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
}
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -551,7 +551,7 @@ int _identification_request(identification_data_t *data)
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT;
emm_sap.u.emm_as.u.security.identType = data->type;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (data->ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
......
......@@ -236,7 +236,7 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
LOG_FUNC_IN;
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -290,7 +290,7 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
#ifdef NAS_MME
emm_sap.u.emm_as.u.data.guti = NULL;
emm_sap.u.emm_as.u.data.ueid = ueid;
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
ctx = emm_data_context_get(&_emm_data, ueid);
......
......@@ -446,7 +446,7 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi,
"KSI = %d EEA = %d EIA = %d",
ksi, eea, eia);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -638,7 +638,7 @@ int emm_proc_security_mode_complete(unsigned int ueid)
}
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -721,7 +721,7 @@ int emm_proc_security_mode_reject(unsigned int ueid)
}
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -1074,7 +1074,7 @@ int _security_request(security_data_t *data, int is_new)
emm_sap.u.emm_as.u.security.selected_eea = data->selected_eea;
emm_sap.u.emm_as.u.security.selected_eia = data->selected_eia;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (data->ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
......
......@@ -123,7 +123,7 @@ int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause)
ue_ctx.ueid = ueid;
/* Update the EMM cause code */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0)
#else
......
......@@ -58,7 +58,7 @@ Description Defines internal private data handled by EPS Mobility
#ifdef NAS_MME
#include "emm_fsm.h"
#include "mme_api.h"
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "tree.h"
# endif
#endif
......@@ -356,7 +356,7 @@ typedef struct {
* ---------------------------------------------------------------------------
*/
typedef struct emm_data_context_s {
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
RB_ENTRY(emm_data_context_s) entries;
#endif
......@@ -409,7 +409,7 @@ typedef struct {
* EMM contexts
* ------------
*/
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
/* Use a tree for ue data context within MME */
RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map;
# else
......
......@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
#include "assertions.h"
#include "tree.h"
#include "emmData.h"
......
......@@ -58,7 +58,7 @@ Description Defines the EPS Mobility Management procedure call manager,
#include <stdlib.h> // malloc, free
#endif
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
# include "mme_config.h"
#endif
......@@ -425,7 +425,7 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei)
** Others: _emm_data **
** **
***************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
void emm_main_initialize(mme_config_t *mme_config_p)
#else
void emm_main_initialize(void)
......@@ -434,7 +434,7 @@ void emm_main_initialize(void)
LOG_FUNC_IN;
/* Retreive MME supported configuration data */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (mme_api_get_emm_config(&_emm_data.conf, mme_config_p) != RETURNok)
#else
......@@ -444,7 +444,7 @@ void emm_main_initialize(void)
LOG_TRACE(ERROR, "EMM-MAIN - Failed to get MME configuration data");
}
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
RB_INIT(&_emm_data.ctx_map);
#endif
......
......@@ -46,7 +46,7 @@ Description Defines the EPS Mobility Management procedure call manager,
#ifndef __EMM_MAIN_H__
#define __EMM_MAIN_H__
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
#endif
......@@ -73,7 +73,7 @@ Description Defines the EPS Mobility Management procedure call manager,
void emm_main_initialize(emm_indication_callback_t cb, const char *imei);
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
void emm_main_initialize(mme_config_t *mme_config_p);
# else
void emm_main_initialize(void);
......
......@@ -51,7 +51,7 @@ Description Defines EPS Mobility Management messages
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
......@@ -97,12 +97,12 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int decode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
......@@ -265,7 +265,7 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
"(%d)", msg->header.message_type, decode_result);
LOG_FUNC_RETURN (decode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link);
#endif
......@@ -298,11 +298,11 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int encode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
......@@ -466,7 +466,7 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x "
"(%d)", msg->header.message_type, encode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link);
#endif
}
......
......@@ -63,7 +63,7 @@ Description Defines the EMMAS Service Access Point that provides
#include <string.h> // memset
#include <stdlib.h> // malloc, free
#if (defined(EPC_BUILD) && defined(NAS_MME)) || (defined(UE_BUILD) && defined(NAS_UE))
#if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE))
# include "nas_itti_messaging.h"
#endif
......@@ -356,11 +356,11 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
emm_security_context_t *security = NULL; /* Current EPS NAS security context */
#if defined(NAS_MME)
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *emm_ctx = NULL;
#endif
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, ueid);
if (emm_ctx) {
......@@ -552,7 +552,7 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
/* Decrypt the received security protected message */
#if defined(NAS_MME)
emm_data_context_t *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (msg->ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
......@@ -825,7 +825,7 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
memset(&nas_msg, 0 , sizeof(nas_message_t));
#if defined(NAS_MME)
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -1279,7 +1279,7 @@ static int _emm_as_send(const emm_as_t *msg)
/* Send the message to the Access Stratum or S1AP in case of MME */
if (as_msg.msgID > 0) {
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
LOG_TRACE(DEBUG, "EMMAS-SAP - "
"Sending msg with id 0x%x, primitive %s (%d) to S1AP layer for transmission",
as_msg.msgID,
......@@ -1330,7 +1330,7 @@ static int _emm_as_send(const emm_as_t *msg)
}
#else
# if defined(UE_BUILD) && defined(NAS_UE)
# if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
LOG_TRACE(DEBUG, "EMMAS-SAP - "
"Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission",
as_msg.msgID,
......@@ -1467,7 +1467,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
emm_security_context_t *emm_security_context = NULL;
#if defined(NAS_MME)
struct emm_data_context_s *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -1573,7 +1573,7 @@ static int _emm_as_status_ind(const emm_as_status_t *msg,
emm_security_context_t *emm_security_context = NULL;
#if defined(NAS_MME)
struct emm_data_context_s *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -1914,7 +1914,7 @@ static int _emm_as_security_req(const emm_as_security_t *msg,
if (size > 0) {
struct emm_data_context_s *emm_ctx = NULL;
emm_security_context_t *emm_security_context = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -2004,7 +2004,7 @@ static int _emm_as_security_rej(const emm_as_security_t *msg,
if (size > 0) {
struct emm_data_context_s *emm_ctx = NULL;
emm_security_context_t *emm_security_context = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -2099,7 +2099,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
if (size > 0) {
struct emm_data_context_s *emm_ctx = NULL;
emm_security_context_t *emm_security_context = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......@@ -2217,7 +2217,7 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg,
if (size > 0) {
struct emm_data_context_s *emm_ctx = NULL;
emm_security_context_t *emm_security_context = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
......
......@@ -46,7 +46,7 @@ Description
#include <string.h>
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
#include "nas_log.h"
#include "commonDef.h"
......
......@@ -49,7 +49,7 @@ Description
#ifndef _EMM_CN_H_
#define _EMM_CN_H_
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int emm_cn_send(const emm_cn_t *msg);
#endif
......
......@@ -44,7 +44,7 @@ Description
*****************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
#include "intertask_interface.h"
#endif
......@@ -53,7 +53,7 @@ Description
typedef enum emmcn_primitive_s {
_EMMCN_START = 400,
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
_EMMCN_AUTHENTICATION_PARAM_RES,
_EMMCN_AUTHENTICATION_PARAM_FAIL,
_EMMCN_DEREGISTER_UE,
......@@ -63,7 +63,7 @@ typedef enum emmcn_primitive_s {
_EMMCN_END
} emm_cn_primitive_t;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
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;
......
......@@ -52,7 +52,7 @@ Description Defines the EPS Mobility Management procedures executed at
#include "mme_api.h"
#include "emmData.h"
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
# include "assertions.h"
#endif
......@@ -229,7 +229,7 @@ static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
* -----------------------------------------------------------------------------
*/
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
#endif
......@@ -260,7 +260,7 @@ void emm_fsm_initialize(void)
_emm_fsm_status[0] = EMM_NULL;
#endif
#if defined(NAS_MME) && !defined(EPC_BUILD)
#if defined(NAS_MME) && !defined(NAS_BUILT_IN_EPC)
for (ueid = 0; ueid < EMM_FSM_NB_UE_MAX; ueid++) {
_emm_fsm_status[ueid] = EMM_DEREGISTERED;
......@@ -299,7 +299,7 @@ int emm_fsm_set_status(
unsigned int ueid = 0;
#endif
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
DevAssert(emm_ctx != NULL);
......@@ -360,7 +360,7 @@ emm_fsm_state_t emm_fsm_get_status(void)
#ifdef NAS_MME
emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
{
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
if (emm_ctx != NULL) {
......@@ -406,7 +406,7 @@ int emm_fsm_process(const emm_reg_t *evt)
status = _emm_fsm_status[0];
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *emm_ctx = (emm_data_context_t *)evt->ctx;
DevAssert(emm_ctx != NULL);
......@@ -426,7 +426,7 @@ int emm_fsm_process(const emm_reg_t *evt)
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
DevAssert(status != EMM_INVALID);
#endif
......
......@@ -112,7 +112,7 @@ int emm_fsm_set_status(emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(void);
#endif
#ifdef NAS_MME
struct emm_data_context_t;
//LG 2015-03-13 struct emm_data_context_t;
int emm_fsm_set_status(unsigned int ueid, void *ctx, emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx);
#endif
......
......@@ -510,7 +510,8 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg,
int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg,
int *emm_cause)
{
int rc;
int rc;
uint8_t gea = 0;
emm_proc_attach_type_t type;
LOG_FUNC_IN;
......@@ -639,6 +640,16 @@ int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg,
}
/* Execute the requested UE attach procedure */
#warning " TODO gea to be review"
if (msg->msnetworkcapability.msnetworkcapabilityvalue.length > 0) {
gea = (msg->msnetworkcapability.msnetworkcapabilityvalue.value[0] & 0x80) >> 1;
if ((gea) && (msg->msnetworkcapability.msnetworkcapabilityvalue.length >= 2)) {
gea |= ((msg->msnetworkcapability.msnetworkcapabilityvalue.value[1] & 0x60) >> 1);
}
}
rc = emm_proc_attach_request(ueid, type,
msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
msg->naskeysetidentifier.naskeysetidentifier,
......@@ -648,13 +659,7 @@ int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg,
msg->uenetworkcapability.ucs2,
msg->uenetworkcapability.uea,
msg->uenetworkcapability.uia,
0x00 |
//((msg->uenetworkcapability.spare & 0x7) << 5) | // spare coded as zero
((msg->uenetworkcapability.csfb & 0x1) << 4) |
((msg->uenetworkcapability.lpp & 0x1) << 3) |
((msg->uenetworkcapability.lcs & 0x1) << 2) |
((msg->uenetworkcapability.srvcc & 0x1) << 1) |
(msg->uenetworkcapability.nf & 0x1),
gea,
msg->uenetworkcapability.umts_present,
msg->uenetworkcapability.gprs_present,
&msg->esmmessagecontainer.esmmessagecontainercontents);
......
......@@ -132,7 +132,7 @@ int emm_sap_send(emm_sap_t *msg)
rc = emm_as_send(&msg->u.emm_as);
}
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
else if ( (primitive > EMMCN_PRIMITIVE_MIN) &&
(primitive < EMMCN_PRIMITIVE_MAX) ) {
/* Forward to the EMMCN-SAP */
......
......@@ -133,7 +133,7 @@ typedef enum {
EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES,
EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND,
#ifdef EPC_BUILD
#ifdef NAS_BUILT_IN_EPC
EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES,
EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL,
EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE,
......@@ -171,7 +171,7 @@ typedef struct {
emm_reg_t emm_reg; /* EMMREG-SAP primitives */
emm_esm_t emm_esm; /* EMMESM-SAP primitives */
emm_as_t emm_as; /* EMMAS-SAP primitives */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_cn_t emm_cn; /* EMMCN-SAP primitives */
#endif
} u;
......
......@@ -666,7 +666,7 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
(apn) ? (char *)(apn->value) : "null",
(pdn_addr) ? (char *)(pdn_addr->value) : "null");
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
/* UE identifier sanity check */
if (ctx->ueid >= ESM_DATA_NB_UE_MAX) {
......
......@@ -53,7 +53,7 @@ Description Defines internal private data handled by EPS Session
#include "mme_api.h"
#endif
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
# include "tree.h"
#endif
......@@ -244,7 +244,7 @@ typedef struct {
* ESM contexts
* ------------
*/
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
/* Use a tree for ue data context within MME */
RB_HEAD(esm_data_context_map, esm_data_context_s) ctx_map;
# else
......@@ -253,7 +253,7 @@ typedef struct {
# endif
} esm_data_t;
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
struct esm_data_context_s *esm_data_context_get(
esm_data_t *esm_data, unsigned int _ueid);
......@@ -282,10 +282,10 @@ esm_data_t _esm_data;
extern char ip_addr_str[100];
extern inline char *esm_data_get_ipv4_addr(const OctetString *ip_addr);
extern char *esm_data_get_ipv4_addr(const OctetString *ip_addr);
extern inline char *esm_data_get_ipv6_addr(const OctetString *ip_addr);
extern char *esm_data_get_ipv6_addr(const OctetString *ip_addr);
extern inline char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr);
extern char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr);
#endif /* __ESMDATA_H__*/
......@@ -86,7 +86,7 @@ static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
* ----------------------------------
*/
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
static esm_ebr_data_t _esm_ebr_data[ESM_EBR_NB_UE_MAX];
#endif
......@@ -151,7 +151,7 @@ void esm_ebr_initialize(
#endif
)
{
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
int ueid, i;
LOG_FUNC_IN;
......@@ -249,7 +249,7 @@ int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
}
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN] = ebr_ctx;
#else
_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] = ebr_ctx;
......
......@@ -128,7 +128,7 @@ int esm_ebr_context_create(
esm_ctx = &_esm_data;
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
esm_ctx = &ctx->esm_data_ctx;
# else
......@@ -369,7 +369,7 @@ int esm_ebr_context_release(
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
esm_ctx = &ctx->esm_data_ctx;
# else
......
......@@ -135,7 +135,7 @@ void esm_main_initialize(void)
LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data");
}
# if !defined(EPC_BUILD)
# if !defined(NAS_BUILT_IN_EPC)
/* Initialize ESM contexts */
for (i = 0; i < ESM_DATA_NB_UE_MAX; i++) {
......
......@@ -50,7 +50,7 @@ Description Defines EPS Session Management messages
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
......@@ -92,12 +92,12 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int decode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
......@@ -219,7 +219,7 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
"(%u)", msg->header.message_type, decode_result);
LOG_FUNC_RETURN (decode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link);
#endif
......@@ -252,11 +252,11 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int encode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
......@@ -378,7 +378,7 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
LOG_TRACE(ERROR, "ESM-MSG - Failed to encode L3 ESM message 0x%x "
"(%d)", msg->header.message_type, encode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link);
#endif
}
......
......@@ -80,6 +80,9 @@ int decode_ue_network_capability(UeNetworkCapability *uenetworkcapability, uint8
uenetworkcapability->gprs_present =1;
LOG_TRACE(INFO, "uenetworkcapability decoded GPRS\n");
}
#warning "Force GPRS present if UMTS present"
uenetworkcapability->gprs_present =1;
}
}
......
......@@ -96,18 +96,32 @@ int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui
*(buffer + encoded) = uesecuritycapability->eia;
encoded++;
// From ETSI TS 124 301 V10.15.0 (2014-10) 9.9.3.36 Security capability:
// Octets 5, 6, and 7 are optional. If octet 5 is included, then also octet 6 shall be included and octet 7 may be included.
// If a UE did not indicate support of any security algorithm for Gb mode, octet 7 shall not be included. If the UE did not
// indicate support of any security algorithm for Iu mode and Gb mode, octets 5, 6, and 7 shall not be included.
// If the UE did not indicate support of any security algorithm for Iu mode but indicated support of a security algorithm for
// Gb mode, octets 5, 6, and 7 shall be included. In this case octets 5 and 6 are filled with the value of zeroes.
if (uesecuritycapability->umts_present) {
*(buffer + encoded) = uesecuritycapability->uea;
encoded++;
*(buffer + encoded) = 0x00 |
(uesecuritycapability->uia & 0x7f);
encoded++;
#warning "force gea to 0x60 if umts security capability present"
//if (uesecuritycapability->gprs_present) {
*(buffer + encoded) = 0x00 | 0x60;
//(uesecuritycapability->gea & 0x7f);
encoded++;
//}
if (uesecuritycapability->gprs_present) {
*(buffer + encoded) = 0x00 | (uesecuritycapability->gea & 0x7f);
encoded++;
}
} else {
if (uesecuritycapability->gprs_present) {
*(buffer + encoded) = 0x00;
encoded++;
*(buffer + encoded) = 0x00;
encoded++;
*(buffer + encoded) = 0x00 | (uesecuritycapability->gea & 0x7f);
encoded++;
}
}
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
......
......@@ -77,7 +77,7 @@ Description NAS procedure functions triggered by the network
** Others: None **
** **
***************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
void nas_network_initialize(mme_config_t *mme_config_p)
#else
void nas_network_initialize(void)
......@@ -87,7 +87,7 @@ void nas_network_initialize(void)
#ifdef NAS_MME
/* Initialize the internal NAS processing data */
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
nas_timer_init();
nas_proc_initialize(mme_config_p);
# else
......
......@@ -43,7 +43,7 @@ Description NAS procedure functions triggered by the network
*****************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
# include "mme_config.h"
#endif
......@@ -66,7 +66,7 @@ Description NAS procedure functions triggered by the network
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
void nas_network_initialize(mme_config_t *mme_config_p);
#else
void nas_network_initialize(void);
......
......@@ -140,7 +140,7 @@ void nas_proc_initialize(emm_indication_callback_t emm_cb,
** Others: None **
** **
***************************************************************************/
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
void nas_proc_initialize(mme_config_t *mme_config_p)
{
LOG_FUNC_IN;
......@@ -1482,7 +1482,7 @@ int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len)
LOG_FUNC_RETURN (rc);
}
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res)
{
int rc = RETURNerror;
......
......@@ -45,7 +45,7 @@ Description NAS procedure call manager
#ifndef __NAS_PROC_H__
#define __NAS_PROC_H__
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
# include "emm_cnDef.h"
#endif
......@@ -74,7 +74,7 @@ void nas_proc_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *imei);
#endif
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
void nas_proc_initialize(mme_config_t *mme_config_p);
# else
void nas_proc_initialize(void);
......@@ -159,7 +159,7 @@ int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len);
* NAS procedures triggered by the mme applicative layer
* --------------------------------------------------------------------------
*/
#if defined(NAS_MME) && defined(EPC_BUILD)
#if defined(NAS_MME) && defined(NAS_BUILT_IN_EPC)
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);
......
......@@ -44,7 +44,7 @@ Description Usefull logging functions
*****************************************************************************/
#include "nas_log.h"
#if defined(UE_BUILD) && defined(NAS_UE)
#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
int nas_log_func_indent;
#else
#include <stdio.h> // stderr, sprintf, fprintf, vfprintf
......
......@@ -45,7 +45,7 @@ Description Usefull logging functions
#ifndef __NAS_LOG_H__
#define __NAS_LOG_H__
#if defined(UE_BUILD) && defined(NAS_UE)
#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
# include "UTIL/LOG/log.h"
# undef LOG_TRACE
#endif
......@@ -102,7 +102,7 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(UE_BUILD) && defined(NAS_UE)
#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
# define LOG_TRACE(s, x, args...) \
do { \
switch (s) { \
......
......@@ -278,7 +278,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
/* Insert the new entry into the timer queue */
_nas_timer_db_insert_entry(id, te);
#if defined(ENABLE_ITTI)
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# else
ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
......
......@@ -81,7 +81,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args);
int nas_timer_stop(int id);
int nas_timer_restart(int id);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
void nas_timer_handle_signal_expiry(long timer_id, void *arg_p);
#endif
......
......@@ -52,6 +52,7 @@ Description Defines a list of PLMN network operators
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
#define TEST_PLMN {0,0,0x0f,1,1,0} // 00101
#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810
#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811
#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813
......@@ -71,7 +72,8 @@ Description Defines a list of PLMN network operators
* PLMN network operator record index
*/
enum {
SFR1=0,
TEST1=0,
SFR1,
SFR2,
SFR3,
TM1,
......@@ -104,6 +106,7 @@ typedef struct {
* The list of PLMN network operator records
*/
network_record_t network_records[] = {
{00101, TEST_PLMN, "Test network", "OAI4G", 0x0001, 0xfffd},
{20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd},
{20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd},
{20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd},
......
......@@ -53,7 +53,7 @@ Description Implements the utility used to generate data stored in the
#include <stdlib.h> // exit, free
#include <string.h> // memset, strncpy
#define SELECTED_PLMN SFR1
#define SELECTED_PLMN TEST1
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
......@@ -331,31 +331,34 @@ static void _gen_emm_data(emm_nvdata_t* data)
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
#warning "IMSI 208.10.000001234"
/* data->imsi.length = 8;
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 1; // MNC digit 1
data->imsi.u.num.digit5 = 0; // MNC digit 2
data->imsi.u.num.digit6 = 0xF; // MNC digit 3
data->imsi.u.num.digit7 = 0;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 0;
data->imsi.u.num.digit10 = 0;
data->imsi.u.num.digit11 = 1;
data->imsi.u.num.digit12 = 2;
data->imsi.u.num.digit13 = 3;
data->imsi.u.num.digit14 = 4;
data->imsi.u.num.digit15 = 0xF;*/
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 1; // MNC digit 1
data->imsi.u.num.digit5 = 0; // MNC digit 2
data->imsi.u.num.digit6 = 0xF; // MNC digit 3
data->imsi.u.num.digit7 = 0;
data->imsi.u.num.digit8 = 0;
data->imsi.u.num.digit9 = 0;
data->imsi.u.num.digit10 = 0;
data->imsi.u.num.digit11 = 1;
data->imsi.u.num.digit12 = 2;
data->imsi.u.num.digit13 = 3;
data->imsi.u.num.digit14 = 4;
data->imsi.u.num.digit15 = 0xF;*/
/*
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 001 + 01 + 00001234
*/
data->imsi.length = 8;
data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
data->imsi.u.num.digit1 = 2; // MCC digit 1
data->imsi.u.num.digit1 = 0; // MCC digit 1
data->imsi.u.num.digit2 = 0; // MCC digit 2
data->imsi.u.num.digit3 = 8; // MCC digit 3
data->imsi.u.num.digit4 = 1; // MNC digit 1
data->imsi.u.num.digit5 = 0; // MNC digit 2
data->imsi.u.num.digit3 = 1; // MCC digit 3
data->imsi.u.num.digit4 = 0; // MNC digit 1
data->imsi.u.num.digit5 = 1; // MNC digit 2
data->imsi.u.num.digit6 = 0;
data->imsi.u.num.digit7 = 0;
data->imsi.u.num.digit8 = 0;
......@@ -370,11 +373,11 @@ static void _gen_emm_data(emm_nvdata_t* data)
/*
* Last registered home PLMN
*/
data->rplmn.MCCdigit1 = 2;
data->rplmn.MCCdigit1 = 0;
data->rplmn.MCCdigit2 = 0;
data->rplmn.MCCdigit3 = 8;
data->rplmn.MNCdigit1 = 1;
data->rplmn.MNCdigit2 = 0;
data->rplmn.MCCdigit3 = 1;
data->rplmn.MNCdigit1 = 0;
data->rplmn.MNCdigit2 = 1;
data->rplmn.MNCdigit3 = 0xf;
#endif
/*
......
......@@ -27,20 +27,20 @@
*******************************************************************************/
/*****************************************************************************
Source usim_data.c
Source usim_data.c
Version 0.1
Version 0.1
Date 2012/10/31
Date 2012/10/31
Product USIM data generator
Product USIM data generator
Subsystem USIM data generator main process
Subsystem USIM data generator main process
Author Frederic Maurel
Author Frederic Maurel
Description Implements the utility used to generate data stored in the
USIM application
Description Implements the utility used to generate data stored in the
USIM application
*****************************************************************************/
......@@ -53,7 +53,7 @@
#include <stdlib.h> // exit
#include <string.h> // memset, memcpy, strncpy
#define SELECTED_PLMN SFR1
#define SELECTED_PLMN TEST1
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
......@@ -104,7 +104,6 @@ int main (int argc, const char* argv[])
{
int rc;
usim_data_t usim_data;
int i;
unsigned char gen_data;
......@@ -115,12 +114,12 @@ int main (int argc, const char* argv[])
fprintf(stderr, "Invalid parameter\n");
_display_usage(argv[0]);
exit(EXIT_FAILURE);
} else if ((strcmp(argv[1], "--gen") == 0)
|| (strcmp(argv[1], "-g") == 0)) {
} else if ( (strcmp(argv[1], "--gen") == 0) ||
(strcmp(argv[1], "-g") == 0) ) {
/* Generate USIM data files */
gen_data = TRUE;
} else if ((strcmp(argv[1], "--print") == 0)
|| (strcmp(argv[1], "-p") == 0)) {
} else if ( (strcmp(argv[1], "--print") == 0) ||
(strcmp(argv[1], "-p") == 0) ) {
/* Display content of USIM data files */
gen_data = FALSE;
} else {
......@@ -164,31 +163,31 @@ int main (int argc, const char* argv[])
* International Mobile Subscriber Identity
* IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234
*/
#warning "IMSI 208.10.00001234"
//#warning "IMSI 208.10.00001234"
/* usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
usim_data.imsi.u.num.digit7 = 0;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 0;
usim_data.imsi.u.num.digit10 = 0;
usim_data.imsi.u.num.digit11 = 1;
usim_data.imsi.u.num.digit12 = 2;
usim_data.imsi.u.num.digit13 = 3;
usim_data.imsi.u.num.digit14 = 4;
usim_data.imsi.u.num.digit15 = 0b1111;*/
usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even
usim_data.imsi.u.num.digit1 = 2; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 8; // MCC digit 3
usim_data.imsi.u.num.digit4 = 1; // MNC digit 1
usim_data.imsi.u.num.digit5 = 0; // MNC digit 2
usim_data.imsi.u.num.digit6 = 0b1111; // MNC digit 3
usim_data.imsi.u.num.digit7 = 0;
usim_data.imsi.u.num.digit8 = 0;
usim_data.imsi.u.num.digit9 = 0;
usim_data.imsi.u.num.digit10 = 0;
usim_data.imsi.u.num.digit11 = 1;
usim_data.imsi.u.num.digit12 = 2;
usim_data.imsi.u.num.digit13 = 3;
usim_data.imsi.u.num.digit14 = 4;
usim_data.imsi.u.num.digit15 = 0b1111;*/
usim_data.imsi.length = 8;
usim_data.imsi.u.num.parity = 0x0; // Type of identity = IMSI, even
usim_data.imsi.u.num.digit1 = 2;// MCC digit 1
usim_data.imsi.u.num.digit2 = 0;// MCC digit 2
usim_data.imsi.u.num.digit3 = 8;// MCC digit 3
usim_data.imsi.u.num.digit4 = 1;// MNC digit 1
usim_data.imsi.u.num.digit5 = 0;// MNC digit 2
usim_data.imsi.u.num.digit1 = 0; // MCC digit 1
usim_data.imsi.u.num.digit2 = 0; // MCC digit 2
usim_data.imsi.u.num.digit3 = 1; // MCC digit 3
usim_data.imsi.u.num.digit4 = 0; // MNC digit 1
usim_data.imsi.u.num.digit5 = 1; // MNC digit 2
usim_data.imsi.u.num.digit6 = 0;
usim_data.imsi.u.num.digit7 = 0;
usim_data.imsi.u.num.digit8 = 0;
......@@ -210,12 +209,12 @@ int main (int argc, const char* argv[])
/*
* Higher Priority PLMN search period
*/
usim_data.hpplmn = 0x00; /* Disable timer */
usim_data.hpplmn = 0x00; /* Disable timer */
/*
* List of Forbidden PLMNs
*/
for (i = 0; i < USIM_FPLMN_MAX; i++) {
for (int i = 0; i < USIM_FPLMN_MAX; i++) {
memset(&usim_data.fplmn[i], 0xff, sizeof(plmn_t));
}
......@@ -292,21 +291,21 @@ int main (int argc, const char* argv[])
usim_data.msisdn.number.digit[8].lsb = 0xf;
usim_data.msisdn.number.digit[9].msb = 0xf;
usim_data.msisdn.number.digit[9].lsb = 0xf;
usim_data.msisdn.conf1_record_id = 0xff; /* Not used */
usim_data.msisdn.ext1_record_id = 0xff; /* Not used */
usim_data.msisdn.conf1_record_id = 0xff; /* Not used */
usim_data.msisdn.ext1_record_id = 0xff; /* Not used */
/*
* PLMN Network Name and Operator PLMN List
*/
for (i = SFR1; i < VDF2; i++) {
for (int i = TEST1; i < VDF1; i++) {
network_record_t record = network_records[i];
usim_data.pnn[i].fullname.type = USIM_PNN_FULLNAME_TAG;
usim_data.pnn[i].fullname.length = strlen(record.fullname);
strncpy((char*) usim_data.pnn[i].fullname.value, record.fullname,
strncpy((char*)usim_data.pnn[i].fullname.value, record.fullname,
usim_data.pnn[i].fullname.length);
usim_data.pnn[i].shortname.type = USIM_PNN_SHORTNAME_TAG;
usim_data.pnn[i].shortname.length = strlen(record.shortname);
strncpy((char*) usim_data.pnn[i].shortname.value, record.shortname,
strncpy((char*)usim_data.pnn[i].shortname.value, record.shortname,
usim_data.pnn[i].shortname.length);
usim_data.opl[i].plmn = record.plmn;
usim_data.opl[i].start = record.tac_start;
......@@ -314,7 +313,7 @@ int main (int argc, const char* argv[])
usim_data.opl[i].record_id = i;
}
for (i = VDF2; i < USIM_OPL_MAX; i++) {
for (int i = VDF2; i < USIM_OPL_MAX; i++) {
memset(&usim_data.opl[i].plmn, 0xff, sizeof(plmn_t));
}
......@@ -332,7 +331,7 @@ int main (int argc, const char* argv[])
/*
* List of user controlled PLMN selector with Access Technology
*/
for (i = 0; i < USIM_PLMN_MAX; i++) {
for (int i = 0; i < USIM_PLMN_MAX; i++) {
memset(&usim_data.plmn[i], 0xff, sizeof(plmn_t));
}
......@@ -340,30 +339,24 @@ int main (int argc, const char* argv[])
* List of operator controlled PLMN selector with Access Technology
*/
usim_data.oplmn[0].plmn = network_records[VDF1].plmn;
usim_data.oplmn[0].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN
| USIM_ACT_EUTRAN);
usim_data.oplmn[0].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
usim_data.oplmn[1].plmn = network_records[VDF2].plmn;
usim_data.oplmn[1].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN
| USIM_ACT_EUTRAN);
usim_data.oplmn[1].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
usim_data.oplmn[2].plmn = network_records[VDF3].plmn;
usim_data.oplmn[2].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN
| USIM_ACT_EUTRAN);
usim_data.oplmn[2].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
usim_data.oplmn[3].plmn = network_records[VDF4].plmn;
usim_data.oplmn[3].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN
| USIM_ACT_EUTRAN);
usim_data.oplmn[3].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
usim_data.oplmn[4].plmn = network_records[VDF5].plmn;
usim_data.oplmn[4].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN
| USIM_ACT_EUTRAN);
usim_data.oplmn[4].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN);
for (i = 5; i < USIM_OPLMN_MAX; i++) {
for (int i = 5; i < USIM_OPLMN_MAX; i++) {
memset(&usim_data.oplmn[i], 0xff, sizeof(plmn_t));
}
/*
* EPS Location Information
*/
usim_data.epsloci.guti.gummei.plmn =
network_records[SELECTED_PLMN].plmn;
usim_data.epsloci.guti.gummei.plmn = network_records[SELECTED_PLMN].plmn;
usim_data.epsloci.guti.gummei.MMEgid = DEFAULT_MME_ID;
usim_data.epsloci.guti.gummei.MMEcode = DEFAULT_MME_CODE;
usim_data.epsloci.guti.m_tmsi = DEFAULT_M_TMSI;
......@@ -373,8 +366,7 @@ int main (int argc, const char* argv[])
/*
* Non-Access Stratum configuration
*/
usim_data.nasconfig.NAS_SignallingPriority.type =
USIM_NAS_SIGNALLING_PRIORITY_TAG;
usim_data.nasconfig.NAS_SignallingPriority.type = USIM_NAS_SIGNALLING_PRIORITY_TAG;
usim_data.nasconfig.NAS_SignallingPriority.length = 1;
usim_data.nasconfig.NAS_SignallingPriority.value[0] = 0x00;
usim_data.nasconfig.NMO_I_Behaviour.type = USIM_NMO_I_BEHAVIOUR_TAG;
......@@ -387,16 +379,13 @@ int main (int argc, const char* argv[])
#else
usim_data.nasconfig.AttachWithImsi.value[0] = 0x01;
#endif
usim_data.nasconfig.MinimumPeriodicSearchTimer.type =
USIM_MINIMUM_PERIODIC_SEARCH_TIMER_TAG;
usim_data.nasconfig.MinimumPeriodicSearchTimer.type = USIM_MINIMUM_PERIODIC_SEARCH_TIMER_TAG;
usim_data.nasconfig.MinimumPeriodicSearchTimer.length = 1;
usim_data.nasconfig.MinimumPeriodicSearchTimer.value[0] = 0x00;
usim_data.nasconfig.ExtendedAccessBarring.type =
USIM_EXTENDED_ACCESS_BARRING_TAG;
usim_data.nasconfig.ExtendedAccessBarring.type = USIM_EXTENDED_ACCESS_BARRING_TAG;
usim_data.nasconfig.ExtendedAccessBarring.length = 1;
usim_data.nasconfig.ExtendedAccessBarring.value[0] = 0x00;
usim_data.nasconfig.Timer_T3245_Behaviour.type =
USIM_TIMER_T3245_BEHAVIOUR_TAG;
usim_data.nasconfig.Timer_T3245_Behaviour.type = USIM_TIMER_T3245_BEHAVIOUR_TAG;
usim_data.nasconfig.Timer_T3245_Behaviour.length = 1;
usim_data.nasconfig.Timer_T3245_Behaviour.value[0] = 0x00;
......@@ -449,8 +438,7 @@ static void _display_usage(const char* command)
{
fprintf(stderr, "usage: %s [OPTION]\n", command);
fprintf(stderr, "\t[--gen|-g]\tGenerate the USIM data file\n");
fprintf(stderr,
"\t[--print|-p]\tDisplay the content of the USIM data file\n");
fprintf(stderr, "\t[--print|-p]\tDisplay the content of the USIM data file\n");
fprintf(stderr, "\t[--help|-h]\tDisplay this usage\n");
const char* path = getenv("USIM_DIR");
......@@ -467,7 +455,6 @@ static void _display_usage(const char* command)
static void _display_usim_data(const usim_data_t* data)
{
int digits;
int i;
printf("Administrative Data:\n");
printf("\tUE_Operation_Mode\t= 0x%.2x\n", data->ad.UE_Operation_Mode);
......@@ -476,10 +463,8 @@ static void _display_usim_data(const usim_data_t* data)
printf("IMSI:\n");
printf("\tlength\t= %d\n", data->imsi.length);
printf("\tparity\t= %s\n",
data->imsi.u.num.parity == EVEN_PARITY ? "Even" : "Odd");
digits = (data->imsi.length * 2) - 1
- (data->imsi.u.num.parity == EVEN_PARITY ? 1 : 0);
printf("\tparity\t= %s\n", data->imsi.u.num.parity == EVEN_PARITY ? "Even" : "Odd");
digits = (data->imsi.length * 2) - 1 - (data->imsi.u.num.parity == EVEN_PARITY ? 1 : 0);
printf("\tdigits\t= %d\n", digits);
printf("\tdigits\t= %u%u%u%u%u%x%u%u%u%u",
data->imsi.u.num.digit1, // MCC digit 1
......@@ -488,8 +473,10 @@ static void _display_usim_data(const usim_data_t* data)
data->imsi.u.num.digit4, // MNC digit 1
data->imsi.u.num.digit5, // MNC digit 2
data->imsi.u.num.digit6, // MNC digit 3
data->imsi.u.num.digit7, data->imsi.u.num.digit8,
data->imsi.u.num.digit9, data->imsi.u.num.digit10);
data->imsi.u.num.digit7,
data->imsi.u.num.digit8,
data->imsi.u.num.digit9,
data->imsi.u.num.digit10);
if (digits >= 11)
printf("%x", data->imsi.u.num.digit11);
......@@ -524,32 +511,37 @@ static void _display_usim_data(const usim_data_t* data)
memcpy(kasme, data->securityctx.Kasme.value, USIM_K_ASME_SIZE);
printf("\tKasme\t: \"%s\"\n", kasme);
printf("\tulNAScount\t: 0x%.8x\n",
*(UInt32_t*) data->securityctx.ulNAScount.value);
*(UInt32_t*)data->securityctx.ulNAScount.value);
printf("\tdlNAScount\t: 0x%.8x\n",
*(UInt32_t*) data->securityctx.dlNAScount.value);
*(UInt32_t*)data->securityctx.dlNAScount.value);
printf("\talgorithmID\t: 0x%.2x\n\n",
data->securityctx.algorithmID.value[0]);
printf("MSISDN\t= %u%u%u %u%u%u%u %u%u%u%u\n\n",
data->msisdn.number.digit[0].msb, data->msisdn.number.digit[0].lsb,
data->msisdn.number.digit[1].msb, data->msisdn.number.digit[1].lsb,
data->msisdn.number.digit[2].msb, data->msisdn.number.digit[2].lsb,
data->msisdn.number.digit[3].msb, data->msisdn.number.digit[3].lsb,
data->msisdn.number.digit[4].msb, data->msisdn.number.digit[4].lsb,
data->msisdn.number.digit[0].msb,
data->msisdn.number.digit[0].lsb,
data->msisdn.number.digit[1].msb,
data->msisdn.number.digit[1].lsb,
data->msisdn.number.digit[2].msb,
data->msisdn.number.digit[2].lsb,
data->msisdn.number.digit[3].msb,
data->msisdn.number.digit[3].lsb,
data->msisdn.number.digit[4].msb,
data->msisdn.number.digit[4].lsb,
data->msisdn.number.digit[5].msb);
for (i = 0; i < USIM_PNN_MAX; i++) {
printf("PNN[%d]\t= {%s, %s}\n", i, data->pnn[i].fullname.value,
data->pnn[i].shortname.value);
for (int i = 0; i < USIM_PNN_MAX; i++) {
printf("PNN[%d]\t= {%s, %s}\n", i,
data->pnn[i].fullname.value, data->pnn[i].shortname.value);
}
printf("\n");
for (i = 0; i < USIM_OPL_MAX; i++) {
for (int i = 0; i < USIM_OPL_MAX; i++) {
printf("OPL[%d]\t= ", i);
PRINT_PLMN(data->opl[i].plmn);
printf(", TAC = [%.4x - %.4x], record_id = %d\n", data->opl[i].start,
data->opl[i].end, data->opl[i].record_id);
printf(", TAC = [%.4x - %.4x], record_id = %d\n",
data->opl[i].start, data->opl[i].end, data->opl[i].record_id);
}
printf("\n");
......@@ -558,7 +550,7 @@ static void _display_usim_data(const usim_data_t* data)
PRINT_PLMN(data->hplmn.plmn);
printf(", AcT = 0x%x\n\n", data->hplmn.AcT);
for (i = 0; i < USIM_FPLMN_MAX; i++) {
for (int i = 0; i < USIM_FPLMN_MAX; i++) {
printf("FPLMN[%d]\t= ", i);
PRINT_PLMN(data->fplmn[i]);
printf("\n");
......@@ -566,7 +558,7 @@ static void _display_usim_data(const usim_data_t* data)
printf("\n");
for (i = 0; i < USIM_EHPLMN_MAX; i++) {
for (int i = 0; i < USIM_EHPLMN_MAX; i++) {
printf("EHPLMN[%d]\t= ", i);
PRINT_PLMN(data->ehplmn[i]);
printf("\n");
......@@ -574,7 +566,7 @@ static void _display_usim_data(const usim_data_t* data)
printf("\n");
for (i = 0; i < USIM_PLMN_MAX; i++) {
for (int i = 0; i < USIM_PLMN_MAX; i++) {
printf("PLMN[%d]\t\t= ", i);
PRINT_PLMN(data->plmn[i].plmn);
printf(", AcTPLMN = 0x%x", data->plmn[i].AcT);
......@@ -583,7 +575,7 @@ static void _display_usim_data(const usim_data_t* data)
printf("\n");
for (i = 0; i < USIM_OPLMN_MAX; i++) {
for (int i = 0; i < USIM_OPLMN_MAX; i++) {
printf("OPLMN[%d]\t= ", i);
PRINT_PLMN(data->oplmn[i].plmn);
printf(", AcTPLMN = 0x%x", data->oplmn[i].AcT);
......@@ -603,12 +595,14 @@ static void _display_usim_data(const usim_data_t* data)
printf("PSLOCI:\n");
printf("\tP-TMSI = 0x%.4x\n", data->psloci.p_tmsi);
printf("\tsignature = 0x%x 0x%x 0x%x\n", data->psloci.signature[0],
data->psloci.signature[1], data->psloci.signature[2]);
printf("\tsignature = 0x%x 0x%x 0x%x\n",
data->psloci.signature[0],
data->psloci.signature[1],
data->psloci.signature[2]);
printf("\tRAI\t: PLMN = ");
PRINT_PLMN(data->psloci.rai.plmn);
printf(", LAC = 0x%.2x, RAC = 0x%.1x\n", data->psloci.rai.lac,
data->psloci.rai.rac);
printf(", LAC = 0x%.2x, RAC = 0x%.1x\n",
data->psloci.rai.lac, data->psloci.rai.rac);
printf("\tstatus\t= %d\n\n", data->psloci.status);
printf("EPSLOCI:\n");
......@@ -620,7 +614,8 @@ static void _display_usim_data(const usim_data_t* data)
printf(", M-TMSI = 0x%.4x\n", data->epsloci.guti.m_tmsi);
printf("\tTAI\t: PLMN = ");
PRINT_PLMN(data->epsloci.tai.plmn);
printf(", TAC = 0x%.2x\n", data->epsloci.tai.tac);
printf(", TAC = 0x%.2x\n",
data->epsloci.tai.tac);
printf("\tstatus\t= %d\n\n", data->epsloci.status);
printf("NASCONFIG:\n");
......
......@@ -307,7 +307,7 @@ CFLAGS = \
-g \
-Wall \
-DNAS_UE \
-DUE_BUILD \
-DNAS_BUILT_IN_UE \
-Wuninitialized \
-Werror=implicit-function-declaration \
$(UENAS_CFLAGS) \
......
......@@ -33,7 +33,7 @@ libnas_la_LDFLAGS = -all-static
AM_CFLAGS = \
@ADD_CFLAGS@ \
-DNAS_MME \
-DEPC_BUILD \
-DNAS_BUILT_IN_EPC \
-DENABLE_ITTI \
-I$(top_srcdir)/COMMON \
-I$(top_srcdir)/SECU \
......
......@@ -31,15 +31,15 @@
#include "intertask_interface.h"
#include "nas_itti_messaging.h"
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(UE_BUILD) && defined(NAS_UE)))
# if (defined(EPC_BUILD) && defined(NAS_MME))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))
# define TASK_ORIGIN TASK_NAS_MME
# else
# define TASK_ORIGIN TASK_NAS_UE
# endif
#endif
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
static const UInt8_t emm_message_ids[] = {
ATTACH_REQUEST,
ATTACH_ACCEPT,
......@@ -188,7 +188,7 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
}
#endif
#if defined(EPC_BUILD) && defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
const uint32_t length)
{
......@@ -205,7 +205,7 @@ int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
#endif
#if defined(UE_BUILD) && defined(NAS_UE)
#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
extern unsigned char NB_eNB_INST;
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat)
......
......@@ -37,7 +37,7 @@
#ifndef NAS_ITTI_MESSAGING_H_
#define NAS_ITTI_MESSAGING_H_
# if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
int nas_itti_plain_msg(
const char *buffer,
const nas_message_t *msg,
......@@ -51,7 +51,7 @@ int nas_itti_protected_msg(
const int instance);
# endif
# if defined(EPC_BUILD) && defined(NAS_MME)
# if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
#include "conversions.h"
int nas_itti_dl_data_req(
......@@ -223,7 +223,7 @@ static inline void nas_itti_establish_rej(
}
# endif
# if defined(UE_BUILD) && defined(NAS_UE)
# if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat);
int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data_pP, UInt32_t lengthP);
......
......@@ -85,7 +85,9 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(mme_app_init(&mme_config));
CHECK_INIT_RETURN(s6a_init(&mme_config));
CHECK_INIT_RETURN(sgw_lite_init(mme_config.config_file));
#if ! defined(ENABLE_USE_GTPU_IN_KERNEL)
CHECK_INIT_RETURN(sgi_init(&spgw_config.pgw_config));
#endif
/* Handle signals here */
itti_wait_tasks_end();
......
......@@ -55,6 +55,9 @@
#include "s1ap_eNB_itti_messaging.h"
#include "s1ap_eNB_ue_context.h" // test, to be removed
#include "assertions.h"
#include "conversions.h"
......@@ -322,8 +325,22 @@ void *s1ap_eNB_task(void *arg)
break;
case S1AP_UE_CONTEXT_RELEASE_REQ: {
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
DevAssert(s1ap_eNB_instance_p != NULL); // test
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n",
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test
} // test
}
break;
......
......@@ -48,6 +48,9 @@
#include "s1ap_eNB_nas_procedures.h"
#include "s1ap_eNB_management_procedures.h"
#include "s1ap_eNB_context_management_procedures.h"
#ifdef MESSAGE_CHART_GENERATOR
#include "msc.h"
#endif
int s1ap_ue_context_release_complete(instance_t instance,
......@@ -98,6 +101,18 @@ int s1ap_ue_context_release_complete(instance_t instance,
return -1;
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
buffer,
length,
MSC_AS_TIME_FMT" UEContextRelease successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0, //MSC_AS_TIME_ARGS(ctxt_pP),
ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID,
ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
......@@ -114,7 +129,12 @@ int s1ap_ue_context_release_complete(instance_t instance,
if ((ue_context2_p = RB_REMOVE(s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head, ue_context_p))
== NULL) {
S1AP_WARN("Removed UE context eNB_ue_s1ap_id %u\n",
ue_context2_p->eNB_ue_s1ap_id);
s1ap_eNB_free_ue_context(ue_context2_p);
} else {
S1AP_WARN("Removing UE context eNB_ue_s1ap_id %u: did not find context\n",
ue_context_p->eNB_ue_s1ap_id);
}
return ret;
......@@ -195,6 +215,18 @@ int s1ap_ue_context_release_req(instance_t instance,
return -1;
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
buffer,
length,
MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID,
ue_ctxt_release_request_ies_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
......
......@@ -226,7 +226,7 @@ typedef struct {
uint16_t global_cnx_id;
} s1ap_eNB_internal_data_t;
inline int s1ap_eNB_compare_assoc_id(
int s1ap_eNB_compare_assoc_id(
struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
/* Generate the tree management functions */
......
......@@ -47,9 +47,14 @@
#include "s1ap_eNB_ue_context.h"
#include "s1ap_eNB_nas_procedures.h"
#include "s1ap_eNB_management_procedures.h"
#ifdef MESSAGE_CHART_GENERATOR
#include "msc.h"
#endif
//------------------------------------------------------------------------------
int s1ap_eNB_handle_nas_first_req(
instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p)
//------------------------------------------------------------------------------
{
s1ap_eNB_instance_t *instance_p = NULL;
struct s1ap_eNB_mme_data_s *mme_desc_p = NULL;
......@@ -221,8 +226,21 @@ int s1ap_eNB_handle_nas_first_req(
mme_desc_p->nextstream += 1;
}
#if defined(S1AP_LIMIT_STREAM_ID_TO_1)
mme_desc_p->nextstream = 1;
#endif
ue_desc_p->stream = mme_desc_p->nextstream;
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)NULL,
0,
MSC_AS_TIME_FMT" initialUEMessage initiatingMessage eNB_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
initial_ue_message_p->eNB_UE_S1AP_ID);
#endif
/* Send encoded message over sctp */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id,
buffer, length, ue_desc_p->stream);
......@@ -230,11 +248,13 @@ int s1ap_eNB_handle_nas_first_req(
return 0;
}
//------------------------------------------------------------------------------
int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
const uint32_t stream,
const struct s1ap_message_s *const message_p)
//------------------------------------------------------------------------------
{
S1ap_DownlinkNASTransportIEs_t *downlink_NAS_transport_p = NULL;
const S1ap_DownlinkNASTransportIEs_t *downlink_NAS_transport_p = NULL;
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
s1ap_eNB_ue_context_t *ue_desc_p = NULL;
......@@ -262,7 +282,19 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance,
downlink_NAS_transport_p->eNB_UE_S1AP_ID)) == NULL) {
S1AP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context: 0x%08x %l(10)\n",
#ifdef MESSAGE_CHART_GENERATOR
msc_log_rx_discarded_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)downlink_NAS_transport_p,
sizeof(S1ap_DownlinkNASTransportIEs_t),
MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
downlink_NAS_transport_p->eNB_UE_S1AP_ID,
downlink_NAS_transport_p->mme_ue_s1ap_id);
#endif
S1AP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context eNB_UE_S1AP_ID: 0x%"PRIx32" %u\n",
assoc_id,
downlink_NAS_transport_p->eNB_UE_S1AP_ID,
downlink_NAS_transport_p->eNB_UE_S1AP_ID);
......@@ -277,7 +309,7 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
} else {
/* We already have a mme ue s1ap id check the received is the same */
if (ue_desc_p->mme_ue_s1ap_id != downlink_NAS_transport_p->mme_ue_s1ap_id) {
S1AP_ERROR("[SCTP %d] Mismatch in MME UE S1AP ID (0x%08x != 0x%08x)\n",
S1AP_ERROR("[SCTP %d] Mismatch in MME UE S1AP ID (0x%"PRIx32" != 0x%"PRIx32")\n",
assoc_id,
downlink_NAS_transport_p->mme_ue_s1ap_id,
ue_desc_p->mme_ue_s1ap_id
......@@ -285,6 +317,18 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
}
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_rx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)downlink_NAS_transport_p,
sizeof(S1ap_DownlinkNASTransportIEs_t),
MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
downlink_NAS_transport_p->eNB_UE_S1AP_ID,
downlink_NAS_transport_p->mme_ue_s1ap_id);
#endif
/* Forward the NAS PDU to RRC */
s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance,
ue_desc_p->ue_initial_id,
......@@ -292,12 +336,15 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
downlink_NAS_transport_p->nas_pdu.buf,
downlink_NAS_transport_p->nas_pdu.size);
ue_desc_p->ue_initial_id = 0;
// LG: Why set to 0 ??
//ue_desc_p->ue_initial_id = 0;
return 0;
}
//------------------------------------------------------------------------------
int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p)
//------------------------------------------------------------------------------
{
struct s1ap_eNB_ue_context_s *ue_context_p;
s1ap_eNB_instance_t *s1ap_eNB_instance_p;
......@@ -370,6 +417,18 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
return -1;
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)NULL,
0,
MSC_AS_TIME_FMT" uplinkNASTransport initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
uplink_NAS_transport_p->eNB_UE_S1AP_ID,
uplink_NAS_transport_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
......@@ -378,8 +437,11 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
return 0;
}
//------------------------------------------------------------------------------
void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind)
//------------------------------------------------------------------------------
{
struct s1ap_eNB_ue_context_s *ue_context_p;
s1ap_eNB_instance_t *s1ap_eNB_instance_p;
......@@ -426,6 +488,17 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
/* Send a dummy cause */
nas_non_delivery_p->cause.present = S1ap_Cause_PR_radioNetwork;
nas_non_delivery_p->cause.choice.radioNetwork = S1ap_CauseRadioNetwork_radio_connection_with_ue_lost;
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)s1ap_nas_non_delivery_ind,
sizeof(s1ap_nas_non_delivery_ind_t),
MSC_AS_TIME_FMT" NASNonDeliveryIndication initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
nas_non_delivery_p->eNB_UE_S1AP_ID,
nas_non_delivery_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
......@@ -433,8 +506,10 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
length, ue_context_p->stream);
}
//------------------------------------------------------------------------------
int s1ap_eNB_initial_ctxt_resp(
instance_t instance, s1ap_initial_context_setup_resp_t *initial_ctxt_resp_p)
//------------------------------------------------------------------------------
{
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
......@@ -505,6 +580,18 @@ int s1ap_eNB_initial_ctxt_resp(
return -1;
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)buffer,
length,
MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
initial_ies_p->eNB_UE_S1AP_ID,
initial_ies_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
......@@ -513,8 +600,10 @@ int s1ap_eNB_initial_ctxt_resp(
return ret;
}
//------------------------------------------------------------------------------
int s1ap_eNB_ue_capabilities(instance_t instance,
s1ap_ue_cap_info_ind_t *ue_cap_info_ind_p)
//------------------------------------------------------------------------------
{
s1ap_eNB_instance_t *s1ap_eNB_instance_p;
struct s1ap_eNB_ue_context_s *ue_context_p;
......@@ -572,6 +661,18 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
return -1;
}
#ifdef MESSAGE_CHART_GENERATOR
msc_log_tx_message(
MSC_S1AP_ENB,
MSC_S1AP_MME,
(const char *)buffer,
length,
MSC_AS_TIME_FMT" UECapabilityInfoIndication initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u",
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_cap_info_ind_ies_p->eNB_UE_S1AP_ID,
ue_cap_info_ind_ies_p->mme_ue_s1ap_id);
#endif
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
......
......@@ -78,7 +78,7 @@ typedef struct s1ap_eNB_ue_context_s {
s1ap_eNB_instance_t *eNB_instance;
} s1ap_eNB_ue_context_t;
inline int s1ap_eNB_compare_eNB_ue_s1ap_id(
int s1ap_eNB_compare_eNB_ue_s1ap_id(
struct s1ap_eNB_ue_context_s *p1, struct s1ap_eNB_ue_context_s *p2);
/* Generate the tree management functions prototypes */
......
......@@ -291,14 +291,14 @@ void s1ap_dump_ue(ue_description_t *ue_ref)
#endif
}
eNB_description_t* s1ap_is_eNB_id_in_list(uint32_t eNB_id)
eNB_description_t* s1ap_is_eNB_id_in_list(const uint32_t eNB_id)
{
eNB_description_t *eNB_ref;
STAILQ_FOREACH(eNB_ref, &eNB_list_head, eNB_entries) {
if (eNB_ref->eNB_id == eNB_id) {
/* We fount a matching reference, return it */
/* We found a matching reference, return it */
return eNB_ref;
}
}
......@@ -306,14 +306,14 @@ eNB_description_t* s1ap_is_eNB_id_in_list(uint32_t eNB_id)
return eNB_ref;
}
eNB_description_t* s1ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id)
eNB_description_t* s1ap_is_eNB_assoc_id_in_list(const uint32_t sctp_assoc_id)
{
eNB_description_t *eNB_ref;
STAILQ_FOREACH(eNB_ref, &eNB_list_head, eNB_entries) {
if (eNB_ref->sctp_assoc_id == sctp_assoc_id) {
/* We fount a matching reference, return it */
/* We found a matching reference, return it */
return eNB_ref;
}
}
......@@ -322,7 +322,7 @@ eNB_description_t* s1ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id)
}
ue_description_t *s1ap_is_ue_eNB_id_in_list(eNB_description_t *eNB_ref,
uint32_t eNB_ue_s1ap_id)
const uint32_t eNB_ue_s1ap_id)
{
ue_description_t *ue_ref;
......@@ -337,7 +337,7 @@ ue_description_t *s1ap_is_ue_eNB_id_in_list(eNB_description_t *eNB_ref,
return NULL;
}
ue_description_t* s1ap_is_ue_mme_id_in_list(uint32_t mme_ue_s1ap_id)
ue_description_t* s1ap_is_ue_mme_id_in_list(const uint32_t mme_ue_s1ap_id)
{
ue_description_t *ue_ref;
......@@ -345,7 +345,7 @@ ue_description_t* s1ap_is_ue_mme_id_in_list(uint32_t mme_ue_s1ap_id)
STAILQ_FOREACH(eNB_ref, &eNB_list_head, eNB_entries) {
STAILQ_FOREACH(ue_ref, &eNB_ref->ue_list_head, ue_entries) {
// We fount a matching reference, return it
// We found a matching reference, return it
if (ue_ref->mme_ue_s1ap_id == mme_ue_s1ap_id) {
return ue_ref;
}
......@@ -355,7 +355,7 @@ ue_description_t* s1ap_is_ue_mme_id_in_list(uint32_t mme_ue_s1ap_id)
return NULL;
}
ue_description_t* s1ap_is_teid_in_list(uint32_t teid)
ue_description_t* s1ap_is_teid_in_list(const uint32_t teid)
{
ue_description_t *ue_ref;
......@@ -363,7 +363,7 @@ ue_description_t* s1ap_is_teid_in_list(uint32_t teid)
STAILQ_FOREACH(eNB_ref, &eNB_list_head, eNB_entries) {
STAILQ_FOREACH(ue_ref, &eNB_ref->ue_list_head, ue_entries) {
// We fount a matching reference, return it
// We found a matching reference, return it
if (ue_ref->teid == teid) {
return ue_ref;
}
......@@ -397,7 +397,7 @@ eNB_description_t* s1ap_new_eNB(void)
return eNB_ref;
}
ue_description_t* s1ap_new_ue(uint32_t sctp_assoc_id)
ue_description_t* s1ap_new_ue(const uint32_t sctp_assoc_id)
{
eNB_description_t *eNB_ref = NULL;
......@@ -438,6 +438,7 @@ void s1ap_remove_ue(ue_description_t *ue_ref)
/* Freeing memory */
free(ue_ref);
ue_ref = NULL;
}
void s1ap_remove_eNB(eNB_description_t *eNB_ref)
......@@ -456,6 +457,7 @@ void s1ap_remove_eNB(eNB_description_t *eNB_ref)
STAILQ_REMOVE(&eNB_list_head, eNB_ref, eNB_description_s, eNB_entries);
free(eNB_ref);
eNB_ref = NULL;
nb_eNB_associated--;
}
......
......@@ -123,27 +123,27 @@ int s1ap_mme_init(const mme_config_t *mme_config);
* \param eNB_id The unique eNB id to search in list
* @returns NULL if no eNB matchs the eNB id, or reference to the eNB element in list if matches
**/
eNB_description_t* s1ap_is_eNB_id_in_list(uint32_t eNB_id);
eNB_description_t* s1ap_is_eNB_id_in_list(const uint32_t eNB_id);
/** \brief Look for given eNB SCTP assoc id in the list
* \param eNB_id The unique sctp assoc id to search in list
* @returns NULL if no eNB matchs the sctp assoc id, or reference to the eNB element in list if matches
**/
eNB_description_t* s1ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id);
eNB_description_t* s1ap_is_eNB_assoc_id_in_list(const uint32_t sctp_assoc_id);
/** \brief Look for given ue eNB id in the list
* \param eNB_id The unique ue_eNB_id to search in list
* @returns NULL if no UE matchs the ue_eNB_id, or reference to the ue element in list if matches
**/
ue_description_t* s1ap_is_ue_eNB_id_in_list(eNB_description_t *eNB_ref,
uint32_t eNB_ue_s1ap_id);
const uint32_t eNB_ue_s1ap_id);
/** \brief Look for given ue mme id in the list
* \param eNB_id The unique ue_mme_id to search in list
* @returns NULL if no UE matchs the ue_mme_id, or reference to the ue element in list if matches
**/
ue_description_t* s1ap_is_ue_mme_id_in_list(uint32_t ue_mme_id);
ue_description_t* s1ap_is_teid_in_list(uint32_t teid);
ue_description_t* s1ap_is_ue_mme_id_in_list(const uint32_t ue_mme_id);
ue_description_t* s1ap_is_teid_in_list(const uint32_t teid);
/** \brief Allocate and add to the list a new eNB descriptor
* @returns Reference to the new eNB element in list
......@@ -154,7 +154,7 @@ eNB_description_t* s1ap_new_eNB(void);
* \param sctp_assoc_id association ID over SCTP
* @returns Reference to the new UE element in list
**/
ue_description_t* s1ap_new_ue(uint32_t sctp_assoc_id);
ue_description_t* s1ap_new_ue(const uint32_t sctp_assoc_id);
/** \brief Dump the eNB list
* Calls dump_eNB for each eNB in list
......
......@@ -77,7 +77,7 @@ s1ap_message_decoded_callback messages_callback[][3] = {
{ 0, 0, 0 }, /* ErrorIndication */
{ s1ap_mme_handle_nas_non_delivery, 0, 0 }, /* NASNonDeliveryIndication */
{ s1ap_mme_handle_s1_setup_request, 0, 0 }, /* S1Setup */
{ 0, 0, 0 }, /* UEContextReleaseRequest */
{ s1ap_mme_handle_ue_context_release_request, 0, 0 }, /* UEContextReleaseRequest */
{ 0, 0, 0 }, /* DownlinkS1cdma2000tunneling */
{ 0, 0, 0 }, /* UplinkS1cdma2000tunneling */
{ 0, 0, 0 }, /* UEContextModification */
......@@ -586,6 +586,9 @@ int s1ap_mme_handle_ue_context_release_request(uint32_t assoc_id,
/* MME doesn't know the MME UE S1AP ID provided.
* TODO
*/
S1AP_DEBUG("UE_CONTEXT_RELEASE_REQUEST ignored cause could not get context with mme_ue_s1ap_id 0x%08x %u(10)\n",
ueContextReleaseRequest_p->mme_ue_s1ap_id,
ueContextReleaseRequest_p->mme_ue_s1ap_id);
return -1;
} else {
if (ue_ref->eNB_ue_s1ap_id == (ueContextReleaseRequest_p->eNB_UE_S1AP_ID &
......@@ -594,6 +597,8 @@ int s1ap_mme_handle_ue_context_release_request(uint32_t assoc_id,
* -> Send a UE context Release Command to eNB.
* TODO
*/
s1ap_mme_generate_ue_context_release_command(ue_ref);
// UE context will be removed when receiving UE_CONTEXT_RELEASE_COMPLETE
} else {
// TODO
return -1;
......@@ -888,15 +893,15 @@ int s1ap_handle_create_session_response(SgwCreateSessionResponse
initialContextSetupRequest_p->eNB_UE_S1AP_ID = ue_ref->eNB_ue_s1ap_id;
/* uEaggregateMaximumBitrateDL and uEaggregateMaximumBitrateUL expressed in term of bits/sec */
// asn_int642INTEGER(
// &initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL,
// 100000000UL);
// asn_int642INTEGER(
// &initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL,
// 50000000UL);
initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL = 100000000UL;
initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL = 50000000UL;
asn_int642INTEGER(
&initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL,
100000000UL);
asn_int642INTEGER(
&initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL,
50000000UL);
//initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL = 100000000UL;
//initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL = 50000000UL;
e_RABToBeSetup.e_RAB_ID =
session_response_p->bearer_context_created.eps_bearer_id; /* ??? */
......
......@@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdint.h>
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_mme_encoder.h"
......@@ -211,7 +212,7 @@ int s1ap_generate_downlink_nas_transport(const uint32_t ue_id, void * const data
/* If the UE-associated logical S1-connection is not established,
* the MME shall allocate a unique MME UE S1AP ID to be used for the UE.
*/
DevMessage("This case is not handled right now\n");
S1AP_DEBUG("Unknown UE MME ID %08X, This case is not handled right now\n", ue_id);
return -1;
} else {
......@@ -580,8 +581,8 @@ void s1ap_handle_conn_est_cnf(const mme_app_connection_establishment_cnf_t * con
initialContextSetupRequest_p->eNB_UE_S1AP_ID = (unsigned long)ue_ref->eNB_ue_s1ap_id;
/* uEaggregateMaximumBitrateDL and uEaggregateMaximumBitrateUL expressed in term of bits/sec */
initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL = conn_est_cnf_pP->ambr.br_dl;
initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL = conn_est_cnf_pP->ambr.br_ul;
asn_uint642INTEGER(&initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL, conn_est_cnf_pP->ambr.br_dl);
asn_uint642INTEGER(&initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL, conn_est_cnf_pP->ambr.br_ul);
e_RABToBeSetup.e_RAB_ID = conn_est_cnf_pP->eps_bearer_id; //5;
e_RABToBeSetup.e_RABlevelQoSParameters.qCI = conn_est_cnf_pP->bearer_qos_qci;
......
......@@ -55,7 +55,7 @@ RB_PROTOTYPE(s1ap_timer_map, s1ap_timer_map_s, entries,
RB_GENERATE(s1ap_timer_map, s1ap_timer_map_s, entries,
s1ap_mme_timer_map_compare_id);
inline int s1ap_mme_timer_map_compare_id(
int s1ap_mme_timer_map_compare_id(
struct s1ap_timer_map_s *p1, struct s1ap_timer_map_s *p2)
{
if (p1->mme_ue_s1ap_id > 0) {
......
......@@ -39,7 +39,7 @@ typedef struct s1ap_timer_map_s {
RB_ENTRY(s1ap_timer_map_s) entries;
} s1ap_timer_map_t;
inline int s1ap_mme_timer_map_compare_id(
int s1ap_mme_timer_map_compare_id(
struct s1ap_timer_map_s *p1, struct s1ap_timer_map_s *p2);
int s1ap_handle_timer_expiry(timer_has_expired_t *timer_has_expired);
......
......@@ -171,7 +171,7 @@ diff -rupN freeDiameter-1.2.0/extensions/dict_s6a/dict_s6a.c freeDiameter-1.2.0.
+ {
+ struct dict_avp_data data = {
+ 493, /* Code */
+ 0, /* Vendor */
+ VENDOR_3GPP_Id, /* Vendor , EURECOM: with FD 1.2.0 does not work if vendor ID is 0 for this AVP*/
+ "Service-Selection", /* Name */
+ AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
+ AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */
......
......@@ -117,6 +117,7 @@ typedef struct {
struct dict_object *dataobj_s6a_immediate_response_pref;
struct dict_object *dataobj_s6a_authentication_info;
struct dict_object *dataobj_s6a_re_synchronization_info;
struct dict_object *dataobj_s6a_service_selection;
struct dict_object *dataobj_s6a_ue_srvcc_cap;
/* Handlers */
......
......@@ -148,6 +148,9 @@ int s6a_fd_init_dict_objs(void)
CHECK_FD_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
AVP_BY_NAME_ALL_VENDORS, "Re-Synchronization-Info",
&s6a_fd_cnf.dataobj_s6a_re_synchronization_info, ENOENT));
CHECK_FD_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
AVP_BY_NAME_ALL_VENDORS, "Service-Selection",
&s6a_fd_cnf.dataobj_s6a_service_selection, ENOENT));
CHECK_FD_FCT(fd_dict_search(fd_g_config->cnf_dict, DICT_AVP,
AVP_BY_NAME_ALL_VENDORS, "UE-SRVCC-Capability",
&s6a_fd_cnf.dataobj_s6a_ue_srvcc_cap, ENOENT));
......
......@@ -89,8 +89,7 @@ void *s6a_thread(void *args)
itti_exit_task();
} break;
default: {
S6A_DEBUG("Unkwnon message ID %d:
%s\n",
S6A_DEBUG("Unkwnon message ID %d: %s\n",
ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
} break;
}
......@@ -121,8 +120,7 @@ int s6a_init(const mme_config_t *mme_config_p)
S6A_DEBUG("Initializing freeDiameter core...\n");
ret = fd_core_initialize();
if (ret != 0) {
S6A_ERROR("An error occurred during freeDiameter core library initialization:
%d\n",ret);
S6A_ERROR("An error occurred during freeDiameter core library initialization: %d\n",ret);
return ret;
} else {
S6A_DEBUG("Initializing freeDiameter core done\n");
......@@ -130,13 +128,11 @@ int s6a_init(const mme_config_t *mme_config_p)
S6A_DEBUG("Default ext path:
%s\n", DEFAULT_EXTENSIONS_PATH);
S6A_DEBUG("Default ext path: %s\n", DEFAULT_EXTENSIONS_PATH);
ret = fd_core_parseconf(mme_config_p->s6a_config.conf_file);
if (ret != 0) {
S6A_ERROR("An error occurred during fd_core_parseconf file :
%s.\n", mme_config_p->s6a_config.conf_file);
S6A_ERROR("An error occurred during fd_core_parseconf file : %s.\n", mme_config_p->s6a_config.conf_file);
return ret;
} else {
S6A_DEBUG("fd_core_parseconf done\n");
......@@ -183,8 +179,7 @@ int s6a_init(const mme_config_t *mme_config_p)
S6A_ERROR("s6a create task\n");
return -1;
}
S6A_DEBUG("Initializing S6a interface:
DONE\n");
S6A_DEBUG("Initializing S6a interface: DONE\n");
return 0;
}
......@@ -155,6 +155,15 @@ int sgw_lite_init(char* config_file_name_pP)
spgw_system("rmmod x_tables > /dev/null 2>&1", SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
spgw_system("rmmod nf_conntrack_netlink nfnetlink nf_nat nf_conntrack_ipv4 nf_conntrack > /dev/null 2>&1", SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe ip_tables", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe iptable_filter", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe iptable_mangle", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe iptable_nat", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe iptable_raw", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe ipt_MASQUERADE", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe ipt_LOG", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe nf_conntrack", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe nf_conntrack_ipv4", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe nf_nat", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe x_tables", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("sysctl -w net.ipv4.netfilter.ip_conntrack_max=16000", SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
spgw_system("sysctl -w net.ipv4.ip_forward=1", SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
......
......@@ -168,7 +168,7 @@ int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id)
sin.sin_port = htons(port);
if (ip_addr == NULL) {
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_addr.s_addr = inet_addr(INADDR_ANY);
} else {
sin.sin_addr.s_addr = inet_addr(ip_addr);
}
......
# ------- Interfaces definitions
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IP_ADDRESS_FOR_S1_MME = "192.168.12.30";
ENB_IP_NETMASK_FOR_S1_MME = 24;
ENB_INTERFACE_NAME_FOR_S1U = "eth2";
ENB_IP_ADDRESS_FOR_S1U = "192.168.14.30";
ENB_IP_NETMASK_FOR_S1U = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.175";
MME_IP_NETMASK_FOR_S1_MME = 24;
# ------- Interfaces definitions
ENB_INTERFACE_NAME_FOR_S1_MME = "eth2";
ENB_IP_ADDRESS_FOR_S1_MME = "192.168.14.30";
ENB_IP_NETMASK_FOR_S1_MME = 24;
ENB_INTERFACE_NAME_FOR_S1U = "eth2";
ENB_IP_ADDRESS_FOR_S1U = "192.168.14.30";
ENB_IP_NETMASK_FOR_S1U = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.14.162";
MME_IP_NETMASK_FOR_S1_MME = 24;
# ------- Interfaces definitions
ENB_INTERFACE_NAME_FOR_S1_MME = "cpenb0";
ENB_IP_ADDRESS_FOR_S1_MME = "192.168.30.117";
ENB_IP_NETMASK_FOR_S1_MME = 24;
ENB_INTERFACE_NAME_FOR_S1U = "upenb0";
ENB_IP_ADDRESS_FOR_S1U = "192.168.31.117";
ENB_IP_NETMASK_FOR_S1U = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "cpmme0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.30.17";
MME_IP_NETMASK_FOR_S1_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 60;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.92:1;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.12.87";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.12.87";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.12.87";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.87";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth0";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.12.87";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.35:8;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.14.162";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.14.162";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.14.162";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.30";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth2";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.14.30";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.35:8;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.14.162";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.14.162";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.14.162";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.14.162";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth0";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.14.162";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../epc_nas/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.92:1,208.10:1;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.12.31";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.12.31";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "eth0";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.12.31";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "eth0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.12.31";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.12.31";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.31";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth0";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.12.31";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../epc_nas/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 60;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.92:1,208.10:1;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.12.86";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.12.86";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "eth0";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.12.86";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "eth0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.12.86";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.12.86";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.86";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth0";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.12.86";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.35:8;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "s11sgw";
SGW_IP_ADDRESS_FOR_S11 = "192.168.33.17";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "upsgw0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.31.17";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth2";
PGW_IP_ADDR_FOR_SGI = "192.168.13.17";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "cpmme0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.30.17";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "s11mme";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.33.117";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.35:8;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "eth0";
SGW_IP_ADDRESS_FOR_S11 = "192.168.14.162";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "eth0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.14.162";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth0";
PGW_IP_ADDR_FOR_SGI = "192.168.14.162";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "eth0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.12.175";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "eth0";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.12.175";
MME_IP_NETMASK_FOR_S11_MME = 24;
S6A_CONF = "../objs/UTILS/CONF/s6a.conf";
REALM = "eur";
# Define the limits of the system in terms of served eNB and served UE.
# When the limits will be reached, overload procedure will take place.
MAXENB = 10;
MAXUE = 100;
RELATIVE_CAPACITY = 10;
# Display statistics about whole system (expressed in seconds)
MME_STATISTIC_TIMER = 10;
# max queue size per task
ITTI_QUEUE_SIZE = 2000000;
# ------- SCTP definitions
# Number of streams to use in input/output
SCTP_INSTREAMS = 32;
SCTP_OUTSTREAMS = 32;
# ------- S1AP definitions
# outcome drop timer value (seconds)
S1AP_OUTCOME_TIMER = 10;
# ------- MME served GUMMEI
# MME code DEFAULT = 0
# size = 8 bits
# maximum of 256 values, comma separated
MME_CODE = 30,56,1,8;
# MME GROUP ID DEFAULT = 0
# size = 16 bits
# maximum of 65535 values, comma separated
MME_GID = 3,4,5,30,8,9,50021;
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
PLMN = 208.38:0,209.130:4,208.35:8;
# ------- Interfaces definitions
SGW_INTERFACE_NAME_FOR_S11 = "s11sgw";
SGW_IP_ADDRESS_FOR_S11 = "192.168.33.17";
SGW_IP_NETMASK_FOR_S11 = 24;
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "upsgw0";
SGW_IP_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.31.17";
SGW_IP_NETMASK_FOR_S1U_S12_S4_UP = 24;
SGW_INTERFACE_NAME_FOR_S5_S8_UP = "upsgw1";
SGW_IP_ADDRESS_FOR_S5_S8_UP = "192.168.5.2";
SGW_IP_NETMASK_FOR_S5_S8_UP = 24;
PGW_INTERFACE_NAME_FOR_S5_S8 = "uppgw0";
PGW_IP_ADDRESS_FOR_S5_S8 = "192.168.5.1";
PGW_IP_NETMASK_FOR_S5_S8 = 24;
PGW_INTERFACE_NAME_FOR_SGI = "eth2";
PGW_IP_ADDR_FOR_SGI = "192.168.13.17";
PGW_IP_NETMASK_FOR_SGI = 24;
MME_INTERFACE_NAME_FOR_S1_MME = "cpmme0";
MME_IP_ADDRESS_FOR_S1_MME = "192.168.30.17";
MME_IP_NETMASK_FOR_S1_MME = 24;
MME_INTERFACE_NAME_FOR_S11_MME = "s11mme";
MME_IP_ADDRESS_FOR_S11_MME = "192.168.33.117";
MME_IP_NETMASK_FOR_S11_MME = 24;
# -------- Local ---------
# Uncomment if the framework cannot resolv it.
Identity = "@MME_FQDN@";
Realm = "@REALM@";
# TLS configuration (see previous section)
TLS_Cred = "${FREEDIAMETER_PATH}/../etc/freeDiameter/mme.cert.pem",
"${FREEDIAMETER_PATH}/../etc/freeDiameter/mme.key.pem";
TLS_CA = "${FREEDIAMETER_PATH}/../etc/freeDiameter/mme.cacert.pem";
# Disable use of TCP protocol (only listen and connect in SCTP)
# Default : TCP enabled
@TRANSPORT_option@;
# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option.
# Prefer TCP instead of SCTP for establishing new connections.
# This setting may be overwritten per peer in peer configuration blocs.
# Default : SCTP is attempted first.
@TRANSPORT_PREFER_TCP_option@;
No_IPv6;
# Overwrite the number of SCTP streams. This value should be kept low,
# especially if you are using TLS over SCTP, because it consumes a lot of
# resources in that case. See tickets 19 and 27 for some additional details on
# this.
# Limit the number of SCTP streams
SCTP_streams = 3;
# By default, freeDiameter acts as a Diameter Relay Agent by forwarding all
# messages it cannot handle locally. This parameter disables this behavior.
NoRelay;
TLS_old_method;
AppServThreads = 1;
# Specify the addresses on which to bind the listening server. This must be
# specified if the framework is unable to auto-detect these addresses, or if the
# auto-detected values are incorrect. Note that the list of addresses is sent
# in CER or CEA message, so one should pay attention to this parameter if some
# adresses should be kept hidden.
@ListenOn@
@DIAMETER_PORT@;
@DIAMETER_SEC_PORT@;
# -------- Extensions ---------
# Uncomment (and create rtd.conf) to specify routing table for this peer.
#LoadExtension = "rt_default.fdx" : "rtd.conf";
# Uncomment (and create acl.conf) to allow incoming connections from other peers.
#LoadExtension = "acl_wl.fdx" : "acl.conf";
# Uncomment to display periodic state information
#LoadExtension = "dbg_monitor.fdx";
# Uncomment to enable an interactive Python interpreter session.
# (see doc/dbg_interactive.py.sample for more information)
#LoadExtension = "dbg_interactive.fdx";
# Load the RFC4005 dictionary objects
#LoadExtension = "dict_nasreq.fdx";
LoadExtension = "dict_nas_mipv6.fdx";
LoadExtension = "dict_s6a.fdx";
# Load RFC4072 dictionary objects
#LoadExtension = "dict_eap.fdx";
# Load the Diameter EAP server extension (requires diameap.conf)
#LoadExtension = "app_diameap.fdx" : "diameap.conf";
# Load the Accounting Server extension (requires app_acct.conf)
#LoadExtension = "app_acct.fdx" : "app_acct.conf";
# -------- Peers ---------
# The framework will actively attempt to establish and maintain a connection
# with the peers listed here.
# For only accepting incoming connections, see the acl_wl.fx extension.
# ConnectPeer
# Declare a remote peer to which this peer must maintain a connection.
# In addition, this allows specifying non-default parameters for this peer only
# (for example disable SCTP with this peer, or use RFC3588-flavour TLS).
# Note that by default, if a peer is not listed as a ConnectPeer entry, an
# incoming connection from this peer will be rejected. If you want to accept
# incoming connections from other peers, see the acl_wl.fdx? extension which
# allows exactly this.
@ConnectPeer@ = "@HSS_FQDN@" { ConnectTo = "@HSS_IP@"; No_IPv6; No_TLS ; port = 3868; Realm = "@REALM@"; };
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