Commit e9e6e77f authored by gauthier's avatar gauthier
Browse files

Updates, less bugs

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4850 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c2018916
......@@ -47,10 +47,12 @@
#define DEFAULT_ADDRESS_3GPP "0335060080149150"
#define DEFAULT_ADDRESS_eNB "0000000000000001"
#define USE_3GPP_ADDR_AS_LINK_ADDR 1
//-----------------------------------------------------------------------------
// Constants for scenario
#define PREDEFINED_MIH_PLMN_ID 503
#define PREDEFINED_MIH_NETWORK_ID "eurecom"
#define PREDEFINED_MIH_NETAUX_ID "netaux"
#define PREDEFINED_MIH_NETAUX_ID "netaux"
#define PREDEFINED_CHANNEL_ID 2
#define PREDEFINED_CLASSES_SERVICE_SUPPORTED 2
......
......@@ -62,16 +62,22 @@
public_mRAL_mih_msg( int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t *bufferP, size_t lenP);)
protected_mRAL_mih_msg( int mRAL_mihf_connect (ral_ue_instance_t instanceP);)
protected_mRAL_mih_msg( void MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_ue_instance_t instanceP, \
MIH_C_3GPP_ADDR_T* _3gpp_addrP, \
u_int8_t* strP);)
protected_mRAL_mih_msg( void mRAL_send_link_register_indication (\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP);)
protected_mRAL_mih_msg( void mRAL_send_link_detected_indication (\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_DET_INFO_T *link_detected_infoP);)
protected_mRAL_mih_msg( void mRAL_send_link_up_indication(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_TUPLE_ID_T *link_identifierP,\
MIH_C_LINK_ADDR_T *old_access_routerP,\
......@@ -80,59 +86,59 @@ protected_mRAL_mih_msg( void mRAL_send_link_up_indication(\
MIH_C_IP_MOB_MGMT_T *mobility_management_supportP);)
protected_mRAL_mih_msg( void mRAL_send_link_parameters_report_indication(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_TUPLE_ID_T *link_identifierP,\
MIH_C_LINK_PARAM_RPT_LIST_T *link_parameters_report_listP);)
protected_mRAL_mih_msg( void mRAL_send_link_going_down_indication(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_TUPLE_ID_T *link_identifierP,\
MIH_C_UNSIGNED_INT2_T *time_intervalP,\
MIH_C_LINK_GD_REASON_T *link_going_down_reasonP);)
protected_mRAL_mih_msg( void mRAL_send_link_down_indication(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_TUPLE_ID_T *link_identifierP,\
MIH_C_LINK_ADDR_T *old_access_routerP,\
MIH_C_LINK_DN_REASON_T *reason_codeP);)
protected_mRAL_mih_msg( void mRAL_send_link_action_confirm(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_SCAN_RSP_LIST_T *scan_response_setP,\
MIH_C_LINK_AC_RESULT_T *link_action_resultP);)
protected_mRAL_mih_msg( void mRAL_send_capability_discover_confirm(\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *supported_link_event_listP,\
MIH_C_LINK_CMD_LIST_T *supported_link_command_listP);)
protected_mRAL_mih_msg( void mRAL_send_event_subscribe_confirm (\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *response_link_event_listP);)
protected_mRAL_mih_msg( void mRAL_send_event_unsubscribe_confirm (\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *response_link_event_listP);)
protected_mRAL_mih_msg( void mRAL_send_configure_thresholds_confirm(\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_CFG_STATUS_LIST_T *link_configure_status_listP);)
protected_mRAL_mih_msg( void mRAL_send_get_parameters_confirm (\
ral_ue_instance_t instanceP,\
ral_ue_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_PARAM_LIST_T *link_parameters_status_listP,\
......@@ -142,5 +148,6 @@ protected_mRAL_mih_msg( void mRAL_send_get_parameters_confirm (\
private_mRAL_mih_msg( int mRAL_mih_link_msg_decode (\
ral_ue_instance_t instanceP,\
Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP);)
protected_mRAL_mih_msg( int mRAL_mih_link_process_message (ral_ue_instance_t instanceP);)
#endif
......@@ -58,6 +58,7 @@
#include "lteRALue.h"
#include "intertask_interface.h"
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_scan_confirm (instance_t instance, MessageDef *msg_p);)
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_system_information_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_establishment_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_reestablishment_indication (instance_t instance, MessageDef *msg_p);)
......
......@@ -38,6 +38,7 @@
#define LTERALUE_ACTION_C
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "LAYER2/MAC/extern.h"
//-----------------------------------------------------------------------------
void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_request_t* messageP) {
......@@ -47,20 +48,26 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
MIH_C_LINK_AC_RESULT_T link_action_result;
//unsigned int scan_index, meas_to_send;
MessageDef *message_p = NULL;
rrc_ral_scan_req_t scan_req;
rrc_ral_connection_release_req_t release_req;
rrc_ral_connection_establishment_req_t connection_establishment_req;
unsigned int mod_id = instanceP - NB_eNB_INST;
status = MIH_C_STATUS_SUCCESS;
link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS;
scan_response_set_list.length = 0;
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN) {
//----------------------------------------------------
// send a response to MIH-F or it will report an error.
//----------------------------------------------------
//link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS;
//mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
//----------------------------------------------------
// Transmit request to RRC.
//----------------------------------------------------
message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_SCAN_REQ);
memset(&scan_req, 0, sizeof(rrc_ral_scan_req_t));
// copy transaction id
scan_req.transaction_id = messageP->header.transaction_id;
memcpy (&message_p->ittiMsg, (void *) &scan_req, sizeof(rrc_ral_scan_req_t));
RRC_RAL_SCAN_REQ(message_p).transaction_id = messageP->header.transaction_id;
itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
}
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN) {
......@@ -88,7 +95,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_DISCONNECT:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DISCONNECT: NO ACTION\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DISCONNECT) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DISCONNECT) {
message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONNECTION_RELEASE_REQ);
memset(&release_req, 0, sizeof(rrc_ral_connection_release_req_t));
// copy transaction id
......@@ -103,7 +110,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_LOW_POWER:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_LOW_POWER\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_LOW_POWER) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_LOW_POWER) {
// TO DO
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
......@@ -113,13 +120,13 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN) {
if ( g_ue_ral_obj[instanceP].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN ) {
if (g_ue_ral_obj[instanceP].state == DISCONNECTED) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN) {
if ( g_ue_ral_obj[mod_id].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN ) {
if (g_ue_ral_obj[mod_id].state == DISCONNECTED) {
LOG_D(RAL_UE, "Deactivation requested, but interface already inactive ==> NO OP\n");
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
} else {
g_ue_ral_obj[instanceP].pending_req_action = g_ue_ral_obj[instanceP].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
g_ue_ral_obj[mod_id].pending_req_action = g_ue_ral_obj[mod_id].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
//Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, NULL, &link_action_result);
......@@ -130,11 +137,11 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
memcpy (&message_p->ittiMsg, (void *) &release_req, sizeof(rrc_ral_connection_release_req_t));
itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
LOG_D(RAL_UE, "Deactivation requested to NAS interface\n");
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[instanceP].cell_id);
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[mod_id].cell_id);
}
} else {
g_ue_ral_obj[instanceP].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
g_ue_ral_obj[mod_id].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
//Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, NULL, &link_action_result);
......@@ -145,7 +152,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
memcpy (&message_p->ittiMsg, (void *) &release_req, sizeof(rrc_ral_connection_release_req_t));
itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
LOG_D(RAL_UE, "Deactivation requested to NAS interface\n");
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[instanceP].cell_id);
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, g_ue_ral_obj[mod_id].cell_id);
}
} else {
LOG_D(RAL_UE, " command POWER DOWN not available \n\n");
......@@ -156,21 +163,21 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_POWER_UP:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_UP\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
// Activation requested - check it is not already active
if(g_ue_ral_obj[instanceP].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
if (g_ue_ral_obj[instanceP].state == CONNECTED) {
if(g_ue_ral_obj[mod_id].pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
if (g_ue_ral_obj[mod_id].state == CONNECTED) {
LOG_D(RAL_UE, "Activation requested, but interface already active ==> NO OP\n");
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
} else {
g_ue_ral_obj[instanceP].pending_req_action = g_ue_ral_obj[instanceP].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
g_ue_ral_obj[instanceP].cell_id = g_ue_ral_obj[instanceP].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
LOG_D(RAL_UE, "Activation requested to NAS interface on cell %d\n", g_ue_ral_obj[instanceP].cell_id);
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, g_ue_ral_obj[instanceP].cell_id);
g_ue_ral_obj[mod_id].pending_req_action = g_ue_ral_obj[mod_id].pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
g_ue_ral_obj[mod_id].cell_id = g_ue_ral_obj[mod_id].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
LOG_D(RAL_UE, "Activation requested to NAS interface on cell %d\n", g_ue_ral_obj[mod_id].cell_id);
//RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, g_ue_ral_obj[mod_id].cell_id);
}
} else {
g_ue_ral_obj[instanceP].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
g_ue_ral_obj[instanceP].cell_id = g_ue_ral_obj[instanceP].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
g_ue_ral_obj[mod_id].pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
g_ue_ral_obj[mod_id].cell_id = g_ue_ral_obj[mod_id].meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONNECTION_ESTABLISHMENT_REQ);
memset(&connection_establishment_req, 0, sizeof(rrc_ral_connection_establishment_req_t));
// copy transaction id
......@@ -187,7 +194,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
/* LG KEEP case MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR: NO ACTION\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
......@@ -196,7 +203,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
......@@ -205,7 +212,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
case MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__);
if (g_ue_ral_obj[instanceP].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES) {
if (g_ue_ral_obj[mod_id].mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
......
......@@ -46,10 +46,13 @@
#include <time.h>
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "LAYER2/MAC/extern.h"
#include "intertask_interface.h"
#include "OCG.h"
//-----------------------------------------------------------------------------
extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST;
extern OAI_Emulation oai_emulation;
......@@ -156,7 +159,11 @@ void mRAL_get_IPv6_addr(void) {
}
}
void mRAL_init_default_values(void) {
//---------------------------------------------------------------------------
void mRAL_init_default_values(void)
//---------------------------------------------------------------------------
{
g_conf_ue_ral_listening_port = UE_DEFAULT_LOCAL_PORT_RAL;
g_conf_ue_ral_ip_address = UE_DEFAULT_IP_ADDRESS_RAL;
g_conf_ue_ral_link_id = UE_DEFAULT_LINK_ID_RAL;
......@@ -170,6 +177,7 @@ void mRAL_init_default_values(void) {
int mRAL_initialize(void) {
//---------------------------------------------------------------------------
ral_ue_instance_t instance = 0;
unsigned int mod_id = 0;
char *char_tmp = NULL;
MIH_C_init();
......@@ -180,34 +188,36 @@ int mRAL_initialize(void) {
g_ue_ral_fd2instance = hashtable_create (32, NULL, hash_free_int_func);
for (instance = 0; instance < oai_emulation.info.nb_ue_local; instance++) {
char_tmp = calloc(1, strlen(g_conf_ue_ral_listening_port) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp,"%d", atoi(g_conf_ue_ral_listening_port) + instance);
g_ue_ral_obj[instance].ral_listening_port = char_tmp;
for (mod_id = 0; mod_id < oai_emulation.info.nb_ue_local; mod_id++) {
instance = mod_id + NB_eNB_INST;
char_tmp = calloc(1, strlen(g_conf_ue_ral_listening_port) + 3); // 2 digits + \0 ->99 mod_ids
sprintf(char_tmp,"%d", atoi(g_conf_ue_ral_listening_port) + mod_id);
g_ue_ral_obj[mod_id].ral_listening_port = char_tmp;
g_ue_ral_obj[instance].ral_ip_address = strdup(g_conf_ue_ral_ip_address);
g_ue_ral_obj[instance].ral_link_address = strdup(g_conf_ue_ral_link_address);
g_ue_ral_obj[mod_id].ral_ip_address = strdup(g_conf_ue_ral_ip_address);
g_ue_ral_obj[mod_id].ral_link_address = strdup(g_conf_ue_ral_link_address);
char_tmp = calloc(1, strlen(g_conf_ue_mihf_remote_port) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%d", atoi(g_conf_ue_mihf_remote_port) + instance);
g_ue_ral_obj[instance].mihf_remote_port = char_tmp;
char_tmp = calloc(1, strlen(g_conf_ue_mihf_remote_port) + 3); // 2 digits + \0 ->99 mod_ids
sprintf(char_tmp, "%d", atoi(g_conf_ue_mihf_remote_port) + mod_id);
g_ue_ral_obj[mod_id].mihf_remote_port = char_tmp;
g_ue_ral_obj[instance].mihf_ip_address = strdup(g_conf_ue_mihf_ip_address);
g_ue_ral_obj[mod_id].mihf_ip_address = strdup(g_conf_ue_mihf_ip_address);
char_tmp = calloc(1, strlen(g_conf_ue_mihf_id) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%s%02d",g_conf_ue_mihf_id, instance);
g_ue_ral_obj[instance].mihf_id = char_tmp;
char_tmp = calloc(1, strlen(g_conf_ue_mihf_id) + 3); // 2 digits + \0 ->99 mod_ids
sprintf(char_tmp, "%s%02d",g_conf_ue_mihf_id, mod_id);
g_ue_ral_obj[mod_id].mihf_id = char_tmp;
char_tmp = calloc(1, strlen(g_conf_ue_ral_link_id) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%s%02d",g_conf_ue_ral_link_id, instance);
g_ue_ral_obj[instance].link_id = char_tmp;
char_tmp = calloc(1, strlen(g_conf_ue_ral_link_id) + 3); // 2 digits + \0 ->99 mod_ids
sprintf(char_tmp, "%s%02d",g_conf_ue_ral_link_id, mod_id);
g_ue_ral_obj[mod_id].link_id = char_tmp;
char_tmp = NULL;
printf("g_ue_ral_obj[%d].link_id=%s\n", instance, g_ue_ral_obj[instance].link_id);
printf("g_ue_ral_obj[%d].link_id=%s\n", mod_id, g_ue_ral_obj[mod_id].link_id);
// excluded MIH_C_LINK_AC_TYPE_NONE
// excluded MIH_C_LINK_AC_TYPE_LINK_LOW_POWER
g_ue_ral_obj[instance].mih_supported_action_list = MIH_C_LINK_AC_TYPE_LINK_DISCONNECT |
g_ue_ral_obj[mod_id].mih_supported_action_list = MIH_C_LINK_AC_TYPE_LINK_DISCONNECT |
MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN |
MIH_C_LINK_AC_TYPE_LINK_POWER_UP |
MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR |
......@@ -216,7 +226,7 @@ int mRAL_initialize(void) {
g_ue_ral_obj[instance].mih_supported_link_event_list = MIH_C_BIT_LINK_DETECTED |
g_ue_ral_obj[mod_id].mih_supported_link_event_list = MIH_C_BIT_LINK_DETECTED |
MIH_C_BIT_LINK_UP |
MIH_C_BIT_LINK_DOWN |
MIH_C_BIT_LINK_PARAMETERS_REPORT |
......@@ -225,33 +235,33 @@ int mRAL_initialize(void) {
MIH_C_BIT_LINK_HANDOVER_COMPLETE |
MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS;
g_ue_ral_obj[instance].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE |
g_ue_ral_obj[mod_id].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE |
MIH_C_BIT_LINK_GET_PARAMETERS | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS |
MIH_C_BIT_LINK_ACTION;
g_ue_ral_obj[instance].link_to_be_detected = MIH_C_BOOLEAN_TRUE;
g_ue_ral_obj[mod_id].link_to_be_detected = MIH_C_BOOLEAN_TRUE;
g_ue_ral_obj[instance].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED;
g_ue_ral_obj[mod_id].link_mihcap_flag = MIH_C_BIT_EVENT_SERVICE_SUPPORTED | MIH_C_BIT_COMMAND_SERVICE_SUPPORTED | MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED;
g_ue_ral_obj[instance].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY;
g_ue_ral_obj[mod_id].net_caps = MIH_C_BIT_NET_CAPS_QOS_CLASS5 | MIH_C_BIT_NET_CAPS_INTERNET_ACCESS | MIH_C_BIT_NET_CAPS_MIH_CAPABILITY;
g_ue_ral_obj[instance].transaction_id = (MIH_C_TRANSACTION_ID_T)rand();
g_ue_ral_obj[mod_id].transaction_id = (MIH_C_TRANSACTION_ID_T)rand();
LOG_D(RAL_UE, " Connect to the MIH-F for instance %d...\n", instance);
g_ue_ral_obj[instance].mih_sock_desc = -1;
LOG_D(RAL_UE, " Connect to the MIH-F for module id instance %d...\n", mod_id, instance);
g_ue_ral_obj[mod_id].mih_sock_desc = -1;
if (mRAL_mihf_connect(instance) < 0 ) {
LOG_E(RAL_UE, " %s : Could not connect to MIH-F...\n", __FUNCTION__);
// TO DO RETRY LATER
//exit(-1);
} else {
itti_subscribe_event_fd(TASK_RAL_UE, g_ue_ral_obj[instance].mih_sock_desc);
hashtable_insert(g_ue_ral_fd2instance, g_ue_ral_obj[instance].mih_sock_desc, (void*)instance);
itti_subscribe_event_fd(TASK_RAL_UE, g_ue_ral_obj[mod_id].mih_sock_desc);
hashtable_insert(g_ue_ral_fd2instance, g_ue_ral_obj[mod_id].mih_sock_desc, (void*)instance);
}
mRAL_send_link_register_indication(instance, &g_ue_ral_obj[instance].transaction_id);
mRAL_send_link_register_indication(instance, &g_ue_ral_obj[mod_id].transaction_id);
}
return 0;
}
......@@ -259,7 +269,7 @@ int mRAL_initialize(void) {
void mRAL_process_file_descriptors(struct epoll_event *events, int nb_events)
{
int i;
ral_ue_instance_t instance;
ral_ue_instance_t instance;
hashtable_rc_t rc;
if (events == NULL) {
......@@ -286,6 +296,15 @@ void* mRAL_task(void *args_p) {
itti_mark_task_ready (TASK_RAL_UE);
// Set UE activation state
for (instance = NB_eNB_INST; instance < (NB_eNB_INST + NB_UE_INST); instance++)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RAL_UE, DEACTIVATE_MESSAGE);
itti_send_msg_to_task(TASK_L2L1, instance, message_p);
}
while(1) {
// Wait for a message
itti_receive_msg (TASK_RAL_UE, &msg_p);
......@@ -305,6 +324,11 @@ void* mRAL_task(void *args_p) {
LOG_D(RAL_UE, "Received %s\n", msg_name);
break;
case RRC_RAL_SCAN_CONF:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_scan_confirm(instance, msg_p);
break;
case RRC_RAL_SYSTEM_INFORMATION_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_system_information_indication(instance, msg_p);
......
......@@ -43,6 +43,7 @@
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "PHY/extern.h"
/*
//---------------------------------------------------------------------------
// Temp - Enter hard-coded measures in IAL
......
......@@ -20,8 +20,11 @@
#define LTE_RAL_UE
#define LTE_RAL_UE_RRC_MSG_C
#include "lteRALue.h"
#include "LAYER2/MAC/extern.h"
//---------------------------------------------------------------------------------------------------------------------
static int ueid2eui48(u8 *euiP, u8* ue_idP)
//---------------------------------------------------------------------------------------------------------------------
{
// inspired by linux-source-3.2.0/net/ipv6/addrconf.c
memcpy(euiP, ue_idP, 3);
......@@ -32,24 +35,70 @@ static int ueid2eui48(u8 *euiP, u8* ue_idP)
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_STATUS_T status;
MIH_C_LINK_SCAN_RSP_LIST_T scan_rsp_list;
MIH_C_LINK_AC_RESULT_T ac_result;
int i;
status = MIH_C_STATUS_SUCCESS;
ac_result = MIH_C_LINK_AC_RESULT_SUCCESS;
memset(&scan_rsp_list, 0, sizeof(MIH_C_LINK_SCAN_RSP_LIST_T));
for (i = 0 ; i < RRC_RAL_SCAN_CONF (msg_p).num_scan_resp; i++) {
// TO DO
memcpy(&scan_rsp_list.val[i].link_addr, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].link_addr, sizeof(MIH_C_LINK_ADDR_T));
// TO DO
memcpy(&scan_rsp_list.val[i].network_id, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].network_id, sizeof(MIH_C_NETWORK_ID_T));
scan_rsp_list.val[i].sig_strength.choice = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength.choice;
switch (scan_rsp_list.val[i].sig_strength.choice) {
case RAL_SIG_STRENGTH_CHOICE_DBM:
scan_rsp_list.val[i].sig_strength._union.dbm = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.dbm;
break;
case RAL_SIG_STRENGTH_CHOICE_PERCENTAGE:
scan_rsp_list.val[i].sig_strength._union.percentage = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.percentage;
break;
default:
LOG_E(RAL_UE, "INVALID RRC_RAL_SCAN_CONF field sig_strength.choice %d\n", scan_rsp_list.val[i].sig_strength.choice);
status = MIH_C_STATUS_UNSPECIFIED_FAILURE;
}
scan_rsp_list.length += 1;
}
mRAL_send_link_action_confirm(instanceP,
&RRC_RAL_SCAN_CONF (msg_p).transaction_id,
&status,
&scan_rsp_list,
&ac_result);
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_DET_INFO_T link_det_info;
int i;
MIH_C_LINK_DET_INFO_T link_det_info;
int i;
unsigned int mod_id = instanceP - NB_eNB_INST;
memset(&link_det_info, 0, sizeof(MIH_C_LINK_DET_INFO_T));
// save cell parameters
g_ue_ral_obj[mod_id].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id;
memcpy(&g_ue_ral_obj[mod_id].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, sizeof(g_ue_ral_obj[mod_id].plmn_id));
// link id
link_det_info.link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE;
#ifdef USE_3GPP_ADDR_AS_LINK_ADDR
link_det_info.link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
#else
link_det_info.link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
link_det_info.link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR;
// save cell parameters
g_ue_ral_obj[instanceP].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id;
memcpy(&g_ue_ral_obj[instanceP].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, sizeof(g_ue_ral_obj[instanceP].plmn_id));
// preserve byte order of plmn id
memcpy(link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, 3);
link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id;
......@@ -58,6 +107,9 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message
link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]);
LOG_D(RAL_UE, "CELL ID %d\n", link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id);
#endif
//The optional LINK_ADDR may contains a link address of PoA.
link_det_info.link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
MIH_C_NETWORK_ID_set(&link_det_info.network_id, (u_int8_t *)PREDEFINED_MIH_NETWORK_ID, strlen(PREDEFINED_MIH_NETWORK_ID));
......@@ -70,13 +122,13 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message
link_det_info.link_data_rate = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).link_data_rate;
link_det_info.link_mihcap_flag = g_ue_ral_obj[instanceP].link_mihcap_flag;
link_det_info.link_mihcap_flag = g_ue_ral_obj[mod_id].link_mihcap_flag;
link_det_info.net_caps = g_ue_ral_obj[instanceP].net_caps;
link_det_info.net_caps = g_ue_ral_obj[mod_id].net_caps;
mRAL_send_link_detected_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, &link_det_info);
mRAL_send_link_detected_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id, &link_det_info);
g_ue_ral_obj[instanceP].transaction_id ++;
g_ue_ral_obj[mod_id].transaction_id ++;
}
//---------------------------------------------------------------------------------------------------------------------
......@@ -84,52 +136,34 @@ void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_TUPLE_ID_T link_tuple_id;
uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH];