Commit 61f7b836 authored by Lionel Gauthier's avatar Lionel Gauthier

Updated for integration as tasks in oaisim executable.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4596 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent e90b9e1f
......@@ -2,12 +2,10 @@
#define MIH_C_C
#include "MIH_C.h"
//-----------------------------------------------------------------------------
void MIH_C_init(int log_outputP) {
void MIH_C_init(void) {
//-----------------------------------------------------------------------------
MIH_C_log_init(log_outputP);
}
//-----------------------------------------------------------------------------
void MIH_C_exit(void) {
//-----------------------------------------------------------------------------
MIH_C_log_exit();
}
......@@ -9,12 +9,12 @@ unsigned int MIH_C_BITMAP82String(MIH_C_BITMAP8_T* dataP, char* bufP) {
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP) {
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);
printf("[MIH_C] %s: %02X\n", __FUNCTION__, *dataP);
BitBuffer_write8(bbP, *dataP);
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP) {
DEBUG_ENCODE("%s: %04X\n", __FUNCTION__, *dataP);
printf("[MIH_C] %s: %04X\n", __FUNCTION__, *dataP);
BitBuffer_write16(bbP, *dataP);
}
//-----------------------------------------------------------------------------
......@@ -25,7 +25,7 @@ unsigned int MIH_C_BITMAP162String(MIH_C_BITMAP16_T* dataP, char* bufP) {
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP) {
//-----------------------------------------------------------------------------
DEBUG_ENCODE("%s: %02X%02X%02X\n", __FUNCTION__, dataP->val[0],dataP->val[1], dataP->val[2]);
printf("[MIH_C] %s: %02X%02X%02X\n", __FUNCTION__, dataP->val[0],dataP->val[1], dataP->val[2]);
MIH_C_BITMAP8_encode(bbP, &dataP->val[0]);
MIH_C_BITMAP8_encode(bbP, &dataP->val[1]);
MIH_C_BITMAP8_encode(bbP, &dataP->val[2]);
......@@ -37,27 +37,27 @@ unsigned int MIH_C_BITMAP242String(MIH_C_BITMAP24_T* dataP, char* bufP) {
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP) {
DEBUG_ENCODE("%s: %08X\n", __FUNCTION__, *dataP);
printf("[MIH_C] %s: %08X\n", __FUNCTION__, *dataP);
BitBuffer_write32(bbP, *dataP);
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP) {
//-----------------------------------------------------------------------------
DEBUG_ENCODE("%s: %16X\n", __FUNCTION__, *dataP);
printf("[MIH_C] %s: %16X\n", __FUNCTION__, *dataP);
BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));
BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)*dataP);
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP) {
//-----------------------------------------------------------------------------
DEBUG_ENCODE("%s: %16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1]);
printf("[MIH_C] %s: %16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1]);
MIH_C_BITMAP64_encode(bbP, &dataP->val[0]);
MIH_C_BITMAP64_encode(bbP, &dataP->val[1]);
}
//-----------------------------------------------------------------------------
inline void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP) {
//-----------------------------------------------------------------------------
DEBUG_ENCODE("%s: %16X%16X%16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1], dataP->val[2], dataP->val[3]);
printf("[MIH_C] %s: %16X%16X%16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1], dataP->val[2], dataP->val[3]);
MIH_C_BITMAP64_encode(bbP, &dataP->val[0]);
MIH_C_BITMAP64_encode(bbP, &dataP->val[1]);
MIH_C_BITMAP64_encode(bbP, &dataP->val[2]);
......@@ -98,7 +98,7 @@ inline void MIH_C_OCTET_encode(Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *data
}
//-----------------------------------------------------------------------------
inline void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP) {
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);
printf("[MIH_C] %s: %02X\n", __FUNCTION__, *dataP);
BitBuffer_write8(bbP, *dataP);
}
//-----------------------------------------------------------------------------
......@@ -216,7 +216,7 @@ inline void MIH_C_LIST_LENGTH_encode(Bit_Buffer_t* bbP, u_int16_t lengthP) {
int length;
if (lengthP <= 128) {
#ifdef DEBUG_TRACE_DETAILS
DEBUG_ENCODE("%s: Length %02X\n", __FUNCTION__, lengthP);
printf("[MIH_C] %s: Length %02X\n", __FUNCTION__, lengthP);
#endif
BitBuffer_write8(bbP, (MIH_C_UNSIGNED_INT1_T)lengthP);
} else {
......@@ -224,7 +224,7 @@ inline void MIH_C_LIST_LENGTH_encode(Bit_Buffer_t* bbP, u_int16_t lengthP) {
if (((lengthP - 128) % 255) != 0) {
num_more_bytes += 1;
}
DEBUG_ENCODE("%s: Length %02X on %d more bytes\n", __FUNCTION__, lengthP, num_more_bytes);
printf("[MIH_C] %s: Length %02X on %d more bytes\n", __FUNCTION__, lengthP, num_more_bytes);
BitBuffer_write8(bbP, (MIH_C_UNSIGNED_INT1_T)(128 + num_more_bytes));
length = lengthP - 128;
while (length > 0) {
......@@ -249,7 +249,7 @@ inline u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP) {
if (((lengthP - 128) % 255) != 0) {
num_more_bytes += 1;
}
DEBUG_ENCODE("%s: Length %02X on %d more bytes\n", __FUNCTION__, lengthP, num_more_bytes);
printf("[MIH_C] %s: Length %02X on %d more bytes\n", __FUNCTION__, lengthP, num_more_bytes);
return num_more_bytes + sizeof (MIH_C_UNSIGNED_INT1_T);
}
}
......@@ -268,12 +268,12 @@ inline void MIH_C_LIST_LENGTH_decode(Bit_Buffer_t* bbP, u_int16_t *lengthP) {
num_more_bytes = num_more_bytes - 1;
}
#ifdef DEBUG_TRACE_DETAILS
DEBUG_DECODE("%s: Length %d \n", __FUNCTION__, *lengthP);
printf("[MIH_C] %s: Length %d \n", __FUNCTION__, *lengthP);
#endif
} else {
*lengthP = byte1;
#ifdef DEBUG_TRACE_DETAILS
DEBUG_DECODE("%s: Length %d \n", __FUNCTION__, *lengthP);
printf("[MIH_C] %s: Length %d \n", __FUNCTION__, *lengthP);
#endif
}
}
......
......@@ -106,7 +106,7 @@ inline void MIH_C_LINK_ADDR_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP)
MIH_C_OTHER_L2_ADDR_encode(bbP, &dataP->_union.other_l2_addr);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -133,7 +133,7 @@ inline void MIH_C_LINK_ADDR_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP)
MIH_C_OTHER_L2_ADDR_decode(bbP, &dataP->_union.other_l2_addr);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ADDR_T %d\n", dataP->choice);
}
}
......
......@@ -38,7 +38,7 @@ inline void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T
MIH_C_BATT_LEVEL_encode(bbP, &dataP->_union.batt_level);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_DEV_STATE_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_DEV_STATE_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -53,7 +53,7 @@ inline void MIH_C_DEV_STATE_RSP_decode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T
MIH_C_BATT_LEVEL_decode(bbP, &dataP->_union.batt_level);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_DEV_STATE_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_DEV_STATE_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -218,7 +218,7 @@ inline void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RE
MIH_C_LINK_ADDR_encode(bbP, &dataP->_union.link_addr);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ACTION_REQ_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ACTION_REQ_T %d\n", dataP->choice);
}
MIH_C_LINK_ACTION_encode(bbP, &dataP->link_action);
MIH_C_LINK_AC_EX_TIME_encode(bbP, &dataP->link_action_ex_time);
......@@ -235,7 +235,7 @@ inline void MIH_C_LINK_ACTION_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RE
MIH_C_LINK_ADDR_decode(bbP, &dataP->_union.link_addr);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ACTION_REQ_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ACTION_REQ_T %d\n", dataP->choice);
}
MIH_C_LINK_ACTION_decode(bbP, &dataP->link_action);
MIH_C_LINK_AC_EX_TIME_decode(bbP, &dataP->link_action_ex_time);
......@@ -268,7 +268,7 @@ inline void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *d
MIH_C_PERCENTAGE_encode(bbP, &dataP->_union.percentage);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_SIG_STRENGTH_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_SIG_STRENGTH_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -283,7 +283,7 @@ inline void MIH_C_SIG_STRENGTH_decode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *d
MIH_C_PERCENTAGE_decode(bbP, &dataP->_union.percentage);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_SIG_STRENGTH_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_SIG_STRENGTH_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -327,7 +327,7 @@ inline void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RS
MIH_C_LINK_SCAN_RSP_LIST_encode(bbP, &dataP->_union.link_scan_rsp_list);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ACTION_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_ACTION_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -343,7 +343,7 @@ inline void MIH_C_LINK_ACTION_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RS
MIH_C_LINK_SCAN_RSP_LIST_decode(bbP, &dataP->_union.link_scan_rsp_list);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ACTION_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_ACTION_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -413,7 +413,7 @@ inline void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYP
case 11: MIH_C_LINK_PARAM_802_22_encode(bbP, &dataP->_union.link_param_802_22); break;
case 12: MIH_C_LINK_PARAM_LTE_encode(bbP, &dataP->_union.link_param_lte); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_TYPE_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_TYPE_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -437,7 +437,7 @@ inline void MIH_C_LINK_PARAM_TYPE_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYP
case 11: MIH_C_LINK_PARAM_802_22_decode(bbP, &dataP->_union.link_param_802_22); break;
case 12: MIH_C_LINK_PARAM_LTE_decode(bbP, &dataP->_union.link_param_802_22); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_TYPE_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_TYPE_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -483,7 +483,7 @@ inline void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_
MIH_C_LINK_SCAN_RSP_LIST_encode(bbP, &dataP->_union.link_scan_rsp_list);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_CFG_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_CFG_PARAM_T %d\n", dataP->choice);
}
MIH_C_TH_ACTION_encode(bbP, &dataP->th_action);
MIH_C_THRESHOLD_LIST_encode(bbP, &dataP->threshold_list);
......@@ -503,7 +503,7 @@ inline void MIH_C_LINK_CFG_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_
MIH_C_LINK_SCAN_RSP_LIST_decode(bbP, &dataP->_union.link_scan_rsp_list);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_CFG_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_CFG_PARAM_T %d\n", dataP->choice);
}
MIH_C_TH_ACTION_decode(bbP, &dataP->th_action);
MIH_C_THRESHOLD_LIST_decode(bbP, &dataP->threshold_list);
......@@ -566,7 +566,7 @@ inline void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T
MIH_C_NUM_QUEUE_encode(bbP, &dataP->_union.num_queue);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_DESC_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_DESC_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -581,7 +581,7 @@ inline void MIH_C_LINK_DESC_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T
MIH_C_NUM_QUEUE_decode(bbP, &dataP->_union.num_queue);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_DESC_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_DESC_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -613,7 +613,7 @@ inline void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP
case 0: MIH_C_LINK_PARAM_VAL_encode(bbP, &dataP->_union.link_param_val); break;
case 1: MIH_C_QOS_PARAM_VAL_encode(bbP, &dataP->_union.qos_param_val); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -625,7 +625,7 @@ inline void MIH_C_LINK_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP
case 0: MIH_C_LINK_PARAM_VAL_decode(bbP, &dataP->_union.link_param_val); break;
case 1: MIH_C_QOS_PARAM_VAL_decode(bbP, &dataP->_union.qos_param_val); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -656,7 +656,7 @@ inline void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_
case 0: break;
case 1: MIH_C_THRESHOLD_encode(bbP, &dataP->_union.threshold); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_RPT_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_PARAM_RPT_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -668,7 +668,7 @@ inline void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_
case 0: break;
case 1: MIH_C_THRESHOLD_decode(bbP, &dataP->_union.threshold); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_RPT_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_PARAM_RPT_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -709,7 +709,7 @@ inline void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RS
case 0: MIH_C_OPMODE_encode(bbP, &dataP->_union.op_mode); break;
case 1: MIH_C_CHANNEL_ID_encode(bbP, &dataP->_union.channel_id); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_STATES_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_STATES_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -720,7 +720,7 @@ inline void MIH_C_LINK_STATES_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RS
case 0: MIH_C_OPMODE_decode(bbP, &dataP->_union.op_mode); break;
case 1: MIH_C_CHANNEL_ID_decode(bbP, &dataP->_union.channel_id); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_STATES_RSP_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_STATES_RSP_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -776,7 +776,7 @@ inline void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T
case 0: break;
case 1: MIH_C_LINK_ADDR_encode(bbP, &dataP->_union.link_addr); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_TUPLE_ID_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_TUPLE_ID_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -788,7 +788,7 @@ inline void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T
case 0: break;
case 1: MIH_C_LINK_ADDR_decode(bbP, &dataP->_union.link_addr); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_TUPLE_ID_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_TUPLE_ID_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......
......@@ -159,7 +159,7 @@ inline void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T
case 4: MIH_C_PK_DELAY_JITTER_LIST_encode(bbP, &dataP->_union.pk_delay_jitter_list); break;
case 5: MIH_C_PK_LOSS_RATE_LIST_encode(bbP, &dataP->_union.pk_loss_rate_list); break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_QOS_PARAM_VAL_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_QOS_PARAM_VAL_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -174,7 +174,7 @@ inline void MIH_C_QOS_PARAM_VAL_decode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T
case 4: MIH_C_PK_DELAY_JITTER_LIST_decode(bbP, &dataP->_union.pk_delay_jitter_list); break;
case 5: MIH_C_PK_LOSS_RATE_LIST_decode(bbP, &dataP->_union.pk_loss_rate_list); break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_QOS_PARAM_VAL_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_QOS_PARAM_VAL_T %d\n", dataP->choice);
}
}
......
......@@ -99,7 +99,7 @@ inline void MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
MIH_C_BITMAP24_encode(bbP, &dataP->_union.flow_label_mask);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_MARK_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_MARK_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -114,7 +114,7 @@ inline void MIH_C_MARK_decode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
MIH_C_BITMAP24_decode(bbP, &dataP->_union.flow_label_mask);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_MARK_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_MARK_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -160,7 +160,7 @@ inline void MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
MIH_C_COS_encode(bbP, &dataP->_union.cos);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_QOS_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_QOS_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -178,7 +178,7 @@ inline void MIH_C_QOS_decode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
MIH_C_COS_decode(bbP, &dataP->_union.cos);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_QOS_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_QOS_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -250,7 +250,7 @@ inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_LINK_DATA_RATE_encode(bbP, &dataP->_union_link_data_rate.link_data_rate);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_link_data_rate OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_link_data_rate);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_link_data_rate OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_link_data_rate);
}
MIH_C_CHOICE_encode(bbP, &dataP->choice_qos);
switch (dataP->choice_qos) {
......@@ -260,7 +260,7 @@ inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_QOS_encode(bbP, &dataP->_union_qos.qos);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_qos OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_qos);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_qos OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_qos);
}
MIH_C_CHOICE_encode(bbP, &dataP->choice_jumbo_enable);
switch (dataP->choice_jumbo_enable) {
......@@ -270,7 +270,7 @@ inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_JUMBO_ENABLE_encode(bbP, &dataP->_union_jumbo_enable.jumbo_enable);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_jumbo_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_jumbo_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_jumbo_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_jumbo_enable);
}
MIH_C_CHOICE_encode(bbP, &dataP->choice_multicast_enable);
switch (dataP->choice_multicast_enable) {
......@@ -280,7 +280,7 @@ inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_MULTICAST_ENABLE_encode(bbP, &dataP->_union_multicast_enable.multicast_enable);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_multicast_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_multicast_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_multicast_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_multicast_enable);
}
}
//-----------------------------------------------------------------------------
......@@ -297,7 +297,7 @@ inline void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_LINK_DATA_RATE_decode(bbP, &dataP->_union_link_data_rate.link_data_rate);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_link_data_rate OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_link_data_rate);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_link_data_rate OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_link_data_rate);
}
MIH_C_CHOICE_decode(bbP, &dataP->choice_qos);
switch (dataP->choice_qos) {
......@@ -307,7 +307,7 @@ inline void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_QOS_decode(bbP, &dataP->_union_qos.qos);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_qos OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_qos);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_qos OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_qos);
}
MIH_C_CHOICE_decode(bbP, &dataP->choice_jumbo_enable);
switch (dataP->choice_jumbo_enable) {
......@@ -317,7 +317,7 @@ inline void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_JUMBO_ENABLE_decode(bbP, &dataP->_union_jumbo_enable.jumbo_enable);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_jumbo_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_jumbo_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_jumbo_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_jumbo_enable);
}
MIH_C_CHOICE_decode(bbP, &dataP->choice_multicast_enable);
switch (dataP->choice_multicast_enable) {
......@@ -327,7 +327,7 @@ inline void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
MIH_C_MULTICAST_ENABLE_decode(bbP, &dataP->_union_multicast_enable.multicast_enable);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_multicast_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_multicast_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_multicast_enable OF MIH_C_RESOURCE_DESC_T %d\n", dataP->choice_multicast_enable);
}
}
//-----------------------------------------------------------------------------
......@@ -386,7 +386,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_MULTICAST_ENABLE_encode(bbP, &dataP->_union_multicast_enable.multicast_enable);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_multicast_enable OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_multicast_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_multicast_enable OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_multicast_enable);
}
MIH_C_CHOICE_encode(bbP, &dataP->choice_mark_qos);
switch (dataP->choice_mark_qos) {
......@@ -397,7 +397,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_QOS_encode(bbP, &dataP->_union_mark_qos.mark_qos.qos);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_mark_qos OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_qos);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_mark_qos OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_qos);
}
MIH_C_CHOICE_encode(bbP, &dataP->choice_mark_drop_eligibility);
switch (dataP->choice_mark_drop_eligibility) {
......@@ -408,7 +408,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_DROP_ELIGIBILITY_encode(bbP, &dataP->_union_mark_drop_eligibility.mark_drop_eligibility.drop_eligibility);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE choice_mark_drop_eligibility OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_drop_eligibility);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE choice_mark_drop_eligibility OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_drop_eligibility);
}
}
//-----------------------------------------------------------------------------
......@@ -424,7 +424,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_MULTICAST_ENABLE_decode(bbP, &dataP->_union_multicast_enable.multicast_enable);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_multicast_enable OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_multicast_enable);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_multicast_enable OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_multicast_enable);
}
MIH_C_CHOICE_decode(bbP, &dataP->choice_mark_qos);
switch (dataP->choice_mark_qos) {
......@@ -435,7 +435,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_QOS_decode(bbP, &dataP->_union_mark_qos.mark_qos.qos);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_mark_qos OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_qos);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_mark_qos OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_qos);
}
MIH_C_CHOICE_decode(bbP, &dataP->choice_mark_drop_eligibility);
switch (dataP->choice_mark_drop_eligibility) {
......@@ -446,7 +446,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
MIH_C_DROP_ELIGIBILITY_decode(bbP, &dataP->_union_mark_drop_eligibility.mark_drop_eligibility.drop_eligibility);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE choice_mark_drop_eligibility OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_drop_eligibility);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE choice_mark_drop_eligibility OF MIH_C_FLOW_ATTRIBUTE_T %d\n", dataP->choice_mark_drop_eligibility);
}
}
//-----------------------------------------------------------------------------
......@@ -484,7 +484,7 @@ inline void MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T
MIH_C_RESOURCE_DESC_encode(bbP, &dataP->_union.resource_desc);
break;
default:
ERR("NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_AC_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR ENCODING CHOICE OF MIH_C_LINK_AC_PARAM_T %d\n", dataP->choice);
}
}
//-----------------------------------------------------------------------------
......@@ -501,7 +501,7 @@ inline void MIH_C_LINK_AC_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T
MIH_C_RESOURCE_DESC_decode(bbP, &dataP->_union.resource_desc);
break;
default:
ERR("NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_AC_PARAM_T %d\n", dataP->choice);
printf("[MIH_C] ERROR NO KNOWN VALUE FOR DECODING CHOICE OF MIH_C_LINK_AC_PARAM_T %d\n", dataP->choice);
}
}
......
......@@ -7,7 +7,6 @@
#include <arpa/inet.h>
//-----------------------------------------------------------------------------
#include "MIH_C_bit_buffer.h"
#include "MIH_C_log.h"
//-----------------------------------------------------------------------------
Bit_Buffer_t* new_BitBuffer_0(void)
//-----------------------------------------------------------------------------
......@@ -115,7 +114,7 @@ u_int32_t BitBuffer_read(Bit_Buffer_t* bbP, const unsigned int nb_bitsP)
//cout << dec << "BitBuffer_read(" << nb_bitsP << ")"<< endl;
if (BitBuffer_isCheckReadOverflowOK(bbP, nb_bitsP)) {
if (nb_bitsP > (sizeof(unsigned long)*8)) {
ERR("BitBuffer_read nb bits too large - must be <= sizeof(long int)*8");
printf("[MIH_C] ERROR BitBuffer_read nb bits too large - must be <= sizeof(long int)*8");
} else {
do {
data_l = data_l << 8;
......@@ -254,7 +253,7 @@ void BitBuffer_write8b(Bit_Buffer_t* bbP, u_int8_t valueP, unsigned int nb_bitsP
valueP = valueP & ((u_int8_t)(0xFF) >> (8 - nb_bitsP));
//std::cout << "BitBuffer_write char " << (u_int32_t)(valueP) << " " << nb_bitsP << " bits" << std::endl;
if (nb_bitsP > (sizeof(unsigned char)*8)) {
ERR("BitBuffer_write nb bits too large - must be <= sizeof(char)*8");
printf("[MIH_C] ERROR BitBuffer_write nb bits too large - must be <= sizeof(char)*8");
} else {
if (bbP->m_bit_mod_8_position == 0) {
if (nb_bitsP == (sizeof(unsigned char)*8)) {
......@@ -288,7 +287,7 @@ void BitBuffer_write16b(Bit_Buffer_t* bbP, u_int16_t valueP, unsigned int nb_bit
if (BitBuffer_isCheckWriteOverflowOK(bbP,nb_bitsP)) {
valueP = valueP & ((u_int16_t)(0xFFFF) >> (16 - nb_bitsP));
if (nb_bitsP > (sizeof (u_int16_t)*8)) {
ERR("BitBuffer_write nb bits too large - must be <= sizeof (short)*8");
printf("[MIH_C] ERROR BitBuffer_write nb bits too large - must be <= sizeof (short)*8");
} else {
if (nb_bitsP > 8) {
//BitBuffer_write8b(bbP,(u_int8_t)(valueP >> (8 - (16-nb_bitsP))), nb_bitsP - 8);
......@@ -308,7 +307,7 @@ void BitBuffer_writelittleendian16b(Bit_Buffer_t* bbP, u_int16_t valueP, unsigne
if (BitBuffer_isCheckWriteOverflowOK(bbP,nb_bitsP)) {
valueP = valueP & ((u_int16_t)(0xFFFF) >> (16 - nb_bitsP));
if (nb_bitsP > (sizeof (u_int16_t)*8)) {
ERR("BitBuffer_write nb bits too large - must be <= sizeof (short)*8");
printf("[MIH_C] ERROR BitBuffer_write nb bits too large - must be <= sizeof (short)*8");
} else {
if (nb_bitsP > 8) {
BitBuffer_write8(bbP,(u_int8_t)(valueP));
......@@ -328,7 +327,7 @@ void BitBuffer_write32b(Bit_Buffer_t* bbP, u_int32_t valueP, unsigned int nb_bit
if (BitBuffer_isCheckWriteOverflowOK(bbP,nb_bitsP)) {
valueP = valueP & ((u_int32_t)(0xFFFFFFFF) >> (32 - nb_bitsP));
if (nb_bitsP > (sizeof (u_int32_t)*8)) {
ERR("BitBuffer_write nb bits too large - must be <= sizeof (int)*8");
printf("[MIH_C] ERROR BitBuffer_write nb bits too large - must be <= sizeof (int)*8");
} else {
if (nb_bitsP > 24) {
//BitBuffer_write8b(bbP,(u_int8_t)(valueP >> (24 - (32-nb_bitsP))), nb_bitsP - 24);
......@@ -359,7 +358,7 @@ void BitBuffer_writelittleendian32b(Bit_Buffer_t* bbP, u_int32_t valueP, unsigne
if (BitBuffer_isCheckWriteOverflowOK(bbP,nb_bitsP)) {
valueP = valueP & ((u_int32_t)(0xFFFFFFFF) >> (32 - nb_bitsP));
if (nb_bitsP > (sizeof (u_int32_t)*8)) {
ERR("BitBuffer_write nb bits too large - must be <= sizeof (int)*8");
printf("[MIH_C] ERROR BitBuffer_write nb bits too large - must be <= sizeof (int)*8");
} else {
if (nb_bitsP > 24) {
BitBuffer_write8(bbP,(u_int8_t)(valueP));
......
......@@ -50,7 +50,7 @@ int MIH_C_Link_Header_Encode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP) {
BitBuffer_write8b (bbP, reserved, 4);
BitBuffer_write16b (bbP, headerP->transaction_id, 12);
BitBuffer_write16 (bbP, headerP->payload_length);
DEBUG_ENCODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
/*DEBUG_ENCODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
DEBUG_ENCODE("%s: ack_req 0x%02X\n", __FUNCTION__, headerP->ack_req);
DEBUG_ENCODE("%s: ack_rsp 0x%02X\n", __FUNCTION__, headerP->ack_rsp);
DEBUG_ENCODE("%s: uir 0x%02X\n", __FUNCTION__, headerP->uir);
......@@ -61,7 +61,7 @@ int MIH_C_Link_Header_Encode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP) {
DEBUG_ENCODE("%s: action_identifier 0x%04X\n", __FUNCTION__, headerP->action_identifier);
DEBUG_ENCODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_ENCODE("%s: transaction_id 0x%04X\n", __FUNCTION__, headerP->transaction_id);
DEBUG_ENCODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);
DEBUG_ENCODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);*/
// may be check for validity of header field -> set MIH_HEADER_DECODE_FAILURE
if (BitBuffer_isCheckWriteOverflowOK(bbP, 0) == BIT_BUFFER_FALSE) {
......@@ -99,7 +99,7 @@ int MIH_C_Link_Header_Decode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP) {
headerP->transaction_id = (MIH_C_TRANSACTION_ID_T) BitBuffer_read(bbP, 12);
headerP->payload_length = (MIH_C_VARIABLE_PAYLOAD_LENGTH_T)BitBuffer_read16(bbP);
DEBUG_DECODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
/*DEBUG_DECODE("%s: version 0x%02X\n", __FUNCTION__, headerP->version);
DEBUG_DECODE("%s: ack_req 0x%02X\n", __FUNCTION__, headerP->ack_req);
DEBUG_DECODE("%s: ack_rsp 0x%02X\n", __FUNCTION__, headerP->ack_rsp);
DEBUG_DECODE("%s: uir 0x%02X\n", __FUNCTION__, headerP->uir);
......@@ -110,7 +110,7 @@ int MIH_C_Link_Header_Decode(Bit_Buffer_t* bbP, MIH_C_HEADER_T* headerP) {
DEBUG_DECODE("%s: action_identifier 0x%04X\n", __FUNCTION__, headerP->action_identifier);
DEBUG_DECODE("%s: reserved 0x%02X\n", __FUNCTION__, reserved);
DEBUG_DECODE("%s: transaction_id 0x%04X\n", __FUNCTION__, headerP->transaction_id);
DEBUG_DECODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);
DEBUG_DECODE("%s: payload_length 0x%02X\n", __FUNCTION__, headerP->payload_length);*/
// may be check for validity of header field -> set MIH_HEADER_DECODE_FAILURE
if (BitBuffer_isCheckReadOverflowOK(bbP, 0) == BIT_BUFFER_FALSE) {
......
......@@ -5,6 +5,7 @@
***************************************************************************/
#define MIH_C_INTERFACE
#define MIH_C_LOG_C
/*
//-----------------------------------------------------------------------------
#include "MIH_C_log.h"
//-----------------------------------------------------------------------------
......@@ -35,7 +36,7 @@ int is_newline( char *str, int size){
if ( str[i] == '\n' )
return 1;
}
/* if we get all the way to here, there must not have been a newline! */
// if we get all the way to here, there must not have been a newline!
return 0;
}
......@@ -161,5 +162,5 @@ int MIH_C_log_exit(void) {
}
return 0;
}
*/
......@@ -23,7 +23,7 @@ int MIH_C_Link_Message_Decode_Link_Capability_Discover_request(Bit_Buffer_t* bbP
if (tlv == MIH_C_TLV_SOURCE_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->source);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
......@@ -33,25 +33,25 @@ int MIH_C_Link_Message_Decode_Link_Capability_Discover_request(Bit_Buffer_t* bbP
if (tlv == MIH_C_TLV_DESTINATION_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->destination);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
status = MIH_C_Link_Primitive_Decode_Link_Capability_Discover_request(bbP, &messageP->primitive);
if (status == MIH_PRIMITIVE_DECODE_OK) {
DEBUG(" %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
printf("[MIH_C] %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_OK;
}
if (status == MIH_PRIMITIVE_DECODE_TOO_SHORT) {
ERR(" %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_TOO_SHORT;
}
if (status == MIH_PRIMITIVE_DECODE_FAILURE) {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
if (status == MIH_PRIMITIVE_DECODE_BAD_PARAMETER) {
ERR(" %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_BAD_PARAMETER;
}
return status;
......@@ -87,7 +87,7 @@ int MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(Bit_Buffer_t* bbP, MI
if (tlv == MIH_C_TLV_SOURCE_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->source);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
......@@ -97,25 +97,25 @@ int MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(Bit_Buffer_t* bbP, MI
if (tlv == MIH_C_TLV_DESTINATION_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->destination);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
status = MIH_C_Link_Primitive_Decode_Link_Event_Subscribe_request(bbP, &messageP->primitive);
if (status == MIH_PRIMITIVE_DECODE_OK) {
DEBUG(" %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
printf("[MIH_C] %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_OK;
}
if (status == MIH_PRIMITIVE_DECODE_TOO_SHORT) {
ERR(" %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_TOO_SHORT;
}
if (status == MIH_PRIMITIVE_DECODE_FAILURE) {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
if (status == MIH_PRIMITIVE_DECODE_BAD_PARAMETER) {
ERR(" %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_BAD_PARAMETER;
}
return status;
......@@ -151,7 +151,7 @@ int MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(Bit_Buffer_t* bbP,
if (tlv == MIH_C_TLV_SOURCE_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->source);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_SOURCE_MIHF_ID\n", __FUNCTION__);
return MIH_PRIMITIVE_DECODE_FAILURE;
}
......@@ -161,25 +161,25 @@ int MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(Bit_Buffer_t* bbP,
if (tlv == MIH_C_TLV_DESTINATION_MIHF_ID) {
MIH_C_MIHF_ID_decode(bbP, &messageP->destination);
} else {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE @ MIH_C_TLV_DESTINATION_MIHF_ID\n", __FUNCTION__);
return MIH_PRIMITIVE_DECODE_FAILURE;
}
status = MIH_C_Link_Primitive_Decode_Link_Event_Unsubscribe_request(bbP, &messageP->primitive);
if (status == MIH_PRIMITIVE_DECODE_OK) {
DEBUG(" %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
printf("[MIH_C] %s() -> MIH_MESSAGE_DECODE_OK \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_OK;
}
if (status == MIH_PRIMITIVE_DECODE_TOO_SHORT) {
ERR(" %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_TOO_SHORT \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_TOO_SHORT;
}
if (status == MIH_PRIMITIVE_DECODE_FAILURE) {
ERR(" %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_FAILURE \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_FAILURE;
}
if (status == MIH_PRIMITIVE_DECODE_BAD_PARAMETER) {
ERR(" %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
printf("[MIH_C] ERROR %s() -> MIH_MESSAGE_DECODE_BAD_PARAMETER \n", __FUNCTION__);
return MIH_MESSAGE_DECODE_BAD_PARAMETER;
}
return status;
......
......@@ -25,14 +25,14 @@ int MIH_C_Link_Primitive_Decode_Link_Event_Subscribe_request(Bit_Buffer_t* bbP,
MIH_C_LINK_EVENT_LIST_decode(bbP, &primitiveP->RequestedLinkEventList);
#if MIH_C_DEBUG_DESERIALIZATION
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_DETECTED) DEBUG("SUBSCRIBE_REQUEST LINK_DETECTED\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_UP) DEBUG("SUBSCRIBE_REQUEST LINK_UP\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_DOWN) DEBUG("SUBSCRIBE_REQUEST LINK_DOWN\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_PARAMETERS_REPORT) DEBUG("SUBSCRIBE_REQUEST LINK_PARAMETERS_REPORT\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_GOING_DOWN) DEBUG("SUBSCRIBE_REQUEST LINK_GOING_DOWN\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_HANDOVER_IMMINENT) DEBUG("SUBSCRIBE_REQUEST LINK_HANDOVER_IMMINENT\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_HANDOVER_COMPLETE) DEBUG("SUBSCRIBE_REQUEST LINK_HANDOVER_COMPLETE\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS) DEBUG("SUBSCRIBE_REQUEST LINK_PDU_TRANSMIT_STATUS\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_DETECTED) printf("SUBSCRIBE_REQUEST LINK_DETECTED\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_UP) printf("SUBSCRIBE_REQUEST LINK_UP\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_DOWN) printf("SUBSCRIBE_REQUEST LINK_DOWN\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_PARAMETERS_REPORT) printf("SUBSCRIBE_REQUEST LINK_PARAMETERS_REPORT\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_GOING_DOWN) printf("SUBSCRIBE_REQUEST LINK_GOING_DOWN\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_HANDOVER_IMMINENT) printf("SUBSCRIBE_REQUEST LINK_HANDOVER_IMMINENT\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_HANDOVER_COMPLETE) printf("SUBSCRIBE_REQUEST LINK_HANDOVER_COMPLETE\n");
if (primitiveP->RequestedLinkEventList & MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS) printf("SUBSCRIBE_REQUEST LINK_PDU_TRANSMIT_STATUS\n");
#endif
if (BitBuffer_isCheckReadOverflowOK(bbP, 0) == BIT_BUFFER_TRUE) {
......
......@@ -39,7 +39,7 @@
#ifndef __MIH_C_H__
# define __MIH_C_H__
#include "MIH_C_bit_buffer.h"
#include "MIH_C_log.h"
#include "UTIL/LOG/log.h"
#include "MIH_C_Link_Constants.h"
#include "MIH_C_Types.h"
#include "MIH_C_header_codec.h"
......@@ -56,7 +56,7 @@
#include "MIH_C_primitive_codec.h"
#include "MIH_C_msg_codec.h"
void MIH_C_init(int log_outputP);
void MIH_C_init(void);
void MIH_C_exit(void);
#define DEBUG_TRACE_DETAILS
......
......@@ -19,25 +19,15 @@ Type definition and structure for 802.21 interface
#ifndef __MIH_C_LINK_TYPES_H__
#define __MIH_C_LINK_TYPES_H__
#include <sys/types.h>
#include <linux/types.h>
//-----------------------------------------------------------------------------
#include "MIH_C_Link_Constants.h"
#include "MIH_C_bit_buffer.h"
#include "MIH_C_log.h"
#include "UTIL/LOG/log.h"
//-----------------------------------------------------------------------------
#define MIH_C_DEBUG_SERIALIZATION 1
#define MIH_C_DEBUG_DESERIALIZATION 1
//-----------------------------------------------------------------------------
#ifdef MIH_C_DEBUG_SERIALIZATION
#define DEBUG_ENCODE DEBUG
#else
#define DEBUG_ENCODE(x)
#endif
#ifdef MIH_C_DEBUG_DESERIALIZATION
#define DEBUG_DECODE DEBUG
#else
#define DEBUG_DECODE(x)
#endif
//-----------------------------------------------------------------------------
#define STR(x) #x
/** \defgroup MIH_C_INTERFACE 802.21 interface
......@@ -95,7 +85,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return sprintf(buffP, "0x%02X", *bitmapP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %hhX\n", __FUNCTION__, *dataP);\
MIH_C_BITMAP8_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
......@@ -110,7 +99,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return sprintf(buffP, "0x%02X", *bitmapP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *bitmapP);\
MIH_C_BITMAP8_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
......@@ -125,7 +113,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return sprintf(buffP, "0x%04X", *bitmapP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %04X\n", __FUNCTION__, *bitmapP);\
MIH_C_BITMAP16_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP16_decode(bbP, bitmapP);};
......@@ -140,7 +127,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return sprintf(buffP, "0x%02X%02X%02X", bitmapP->val[0], bitmapP->val[1], bitmapP->val[2]);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %02X%02X%02X\n", __FUNCTION__, bitmapP->val[0], bitmapP->val[1], bitmapP->val[2]);\
MIH_C_BITMAP24_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP24_decode(bbP, bitmapP);};
......@@ -155,7 +141,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return sprintf(buffP, "0x%08X", *bitmapP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %08X\n", __FUNCTION__, *bitmapP);\
MIH_C_BITMAP32_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP32_decode(bbP, bitmapP);};
......@@ -173,7 +158,6 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
return buffer_index;\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
DEBUG_ENCODE("%s: %16X\n", __FUNCTION__, *bitmapP);\
MIH_C_BITMAP64_encode(bbP, bitmapP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP64_decode(bbP, bitmapP);};
......@@ -288,11 +272,9 @@ typedef int64_t MIH_C_INTEGER8_T;
return sprintf(buffP, "0x%02X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);\
MIH_C_INTEGER1_encode(bbP, (MIH_C_INTEGER1_T*)dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_INTEGER1_decode(bbP, (MIH_C_INTEGER1_T*)dataP);\
DEBUG_DECODE("%s: %02X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_INTEGER2(DATA_TYPE_NAME)
......@@ -306,11 +288,9 @@ typedef int64_t MIH_C_INTEGER8_T;
return sprintf(buffP, "0x%04X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %04X\n", __FUNCTION__, *dataP);\
MIH_C_INTEGER2_encode(bbP, (MIH_C_INTEGER2_T*)dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_INTEGER2_decode(bbP, (MIH_C_INTEGER2_T*)dataP);\
DEBUG_DECODE("%s: %04X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_INTEGER4(DATA_TYPE_NAME)
......@@ -324,11 +304,9 @@ typedef int64_t MIH_C_INTEGER8_T;
return sprintf(buffP, "0x%08X", (MIH_C_INTEGER4_T)*dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %08X\n", __FUNCTION__, *dataP);\
MIH_C_INTEGER4_encode(bbP, (MIH_C_INTEGER4_T*)dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_INTEGER4_decode(bbP, (MIH_C_INTEGER4_T*)dataP);\
DEBUG_DECODE("%s: %08X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_INTEGER8(DATA_TYPE_NAME)
......@@ -345,11 +323,9 @@ typedef int64_t MIH_C_INTEGER8_T;
return buffer_index;\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %16X\n", __FUNCTION__, *dataP);\
MIH_C_INTEGER8_encode(bbP, (MIH_C_INTEGER8_T*)dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_INTEGER8_decode(bbP, (MIH_C_INTEGER8_T*)dataP);\
DEBUG_DECODE("%s: %16X\n", __FUNCTION__, *dataP);\
};
#else
#define TYPEDEF_INTEGER1(DATA_TYPE_NAME) typedef MIH_C_INTEGER1_T DATA_TYPE_NAME ## _T;\
......@@ -425,11 +401,9 @@ typedef u_int64_t MIH_C_UNSIGNED_INT8_T;
return sprintf(buffP, "0x%02X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);\
MIH_C_UNSIGNED_INT1_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_UNSIGNED_INT1_decode(bbP, dataP);\
DEBUG_DECODE("%s: %02X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)
......@@ -443,11 +417,9 @@ typedef u_int64_t MIH_C_UNSIGNED_INT8_T;
return sprintf(buffP, "0x%04X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %04X\n", __FUNCTION__, *dataP);\
MIH_C_UNSIGNED_INT2_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_UNSIGNED_INT2_decode(bbP, dataP);\
DEBUG_DECODE("%s: %04X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)
......@@ -461,11 +433,9 @@ typedef u_int64_t MIH_C_UNSIGNED_INT8_T;
return sprintf(buffP, "0x%08X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %08X\n", __FUNCTION__, *dataP);\
MIH_C_UNSIGNED_INT4_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_UNSIGNED_INT4_decode(bbP, dataP);\
DEBUG_DECODE("%s: %08X\n", __FUNCTION__, *dataP);\
};
/*! \def TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)
......@@ -479,11 +449,9 @@ typedef u_int64_t MIH_C_UNSIGNED_INT8_T;
return sprintf(buffP, "0x%16X", *dataP);\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %16X\n", __FUNCTION__, *dataP);\
MIH_C_UNSIGNED_INT8_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
MIH_C_UNSIGNED_INT8_decode(bbP, dataP);\
DEBUG_DECODE("%s: %16X\n", __FUNCTION__, *dataP);\
};
#else
#define TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME) typedef MIH_C_UNSIGNED_INT1_T DATA_TYPE_NAME ## _T;\
......@@ -556,8 +524,7 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
inline void DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
int index = 0;\
MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
DEBUG_DECODE("%s: Length\n", __FUNCTION__, listP->length);\
if (listP->length > MAX_LENGTH) {ERR(" DATA_TYPE_NAME ## _LIST_decode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_decode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
} else {\
while ((index < listP->length) && (index < MAX_LENGTH)){\
DATA_TYPE_NAME ## _decode(bbP, &listP->val[index++]);\
......@@ -567,9 +534,8 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
inline void DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
int index = 0;\
if (listP->length > MAX_LENGTH) {\
ERR(" DATA_TYPE_NAME ## _LIST_encode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_encode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
} else {\
DEBUG_ENCODE("%s: Length\n", __FUNCTION__, listP->length);\
MIH_C_LIST_LENGTH_encode(bbP, listP->length);\
while (index < listP->length) {\
DATA_TYPE_NAME ## _encode(bbP, &listP->val[index++]);\
......@@ -633,7 +599,6 @@ TYPEDEF_UNSIGNED_INT1(MIH_C_ENUMERATED)
extern inline void MIH_C_ENUMERATED_encode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
extern inline void MIH_C_ENUMERATED_decode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);\
MIH_C_ENUMERATED_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
#else
......@@ -672,7 +637,6 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
return buffer_index;\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
DEBUG_ENCODE("%s: %02X\n", __FUNCTION__, *dataP);\
MIH_C_BOOLEAN_encode(bbP, dataP);};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
#else
......@@ -703,28 +667,30 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
};\
inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
if (listP->length > MAX_LENGTH) {ERR(" DATA_TYPE_NAME ## _decode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _decode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
} else {\
BitBuffer_readMem(bbP, listP->val, listP->length);\
}\
};\
inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
if (listP->length > MAX_LENGTH) {\
ERR(" DATA_TYPE_NAME ## _encode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
printf("[MIH_C] ERROR DATA_TYPE_NAME ## _encode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
} else {\
DEBUG_ENCODE("%s: Length %04X\n", __FUNCTION__, listP->length);\
MIH_C_LIST_LENGTH_encode(bbP, listP->length);\
BitBuffer_writeMem(bbP, listP->val, listP->length);\
}\
};\
inline void DATA_TYPE_NAME ## _set(DATA_TYPE_NAME ## _T *octet_strP, u_int8_t* strP, u_int16_t lengthP) {\
if (lengthP > MAX_LENGTH) {\
ERR(" DATA_TYPE_NAME ## _set String length out of bounds\n");\
printf("[MIH_C] ERROR DATA_TYPE_NAME ## _set String length out of bounds\n");\
octet_strP->length = 0;\
} else {\
DEBUG_ENCODE("%s: Length %d MAX LENGTH %d\n", __FUNCTION__, lengthP, MAX_LENGTH);\
octet_strP->length = lengthP;\
if (strP != NULL) {\
memcpy((char *)octet_strP->val, (char *)strP, lengthP);\
} else {\
memset((char *)octet_strP->val, 0, lengthP);\
}\
}\
};
#else
......@@ -1229,22 +1195,22 @@ typedef struct MIH_C_RESOURCE_DESC {
MIH_C_FLOW_ID_T flow_id;
MIH_C_CHOICE_T choice_link_data_rate;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_LINK_DATA_RATE_T link_data_rate;
} _union_link_data_rate;
MIH_C_CHOICE_T choice_qos;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_QOS_T qos;
} _union_qos;
MIH_C_CHOICE_T choice_jumbo_enable;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_JUMBO_ENABLE_T jumbo_enable;
} _union_jumbo_enable;
MIH_C_CHOICE_T choice_multicast_enable;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_MULTICAST_ENABLE_T multicast_enable;
} _union_multicast_enable;
} MIH_C_RESOURCE_DESC_T;
......@@ -1259,12 +1225,12 @@ typedef struct MIH_C_FLOW_ATTRIBUTE {
MIH_C_FLOW_ID_T flow_id;
MIH_C_CHOICE_T choice_multicast_enable;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_MULTICAST_ENABLE_T multicast_enable;
} _union_multicast_enable;
MIH_C_CHOICE_T choice_mark_qos;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
struct {
MIH_C_MARK_T mark;
MIH_C_QOS_T qos;
......@@ -1272,7 +1238,7 @@ typedef struct MIH_C_FLOW_ATTRIBUTE {
} _union_mark_qos;
MIH_C_CHOICE_T choice_mark_drop_eligibility;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
struct {
MIH_C_MARK_T mark;
MIH_C_DROP_ELIGIBILITY_T drop_eligibility;
......@@ -1291,7 +1257,7 @@ typedef struct MIH_C_FLOW_ATTRIBUTE {
typedef struct MIH_C_LINK_AC_PARAM {
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_FLOW_ATTRIBUTE_T flow_attribute;
MIH_C_RESOURCE_DESC_T resource_desc;
} _union;
......@@ -1319,7 +1285,7 @@ typedef struct MIH_C_LINK_ACTION_REQ {
MIH_C_LINK_ID_T link_id;
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_LINK_ADDR_T link_addr;
} _union;
......@@ -1373,7 +1339,7 @@ typedef struct MIH_C_LINK_ACTION_RSP {
MIH_C_LINK_AC_RESULT_T link_ac_result;
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
LIST(MIH_C_LINK_SCAN_RSP, link_scan_rsp)
} _union;
} MIH_C_LINK_ACTION_RSP_T;
......@@ -1672,7 +1638,7 @@ typedef struct MIH_C_LINK_CFG_PARAM {
MIH_C_LINK_PARAM_TYPE_T link_param_type;
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_TIMER_INTERVAL_T timer_interval;
LIST(MIH_C_LINK_SCAN_RSP, link_scan_rsp)
} _union;
......@@ -1944,7 +1910,7 @@ typedef struct MIH_C_LINK_PARAM_RPT {
MIH_C_LINK_PARAM_T link_param;
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_THRESHOLD_T threshold;
} _union;
} MIH_C_LINK_PARAM_RPT_T;
......@@ -2055,7 +2021,7 @@ typedef struct MIH_C_LINK_TUPLE_ID {
MIH_C_LINK_ID_T link_id;
MIH_C_CHOICE_T choice;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_LINK_ADDR_T link_addr;
} _union;
} MIH_C_LINK_TUPLE_ID_T;
......@@ -2476,17 +2442,17 @@ typedef struct MIH_C_IP_CONFIG
MIH_C_IP_CFG_MTHDS_T ip_cfg_mthds;
MIH_C_CHOICE_T choice_dhcp_serv;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_DHCP_SERV_T dhcp_serv;
} _union_dhcp_serv;
MIH_C_CHOICE_T choice_fn_agnt;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_FN_AGNT_T fn_agnt;
} _union_fn_agnt;
MIH_C_CHOICE_T choice_acc_rtr;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_ACC_RTR_T acc_rtr;
} _union_acc_rtr;
} MIH_C_IP_CONFIG_T;
......@@ -2536,17 +2502,17 @@ typedef struct MIH_C_NETWORK_TYPE
{
MIH_C_CHOICE_T choice_link_type;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_LINK_TYPE_T link_type;
} _union_link_type;
MIH_C_CHOICE_T choice_subtype;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_SUBTYPE_T subtype;
} _union_subtype;
MIH_C_CHOICE_T choice_type_ext;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_TYPE_EXT_T type_ext;
} _union_type_ext;
} MIH_C_NETWORK_TYPE_T;
......@@ -2695,17 +2661,17 @@ TYPEDEF_OCTET_STRING(MIH_C_MIHF_ID, 253)
typedef struct MIH_C_LINK_DET_CFG {
MIH_C_CHOICE_T choice_network_id;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_NETWORK_ID_T network_id;
} _union_network_id;
MIH_C_CHOICE_T choice_sig_strength;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_SIG_STRENGTH_T sig_strength;
} _union_sig_strength;
MIH_C_CHOICE_T choice_link_data_rate;
union {
MIH_C_NULL_T null;
MIH_C_NULL_T null_attr;
MIH_C_LINK_DATA_RATE_T link_data_rate;
} _union_link_data_rate;
} MIH_C_LINK_DET_CFG_T;
......
......@@ -35,7 +35,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
* \bug
* \warning
*/
#error "To be removed"
#ifndef __MIH_C_LOG_H__
# define __MIH_C_LOG_H__
//-----------------------------------------------------------------------------
......
/*****************************************************************************
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source lteRALenb.h
*
* Version 0.1
*
* Date 11/18/2013
*
* Product MIH RAL LTE
*
* Subsystem RAL-LTE
*
* Authors Michelle Wetterwald, Lionel Gauthier, Frederic Maurel
*
* Description Header file to be included by any module that wants to interface with RAL ENB.
*
*****************************************************************************/
#ifndef __LTE_RAL_ENB_H__
#define __LTE_RAL_ENB_H__
#include "MIH_C.h"
#include "openair_types.h"
#include "platform_constants.h"
#include "platform_types.h"
#include "lteRALenb_constants.h"
#include "lteRALenb_variables.h"
#include "lteRALenb_action.h"
#include "lteRALenb_main.h"
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_rrc_msg.h"
#include "lteRALenb_parameters.h"
#include "lteRALenb_process.h"
#include "lteRALenb_subscribe.h"
#include "lteRALenb_thresholds.h"
#endif
......@@ -26,9 +26,9 @@
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file eRALlte_action.h
/*! \file lteRALenb_action.h
* \brief
* \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
......@@ -36,11 +36,26 @@
* \warning
*/
#ifndef __RAL_LTE_ACTION_H__
#define __RAL_LTE_ACTION_H__
#include "MIH_C_msg_codec.h"
#include "MIH_C_Link_Messages.h"
#ifndef __LTE_RAL_ENB_ACTION_H__
#define __LTE_RAL_ENB_ACTION_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_ACTION_C
# define private_lteralenb_action(x) x
# define protected_lteralenb_action(x) x
# define public_lteralenb_action(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_action(x)
# define protected_lteralenb_action(x) extern x
# define public_lteralenb_action(x) extern x
# else
# define private_lteralenb_action(x)
# define protected_lteralenb_action(x)
# define public_lteralenb_action(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -49,7 +64,37 @@
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
/*
* ---------------------------------------------------------------------------
* Flow identifier management:
* Radio Bearer data flows are identified by a source address, a destination
* address and a port number for a particular IP transport protocol (UDP,
* TCP). A private data structure is used to map upper-layer flow identifiers
* to lower-layer RB channel identifiers. It is handled by private functions.
* ---------------------------------------------------------------------------
*/
/* Structure of the destination data flow */
typedef struct Data_flow {
unsigned char addr[16]; // IP address
unsigned int l2id[2]; // L2 identifier
unsigned int port; // IP port identifier
int proto; // IP protocol
int cnxid; // Data flow identifier
}data_flow_t;
#define ACTION_MAX_FLOW ((RAL_MAX_MT)*(RAL_MAX_RB))
typedef struct eRAL_action_DataFlowList {
int n_flows;
data_flow_t flow [ACTION_MAX_FLOW];
int flow_id [ACTION_MAX_FLOW]; //added TEMP MW 23/05/13
} eRAL_action_DataFlowList_t;
private_lteralenb_action(eRAL_action_DataFlowList_t g_flows = {};)
#endif // MIH_C_MEDIEVAL_EXTENSIONS
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
......@@ -58,6 +103,16 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* messageP);
protected_lteralenb_action(void eRAL_action_request (ral_enb_instance_t instanceP, MIH_C_Message_Link_Action_request_t* msgP);)
protected_lteralenb_action(int eRAL_action_save_flow_id (ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int cnxid);)
private_lteralenb_action( int eRAL_action_set_channel_id (ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int cnxid);)
private_lteralenb_action( int eRAL_action_get_channel_id (ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int* cnxid);)
private_lteralenb_action( int eRAL_action_del_channel_id (ral_enb_instance_t instanceP, int fix);)
private_lteralenb_action( int eRAL_action_is_in_progress (ral_enb_instance_t instanceP, MIH_C_STATUS_T* status, MIH_C_LINK_AC_RESULT_T* ac_status, MIH_C_LINK_AC_TYPE_T action);)
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
private_lteralenb_action( MIH_C_LINK_AC_RESULT_T eRAL_action_link_flow_attr(ral_enb_instance_t instanceP);)
private_lteralenb_action( MIH_C_LINK_AC_RESULT_T eRAL_action_link_activate_resources(ral_enb_instance_t instanceP);)
private_lteralenb_action( MIH_C_LINK_AC_RESULT_T eRAL_action_link_deactivate_resources(ral_enb_instance_t instanceP);)
#endif // MIH_C_MEDIEVAL_EXTENSIONS
#endif
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_constants.h
* Source lteRALenb_constants.h
*
* Version 0.1
*
......@@ -18,8 +18,8 @@
* side.
*
*****************************************************************************/
#ifndef __RAL_LTE_CONS_H__
#define __RAL_LTE_CONS_H__
#ifndef __LTE_RAL_ENB_CONSTANTS_H__
#define __LTE_RAL_ENB_CONSTANTS_H__
#include <sys/types.h>
......@@ -28,23 +28,16 @@
/****************************************************************************/
//-----------------------------------------------------------------------------
#define DEFAULT_LOCAL_PORT_RAL "1235"
#define DEFAULT_REMOTE_PORT_MIHF "1025"
#define DEFAULT_IP_ADDRESS_MIHF "127.0.0.1"
#define DEFAULT_IP_ADDRESS_RAL "127.0.0.1"
#define DEFAULT_LINK_ID "link"
#define DEFAULT_MIHF_ID "mihf1"
#define DEFAULT_ADDRESS_3GPP "0335060080149150"
#define ENB_DEFAULT_LOCAL_PORT_RAL "1235"
#define ENB_DEFAULT_REMOTE_PORT_MIHF "1025"
#define ENB_DEFAULT_IP_ADDRESS_MIHF "127.0.0.1"
#define ENB_DEFAULT_IP_ADDRESS_RAL "127.0.0.1"
#define ENB_DEFAULT_LINK_ID_RAL "enb_lte_link"
#define ENB_DEFAULT_LINK_ADDRESS_RAL "060080149150"
#define ENB_DEFAULT_MIHF_ID "mihf_enb"
#define ENB_DEFAULT_ADDRESS_3GPP "0335060080149150"
#define DEFAULT_PLMN "208020"
#define DEFAULT_MCC "208" // France
#define DEFAULT_MNC "020" // Bouygues Telecom
//-----------------------------------------------------------------------------
#define MIH_C_RADIO_POLLING_INTERVAL_MICRO_SECONDS 50000
#define MIH_C_RADIO_POLLING_INTERVAL_SECONDS 0
//-----------------------------------------------------------------------------
// Constants for scenario
#define PREDEFINED_MIH_NETWORK_ID "eurecom"
......@@ -54,8 +47,4 @@
#define PREDEFINED_CLASSES_SERVICE_SUPPORTED 2
#define PREDEFINED_QUEUES_SUPPORTED 2
#define PREDEFINED_LINK_DETECTED_INDICATION_SIG_STRENGTH 5
#define PREDEFINED_LINK_DETECTED_INDICATION_SINR 45
#define PREDEFINED_LINK_DETECTED_INDICATION_LINK_DATA_RATE 1000
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_main.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_ENB_MAIN_H__
#define __LTE_RAL_ENB_MAIN_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_MAIN_C
# define private_lteralenb_main(x) x
# define protected_lteralenb_main(x) x
# define public_lteralenb_main(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_main(x)
# define protected_lteralenb_main(x) extern x
# define public_lteralenb_main(x) extern x
# else
# define private_lteralenb_main(x)
# define protected_lteralenb_main(x)
# define public_lteralenb_main(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
#include "commonDef.h"
#include "collection/hashtable/hashtable.h"
public_lteralenb_main(char* g_conf_enb_ral_listening_port;)
public_lteralenb_main(char* g_conf_enb_ral_ip_address;)
public_lteralenb_main(char* g_conf_enb_ral_link_id;)
public_lteralenb_main(char* g_conf_enb_ral_link_address;)
public_lteralenb_main(char* g_conf_enb_mihf_remote_port;)
public_lteralenb_main(char* g_conf_enb_mihf_ip_address;)
public_lteralenb_main(char* g_conf_enb_mihf_id;)
/*
* Radio Bearer data
*/
typedef struct ral_lte_channel {
u32 cnx_id;
u8 multicast;
// MIHF parameters ix=0 UPLINK, ix=1 DOWNLINK
u16 flowId[2];
u16 classId[2];
float resBitrate[2];
float meanBitrate[2];
float bktDepth[2];
float pkBitrate[2];
float MTU[2];
#if ! defined(ENABLE_USE_MME)
//IP driver parameters
u16 rbId;
u16 RadioQoSclass;
u16 dscpUL;
u16 dscpDL;
u16 nas_state;
u16 status;
#endif
}ral_lte_channel_t;
/*
* Mobile Terminal data
*/
typedef struct ral_lte_mt_s {
/* The identifier of the link that is associated with a PoA */
MIH_C_LINK_TUPLE_ID_T ltid;
u8 ipv6_addr[16];
u32 ipv6_l2id[2];
u32 ue_id;
struct ral_lte_channel radio_channel[RAL_MAX_RB];
int num_rbs;
int num_class;
int nas_state;
int mt_state;
}ral_lte_mt_t;
/*
* Multicast data // TEMP MW A supprimer!!!!
*/
typedef struct ral_lte_mcast_s {
/* The identifier of the multicast link that is associated with a PoA */
MIH_C_LINK_TUPLE_ID_T ltid;
struct ral_lte_channel radio_channel;
u8 mc_group_addr[16];
}ral_lte_mcast_t;
/*
* RAL LTE internal data
*/
typedef struct lte_ral_enb_object {
//------------------------
// CONFIG PARAMETERS
//------------------------
char* ral_listening_port;
char* ral_ip_address;
char* ral_link_address;
char* mihf_remote_port;
char* mihf_ip_address;
char* link_id;
char* mihf_id;
MIH_C_LINK_MIHCAP_FLAG_T link_mihcap_flag; // hardcoded parameters
MIH_C_NET_CAPS_T net_caps;// hardcoded parameters
// provided by RRC with RRC_RAL_SYSTEM_CONFIGURATION_IND message
plmn_t plmn_id;
unsigned int cell_id:28;
int num_connected_mts;
u8 pending_req_flag;
u8 pending_req_mt_ix;
u8 pending_req_ch_ix;
u8 pending_req_multicast;
// u16 pending_req_transaction_id;
// u8 pending_req_status;
MIH_C_FLOW_ID_T pending_req_fid;
ral_lte_mt_t pending_mt;
int pending_mt_timer;
int pending_mt_flag;
ral_lte_mt_t mt[RAL_MAX_MT];
ral_lte_mcast_t mcast;
// measurements for MEDIEVAL project
//MIH_C_TIMER_INTERVAL_T measurement_timer_interval; // This timer value (ms) is used to set the interval between
// periodic reports. Valid Range: 0..65535
//long measurement_timer_id;
//u16 num_UEs;
//u32 rlcBufferOccupancy[RAL_MAX_MT];
//u32 scheduledPRB[RAL_MAX_MT];
//u32 totalDataVolume[RAL_MAX_MT];
//u32 totalNumPRBs;
//int congestion_flag;
//int congestion_threshold;
//int measures_triggered_flag;
//int requested_period;
// MIH-INTERFACE data
int mih_sock_desc;
MIH_C_LINK_AC_TYPE_LIST_T mih_supported_link_action_list;
MIH_C_LINK_EVENT_LIST_T mih_supported_link_event_list;
MIH_C_LINK_CMD_LIST_T mih_supported_link_command_list;
MIH_C_LINK_EVENT_LIST_T mih_subscribe_req_event_list;
//LIST(MIH_C_LINK_CFG_PARAM, mih_link_cfg_param_thresholds);
// to tell what are the configured thresholds in mih_link_cfg_param_thresholds_list
//MIH_C_BOOLEAN_T active_mih_link_cfg_param_threshold[MIH_C_LINK_CFG_PARAM_LIST_LENGTH];
MIH_C_LINK_AC_TYPE_T pending_req_action;
MIH_C_STATUS_T pending_req_status;
MIH_C_LINK_AC_RESULT_T pending_req_ac_result;
MIH_C_TRANSACTION_ID_T pending_req_transaction_id;
hash_table_t *ue_htbl;
MIH_C_TRANSACTION_ID_T transaction_id;
char buffer[800];
} lte_ral_enb_object_t;
/* RAL LTE internal data */
protected_lteralenb_main(lte_ral_enb_object_t g_enb_ral_obj[MAX_MODULES];)
private_lteralenb_main(hash_table_t *g_enb_ral_fd2instance;)
private_lteralenb_main(void eRAL_get_IPv6_addr (const char* if_name);)
public_lteralenb_main( void eRAL_init_default_values (void);)
private_lteralenb_main(int eRAL_initialize (void);)
private_lteralenb_main(void eRAL_process_file_descriptors(struct epoll_event *events, int nb_events);)
public_lteralenb_main( void* eRAL_task (void *args_p);)
#endif
......@@ -26,9 +26,9 @@
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file eRALlte_mih_msg.h
/*! \file lteRALenb_mih_msg.h
* \brief
* \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
......@@ -36,10 +36,26 @@
* \warning
*/
#ifndef __RAL_LTE_MIH_MSG_H__
#define __RAL_LTE_MIH_MSG_H__
#include <sys/types.h>
#ifndef __LTE_RAL_ENB_MIH_MSG_H__
#define __LTE_RAL_ENB_MIH_MSG_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_MIH_MSG_C
# define private_lteralenb_mih_msg(x) x
# define protected_lteralenb_mih_msg(x) x
# define public_lteralenb_mih_msg(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_mih_msg(x)
# define protected_lteralenb_mih_msg(x) extern x
# define public_lteralenb_mih_msg(x) extern x
# else
# define private_lteralenb_mih_msg(x)
# define protected_lteralenb_mih_msg(x)
# define public_lteralenb_mih_msg(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
#include "MIH_C_Types.h"
#include "MIH_C_header_codec.h"
......@@ -49,24 +65,15 @@
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
char* g_mihf_ip_address;
char* g_mihf_remote_port;
int g_sockd_mihf;
char* g_ral_ip_address;
char* g_ral_listening_port_for_mihf;
char* g_link_id;
char* g_mihf_id;
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
int eRALlte_mihf_connect(void);
int eRALlte_mih_link_process_message(void);
protected_lteralenb_mih_msg(int eRAL_mihf_connect(ral_enb_instance_t instanceP);)
protected_lteralenb_mih_msg(int eRAL_mih_link_process_message(ral_enb_instance_t instanceP);)
private_lteralenb_mih_msg(void eRAL_print_buffer(const u_int8_t * bufferP, int lenP);)
/*
* --------------------------------------------------------------------------
* MIH service management messages
......@@ -74,27 +81,31 @@ int eRALlte_mih_link_process_message(void);
*/
/* MIH_C_MESSAGE_LINK_REGISTER_INDICATION_ID */
void eRALlte_send_link_register_indication(
MIH_C_TRANSACTION_ID_T *transaction_idP);
protected_lteralenb_mih_msg(void eRAL_send_link_register_indication(\
ral_enb_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP);)
/* MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM_ID */
void eRALlte_send_capability_discover_confirm(
MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *link_evt_listP,
MIH_C_LINK_CMD_LIST_T *link_cmd_listP);
private_lteralenb_mih_msg(void eRAL_send_capability_discover_confirm(\
ral_enb_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *tidP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *link_evt_listP,\
MIH_C_LINK_CMD_LIST_T *link_cmd_listP);)
/* MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_CONFIRM_ID */
void eRALlte_send_event_subscribe_confirm(
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *link_event_listP);
protected_lteralenb_mih_msg(void eRAL_send_event_subscribe_confirm(\
ral_enb_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *link_event_listP);)
/* MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_CONFIRM_ID */
void eRALlte_send_event_unsubscribe_confirm(
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *link_event_listP);
protected_lteralenb_mih_msg(void eRAL_send_event_unsubscribe_confirm(\
ral_enb_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_STATUS_T *statusP,\
MIH_C_LINK_EVENT_LIST_T *link_event_listP);)
/*
* --------------------------------------------------------------------------
......@@ -103,38 +114,43 @@ void eRALlte_send_event_unsubscribe_confirm(
*/
/* MIH_C_MESSAGE_LINK_DETECTED_INDICATION_ID */
void eRALlte_send_link_detected_indication(
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_LINK_DET_INFO_T *link_detected_infoP);
protected_lteralenb_mih_msg(void eRAL_send_link_detected_indication(\
ral_enb_instance_t instanceP,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_DET_INFO_T *link_detected_infoP);)
/* MIH_C_MESSAGE_LINK_UP_INDICATION_ID */
void eRALlte_send_link_up_indication(
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_ADDR_T *new_access_routerP,
MIH_C_IP_RENEWAL_FLAG_T *ip_renewal_flagP,
MIH_C_IP_MOB_MGMT_T *mobility_mngtP);
protected_lteralenb_mih_msg(void eRAL_send_link_up_indication(\
ral_enb_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_ADDR_T *new_access_routerP,\
MIH_C_IP_RENEWAL_FLAG_T *ip_renewal_flagP,\
MIH_C_IP_MOB_MGMT_T *mobility_mngtP);)
/* MIH_C_MESSAGE_LINK_DOWN_INDICATION_ID */
void eRALlte_send_link_down_indication(
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);
private_lteralenb_mih_msg(void eRAL_send_link_down_indication(\
ral_enb_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);)
/* MIH_C_MESSAGE_LINK_PARAMETERS_REPORT_INDICATION_ID */
void eRALlte_send_link_parameters_report_indication(
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_lteralenb_mih_msg(void eRAL_send_link_parameters_report_indication(\
ral_enb_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);)
/* MIH_C_MESSAGE_LINK_GOING_DOWN_INDICATION_ID */
void eRALlte_send_link_going_down_indication(
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);
private_lteralenb_mih_msg(void eRAL_send_link_going_down_indication(\
ral_enb_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);)
/* MIH_C_MESSAGE_LINK_HANDOVER_IMMINENT_INDICATION_ID */
......@@ -149,32 +165,37 @@ void eRALlte_send_link_going_down_indication(
*/
/* MIH_C_MESSAGE_LINK_GET_PARAMETERS_CONFIRM_ID */
void eRALlte_send_get_parameters_confirm(
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_PARAM_LIST_T *link_parameters_status_listP,
MIH_C_LINK_STATES_RSP_LIST_T *link_states_response_listP,
MIH_C_LINK_DESC_RSP_LIST_T *link_descriptors_response_listP);
protected_lteralenb_mih_msg(void eRAL_send_get_parameters_confirm(\
ral_enb_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,\
MIH_C_LINK_STATES_RSP_LIST_T *link_states_response_listP,\
MIH_C_LINK_DESC_RSP_LIST_T *link_descriptors_response_listP);)
/* MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_CONFIRM_ID */
void eRALlte_send_configure_thresholds_confirm(
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_CFG_STATUS_LIST_T *link_configure_status_listP);
protected_lteralenb_mih_msg(void eRAL_send_configure_thresholds_confirm(\
ral_enb_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);)
/* MIH_C_MESSAGE_LINK_ACTION_CONFIRM_ID */
void eRALlte_send_link_action_confirm(
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_lteralenb_mih_msg(void eRAL_send_link_action_confirm(\
ral_enb_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);)
/*
* --------------------------------------------------------------------------
* MIH information messages
* --------------------------------------------------------------------------
*/
protected_lteralenb_mih_msg(int eRAL_mihf_connect (ral_enb_instance_t instanceP);)
private_lteralenb_mih_msg( int eRAL_send_to_mih (ral_enb_instance_t instanceP, const u_int8_t *bufferP, int lenP);)
private_lteralenb_mih_msg( int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP);)
/****************************************************************************/
#endif
......@@ -26,9 +26,9 @@
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file eRALlte_parameters.h
/*! \file lteRALenb_parameters.h
* \brief
* \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
......@@ -36,10 +36,26 @@
* \warning
*/
#ifndef __RAL_LTE_PARAMETERS_H__
#define __RAL_LTE_PARAMETERS_H__
#include "MIH_C.h"
#ifndef __LTE_RAL_ENB_PARAMETERS_H__
#define __LTE_RAL_ENB_PARAMETERS_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_PARAMETERS_C
# define private_lteralenb_parameters(x) x
# define protected_lteralenb_parameters(x) x
# define public_lteralenb_parameters(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_parameters(x)
# define protected_lteralenb_parameters(x) extern x
# define public_lteralenb_parameters(x) extern x
# else
# define private_lteralenb_parameters(x)
# define protected_lteralenb_parameters(x)
# define public_lteralenb_parameters(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -57,6 +73,6 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void eRALlte_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* messageP);
void eRAL_get_parameters_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Get_Parameters_request_t* messageP);
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_process.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_ENB_PROCESS_H__
#define __LTE_RAL_ENB_PROCESS_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_PROCESS_C
# define private_lteralenb_process(x) x
# define protected_lteralenb_process(x) x
# define public_lteralenb_process(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_process(x)
# define protected_lteralenb_process(x) extern x
# define public_lteralenb_process(x) extern x
# else
# define private_lteralenb_process(x)
# define protected_lteralenb_process(x)
# define public_lteralenb_process(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
protected_lteralenb_process(int eRAL_process_find_channel (ral_enb_instance_t instanceP, unsigned int cnxid, int* mt_ix, int* ch_ix);)
protected_lteralenb_process(int eRAL_process_find_new_channel (ral_enb_instance_t instanceP, int mt_ix);)
private_lteralenb_process( void eRAL_process_clean_channel (struct ral_lte_channel* channel);)
protected_lteralenb_process(char* eRAL_process_mt_addr_to_string (const unsigned char* ip_addr);)
protected_lteralenb_process(void eRAL_process_mt_addr_to_l2id (const unsigned char* mt_addr, unsigned int* l2id);)
private_lteralenb_process( int eRAL_process_cmp_mt_addr (const char* mt_addr, const char* l2id);)
protected_lteralenb_process(int eRAL_process_find_mt_by_addr (ral_enb_instance_t instanceP, const char* mt_addr);)
private_lteralenb_process( void eRAL_process_verify_pending_mt_status(ral_enb_instance_t instanceP);)
protected_lteralenb_process(int eRAL_process_map_qos (ral_enb_instance_t instanceP, int mt_ix, int ch_ix);)
private_lteralenb_process( void eRAL_process_waiting_RB (ral_enb_instance_t instanceP, int mt_ix);)
private_lteralenb_process( void eRAL_process_clean_pending_mt (ral_enb_instance_t instanceP);)
protected_lteralenb_process(void RAL_printInitStatus (ral_enb_instance_t instanceP);)
private_lteralenb_process( void RAL_NAS_measures_polling (ral_enb_instance_t instanceP);)
private_lteralenb_process( void RAL_NAS_report_congestion (ral_enb_instance_t instanceP, int ix);)
private_lteralenb_process( void RAL_NAS_measures_analyze (ral_enb_instance_t instanceP);)
#endif
......@@ -34,10 +34,11 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __RAL_LTE_PROTO_H__
#define __RAL_LTE_PROTO_H__
#ifndef __LTE_RAL_ENB_PROTO_H__
#define __LTE_RAL_ENB_PROTO_H__
#include "lteRALenb_variables.h"
# error "Remove inclusion"
//#include "lteRALenb_variables.h"
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
......@@ -45,34 +46,37 @@
* Functions defined in eRALlte_NAS.c
*/
void eRALlte_NAS_get_MTs_list(void);
int eRALlte_NAS_update_MTs_list(void);
//void eRALlte_NAS_get_MTs_list(void);
//int eRALlte_NAS_update_MTs_list(void);
int eRALlte_NAS_process_message(void);
int eRALlte_NAS_send_rb_establish_request(int mt_ix, int ch_ix);
int eRALlte_NAS_send_rb_release_request(int mt_ix, int ch_ix);
int eRALlte_NAS_send_measure_request(void);
//int eRALlte_NAS_process_message(void);
//int eRALlte_NAS_send_rb_establish_request(int mt_ix, int ch_ix);
//int eRALlte_NAS_send_rb_release_request(int mt_ix, int ch_ix);
//int eRALlte_NAS_send_measure_request(void);
#ifdef RAL_REALTIME
int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix);
#endif
//#ifdef RAL_REALTIME
//int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix);
//#endif
/*
* Functions defined in eRALlte_process.c
*/
int eRALlte_process_find_channel(unsigned int cnxid, int* mt_ix, int* ch_ix);
int eRALlte_process_find_new_channel(int mt_ix);
void eRALlte_process_clean_channel(struct ral_lte_channel* pchannel);
void eRALlte_process_verify_pending_mt_status(void);
char* eRALlte_process_mt_addr_to_string(const unsigned char* mt_addr);
void eRALlte_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int* l2id);
int eRALlte_process_cmp_mt_addr(const char* mt_addr, const char* l2id);
int eRALlte_process_find_mt_by_addr(const char* mt_addr);
int eRALlte_process_map_qos(int mt_ix, int ch_ix);
//int eRALlte_process_find_channel(unsigned int cnxid, int* mt_ix, int* ch_ix);
//int eRALlte_process_find_new_channel(int mt_ix);
//void eRALlte_process_clean_channel(struct ral_lte_channel* pchannel);
//void eRALlte_process_verify_pending_mt_status(void);
//char* eRALlte_process_mt_addr_to_string(const unsigned char* mt_addr);
//void eRALlte_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int* l2id);
//int eRALlte_process_cmp_mt_addr(const char* mt_addr, const char* l2id);
//int eRALlte_process_find_mt_by_addr(const char* mt_addr);
//int eRALlte_process_map_qos(int mt_ix, int ch_ix);
// MW Added
void RAL_printInitStatus(void);
void RAL_NAS_measures_polling(void);
void RAL_NAS_measures_analyze(void);
void RAL_NAS_report_congestion(int ix);
//void RAL_printInitStatus(void);
//void RAL_NAS_measures_polling(void);
//void RAL_NAS_measures_analyze(void);
//void RAL_NAS_report_congestion(int ix);
//void* ral_enb_task(void *args_p);
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_rrc_msg.h
* \brief
* \author GAUTHIER Lionel
* \date 2013
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_ENB_RRC_MSG_H__
#define __LTE_RAL_ENB_RRC_MSG_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_RRC_MSG_C
# define private_lteralenb_rrc_msg(x) x
# define protected_lteralenb_rrc_msg(x) x
# define public_lteralenb_rrc_msg(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_rrc_msg(x)
# define protected_lteralenb_rrc_msg(x) extern x
# define public_lteralenb_rrc_msg(x) extern x
# else
# define private_lteralenb_rrc_msg(x)
# define protected_lteralenb_rrc_msg(x)
# define public_lteralenb_rrc_msg(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
#include "intertask_interface.h"
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_system_configuration_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_connection_establishment_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_connection_reestablishment_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_connection_reconfiguration_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_measurement_report_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralenb_rrc_msg(void eRAL_rx_rrc_ral_connection_release_indication (instance_t instance, MessageDef *msg_p);)
#endif
......@@ -26,9 +26,9 @@
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file eRALlte_subscribe.h
/*! \file lteRALenb_subscribe.h
* \brief
* \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
......@@ -36,10 +36,26 @@
* \warning
*/
#ifndef __RAL_LTE_SUBSCRIBE_H__
#define __RAL_LTE_SUBSCRIBE_H__
#include "MIH_C.h"
#ifndef __LTE_RAL_ENB_SUBSCRIBE_H__
#define __LTE_RAL_ENB_SUBSCRIBE_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_PROCESS_C
# define private_lteralenb_subscribe(x) x
# define protected_lteralenb_subscribe(x) x
# define public_lteralenb_subscribe(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_subscribe(x)
# define protected_lteralenb_subscribe(x) extern x
# define public_lteralenb_subscribe(x) extern x
# else
# define private_lteralenb_subscribe(x)
# define protected_lteralenb_subscribe(x)
# define public_lteralenb_subscribe(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -57,8 +73,8 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void eRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* msgP);
protected_lteralenb_subscribe(void eRAL_subscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP);)
void eRALlte_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP);
protected_lteralenb_subscribe(void eRAL_unsubscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP);)
#endif
......@@ -26,9 +26,9 @@
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file eRALlte_thresholds.h
/*! \file lteRALenb_thresholds.h
* \brief
* \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
......@@ -36,10 +36,27 @@
* \warning
*/
#ifndef __RAL_LTE_THRESHOLDS_H__
#define __RAL_LTE_THRESHOLDS_H__
#include "MIH_C.h"
#ifndef __LTE_RAL_ENB_THRESHOLDS_H__
#define __LTE_RAL_ENB_THRESHOLDS_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_ENB_PROCESS_C
# define private_lteralenb_thresholds(x) x
# define protected_lteralenb_thresholds(x) x
# define public_lteralenb_thresholds(x) x
# else
# ifdef LTE_RAL_ENB
# define private_lteralenb_thresholds(x)
# define protected_lteralenb_thresholds(x) extern x
# define public_lteralenb_thresholds(x) extern x
# else
# define private_lteralenb_thresholds(x)
# define protected_lteralenb_thresholds(x)
# define public_lteralenb_thresholds(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALenb.h"
#include "intertask_interface.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -59,6 +76,7 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
void eRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);
protected_lteralenb_thresholds(void eRAL_configure_thresholds_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);)
protected_lteralenb_thresholds(void eRAL_rx_rrc_ral_configure_threshold_conf(instance_t instance, MessageDef *msg_p);)
#endif
......@@ -18,8 +18,8 @@
* the network side and the access router dummy configuration.
*
*****************************************************************************/
#ifndef __RAL_LTE_VAR_H__
#define __RAL_LTE_VAR_H__
#ifndef __LTE_RAL_ENB_VARIABLES_H__
#define __LTE_RAL_ENB_VARIABLES_H__
// Define working mode : Dummy or Realtime
//#define RAL_DUMMY
......@@ -31,14 +31,7 @@
//flag to reduce the logs
#define DEBUG_RAL_DETAILS
#include "rrc_d_types.h"
#ifdef RAL_DUMMY
#include "nas_rg_netlink.h"
#endif
#include "MIH_C_Types.h"
#include "MIH_C_header_codec.h"
#include "MIH_C_Link_Primitives.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
......@@ -48,16 +41,16 @@
/*Arguments ioctl command
*/
//arg[0]
#define IO_OBJ_STATS 0
#define IO_OBJ_CNX 1
#define IO_OBJ_RB 2
#define IO_OBJ_MEAS 3
#define IO_OBJ_MC 4 // multicast
//LG#define IO_OBJ_STATS 0
//LG#define IO_OBJ_CNX 1
//LG#define IO_OBJ_RB 2
//LG#define IO_OBJ_MEAS 3
//LG#define IO_OBJ_MC 4 // multicast
//arg[1]
#define IO_CMD_ADD 0
#define IO_CMD_DEL 1
#define IO_CMD_LIST 2
//LG#define IO_CMD_ADD 0
//LG#define IO_CMD_DEL 1
//LG#define IO_CMD_LIST 2
#define NAS_CONNECTED 1 //same as NAS interface
#define NAS_DISCONNECTED 0
......@@ -139,6 +132,8 @@ const char DestIpv6Addr[ADDR_MAX][16] = { // DUMMY
extern const char DestIpv6Addr[ADDR_MAX][16];
#endif
typedef int ral_enb_instance_t;
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
......@@ -146,117 +141,14 @@ extern const char DestIpv6Addr[ADDR_MAX][16];
/* List of link action types */
TYPEDEF_BITMAP8(MIH_C_LINK_AC_TYPE_LIST);
/*
* Radio Bearer data
*/
struct ral_lte_channel {
u32 cnx_id;
u8 multicast;
// MIHF parameters ix=0 UPLINK, ix=1 DOWNLINK
u16 flowId[2];
u16 classId[2];
float resBitrate[2];
float meanBitrate[2];
float bktDepth[2];
float pkBitrate[2];
float MTU[2];
//NAS driver parameters
u16 rbId;
u16 RadioQoSclass;
u16 dscpUL;
u16 dscpDL;
u16 nas_state;
u16 status;
};
/*
* Mobile Terminal data
*/
struct ral_lte_mt {
/* The identifier of the link that is associated with a PoA */
MIH_C_LINK_TUPLE_ID_T ltid;
u8 ipv6_addr[16];
u32 ipv6_l2id[2];
u32 ue_id;
struct ral_lte_channel radio_channel[RAL_MAX_RB];
int num_rbs;
int num_class;
int nas_state;
int mt_state;
};
/*
* Multicast data // TEMP MW A supprimer!!!!
*/
struct ral_lte_mcast {
/* The identifier of the multicast link that is associated with a PoA */
MIH_C_LINK_TUPLE_ID_T ltid;
struct ral_lte_channel radio_channel;
u8 mc_group_addr[16];
};
/*
* RAL LTE internal data
*/
struct ral_lte_priv {
u8 plmn[3];
int curr_cellId;
int num_connected_mts;
u8 pending_req_flag;
u8 pending_req_mt_ix;
u8 pending_req_ch_ix;
u8 pending_req_multicast;
// u16 pending_req_transaction_id;
// u8 pending_req_status;
MIH_C_FLOW_ID_T pending_req_fid;
struct ral_lte_mt pending_mt;
int pending_mt_timer;
int pending_mt_flag;
struct ral_lte_mt mt[RAL_MAX_MT];
struct ral_lte_mcast mcast;
// struct tqal_ar_mobile mt[TQAL_MAX_MTs];
// struct tqal_ar_channel multicast_channel;
// u8 mc_group_addr[16];
//Added for demo 3 - MW
int meas_polling_interval;
int meas_polling_counter;
u16 num_UEs;
u32 rlcBufferOccupancy[RAL_MAX_MT];
u32 scheduledPRB[RAL_MAX_MT];
u32 totalDataVolume[RAL_MAX_MT];
u32 totalNumPRBs;
int congestion_flag;
int congestion_threshold;
int measures_triggered_flag;
int requested_period;
// MIH-INTERFACE data
MIH_C_LINK_AC_TYPE_LIST_T mih_supported_link_action_list;
MIH_C_LINK_EVENT_LIST_T mih_supported_link_event_list;
MIH_C_LINK_CMD_LIST_T mih_supported_link_command_list;
MIH_C_LINK_EVENT_LIST_T mih_subscribe_req_event_list;
LIST(MIH_C_LINK_CFG_PARAM, mih_link_cfg_param_thresholds);
// to tell what are the configured thresholds in mih_link_cfg_param_thresholds_list
MIH_C_BOOLEAN_T active_mih_link_cfg_param_threshold[MIH_C_LINK_CFG_PARAM_LIST_LENGTH];
MIH_C_LINK_AC_TYPE_T pending_req_action;
MIH_C_STATUS_T pending_req_status;
MIH_C_LINK_AC_RESULT_T pending_req_ac_result;
MIH_C_TRANSACTION_ID_T pending_req_transaction_id;
char buffer[800];
};
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
extern struct ral_lte_priv *ralpriv;
//extern struct ral_lte_priv *ralpriv;
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......
......@@ -9,9 +9,10 @@
#ifndef __RRC_DTYPES_H__
#define __RRC_DTYPES_H__
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
# error "Remove inclusion"
//typedef unsigned char u8;
//typedef unsigned short u16;
//typedef unsigned int u32;
#endif
......@@ -27,14 +27,14 @@ CFLAGS += -I$(NAS_DIR) -I$(RRC_DIR)
LDFLAGS = -L$(INTERFACE_DIR)/LIB -lmih_c-802.21 -lrt
ERAL_OBJS += $(SRC_DIR)/lteRALenb_main.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_mih_msg.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_rrc_msg.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_thresholds.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_parameters.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_action.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_subscribe.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_ioctl.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_process.o
ERAL_OBJS += $(SRC_DIR)/lteRALenb_main.o
OBJS = $(ERAL_OBJS)
......
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_action.c
* Source eRAL_action.c
*
* Version 0.1
*
......@@ -17,15 +17,12 @@
* Description
*
*****************************************************************************/
#define LTE_RAL_ENB
#define LTE_RAL_ENB_ACTION_C
#include <assert.h>
#include "lteRALenb.h"
#include "lteRALenb_action.h"
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_variables.h"
#include "lteRALenb_constants.h"
#include "lteRALenb_proto.h"
/****************************************************************************/
/******************* G L O C A L D E F I N I T I O N S *****************/
......@@ -50,53 +47,10 @@ static const char* g_link_action_type_str[] = {
#endif
};
static int _eRALlte_action_is_in_progress(MIH_C_STATUS_T* status,
MIH_C_LINK_AC_RESULT_T* ac_status,
MIH_C_LINK_AC_TYPE_T action);
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_flow_attr(void);
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void);
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_deactivate_resources(void);
/*
* ---------------------------------------------------------------------------
* Flow identifier management:
* Radio Bearer data flows are identified by a source address, a destination
* address and a port number for a particular IP transport protocol (UDP,
* TCP). A private data structure is used to map upper-layer flow identifiers
* to lower-layer RB channel identifiers. It is handled by private functions.
* ---------------------------------------------------------------------------
*/
/* Structure of the destination data flow */
struct Data_flow {
unsigned char addr[16]; // IP address
unsigned int l2id[2]; // L2 identifier
unsigned int port; // IP port identifier
int proto; // IP protocol
int cnxid; // Data flow identifier
};
typedef struct {
int n_flows;
#define ACTION_MAX_FLOW ((RAL_MAX_MT)*(RAL_MAX_RB))
struct Data_flow flow [ACTION_MAX_FLOW];
int flow_id [ACTION_MAX_FLOW]; //added TEMP MW 23/05/13
} eRALlte_action_DataFlowList_t;
static eRALlte_action_DataFlowList_t g_flows = {};
static int _eRALlte_action_set_channel_id (MIH_C_FLOW_ID_T* flowId, int cnxid);
static int _eRALlte_action_get_channel_id (MIH_C_FLOW_ID_T* flowId, int* cnxid);
static int _eRALlte_action_del_channel_id (int fix);
#endif // MIH_C_MEDIEVAL_EXTENSIONS
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************
** **
** Name: eRALlte_action_request() **
** Name: eRAL_action_request() **
** **
** Description: Processes the Link_Action.request message and sends a **
** Link_Action.confirm message to the MIHF. **
......@@ -109,7 +63,7 @@ static int _eRALlte_action_del_channel_id (int fix);
** Others: g_link_action **
** **
***************************************************************************/
void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
void eRAL_action_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Action_request_t* msgP)
{
MIH_C_STATUS_T status;
MIH_C_LINK_AC_TYPE_T link_action_type;
......@@ -132,9 +86,9 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
* Link scan operation request - Not supported by the network side:
* No measurements
*/
DEBUG(" ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN: REFUSED\n");
LOG_D(RAL_ENB, " ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN: REFUSED\n");
link_action_result = MIH_C_LINK_AC_RESULT_REFUSED;
eRALlte_send_link_action_confirm(&msgP->header.transaction_id,
eRAL_send_link_action_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL,
&link_action_result);
......@@ -146,9 +100,9 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
* Link resource retain operation request - Not supported by the
* network side.
*/
DEBUG(" ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN: REFUSED\n");
LOG_D(RAL_ENB, " ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN: REFUSED\n");
link_action_result = MIH_C_LINK_AC_RESULT_REFUSED;
eRALlte_send_link_action_confirm(&msgP->header.transaction_id,
eRAL_send_link_action_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL,
&link_action_result);
......@@ -159,9 +113,9 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
/*
* Data forward operation request - Not supported by the network side.
*/
DEBUG(" ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_DATA_FWD_REQ: REFUSED\n");
LOG_D(RAL_ENB, " ACTION ATTRIBUTE MIH_C_BIT_LINK_AC_ATTR_DATA_FWD_REQ: REFUSED\n");
link_action_result = MIH_C_LINK_AC_RESULT_REFUSED;
eRALlte_send_link_action_confirm(&msgP->header.transaction_id,
eRAL_send_link_action_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL,
&link_action_result);
......@@ -173,20 +127,20 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
* Requested actions that are not supported or currently in progress
* are refused.
*/
if (_eRALlte_action_is_in_progress(&status,
if (eRAL_action_is_in_progress(instanceP, &status,
&link_action_result,
link_action_type))
{
DEBUG(" Link action request %s is not supported or currently in progress\n", g_link_action_type_str[link_action_type]);
LOG_D(RAL_ENB, " Link action request %s is not supported or currently in progress\n", g_link_action_type_str[link_action_type]);
}
else
{
DEBUG(" %s ACTION REQUESTED: %s\n", __FUNCTION__, g_link_action_type_str[link_action_type]);
LOG_D(RAL_ENB, " %s ACTION REQUESTED: %s\n", __FUNCTION__, g_link_action_type_str[link_action_type]);
switch (link_action_type)
{
case MIH_C_LINK_AC_TYPE_NONE:
DEBUG(" NO ACTION\n");
LOG_D(RAL_ENB, " NO ACTION\n");
break;
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
......@@ -195,7 +149,7 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
* Provide the mark and multicast configuration to be set up
* for the data flow
*/
ralpriv->pending_req_ac_result = _eRALlte_action_link_flow_attr();
g_enb_ral_obj[instanceP].pending_req_ac_result = eRAL_action_link_flow_attr(instanceP);
link_action_done = 1;
break;
......@@ -203,7 +157,7 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
/*
* Configure and activate a data flow
*/
ralpriv->pending_req_ac_result = _eRALlte_action_link_activate_resources();
g_enb_ral_obj[instanceP].pending_req_ac_result = eRAL_action_link_activate_resources(instanceP);
link_action_done = 1;
break;
......@@ -211,7 +165,7 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
/*
* Deactivate a previously activated data flow
*/
ralpriv->pending_req_ac_result = _eRALlte_action_link_deactivate_resources();
g_enb_ral_obj[instanceP].pending_req_ac_result = eRAL_action_link_deactivate_resources(instanceP);
link_action_done = 1;
break;
#endif // MIH_C_MEDIEVAL_EXTENSIONS
......@@ -236,12 +190,12 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
* For UMTS link type, power up lower layers and establish
* PDP context - Not supported by the network side
*/
DEBUG(" REFUSED\n");
LOG_D(RAL_ENB, " REFUSED\n");
link_action_result = MIH_C_LINK_AC_RESULT_REFUSED;
break;
default:
ERR(" %s Invalid LinkAction.link_ac_type %d\n",
LOG_E(RAL_ENB, "%s Invalid LinkAction.link_ac_type %d\n",
__FUNCTION__, link_action_type);
status = MIH_C_STATUS_UNSPECIFIED_FAILURE;
}
......@@ -249,32 +203,32 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
/* Return link action confirmation to the MIH-F */
if (link_action_done) {
ralpriv->pending_req_transaction_id = msgP->header.transaction_id;
ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
eRALlte_send_link_action_confirm(&ralpriv->pending_req_transaction_id,
&ralpriv->pending_req_status,
g_enb_ral_obj[instanceP].pending_req_transaction_id = msgP->header.transaction_id;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_SUCCESS;
eRAL_send_link_action_confirm(instanceP, &g_enb_ral_obj[instanceP].pending_req_transaction_id,
&g_enb_ral_obj[instanceP].pending_req_status,
NULL,
&ralpriv->pending_req_ac_result);
&g_enb_ral_obj[instanceP].pending_req_ac_result);
}
else if (status == MIH_C_STATUS_SUCCESS) {
eRALlte_send_link_action_confirm(&msgP->header.transaction_id,
eRAL_send_link_action_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL,
&link_action_result);
}
else {
eRALlte_send_link_action_confirm(&msgP->header.transaction_id,
eRAL_send_link_action_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL,
NULL);
}
ralpriv->pending_req_action = 0;
g_enb_ral_obj[instanceP].pending_req_action = 0;
}
/****************************************************************************
** **
** Name: eRALlte_action_save_flow_id() **
** Name: eRAL_action_save_flow_id() **
** **
** Description: Save connection identifier and data of the specified data **
** flow into the list of active data flows. **
......@@ -290,8 +244,8 @@ void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* msgP)
** Others: None **
** **
***************************************************************************/
extern int eRALlte_action_save_flow_id(MIH_C_FLOW_ID_T* flowId, int cnxid){
return _eRALlte_action_set_channel_id(flowId, cnxid);
int eRAL_action_save_flow_id(ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int cnxid){
return eRAL_action_set_channel_id(instanceP, flowId, cnxid);
}
/****************************************************************************/
......@@ -299,7 +253,7 @@ extern int eRALlte_action_save_flow_id(MIH_C_FLOW_ID_T* flowId, int cnxid){
/****************************************************************************/
/****************************************************************************
** Name: eRALlte_action_set_channel_id() **
** Name: eRAL_action_set_channel_id() **
** **
** Description: Set the Connection identifier and store data of the **
** specified data flow in the list of active data flows. **
......@@ -310,7 +264,7 @@ extern int eRALlte_action_save_flow_id(MIH_C_FLOW_ID_T* flowId, int cnxid){
** the list of active data flows. **
** -1 if the list is full. **
***************************************************************************/
static int _eRALlte_action_set_channel_id (MIH_C_FLOW_ID_T* flowId, int cnxid){
int eRAL_action_set_channel_id (ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int cnxid){
char addr[128];
//char port[8];
int f_ix;
......@@ -320,17 +274,18 @@ static int _eRALlte_action_set_channel_id (MIH_C_FLOW_ID_T* flowId, int cnxid){
for (f_ix = 0; f_ix < ACTION_MAX_FLOW; f_ix++) {
if (g_flows.flow[f_ix].cnxid > 0) continue;
g_flows.flow[f_ix].cnxid = cnxid;
g_flows.flow_id[f_ix] = (int) flowId;
g_flows.flow_id[f_ix] = (int)flowId;
g_flows.n_flows += 1;
// Modified Michelle
memcpy((char*)&(DestIpv6Addr[0][16]), addr, 16);
eRALlte_process_mt_addr_to_l2id(&g_flows.flow[f_ix].addr[8],
#warning "TO DO DestIpv6Addr ?"
//memcpy((char*)&(DestIpv6Addr[0][16]), addr, 16);
eRAL_process_mt_addr_to_l2id(&g_flows.flow[f_ix].addr[8],
&g_flows.flow[f_ix].l2id[0]);
/* MIH_C_TRANSPORT_ADDR_VALUE2String(&flowId->dest_addr.ip_addr.address, addr);
/* MIH_C_TRANSPORT_ADDR_VALUE2String(&flowId->dest_addr.ip_addr.address, addr);
memcpy((char*)&(g_flows.flow[f_ix].addr), addr, 16);
eRALlte_process_mt_addr_to_l2id(&g_flows.flow[f_ix].addr[8],
eRAL_process_mt_addr_to_l2id(&g_flows.flow[f_ix].addr[8],
&g_flows.flow[f_ix].l2id[0]);
MIH_C_PORT2String(&flowId->dest_addr.port, port);
g_flows.flow[f_ix].port = strtol(port, (char**) NULL, 16);
......@@ -341,7 +296,7 @@ static int _eRALlte_action_set_channel_id (MIH_C_FLOW_ID_T* flowId, int cnxid){
}
/****************************************************************************
** Name: eRALlte_action_get_channel_id() **
** Name: eRAL_action_get_channel_id() **
** **
** Description: Returns the Connection identifier of the specified data **
** flow. **
......@@ -355,18 +310,18 @@ static int _eRALlte_action_set_channel_id (MIH_C_FLOW_ID_T* flowId, int cnxid){
** for the specified data flow. **
** Others: None **
***************************************************************************/
static int _eRALlte_action_get_channel_id (MIH_C_FLOW_ID_T* flowId, int* cnxid){
int eRAL_action_get_channel_id (ral_enb_instance_t instanceP, MIH_C_FLOW_ID_T* flowId, int* cnxid){
//char addr[128];
//char port[8];
//unsigned int dp;
int f_ix;
// MIH_C_TRANSPORT_ADDR_VALUE2String(&flowId->dest_addr.ip_addr.address, addr);
// MIH_C_PORT2String(&flowId->dest_addr.port, port);
// dp = strtol(port, (char**) NULL, 16);
// MIH_C_TRANSPORT_ADDR_VALUE2String(&flowId->dest_addr.ip_addr.address, addr);
// MIH_C_PORT2String(&flowId->dest_addr.port, port);
// dp = strtol(port, (char**) NULL, 16);
for (f_ix = 0; f_ix < ACTION_MAX_FLOW; f_ix++) {
/* if (!eRALlte_process_cmp_mt_addr((const char*)addr, (const char*)g_flows.flow[f_ix].l2id)) continue;
/* if (!eRAL_process_cmp_mt_addr((const char*)addr, (const char*)g_flows.flow[f_ix].l2id)) continue;
if (g_flows.flow[f_ix].port != dp) continue;
if (g_flows.flow[f_ix].proto != flowId->transport_protocol) continue;*/
if (g_flows.flow_id[f_ix] != *flowId) continue;
......@@ -378,7 +333,7 @@ static int _eRALlte_action_get_channel_id (MIH_C_FLOW_ID_T* flowId, int* cnxid){
/****************************************************************************
** **
** Name: eRALlte_action_del_channel_id() **
** Name: eRAL_action_del_channel_id() **
** **
** Description: Remove the data flow stored at the specified index in the **
** list of active data flows. **
......@@ -394,7 +349,7 @@ static int _eRALlte_action_get_channel_id (MIH_C_FLOW_ID_T* flowId, int* cnxid){
** Others: None **
** **
***************************************************************************/
static int _eRALlte_action_del_channel_id (int fix)
int eRAL_action_del_channel_id (ral_enb_instance_t instanceP, int fix)
{
if (fix < ACTION_MAX_FLOW) {
g_flows.n_flows -= 1;
......@@ -406,7 +361,7 @@ static int _eRALlte_action_del_channel_id (int fix)
/****************************************************************************
** **
** Name: _eRALlte_action_is_in_progress() **
** Name: eRAL_action_is_in_progress() **
** **
** Description: Checks if an action request is supported and whether it **
** is currently in progress. **
......@@ -422,22 +377,22 @@ static int _eRALlte_action_del_channel_id (int fix)
** Others: None **
** **
***************************************************************************/
static int _eRALlte_action_is_in_progress(MIH_C_STATUS_T* status,
int eRAL_action_is_in_progress(ral_enb_instance_t instanceP, MIH_C_STATUS_T* status,
MIH_C_LINK_AC_RESULT_T* ac_status,
MIH_C_LINK_AC_TYPE_T action)
{
/* Check whether the action link command is supported */
if (!(ralpriv->mih_supported_link_command_list & MIH_C_BIT_LINK_ACTION)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_ACTION)) {
*status = MIH_C_STATUS_REJECTED;
return 1;
}
*status = MIH_C_STATUS_SUCCESS;
/* Check whether the action request is supported */
if (ralpriv->mih_supported_link_action_list & (1 << action))
if (g_enb_ral_obj[instanceP].mih_supported_link_action_list & (1 << action))
{
/* Check whether another action request is currently in progress */
if ((ralpriv->pending_req_action) && (ralpriv->pending_req_action != action))
if ((g_enb_ral_obj[instanceP].pending_req_action) && (g_enb_ral_obj[instanceP].pending_req_action != action))
{
/* Another action request is in progress:
* Do not process new request before completion of this one */
......@@ -458,7 +413,7 @@ static int _eRALlte_action_is_in_progress(MIH_C_STATUS_T* status,
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
/****************************************************************************
** **
** Name: _eRALlte_action_link_flow_attr() **
** Name: eRAL_action_link_flow_attr() **
** **
** Description: Processes the link flow attribut action request. **
** **
......@@ -471,7 +426,7 @@ static int _eRALlte_action_is_in_progress(MIH_C_STATUS_T* status,
** Others: ralpriv **
** **
***************************************************************************/
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_flow_attr(void)
MIH_C_LINK_AC_RESULT_T eRAL_action_link_flow_attr(ral_enb_instance_t instanceP)
//TODO
{
MIH_C_FLOW_ATTRIBUTE_T *flow = &g_link_action.link_ac_param._union.flow_attribute;
......@@ -479,42 +434,42 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_flow_attr(void)
int cnxid;
/* Get the connection identifier */
f_ix = _eRALlte_action_get_channel_id(&flow->flow_id, &cnxid);
f_ix = eRAL_action_get_channel_id(instanceP, &flow->flow_id, &cnxid);
if (f_ix < 0) {
DEBUG(" No RB allocated for this data flow\n");
LOG_D(RAL_ENB, " No RB allocated for this data flow\n");
return MIH_C_LINK_AC_RESULT_REFUSED;
}
/* Get MT and RB channel identifiers */
if (eRALlte_process_find_channel(cnxid, &mt_ix, &ch_ix) != 0) {
if (eRAL_process_find_channel(instanceP, cnxid, &mt_ix, &ch_ix) != 0) {
/* Unicast data flow */
DEBUG (" %s: Unicast MT's address = %s\n", __FUNCTION__,
eRALlte_process_mt_addr_to_string(ralpriv->mt[mt_ix].ipv6_addr));
LOG_D(RAL_ENB, " %s: Unicast MT's address = %s\n", __FUNCTION__,
eRAL_process_mt_addr_to_string(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_addr));
}
else {
/* Multicast data flow */
DEBUG (" %s: Multicast MT's address = %s\n", __FUNCTION__,
eRALlte_process_mt_addr_to_string(ralpriv->mcast.mc_group_addr));
LOG_D(RAL_ENB, " %s: Multicast MT's address = %s\n", __FUNCTION__,
eRAL_process_mt_addr_to_string(g_enb_ral_obj[instanceP].mcast.mc_group_addr));
}
if (flow->choice_mark_qos) {
DEBUG(" Mark QoS enabled\n");
LOG_D(RAL_ENB, " Mark QoS enabled\n");
//TODO ???
}
if (flow->choice_mark_drop_eligibility) {
DEBUG(" Mark drop eligibility enabled\n");
LOG_D(RAL_ENB, " Mark drop eligibility enabled\n");
//TODO ???
}
/* Link action successfully processed */
ralpriv->pending_req_action = MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR;
g_enb_ral_obj[instanceP].pending_req_action = MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR;
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
/****************************************************************************
** **
** Name: _eRALlte_action_link_activate_resources() **
** Name: eRAL_action_link_activate_resources() **
** **
** Description: Processes the link activate resource action request. **
** **
......@@ -527,8 +482,8 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_flow_attr(void)
** Others: ralpriv **
** **
***************************************************************************/
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
//---------------------------------------------------------------------------
MIH_C_LINK_AC_RESULT_T eRAL_action_link_activate_resources(ral_enb_instance_t instanceP){
//---------------------------------------------------------------------------
MIH_C_RESOURCE_DESC_T *res = &g_link_action.link_ac_param._union.resource_desc;
MIH_C_COS_T classIdDL = 0;
MIH_C_COS_T classIdUL = 0;
......@@ -569,10 +524,10 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
//int len = MIH_C_TRANSPORT_ADDR_VALUE2String(&DestIpv6Addr[0][16], mt_addr);
if ( (len > 0) && (len < 128)) {
DEBUG (" %s: MT's address = %s\n", __FUNCTION__, eRALlte_process_mt_addr_to_string((unsigned char*)mt_addr));
LOG_D(RAL_ENB, " %s: MT's address = %s\n", __FUNCTION__, eRAL_process_mt_addr_to_string((unsigned char*)mt_addr));
}
else {
ERR (" %s : IP Address is NOT valid (len=%d)\n", __FUNCTION__, len);
LOG_E(RAL_ENB, "%s : IP Address is NOT valid (len=%d)\n", __FUNCTION__, len);
return MIH_C_LINK_AC_RESULT_FAILURE;
}
......@@ -583,19 +538,19 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
int len = MIH_C_LINK_ADDR2String(&res->link_id.link_addr, link_addr);
if ( (len > 0) && (len <= 128) ) {
int i;
DEBUG (" %s : Link address = %s\n", __FUNCTION__, link_addr);
LOG_D(RAL_ENB, " %s : Link address = %s\n", __FUNCTION__, link_addr);
for (i=0; i < len; i++) {
if (link_addr[i] == '=') break;
}
strncpy(mt_addr, &link_addr[i+2], 16);
DEBUG (" %s : MT address = %s\n", __FUNCTION__, mt_addr);
LOG_D(RAL_ENB, " %s : MT address = %s\n", __FUNCTION__, mt_addr);
} else {
ERR (" %s : Link address is NOT valid (len=%d)\n", __FUNCTION__, len);
LOG_E(RAL_ENB, "%s : Link address is NOT valid (len=%d)\n", __FUNCTION__, len);
return MIH_C_LINK_AC_RESULT_FAILURE;
}
}
else {
ERR (" %s : Link address is NOT valid (type=%d, not 3GPP_3G_CELL_ID)\n",
LOG_E(RAL_ENB, "%s : Link address is NOT valid (type=%d, not 3GPP_3G_CELL_ID)\n",
__FUNCTION__, res->link_id.link_addr.choice);
return MIH_C_LINK_AC_RESULT_FAILURE;
}
......@@ -610,30 +565,30 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
int cnxid;
/* Get the connection identifier */
f_ix = _eRALlte_action_get_channel_id(&res->flow_id, &cnxid);
f_ix = eRAL_action_get_channel_id(instanceP, &res->flow_id, &cnxid);
if (f_ix != -1) {
/* Get MT and RB channel identifiers */
if (eRALlte_process_find_channel(cnxid, &mt_ix, &ch_ix) != 0) {
if (eRAL_process_find_channel(instanceP, cnxid, &mt_ix, &ch_ix) != 0) {
/* Unicast data flow */
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
} else {
/* Multicast data flow */
assert(multicast == MIH_C_BOOLEAN_TRUE);
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
}
if (currChannel->status == RB_CONNECTED) {
//if (currChannel->status == NAS_CONNECTED) {
/* The resource is already in the required state */
DEBUG(" Link action ACTIVATE_RESOURCES requested while link resource is ALREADY activated\n");
LOG_D(RAL_ENB, " Link action ACTIVATE_RESOURCES requested while link resource is ALREADY activated\n");
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
/* The resource is not in the required state:
* Remove the connection identifier from the list of active resources
* and process the action request again. */
DEBUG(" Resource has been activated but is not in the ACTIVE state\n");
(void) _eRALlte_action_del_channel_id(f_ix);
LOG_D(RAL_ENB, " Resource has been activated but is not in the ACTIVE state\n");
(void) eRAL_action_del_channel_id(instanceP, f_ix);
}
MIH_C_LINK_TUPLE_ID_T *ltid;
......@@ -645,48 +600,48 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
*/
mt_ix = RAL_MAX_MT;
ch_ix = 0;
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
currChannel->cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+1;
currChannel->rbId = RAL_DEFAULT_RAB_ID;
currChannel->multicast = 1;
memcpy((char*)&(ralpriv->mcast.mc_group_addr), mt_addr, 16);
ltid = &(ralpriv->mcast.ltid);
memcpy((char*)&(g_enb_ral_obj[instanceP].mcast.mc_group_addr), mt_addr, 16);
ltid = &(g_enb_ral_obj[instanceP].mcast.ltid);
}
else {
/*
* Unicast data flow
*/
/* Get the list of MTs waiting for RB establishment */
#ifdef RAL_REALTIME
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST, 0, 0);
RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST, 0, 0);
#endif
#ifdef RAL_REALTIME
// LG RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST, 0, 0);
// LG RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST, 0, 0);
#endif
/* Check if the MT is in the list */
mt_ix = eRALlte_process_find_mt_by_addr(mt_addr);
mt_ix = eRAL_process_find_mt_by_addr(instanceP, mt_addr);
if ( (mt_ix < RAL_MAX_MT) &&
(ralpriv->mt[mt_ix].mt_state == RB_CONNECTED)) {
(g_enb_ral_obj[instanceP].mt[mt_ix].mt_state == RB_CONNECTED)) {
/* The MT is ready for RB establishment */
ch_ix = eRALlte_process_find_new_channel(mt_ix);
ch_ix = eRAL_process_find_new_channel(instanceP, mt_ix);
if (ch_ix == RAL_MAX_RB) {
DEBUG(" No RB available in MT\n");
LOG_D(RAL_ENB, " No RB available in MT\n");
return MIH_C_LINK_AC_RESULT_REFUSED;
}
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
currChannel->cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
currChannel->rbId = RAL_DEFAULT_RAB_ID + ch_ix;
currChannel->multicast = 0;
DEBUG(" mt_ix %d, ch_ix %d, cnx_id %d, rbId %d\n",
LOG_D(RAL_ENB, " mt_ix %d, ch_ix %d, cnx_id %d, rbId %d\n",
mt_ix, ch_ix, currChannel->cnx_id, currChannel->rbId);
memcpy((char *)&(ralpriv->mt[mt_ix].ipv6_addr), mt_addr, 16);
ltid = &(ralpriv->mt[mt_ix].ltid);
memcpy((char *)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_addr), mt_addr, 16);
ltid = &(g_enb_ral_obj[instanceP].mt[mt_ix].ltid);
}
else {
/* The MT is NOT ready for RB establishment */
is_ready_for_rb_establish = 0;
int qos_is_valid = 0;
DEBUG(" Mobile Terminal not ready - Storing request data\n");
LOG_D(RAL_ENB, " Mobile Terminal not ready - Storing request data\n");
/* Check validity of QoS parameters */
if ( (classIdDL < 64) && (classIdUL < 64) ) {
if ( (resBitrateDL <= RAL_BITRATE_320k)
......@@ -700,20 +655,20 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
}
}
if (qos_is_valid) {
DEBUG(" Received QoS parameters are valid\n");
LOG_D(RAL_ENB, " Received QoS parameters are valid\n");
} else {
DEBUG(" Received QoS parameters are NOT valid - Request will be rejected\n");
LOG_D(RAL_ENB, " Received QoS parameters are NOT valid - Request will be rejected\n");
return MIH_C_LINK_AC_RESULT_REFUSED;
}
currChannel = &(ralpriv->pending_mt.radio_channel[0]);
currChannel = &(g_enb_ral_obj[instanceP].pending_mt.radio_channel[0]);
currChannel->cnx_id = 0;
currChannel->rbId = 0;
currChannel->multicast = 0;
memcpy((char *)&(ralpriv->pending_mt.ipv6_addr), mt_addr, 16);
memcpy((char *)&(g_enb_ral_obj[instanceP].pending_mt.ipv6_addr), mt_addr, 16);
ltid = &(ralpriv->pending_mt.ltid);
ralpriv->pending_req_flag = 1;
ltid = &(g_enb_ral_obj[instanceP].pending_mt.ltid);
g_enb_ral_obj[instanceP].pending_req_flag = 1;
} /* end MT not ready */
......@@ -721,16 +676,16 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
/* Save the current data flow identifier into the list of active data flows */
if (currChannel->cnx_id != 0) {
f_ix = _eRALlte_action_set_channel_id(&res->flow_id, currChannel->cnx_id);
f_ix = eRAL_action_set_channel_id(instanceP, &res->flow_id, currChannel->cnx_id);
if (f_ix < 0) {
DEBUG(" No RB available\n");
LOG_D(RAL_ENB, " No RB available\n");
return MIH_C_LINK_AC_RESULT_REFUSED;
}
}
else {
/* The current request is pending waiting for RB establishment */
f_ix = 0;
ralpriv->pending_req_fid = res->flow_id;
g_enb_ral_obj[instanceP].pending_req_fid = res->flow_id;
}
/*
* Store resource parameters
......@@ -746,7 +701,7 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
//currChannel->bktDepth[i] = p->qos.value[i].tspec.bucketDepth;
//currChannel->pkBitrate[i] = p->qos.value[i].tspec.peakBitrate;
//currChannel->MTU[i] = p->qos.value[i].tspec.maximumTransmissionUnit;
DEBUG(" qos value : DIR %d, flowId %d, classId %d, resBitrate %.1f\n", i , currChannel->flowId[i], currChannel->classId[i], currChannel->resBitrate[i]);
LOG_D(RAL_ENB, " qos value : DIR %d, flowId %d, classId %d, resBitrate %.1f\n", i , currChannel->flowId[i], currChannel->classId[i], currChannel->resBitrate[i]);
}
/* Store the link identifier */
ltid->link_id = res->link_id;
......@@ -759,15 +714,15 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
*/
if (is_ready_for_rb_establish) {
/* Map QoS */
int mapping_result = eRALlte_process_map_qos(mt_ix, ch_ix);
int mapping_result = eRAL_process_map_qos(instanceP, mt_ix, ch_ix);
if (mapping_result) {
int rc;
#ifdef RAL_DUMMY
rc = eRALlte_NAS_send_rb_establish_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_ADD, mt_ix, ch_ix);
#endif
#ifdef RAL_DUMMY
rc = eRAL_NAS_send_rb_establish_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
// LG rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_ADD, mt_ix, ch_ix);
#endif
if (rc < 0) {
/* Failed to send RB establishment request */
return MIH_C_LINK_AC_RESULT_FAILURE;
......@@ -781,21 +736,21 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
/* Wait for MT coming ready;
* re-try to establish RB upon timer expiration */
#ifdef RAL_DUMMY
ralpriv->pending_mt_timer = 5;
g_enb_ral_obj[instanceP].pending_mt_timer = 5;
#endif
#ifdef RAL_REALTIME
ralpriv->pending_mt_timer = 300;
g_enb_ral_obj[instanceP].pending_mt_timer = 300;
#endif
}
/* Link action successfully processed */
ralpriv->pending_req_action = MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES;
g_enb_ral_obj[instanceP].pending_req_action = MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES;
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
/****************************************************************************
** **
** Name: _eRALlte_action_link_deactivate_resources() **
** Name: eRAL_action_link_deactivate_resources() **
** **
** Description: Processes the link deactivate resource action request. **
** **
......@@ -808,7 +763,7 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_activate_resources(void){
** Others: ralpriv **
** **
***************************************************************************/
static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_deactivate_resources(void)
MIH_C_LINK_AC_RESULT_T eRAL_action_link_deactivate_resources(ral_enb_instance_t instanceP)
{
MIH_C_RESOURCE_DESC_T *res = &g_link_action.link_ac_param._union.resource_desc;
struct ral_lte_channel *currChannel;
......@@ -816,43 +771,43 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_deactivate_resources(void)
int cnxid;
/* Get the connection identifier */
f_ix = _eRALlte_action_get_channel_id(&res->flow_id, &cnxid);
f_ix = eRAL_action_get_channel_id(instanceP, &res->flow_id, &cnxid);
if (f_ix < 0) {
DEBUG(" Link action DEACTIVATE_RESOURCES requested while link resource is NOT activated\n");
LOG_D(RAL_ENB, " Link action DEACTIVATE_RESOURCES requested while link resource is NOT activated\n");
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
/* Get MT and RB channel identifiers */
if (eRALlte_process_find_channel(cnxid, &mt_ix, &ch_ix) != 0) {
if (eRAL_process_find_channel(instanceP, cnxid, &mt_ix, &ch_ix) != 0) {
/* Unicast data flow */
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
DEBUG (" %s: Unicast MT's address = %s\n", __FUNCTION__,
eRALlte_process_mt_addr_to_string(ralpriv->mt[mt_ix].ipv6_addr));
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
LOG_D(RAL_ENB, " %s: Unicast MT's address = %s\n", __FUNCTION__,
eRAL_process_mt_addr_to_string(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_addr));
}
else {
/* Multicast data flow */
currChannel = &(ralpriv->mcast.radio_channel);
DEBUG (" %s: Multicast MT's address = %s\n", __FUNCTION__,
eRALlte_process_mt_addr_to_string(ralpriv->mcast.mc_group_addr));
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
LOG_D(RAL_ENB, " %s: Multicast MT's address = %s\n", __FUNCTION__,
eRAL_process_mt_addr_to_string(g_enb_ral_obj[instanceP].mcast.mc_group_addr));
}
if (currChannel->status == NAS_DISCONNECTED) {
/* The resource is already in the required state */
DEBUG(" Link action request DEACTIVATE_RESOURCES is currently in progress\n");
LOG_D(RAL_ENB, " Link action request DEACTIVATE_RESOURCES is currently in progress\n");
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
/* The resource is not in the required state:
* Remove the connection identifier from the list of active resources
* and go ahead in the request processing. */
(void) _eRALlte_action_del_channel_id(f_ix);
(void) eRAL_action_del_channel_id(instanceP, f_ix);
int rc;
#ifdef RAL_DUMMY
rc = eRALlte_NAS_send_rb_release_request(mt_ix, ch_ix);
rc = eRAL_NAS_send_rb_release_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_DEL, mt_ix, ch_ix);
// LG rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_DEL, mt_ix, ch_ix);
#endif
if (rc < 0) {
......@@ -861,7 +816,7 @@ static MIH_C_LINK_AC_RESULT_T _eRALlte_action_link_deactivate_resources(void)
}
/* Link action successfully processed */
ralpriv->pending_req_action = MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES;
g_enb_ral_obj[instanceP].pending_req_action = MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES;
return MIH_C_LINK_AC_RESULT_SUCCESS;
}
......
......@@ -33,7 +33,7 @@
* \company EURECOM
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
/*******************************************************************************
#include <sys/ioctl.h>
#include <string.h>
#include <stdio.h>
......@@ -49,9 +49,9 @@
#include "rrc_d_types.h"
//-----------------------------------------------------------------------------
// LTE AS sub-system
#include "rrc_nas_primitives.h"
#include "nasrg_constant.h"
#include "nasrg_iocontrol.h"
//#include "rrc_nas_primitives.h"
//#include "nasrg_constant.h"
//#include "nasrg_iocontrol.h"
//-----------------------------------------------------------------------------
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_constants.h"
......@@ -69,19 +69,19 @@ extern int init_flag;
void print_state(u8 state){
//---------------------------------------------------------------------------
switch(state){
case NAS_IDLE:DEBUG("NAS_IDLE\n");return;
case NAS_CX_FACH:DEBUG("NAS_CX_FACH\n");return;
case NAS_CX_DCH:DEBUG("NAS_CX_DCH\n");return;
case NAS_CX_RECEIVED:DEBUG("NAS_CX_RECEIVED\n");return;
case NAS_CX_CONNECTING:DEBUG("NAS_CX_CONNECTING\n");return;
case NAS_CX_RELEASING:DEBUG("NAS_CX_RELEASING\n");return;
case NAS_CX_CONNECTING_FAILURE:DEBUG("NAS_CX_CONNECTING_FAILURE\n");return;
case NAS_CX_RELEASING_FAILURE:DEBUG("NAS_CX_RELEASING_FAILURE\n");return;
case NAS_RB_ESTABLISHING:DEBUG("NAS_RB_ESTABLISHING\n");return;
case NAS_RB_RELEASING:DEBUG("NAS_RB_RELEASING\n");return;
case NAS_RB_ESTABLISHED:DEBUG("NAS_RB_ESTABLISHED\n");return;
default: ERR(" Unknown state\n");
case NAS_IDLE:printf("NAS_IDLE\n");return;
case NAS_CX_FACH:printf("NAS_CX_FACH\n");return;
case NAS_CX_DCH:printf("NAS_CX_DCH\n");return;
case NAS_CX_RECEIVED:printf("NAS_CX_RECEIVED\n");return;
case NAS_CX_CONNECTING:printf("NAS_CX_CONNECTING\n");return;
case NAS_CX_RELEASING:printf("NAS_CX_RELEASING\n");return;
case NAS_CX_CONNECTING_FAILURE:printf("NAS_CX_CONNECTING_FAILURE\n");return;
case NAS_CX_RELEASING_FAILURE:printf("NAS_CX_RELEASING_FAILURE\n");return;
case NAS_RB_ESTABLISHING:printf("NAS_RB_ESTABLISHING\n");return;
case NAS_RB_RELEASING:printf("NAS_RB_RELEASING\n");return;
case NAS_RB_ESTABLISHED:printf("NAS_RB_ESTABLISHED\n");return;
default: printf(" Unknown state\n");
}
}
......@@ -91,32 +91,32 @@ void RAL_NASinitMTlist(u8 *msgrep, int num_mts){
int mt_ix, ch_ix;
struct nas_msg_cx_list_reply *list;
memcpy(ralpriv->plmn, DefaultPLMN, DEFAULT_PLMN_SIZE); // DUMMY
memcpy(g_enb_ral_obj[instanceP].plmn, DefaultPLMN, DEFAULT_PLMN_SIZE); // DUMMY
list=(struct nas_msg_cx_list_reply *)(msgrep+1);
num_mts = msgrep[0];
for(mt_ix=0; mt_ix<num_mts; ++mt_ix){
if (list[mt_ix].state != NAS_IDLE){
ralpriv->curr_cellId = list[mt_ix].cellid;
ralpriv->mt[mt_ix].ue_id = list[mt_ix].lcr;
ralpriv->mt[mt_ix].ipv6_l2id[0]= list[mt_ix].iid6[0];
ralpriv->mt[mt_ix].ipv6_l2id[1]= list[mt_ix].iid6[1];
ralpriv->mt[mt_ix].num_rbs = list[mt_ix].num_rb;
ralpriv->mt[mt_ix].num_class = list[mt_ix].nsclassifier;
ralpriv->mt[mt_ix].nas_state = list[mt_ix].state;
if (ralpriv->mt[mt_ix].num_class>=2)
ralpriv->mt[mt_ix].mt_state= NAS_CONNECTED;
g_enb_ral_obj[instanceP].cell_id = list[mt_ix].cellid;
g_enb_ral_obj[instanceP].mt[mt_ix].ue_id = list[mt_ix].lcr;
g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]= list[mt_ix].iid6[0];
g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[1]= list[mt_ix].iid6[1];
g_enb_ral_obj[instanceP].mt[mt_ix].num_rbs = list[mt_ix].num_rb;
g_enb_ral_obj[instanceP].mt[mt_ix].num_class = list[mt_ix].nsclassifier;
g_enb_ral_obj[instanceP].mt[mt_ix].nas_state = list[mt_ix].state;
if (g_enb_ral_obj[instanceP].mt[mt_ix].num_class>=2)
g_enb_ral_obj[instanceP].mt[mt_ix].mt_state= NAS_CONNECTED;
// enter default rb
ch_ix = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].rbId = RAL_DEFAULT_MC_RAB_ID+1;
ralpriv->mt[mt_ix].radio_channel[ch_ix].RadioQoSclass = 2;
ralpriv->mt[mt_ix].radio_channel[ch_ix].cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
ralpriv->mt[mt_ix].radio_channel[ch_ix].dscpUL = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].dscpDL = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].nas_state = NAS_CX_DCH;
ralpriv->mt[mt_ix].radio_channel[ch_ix].status = RB_CONNECTED;
ralpriv->num_connected_mts++;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].rbId = RAL_DEFAULT_MC_RAB_ID+1;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].RadioQoSclass = 2;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].dscpUL = 0;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].dscpDL = 0;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].nas_state = NAS_CX_DCH;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].status = RB_CONNECTED;
g_enb_ral_obj[instanceP].num_connected_mts++;
//RAL_printMobileData(mt_ix);
DEBUG(" MT%d initialized : address %d %d\n", mt_ix, ralpriv->mt[mt_ix].ipv6_l2id[0], ralpriv->mt[mt_ix].ipv6_l2id[1]);
DEBUG(" MT%d initialized : address %d %d\n", mt_ix, g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0], g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[1]);
}
}
}
......@@ -136,35 +136,35 @@ void RAL_NASupdatetMTlist(u8 *msgrep, int num_mts){
num_mts = msgrep[0];
for(mt_ix=0; mt_ix<num_mts; ++mt_ix){
// check if MT already known
if ((ralpriv->mt[mt_ix].ipv6_l2id[0]== list[mt_ix].iid6[0])&&
(ralpriv->mt[mt_ix].ipv6_l2id[1]== list[mt_ix].iid6[1])){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]== list[mt_ix].iid6[0])&&
(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[1]== list[mt_ix].iid6[1])){
// MT already known - update
ralpriv->mt[mt_ix].num_rbs = list[mt_ix].num_rb;
previous_num_class = ralpriv->mt[mt_ix].num_class;
ralpriv->mt[mt_ix].num_class = list[mt_ix].nsclassifier;
if (ralpriv->mt[mt_ix].num_class>=2)
ralpriv->mt[mt_ix].mt_state= RB_CONNECTED;
g_enb_ral_obj[instanceP].mt[mt_ix].num_rbs = list[mt_ix].num_rb;
previous_num_class = g_enb_ral_obj[instanceP].mt[mt_ix].num_class;
g_enb_ral_obj[instanceP].mt[mt_ix].num_class = list[mt_ix].nsclassifier;
if (g_enb_ral_obj[instanceP].mt[mt_ix].num_class>=2)
g_enb_ral_obj[instanceP].mt[mt_ix].mt_state= RB_CONNECTED;
//check if state has changed - MT disconnected FFS
if ((ralpriv->mt[mt_ix].nas_state==NAS_CX_DCH)&&(list[mt_ix].state == NAS_IDLE)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].nas_state==NAS_CX_DCH)&&(list[mt_ix].state == NAS_IDLE)){
DEBUG ("\n\n");
DEBUG (" MOBILE TERMINAL %d IS NOW IDLE.\n\n",mt_ix);
// TODO Send linkdown
}
//check if state has changed - MT reconnected FFS
if ((ralpriv->mt[mt_ix].nas_state==NAS_IDLE)&&(list[mt_ix].state == NAS_CX_DCH)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].nas_state==NAS_IDLE)&&(list[mt_ix].state == NAS_CX_DCH)){
DEBUG ("\n\n");
DEBUG (" MOBILE TERMINAL %d WAS IDLE AND IS NOW CONNECTED.\n\n",mt_ix);
}
//check if MT is completely connected
if ((ralpriv->mt[mt_ix].num_class - previous_num_class)&&(list[mt_ix].state == NAS_CX_DCH)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].num_class - previous_num_class)&&(list[mt_ix].state == NAS_CX_DCH)){
DEBUG ("\n\n");
DEBUG (" MOBILE TERMINAL %d IS NOW COMPLETELY CONNECTED.\n\n",mt_ix);
// send linkup: new_ar will contain the address from the MT
new_ar.choice = MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(ralpriv->mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, &ralpriv->mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
//eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, &ralpriv->mt[mt_ix].ltid, NULL, NULL, NULL, NULL);
eRALlte_send_link_up_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
//eRALlte_send_link_up_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid, NULL, NULL, NULL, NULL);
// if RAL realtime and MEASURES are enabled, start the measuring process in RRC+Driver
#ifdef RAL_REALTIME
#ifdef ENABLE_MEDIEVAL_DEMO3
......@@ -174,65 +174,65 @@ void RAL_NASupdatetMTlist(u8 *msgrep, int num_mts){
}
//check enter sleep mode
if ((ralpriv->mt[mt_ix].nas_state==NAS_CX_DCH)&&(list[mt_ix].state == NAS_CX_RELEASING)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].nas_state==NAS_CX_DCH)&&(list[mt_ix].state == NAS_CX_RELEASING)){
DEBUG ("\n\n");
DEBUG (" MOBILE TERMINAL %d is entering sleep mode. Send LinkDown.\n\n",mt_ix);
// send linkdown: old_ar (represented by new_ar variable) will contain the address from the MT
transaction_id = MIH_C_get_new_transaction_id();
reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT;
new_ar.choice = MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(ralpriv->mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_down_indication(&transaction_id, &ralpriv->mt[mt_ix].ltid, &new_ar, &reason_code);
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_down_indication(&transaction_id, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid, &new_ar, &reason_code);
}
// check leave sleep mode
if ((ralpriv->mt[mt_ix].nas_state==NAS_CX_RELEASING)&&(list[mt_ix].state == NAS_CX_DCH)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].nas_state==NAS_CX_RELEASING)&&(list[mt_ix].state == NAS_CX_DCH)){
DEBUG ("\n\n");
DEBUG (" MOBILE TERMINAL %d WAS IN SLEEP MODE AND IS NOW ACTIVATED.\n\n",mt_ix);
// send linkup: new_ar will contain the address from the MT
new_ar.choice = MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(ralpriv->mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, &ralpriv->mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_up_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
}
ralpriv->mt[mt_ix].nas_state = list[mt_ix].state;
g_enb_ral_obj[instanceP].mt[mt_ix].nas_state = list[mt_ix].state;
}else{
// MT unknown or different
if (list[mt_ix].state != NAS_IDLE){
DEBUG ("\n\n");
DEBUG (" NEW TERMINAL %d DETECTED.\n\n",mt_ix);
ralpriv->mt[mt_ix].ue_id = list[mt_ix].lcr;
ralpriv->mt[mt_ix].ipv6_l2id[0]= list[mt_ix].iid6[0];
ralpriv->mt[mt_ix].ipv6_l2id[1]= list[mt_ix].iid6[1];
ralpriv->mt[mt_ix].num_rbs = list[mt_ix].num_rb;
ralpriv->mt[mt_ix].num_class = list[mt_ix].nsclassifier;
g_enb_ral_obj[instanceP].mt[mt_ix].ue_id = list[mt_ix].lcr;
g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]= list[mt_ix].iid6[0];
g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[1]= list[mt_ix].iid6[1];
g_enb_ral_obj[instanceP].mt[mt_ix].num_rbs = list[mt_ix].num_rb;
g_enb_ral_obj[instanceP].mt[mt_ix].num_class = list[mt_ix].nsclassifier;
// initialize ltid (MIH_C_LINK_TUPLE_ID_T) for that mobile
// first version
//ralpriv->mt[mt_ix].ltid.link_id.link_type = MIH_C_WIRELESS_UMTS;
//ralpriv->mt[mt_ix].ltid.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR;
//MIH_C_3GPP_ADDR_set(&ralpriv->mt[mt_ix].ltid.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
//ralpriv->mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR;
//g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_type = MIH_C_WIRELESS_UMTS;
//g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR;
//MIH_C_3GPP_ADDR_set(&g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
//g_enb_ral_obj[instanceP].mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR;
// SECOND Version
ralpriv->mt[mt_ix].ltid.link_id.link_type = MIH_C_WIRELESS_UMTS;
ralpriv->mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
ralpriv->mt[mt_ix].ltid.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_type = MIH_C_WIRELESS_UMTS;
g_enb_ral_obj[instanceP].mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
Bit_Buffer_t *plmn = new_BitBuffer_0();
BitBuffer_wrap(plmn, (unsigned char*) ralpriv->plmn, DEFAULT_PLMN_SIZE);
MIH_C_PLMN_ID_decode(plmn, &ralpriv->mt[mt_ix].ltid.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id);
BitBuffer_wrap(plmn, (unsigned char*) g_enb_ral_obj[instanceP].plmn, DEFAULT_PLMN_SIZE);
MIH_C_PLMN_ID_decode(plmn, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id);
free_BitBuffer(plmn);
ralpriv->mt[mt_ix].ltid.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = ralpriv->curr_cellId;
ralpriv->mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
g_enb_ral_obj[instanceP].mt[mt_ix].ltid.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
g_enb_ral_obj[instanceP].mt[mt_ix].ltid.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
// check state of the UE connection
ralpriv->mt[mt_ix].nas_state = list[mt_ix].state;
if (ralpriv->mt[mt_ix].num_class>=2){
ralpriv->mt[mt_ix].mt_state= RB_CONNECTED;
g_enb_ral_obj[instanceP].mt[mt_ix].nas_state = list[mt_ix].state;
if (g_enb_ral_obj[instanceP].mt[mt_ix].num_class>=2){
g_enb_ral_obj[instanceP].mt[mt_ix].mt_state= RB_CONNECTED;
// send linkup
//ltid = &ralpriv->mt[mt_ix].ltid;
//ltid = &g_enb_ral_obj[instanceP].mt[mt_ix].ltid;
DEBUG (" MOBILE TERMINAL %d IS COMPLETELY CONNECTED.\n\n",mt_ix);
// new_ar will contain the address from the MT
new_ar.choice = MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(ralpriv->mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
MIH_C_3GPP_ADDR_set(&(new_ar._union._3gpp_addr), (u_int8_t*)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, &ralpriv->mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
eRALlte_send_link_up_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, &g_enb_ral_obj[instanceP].mt[mt_ix].ltid, NULL, &new_ar, NULL, NULL);
// if RAL realtime and MEASURES are enabled, start the measuring process in RRC+Driver
#ifdef RAL_REALTIME
#ifdef ENABLE_MEDIEVAL_DEMO3
......@@ -242,14 +242,14 @@ void RAL_NASupdatetMTlist(u8 *msgrep, int num_mts){
}
// enter default rb
ch_ix = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].rbId = RAL_DEFAULT_MC_RAB_ID+1;
ralpriv->mt[mt_ix].radio_channel[ch_ix].RadioQoSclass = 2;
ralpriv->mt[mt_ix].radio_channel[ch_ix].cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
ralpriv->mt[mt_ix].radio_channel[ch_ix].dscpUL = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].dscpDL = 0;
ralpriv->mt[mt_ix].radio_channel[ch_ix].nas_state = NAS_CX_DCH;
ralpriv->mt[mt_ix].radio_channel[ch_ix].status = RB_CONNECTED;
ralpriv->num_connected_mts++;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].rbId = RAL_DEFAULT_MC_RAB_ID+1;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].RadioQoSclass = 2;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].dscpUL = 0;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].dscpDL = 0;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].nas_state = NAS_CX_DCH;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].status = RB_CONNECTED;
g_enb_ral_obj[instanceP].num_connected_mts++;
//RAL_printMobileData(mt_ix);
}
} // end if MT unknonwn
......@@ -259,45 +259,45 @@ void RAL_NASupdatetMTlist(u8 *msgrep, int num_mts){
//---------------------------------------------------------------------------
void RAL_verifyPendingRbStatus(void){
//---------------------------------------------------------------------------
// ralpriv->mcast.radio_channel.status = RB_CONNECTED;
// g_enb_ral_obj[instanceP].mcast.radio_channel.status = RB_CONNECTED;
int mt_ix, ch_ix;
MIH_C_LINK_TUPLE_ID_T* ltid;
//int is_unicast;
mt_ix = ralpriv->pending_req_mt_ix;
ch_ix = ralpriv->pending_req_ch_ix;
mt_ix = g_enb_ral_obj[instanceP].pending_req_mt_ix;
ch_ix = g_enb_ral_obj[instanceP].pending_req_ch_ix;
if ((ralpriv->pending_req_flag)%5==0){
DEBUG("Pending Req Flag %d, Mobile %d, channel %d\n", ralpriv->pending_req_flag, mt_ix, ch_ix);
if (ralpriv->pending_req_multicast == RAL_TRUE){
if ((g_enb_ral_obj[instanceP].pending_req_flag)%5==0){
DEBUG("Pending Req Flag %d, Mobile %d, channel %d\n", g_enb_ral_obj[instanceP].pending_req_flag, mt_ix, ch_ix);
if (g_enb_ral_obj[instanceP].pending_req_multicast == RAL_TRUE){
mt_ix =0;
ch_ix =1;
}
RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST,mt_ix,0);
if ((ralpriv->mt[mt_ix].radio_channel[ch_ix].status == RB_CONNECTED)||((ralpriv->pending_req_flag) > 100)){
if ((g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].status == RB_CONNECTED)||((g_enb_ral_obj[instanceP].pending_req_flag) > 100)){
DEBUG("RAL_verifyPendingRbStatus -in- mt_ix %d - ch_ix %d \n", mt_ix, ch_ix );
// send confirmation to upper layer
ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
if ((ralpriv->pending_req_flag) > 100){
ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_SUCCESS;
if ((g_enb_ral_obj[instanceP].pending_req_flag) > 100){
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_REJECTED;
if (mt_ix == RAL_MAX_MT)
eRALlte_process_clean_channel(&(ralpriv->mcast.radio_channel));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mcast.radio_channel));
else
eRALlte_process_clean_channel(&(ralpriv->mt[mt_ix].radio_channel[ch_ix]));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]));
}
if (mt_ix == RAL_MAX_MT)
ltid = &ralpriv->mcast.ltid;
ltid = &g_enb_ral_obj[instanceP].mcast.ltid;
else
ltid = &ralpriv->mt[mt_ix].ltid;
ltid = &g_enb_ral_obj[instanceP].mt[mt_ix].ltid;
if (!ralpriv->pending_mt_flag)
if (!g_enb_ral_obj[instanceP].pending_mt_flag)
// To be updated and completed
//aRALu_send_link_res_activate_cnf();
eRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, ltid, NULL, NULL, NULL, NULL);
eRALlte_send_link_up_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, ltid, NULL, NULL, NULL, NULL);
else
ralpriv->pending_mt_flag = 0;
ralpriv->pending_req_flag = 0;
DEBUG("After response, Pending Req Flag = 0 , %d\n", ralpriv->pending_req_flag);
g_enb_ral_obj[instanceP].pending_mt_flag = 0;
g_enb_ral_obj[instanceP].pending_req_flag = 0;
DEBUG("After response, Pending Req Flag = 0 , %d\n", g_enb_ral_obj[instanceP].pending_req_flag);
}
//DEBUG("RAL_verifyPendingRbStatus - 2- \n");
}
......@@ -312,16 +312,13 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
// DEBUG ("\n%d , %d,", mt_ix, ch_ix);
switch (ioctl_obj){
/***************************/
case IO_OBJ_STATS:
{
DEBUG("Statistics requested -- FFS \n");
}
break;
/***************************/
case IO_OBJ_CNX:
switch (ioctl_cmd){
/***/
case IO_CMD_LIST:
{
// printf("Usage: gioctl cx list\n");
......@@ -333,8 +330,8 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
gifr.type=NAS_MSG_CX_LIST_REQUEST;
//gifr.msg=(char *)malloc(NAS_LIST_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1);
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgrep=(u8 *)(gifr.msg);
//
DEBUG("--\n");
......@@ -363,17 +360,14 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
rc = 0;
}
break;
/***/
default:
ERR ("RAL_process_NAS_message : invalid ioctl command %d\n",ioctl_cmd);
rc= -1;
} //end switch ioctl_cmd
break;
/***************************/
case IO_OBJ_RB:
switch (ioctl_cmd){
/***/
case IO_CMD_ADD:
{
// printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
......@@ -384,20 +378,20 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
MIH_C_LINK_DN_REASON_T reason_code;
//
gifr.type=NAS_MSG_RB_ESTABLISHMENT_REQUEST;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_rb_establishment_request *)(gifr.msg);
msgrep=(struct nas_msg_rb_establishment_reply *)(gifr.msg);
//
if (mt_ix == RAL_MAX_MT){
// multicast
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
msgreq->lcr = mt_ix;
memcpy ((char *)&(msgreq->mcast_group), (char *)&(ralpriv->mcast.mc_group_addr), 16);
memcpy ((char *)&(msgreq->mcast_group), (char *)&(g_enb_ral_obj[instanceP].mcast.mc_group_addr), 16);
}else{
// unicast
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
msgreq->lcr = ralpriv->mt[mt_ix].ue_id;
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
msgreq->lcr = g_enb_ral_obj[instanceP].mt[mt_ix].ue_id;
}
msgreq->cnxid = currChannel->cnx_id;
msgreq->rab_id = currChannel->rbId;
......@@ -421,32 +415,31 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
ERR(" Radio bearer establishment failure: %d\n",msgrep->status);
currChannel->status = RB_DISCONNECTED;
rc = -1;
ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
if (ralpriv->pending_mt_flag){
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_REJECTED;
if (g_enb_ral_obj[instanceP].pending_mt_flag){
reason_code = MIH_C_LINK_DOWN_REASON_NO_RESOURCE;
if (mt_ix == RAL_MAX_MT)
ltid = &ralpriv->mcast.ltid;
ltid = &g_enb_ral_obj[instanceP].mcast.ltid;
else
ltid = &ralpriv->mt[mt_ix].ltid;
eRALlte_send_link_down_indication(&ralpriv->pending_req_transaction_id, ltid, NULL, &reason_code);
ltid = &g_enb_ral_obj[instanceP].mt[mt_ix].ltid;
eRALlte_send_link_down_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, ltid, NULL, &reason_code);
// aRALu_send_link_res_activate_cnf();
}
if (mt_ix == RAL_MAX_MT)
eRALlte_process_clean_channel(&(ralpriv->mcast.radio_channel));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mcast.radio_channel));
else
eRALlte_process_clean_channel(&(ralpriv->mt[mt_ix].radio_channel[ch_ix]));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]));
}else{
rc = 0;
ralpriv->pending_req_flag = 1;
ralpriv->pending_req_mt_ix = mt_ix;
ralpriv->pending_req_ch_ix = ch_ix;
ralpriv->pending_req_multicast = currChannel->multicast;
DEBUG("-1- pending_req_mt_ix %d, pending_req_ch_ix %d\n", ralpriv->pending_req_mt_ix, ralpriv->pending_req_ch_ix);
g_enb_ral_obj[instanceP].pending_req_flag = 1;
g_enb_ral_obj[instanceP].pending_req_mt_ix = mt_ix;
g_enb_ral_obj[instanceP].pending_req_ch_ix = ch_ix;
g_enb_ral_obj[instanceP].pending_req_multicast = currChannel->multicast;
DEBUG("-1- pending_req_mt_ix %d, pending_req_ch_ix %d\n", g_enb_ral_obj[instanceP].pending_req_mt_ix, g_enb_ral_obj[instanceP].pending_req_ch_ix);
}
}
break;
/***/
case IO_CMD_DEL:
{
// printf("Usage: gioctl rb del <lcr> <rab_id>\n");
......@@ -457,17 +450,17 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
MIH_C_LINK_DN_REASON_T reason_code;
//
gifr.type=NAS_MSG_RB_RELEASE_REQUEST;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_rb_release_request *)(gifr.msg);
msgrep=(struct nas_msg_rb_release_reply *)(gifr.msg);
//
if (mt_ix == RAL_MAX_MT){
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
msgreq->lcr = mt_ix;
}else{
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
msgreq->lcr = ralpriv->mt[mt_ix].ue_id;
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
msgreq->lcr = g_enb_ral_obj[instanceP].mt[mt_ix].ue_id;
}
msgreq->rab_id = currChannel->rbId;
msgreq->cnxid = currChannel->cnx_id;
......@@ -485,32 +478,30 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
if ((msgrep->status<0)||(msgrep->cnxid!=cnxid)||(err<0)){
ERR(" Radio bearer release failure: status %d\n", msgrep->status);
rc = -1;
ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_REJECTED;
}else{
ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_SUCCESS;
}
if (ralpriv->pending_mt_flag){
if (g_enb_ral_obj[instanceP].pending_mt_flag){
reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT;
if (mt_ix == RAL_MAX_MT)
ltid = &ralpriv->mcast.ltid;
ltid = &g_enb_ral_obj[instanceP].mcast.ltid;
else
ltid = &ralpriv->mt[mt_ix].ltid;
eRALlte_send_link_down_indication(&ralpriv->pending_req_transaction_id, ltid, NULL, &reason_code);
ltid = &g_enb_ral_obj[instanceP].mt[mt_ix].ltid;
eRALlte_send_link_down_indication(&g_enb_ral_obj[instanceP].pending_req_transaction_id, ltid, NULL, &reason_code);
// aRALu_send_link_res_deactivate_cnf();
}
// mark resource as free again anyway
if (mt_ix == RAL_MAX_MT)
eRALlte_process_clean_channel(&(ralpriv->mcast.radio_channel));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mcast.radio_channel));
else
eRALlte_process_clean_channel(&(ralpriv->mt[mt_ix].radio_channel[ch_ix]));
eRALlte_process_clean_channel(&(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]));
DEBUG("Channel released : UE %d, channel %d, cnx_id %d \n\n",mt_ix, ch_ix, cnxid);
}
break;
/***/
/***/
case IO_CMD_LIST:
{
// printf("Usage: gioctl rb list <lcr>\n");
......@@ -520,12 +511,12 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
struct nas_msg_rb_list_reply *list;
struct nas_msg_rb_list_request *msgreq;
gifr.type=NAS_MSG_RB_LIST_REQUEST;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_rb_list_request *)(gifr.msg);
msgrep=(u8 *)(gifr.msg);
if (mt_ix < RAL_MAX_MT){
msgreq->lcr = ralpriv->mt[mt_ix].ue_id;
msgreq->lcr = g_enb_ral_obj[instanceP].mt[mt_ix].ue_id;
}else{
msgreq->lcr = 0;
mt_ix =0; //Temp
......@@ -548,18 +539,18 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
rc = 0;
// store channel status
for (i=0;i<num_rbs; i++){
if (ralpriv->mt[mt_ix].radio_channel[i].cnx_id == list[rbi].cnxid){
ralpriv->mt[mt_ix].radio_channel[i].nas_state = list[rbi].state;
if (g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[i].cnx_id == list[rbi].cnxid){
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[i].nas_state = list[rbi].state;
if (list[rbi].state == NAS_CX_DCH)
ralpriv->mt[mt_ix].radio_channel[i].status = RB_CONNECTED;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[i].status = RB_CONNECTED;
}
}
if ((mt_ix==0)&&(i==num_rbs)){
if (ralpriv->mcast.radio_channel.cnx_id == list[rbi].cnxid){
ralpriv->mcast.radio_channel.nas_state = list[rbi].state;
if (g_enb_ral_obj[instanceP].mcast.radio_channel.cnx_id == list[rbi].cnxid){
g_enb_ral_obj[instanceP].mcast.radio_channel.nas_state = list[rbi].state;
if (list[rbi].state == NAS_CX_DCH){
ralpriv->mcast.radio_channel.status = RB_CONNECTED;
ralpriv->mt[mt_ix].radio_channel[1].status = RB_CONNECTED;
g_enb_ral_obj[instanceP].mcast.radio_channel.status = RB_CONNECTED;
g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[1].status = RB_CONNECTED;
}
}
}
......@@ -567,28 +558,25 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
DEBUG("List complete \n");
}
break;
/***/
default:
ERR ("RAL_process_NAS_message : invalid ioctl command %d\n",ioctl_cmd);
rc= -1;
} //end switch ioctl_cmd
break;
/***************************/
case IO_OBJ_MEAS:
switch (ioctl_cmd){
/***/
case IO_CMD_ADD:
{
struct nas_msg_enb_measure_trigger *msgreq;
struct nas_msg_enb_measure_trigger_reply *msgrep;
//
gifr.type=NAS_MSG_ENB_MEAS_TRIGGER;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_enb_measure_trigger *)(gifr.msg);
msgrep=(struct nas_msg_enb_measure_trigger_reply *)(gifr.msg);
//
msgreq->cell_id = ralpriv->curr_cellId;
msgreq->cell_id = g_enb_ral_obj[instanceP].cell_id;
//
DEBUG("eNB measures triggered, cell_id %d\n", msgreq->cell_id);
err=ioctl(fd, NASRG_IOCTL_RAL, &gifr);
......@@ -606,15 +594,14 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
}
}
break;
/***/
case IO_CMD_LIST:
{
struct nas_msg_enb_measure_retrieve *msgrep;
int ix;
//
gifr.type=NAS_MSG_ENB_MEAS_RETRIEVE;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgrep=(struct nas_msg_enb_measure_retrieve *)(gifr.msg);
//
DEBUG("Retrieving measure from NAS\n");
......@@ -624,33 +611,30 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
rc = -1;
}
// Store the values received
ralpriv->num_UEs = msgrep->num_UEs;
for (ix=0; ix<ralpriv->num_UEs; ix++){
ralpriv->rlcBufferOccupancy[ix] = msgrep->measures[ix].rlcBufferOccupancy;
ralpriv->scheduledPRB[ix] = msgrep->measures[ix].scheduledPRB;
ralpriv->totalDataVolume[ix] = msgrep->measures[ix].totalDataVolume;
g_enb_ral_obj[instanceP].num_UEs = msgrep->num_UEs;
for (ix=0; ix<g_enb_ral_obj[instanceP].num_UEs; ix++){
g_enb_ral_obj[instanceP].rlcBufferOccupancy[ix] = msgrep->measures[ix].rlcBufferOccupancy;
g_enb_ral_obj[instanceP].scheduledPRB[ix] = msgrep->measures[ix].scheduledPRB;
g_enb_ral_obj[instanceP].totalDataVolume[ix] = msgrep->measures[ix].totalDataVolume;
}
ralpriv->totalNumPRBs = msgrep->totalNumPRBs;
g_enb_ral_obj[instanceP].totalNumPRBs = msgrep->totalNumPRBs;
#ifdef DEBUG_RAL_DETAILS
DEBUG("Measures received- cell %d, Number of UEs %d, Total number of PRBs %d\n", msgrep->cell_id, msgrep->num_UEs, msgrep->totalNumPRBs);
for (ix=0; ix<ralpriv->num_UEs; ix++)
for (ix=0; ix<g_enb_ral_obj[instanceP].num_UEs; ix++)
DEBUG("UE%d : RLC Buffers %d, scheduledPRB %d, totalDataVolume %d\n", ix, msgrep->measures[ix].rlcBufferOccupancy,
msgrep->measures[ix].scheduledPRB, msgrep->measures[ix].totalDataVolume);
#endif
RAL_NAS_measures_analyze();
}
break;
/***/
default:
ERR ("RAL_process_NAS_message : invalid ioctl command %d\n",ioctl_cmd);
rc= -1;
} //end switch ioctl_cmd
break;
/***************************/
case IO_OBJ_MC:
switch (ioctl_cmd){
/***/
case IO_CMD_ADD:
{
struct nas_msg_mt_mcast_join *msgreq;
......@@ -658,12 +642,12 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
struct ral_lte_channel *currChannel;
//
gifr.type=NAS_RG_MSG_MT_MCAST_JOIN;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_mt_mcast_join *)(gifr.msg);
msgrep=(struct nas_msg_mt_mcast_reply *)(gifr.msg);
//
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
msgreq->ue_id = mt_ix;
msgreq->rab_id = currChannel->rbId;
msgreq->cnxid = currChannel->cnx_id;
......@@ -677,18 +661,17 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
// check answer from NAS
if ((msgrep->result<0)||(msgrep->ue_id!=mt_ix)||(err<0)){
ERR(" UE multicast join notification failure: %d\n",msgrep->result);
ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_REJECTED;
rc = -1;
}else{
DEBUG(" ++ UE multicast join notification transmitted to MT \n");
ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_SUCCESS;
rc = 0;
}
// TODO aRALu_send_link_mc_join_cnf();
}
break;
/***/
case IO_CMD_DEL:
{
struct nas_msg_mt_mcast_leave *msgreq;
......@@ -696,12 +679,12 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
struct ral_lte_channel *currChannel;
//
gifr.type=NAS_RG_MSG_MT_MCAST_LEAVE;
memset (ralpriv->buffer,0,800);
gifr.msg= &(ralpriv->buffer[0]);
memset (g_enb_ral_obj[instanceP].buffer,0,800);
gifr.msg= &(g_enb_ral_obj[instanceP].buffer[0]);
msgreq=(struct nas_msg_mt_mcast_leave *)(gifr.msg);
msgrep=(struct nas_msg_mt_mcast_reply *)(gifr.msg);
//
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
msgreq->ue_id = mt_ix;
msgreq->rab_id = currChannel->rbId;
msgreq->cnxid = currChannel->cnx_id;
......@@ -715,25 +698,21 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
// check answer from NAS
if ((msgrep->result<0)||(msgrep->ue_id!=mt_ix)||(err<0)){
ERR(" UE multicast leave notification failure: %d\n",msgrep->result);
ralpriv->pending_req_status = MIH_C_STATUS_REJECTED;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_REJECTED;
rc = -1;
}else{
DEBUG(" ++ UE multicast leave notification transmitted to MT \n" );
ralpriv->pending_req_status = MIH_C_STATUS_SUCCESS;
g_enb_ral_obj[instanceP].pending_req_status = MIH_C_STATUS_SUCCESS;
rc = 0;
}
// TODO aRALu_send_link_mc_leave_cnf();
}
break;
/***/
/***/
default:
ERR ("RAL_process_NAS_message : invalid ioctl command %d\n",ioctl_cmd);
rc= -1;
} //end switch ioctl_cmd
break;
/***/
/***************************/
default:
ERR ("RAL_process_NAS_message : invalid ioctl object %d\n",ioctl_obj);
rc= -1;
......@@ -741,6 +720,6 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int mt_ix, int ch_ix){
//rc=0;
return rc;
}
*/
......@@ -16,52 +16,43 @@
* and requests actions from lower layers to optimize handovers
* between heterogeneous networks.
*****************************************************************************/
#define LTE_RAL_ENB
#define LTE_RAL_ENB_MAIN_C
//-----------------------------------------------------------------------------
#include <stdio.h>
# include <sys/epoll.h>
#include <sys/select.h>
#include <net/if.h>
#include <getopt.h>
#include <stdlib.h>
#include <time.h>
//-----------------------------------------------------------------------------
#define DEFINE_GLOBAL_CONSTANTS
//-----------------------------------------------------------------------------
#include "lteRALenb_constants.h"
#include "lteRALenb_variables.h"
#include "lteRALenb_proto.h"
#include "lteRALenb_mih_msg.h"
//-----------------------------------------------------------------------------
#include "MIH_C.h"
#include "lteRALenb.h"
#include "intertask_interface.h"
#include "OCG.h"
//-----------------------------------------------------------------------------
// LTE AS sub-system
//#include "nas_ue_ioctl.h"
#include <net/if.h>
#ifdef RAL_REALTIME
#include "rrc_nas_primitives.h"
#include "nasrg_constant.h"
#include "nasrg_iocontrol.h"
//LG#include "rrc_nas_primitives.h"
//LG#include "nasrg_constant.h"
//LG#include "nasrg_iocontrol.h"
#endif
/****************************************************************************/
/******************* G L O C A L D E F I N I T I O N S *****************/
/******************* G L O B A L D E F I N I T I O N S *****************/
/****************************************************************************/
extern OAI_Emulation oai_emulation;
#ifdef RAL_REALTIME
//ioctl
struct nas_ioctl gifr;
int fd;
#endif
#ifdef RAL_DUMMY
/* NAS socket file descriptor */
int g_sockd_nas; // referenced in lteRALenb_NAS.c
#endif
/* RAL LTE internal data */
struct ral_lte_priv *ralpriv;
int init_flag = 0;
//int init_flag = 0;
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
static int g_log_output;
// static struct ral_lte_priv rl_priv;
// //
// static void arg_usage(const char* name);
......@@ -70,20 +61,19 @@ static int g_log_output;
// static void get_IPv6_addr(const char* if_name);
// static int RAL_initialize(int argc, const char *argv[]);
struct ral_lte_priv rl_priv;
//struct ral_lte_priv rl_priv;
// void arg_usage(const char* name);
// int parse_opts(int argc, char* argv[]);
// void get_IPv6_addr(const char* if_name);
// int RAL_initialize(int argc, const char *argv[]);
#ifdef RAL_DUMMY
int netl_s; /* NAS net link socket */
#endif
/****************************************************************************/
// Next part is used to receive the triggers
/****************************************************************************/
/*
#ifdef MUSER_CONTROL
#define USER_IP_ADDRESS "127.0.0.1"
......@@ -91,10 +81,6 @@ int netl_s; /* NAS net link socket */
#define NAS_IP_ADDRESS "127.0.0.1"
#define NAS_LISTENING_PORT_FOR_USER "22222"
char *g_mih_user_ip_address = USER_IP_ADDRESS;
char *g_mih_user_remote_port = USER_REMOTE_PORT;
char *g_nas_ip_address = NAS_IP_ADDRESS;
char *g_nas_listening_port_for_mih_user = NAS_LISTENING_PORT_FOR_USER;
int g_sockd_user;
signed int g_user_congestion = 0;
unsigned int g_ratio_modif = 0;
......@@ -110,14 +96,14 @@ int lteRALenb_trigger_connect(void){
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6
hints.ai_socktype = SOCK_DGRAM; // Datagram socket
hints.ai_flags = 0;
hints.ai_protocol = 0; /* Any protocol */
hints.ai_protocol = 0; // Any protocol
s = getaddrinfo(g_mih_user_ip_address, g_mih_user_remote_port, &hints, &result);
if (s != 0) {
printf("ERR getaddrinfo: %s\n", gai_strerror(s));
LOG_E (RAL_ENB,"getaddrinfo: %s\n", gai_strerror(s));
return -1;
}
......@@ -130,66 +116,66 @@ int lteRALenb_trigger_connect(void){
setsockopt( g_sockd_user, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
if(rp->ai_family == AF_INET) {
printf("Destination address %s is an ipv4 address\n",g_mih_user_ip_address);
LOG_D (RAL_ENB, "Destination address %s is an ipv4 address\n",g_mih_user_ip_address);
addr = (struct sockaddr_in *)(&buf[0]);
addr->sin_port = htons(atoi(g_nas_listening_port_for_mih_user));
addr->sin_family = AF_INET;
s = inet_pton(AF_INET, g_nas_ip_address, &addr->sin_addr);
if (s <= 0) {
if (s == 0) {
printf("ERR IP address should be a IPv4 ADDR - But found not in presentation format : %s\n", g_nas_ip_address);
LOG_E (RAL_ENB, " IP address should be a IPv4 ADDR - But found not in presentation format : %s\n", g_nas_ip_address);
} else {
printf("ERR %s - inet_pton( IPv4 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
LOG_E (RAL_ENB, " %s - inet_pton( IPv4 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
}
return -1;
}
s = bind(g_sockd_user, (const struct sockaddr *)addr, sizeof(struct sockaddr_in));
if (s == -1) {
printf("ERR IPv4 Address Bind: %s\n", strerror(errno));
LOG_D (RAL_ENB, "IPv4 Address Bind: %s\n", strerror(errno));
return -1;
}
// sockd_mihf is of type SOCK_DGRAM, rp->ai_addr is the address to which datagrams are sent by default
if (connect(g_sockd_user, rp->ai_addr, rp->ai_addrlen) != -1) {
printf(" lteRALeNB is now ready to receive triggers\n");
LOG_D (RAL_ENB, " lteRALeNB is now ready to receive triggers\n");
return 0;
} else {
close(g_sockd_user);
}
} else if (rp->ai_family == AF_INET6) {
printf("Destination address %s is an ipv6 address\n",g_mih_user_ip_address);
LOG_D (RAL_ENB, "Destination address %s is an ipv6 address\n",g_mih_user_ip_address);
addr6 = (struct sockaddr_in6 *)(&buf[0]);
addr6->sin6_port = htons(atoi(g_nas_listening_port_for_mih_user));
addr6->sin6_family = AF_INET6;
s = inet_pton(AF_INET, g_nas_ip_address, &addr6->sin6_addr);
if (s <= 0) {
if (s == 0) {
printf("ERR IP address should be a IPv6 ADDR, But found not in presentation format : %s\n", g_nas_ip_address);
LOG_E (RAL_ENB, "IP address should be a IPv6 ADDR, But found not in presentation format : %s\n", g_nas_ip_address);
} else {
printf("ERR %s - inet_pton( IPv6 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
LOG_E (RAL_ENB, "%s - inet_pton( IPv6 ADDR %s): %s\n", __FUNCTION__, g_nas_ip_address, strerror(s));
}
return -1;
}
s = bind(g_sockd_user, (const struct sockaddr *)addr6, sizeof(struct sockaddr_in));
if (s == -1) {
printf("ERR IPv6 Address Bind: %s\n", strerror(errno));
LOG_D (RAL_ENB, "IPv6 Address Bind: %s\n", strerror(errno));
return -1;
}
if (connect(g_sockd_user, rp->ai_addr, rp->ai_addrlen) != -1) {
printf(" lteRALeNB is now ready to receive triggers\n");
LOG_D (RAL_ENB, "lteRALeNB is now ready to receive triggers\n");
return 0;
} else {
close(g_sockd_user);
}
} else {
printf("ERR %s is an unknown address format %d\n",g_mih_user_ip_address,rp->ai_family);
LOG_E (RAL_ENB, "%s is an unknown address format %d\n",g_mih_user_ip_address,rp->ai_family);
}
close(g_sockd_user);
}
if (rp == NULL) { /* No address succeeded */
printf("ERR Could not establish socket to MIH-User\n");
if (rp == NULL) { // No address succeeded
LOG_E (RAL_ENB, "Could not establish socket to MIH-User\n");
return -1;
}
return -1;
......@@ -212,7 +198,7 @@ int lteRALenb_trigger_receive(int sock){
break;
case 0x01:
printf("USER ASK FOR TRIGGERING CONGESTION\n");
ralpriv->rlcBufferOccupancy[0] = 95;
g_enb_ral_obj[instanceP].rlcBufferOccupancy[0] = 95;
RAL_NAS_report_congestion(0);
break;
default:
......@@ -221,163 +207,21 @@ int lteRALenb_trigger_receive(int sock){
}
return 0;
}
#endif
/****************************************************************************/
/****************************************************************************
** Name: arg_usage() **
** Description: Displays command line usage **
** Inputs: name: Name of the running process **
** **
***************************************************************************/
static void arg_usage(const char *name){
//-----------------------------------------------------------------------------
fprintf(stderr,
"Usage: %s [options]\nOptions:\n"
" -V, --version Display version information\n"
" -?, -h, --help Display this help text\n"
" -P <number>, --ral-listening-port Listening port for incoming MIH-F messages\n"
" -I <string>, --ral-ip-address Binding IP(v4 or v6) address for RAL\n"
" -p <number>, --mihf-remote-port MIH-F remote port\n"
" -i <string>, --mihf-ip-address MIH-F IP(v4 or v6) address\n"
" -l <number>, --mihf-link-id MIH-F link identifier\n"
" -m <number>, --mihf-id MIH-F identifier\n"
" -c, --output-to-console All stream outputs are redirected to console\n"
" -f, --output-to-file All stream outputs are redirected to file\n"
" -s, --output-to-syslog All stream outputs are redirected to syslog\n",
name);
}
/****************************************************************************
** Name: parse_opts() **
** Description: Parses the command line parameters **
** Inputs: argc: Number of parameters in the command line **
** argv: Command line parameters **
***************************************************************************/
static int parse_opts(int argc, char *argv[]){
//-----------------------------------------------------------------------------
static struct option long_opts[] = {
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
{"help", 0, 0, '?'},
{"ral-listening-port", optional_argument, 0, 'P'},
{"ral-ip-address", optional_argument, 0, 'I'},
{"mihf-remote-port", optional_argument, 0, 'p'},
{"mihf-ip-address", optional_argument, 0, 'i'},
{"mihf-link-id", optional_argument, 0, 'l'},
{"mihf-id", optional_argument, 0, 'm'},
{"output-to-console", 0, 0, 'c'},
{"output-to-file", 0, 0, 'f'},
{"output-to-syslog", 0, 0, 's'},
{0, 0, 0, 0}
};
/* parse all other cmd line parameters than -c */
while (1) {
int idx, c;
c = getopt_long(argc, argv, "P:I:p:i:l:m:Vh?cfs", long_opts, &idx);
if (c == -1) break;
switch (c) {
case 'V':
fprintf(stderr, "SVN MODULE VERSION: %s\n", SVN_REV);
return -1;
case '?':
case 'h':
arg_usage(basename(argv[0]));
return -1;
case 'i':
strncpy(g_mihf_ip_address, optarg, strlen(g_mihf_ip_address));
break;
case 'p':
strncpy(g_mihf_remote_port, optarg, strlen(g_mihf_remote_port));
break;
case 'P':
strncpy(g_ral_listening_port_for_mihf, optarg,
strlen(g_ral_listening_port_for_mihf));
break;
case 'I':
strncpy(g_ral_ip_address, optarg, strlen(g_ral_ip_address));
break;
case 'l':
strncpy(g_link_id, optarg, strlen(g_link_id));
break;
case 'm':
strncpy(g_mihf_id, optarg, strlen(g_mihf_id));
break;
case 'c':
g_log_output = LOG_TO_CONSOLE;
break;
case 'f':
g_log_output = LOG_TO_FILE;
break;
case 's':
g_log_output = LOG_TO_SYSTEM;
break;
default:
break;
};
}
return 0;
}
#ifdef RAL_REALTIME
//---------------------------------------------------------------------------
void IAL_NAS_ioctl_init(void){
//---------------------------------------------------------------------------
// Get an UDP IPv6 socket ??
fd=socket(AF_INET6, SOCK_DGRAM, 0);
if (fd<0) {
ERR("Error opening socket for ioctl\n");
exit(1);
}
strcpy(gifr.name, "oai0");
}
#endif
*/
/****************************************************************************/
#ifdef RAL_DUMMY
/****************************************************************************
** Name: NAS_Netlink_socket_init() **
** Description: Initializes the communication channel with the NAS dummy **
** Others: netl_s : the NAS net link socket **
** **
***************************************************************************/
void NAS_Netlink_socket_init(void){
//-----------------------------------------------------------------------------
int len;
struct sockaddr_un local;
if ((netl_s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
perror("NAS_Netlink_socket_init : socket() failed");
exit(1);
}
local.sun_family = AF_UNIX;
strcpy(local.sun_path, SOCK_RAL_NAS_PATH);
unlink(local.sun_path);
len = strlen(local.sun_path) + sizeof(local.sun_family);
if (bind(netl_s, (struct sockaddr *)&local, len) == -1) {
perror("NAS_Netlink_socket_init : bind() failed");
exit(1);
}
if (listen(netl_s, 1) == -1) {
perror("NAS_Netlink_socket_init : listen() failed");
exit(1);
}
}
#endif
/****************************************************************************
** Name: get_IPv6_addr() **
** Description: Gets the IPv6 address of the specified network interface. **
** Inputs: if_name Interface name **
***************************************************************************/
void get_IPv6_addr(const char* if_name){
//-----------------------------------------------------------------------------
void eRAL_get_IPv6_addr(const char* if_name){
//-----------------------------------------------------------------------------
#define IPV6_ADDR_LINKLOCAL 0x0020U
FILE *f;
......@@ -389,7 +233,7 @@ void get_IPv6_addr(const char* if_name){
char temp_addr[32];
int i, j;
DEBUG(" %s : network interface %s\n", __FUNCTION__, if_name);
LOG_D(RAL_ENB, " %s : network interface %s\n", __FUNCTION__, if_name);
if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) {
while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
......@@ -401,22 +245,22 @@ void get_IPv6_addr(const char* if_name){
found = 1;
// retrieve numerical value
if ((scope == 0) || (scope == IPV6_ADDR_LINKLOCAL)) {
DEBUG(" adresse %s:%s:%s:%s:%s:%s:%s:%s",
LOG_D(RAL_ENB, " adresse %s:%s:%s:%s:%s:%s:%s:%s",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
DEBUG(" Scope:");
LOG_D(RAL_ENB, " Scope:");
switch (scope) {
case 0:
DEBUG(" Global\n");
LOG_D(RAL_ENB, " Global\n");
break;
case IPV6_ADDR_LINKLOCAL:
DEBUG(" Link\n");
LOG_D(RAL_ENB, " Link\n");
break;
default:
DEBUG(" Unknown\n");
LOG_D(RAL_ENB, " Unknown\n");
break;
}
DEBUG(" Numerical value: ");
LOG_D(RAL_ENB, " Numerical value: ");
for (i = 0; i < 8; i++) {
for (j = 0; j < 4; j++) {
addr6p[i][j]= toupper(addr6p[i][j]);
......@@ -431,75 +275,79 @@ void get_IPv6_addr(const char* if_name){
}
for (i = 0; i < 16; i++) {
DEBUG("-%hhx-",my_addr[i]);
LOG_D(RAL_ENB, "-%hhx-",my_addr[i]);
}
DEBUG("\n");
LOG_D(RAL_ENB, "\n");
}
}
}
fclose(f);
if (!found) {
ERR(" %s : interface %s not found\n\n", __FUNCTION__, if_name);
LOG_E(RAL_ENB, " %s : interface %s not found\n\n", __FUNCTION__, if_name);
}
}
}
void eRAL_init_default_values(void) {
g_conf_enb_ral_listening_port = ENB_DEFAULT_LOCAL_PORT_RAL;
g_conf_enb_ral_ip_address = ENB_DEFAULT_IP_ADDRESS_RAL;
g_conf_enb_ral_link_id = ENB_DEFAULT_LINK_ID_RAL;
g_conf_enb_ral_link_address = ENB_DEFAULT_LINK_ADDRESS_RAL;
g_conf_enb_mihf_remote_port = ENB_DEFAULT_REMOTE_PORT_MIHF;
g_conf_enb_mihf_ip_address = ENB_DEFAULT_IP_ADDRESS_MIHF;
g_conf_enb_mihf_id = ENB_DEFAULT_MIHF_ID;
}
/****************************************************************************
** Name: RAL_initialize() **
** Name: eRAL_initialize() **
** **
** Description: Performs overall RAL LTE initialisations: **
** **
** Inputs: argc: Number of parameters in the command line **
** argv: Command line parameters **
** Inputs: None **
** **
***************************************************************************/
int RAL_initialize(int argc, const char *argv[]){
//-----------------------------------------------------------------------------
MIH_C_TRANSACTION_ID_T transaction_id;
int eRAL_initialize(void){
//-----------------------------------------------------------------------------
ral_enb_instance_t instance = 0;
char *char_tmp = NULL;
#ifdef RAL_DUMMY
unsigned int t;
struct sockaddr_un nas_socket;
#endif
MIH_C_init();
ralpriv = &rl_priv;
memset(ralpriv, 0, sizeof(struct ral_lte_priv));
srand(time(NULL));
/* Initialize defaults
*/
g_ral_ip_address = strdup(DEFAULT_IP_ADDRESS_RAL);
g_ral_listening_port_for_mihf = strdup(DEFAULT_LOCAL_PORT_RAL);
g_mihf_remote_port = strdup(DEFAULT_REMOTE_PORT_MIHF);
g_mihf_ip_address = strdup(DEFAULT_IP_ADDRESS_MIHF);
g_sockd_mihf = -1;
g_link_id = strdup(DEFAULT_LINK_ID);
g_mihf_id = strdup(DEFAULT_MIHF_ID);
g_log_output = LOG_TO_CONSOLE;
/* Parse command line parameters
*/
if (parse_opts(argc, (char**) argv) < 0) {
exit(0);
}
memset(g_enb_ral_obj, 0, sizeof(lte_ral_enb_object_t)*MAX_MODULES);
MIH_C_init(g_log_output);
g_enb_ral_fd2instance = hashtable_create (32, NULL, hash_free_int_func);
DEBUG(" %s -I %s -P %s -i %s -p %s -l %s -m %s\n", argv[0], g_ral_ip_address, g_ral_listening_port_for_mihf,
g_mihf_ip_address, g_mihf_remote_port, g_link_id, g_mihf_id);
for (instance = 0; instance < oai_emulation.info.nb_enb_local; instance++) {
char_tmp = calloc(1, strlen(g_conf_enb_ral_listening_port) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp,"%d", atoi(g_conf_enb_ral_listening_port) + instance);
g_enb_ral_obj[instance].ral_listening_port = char_tmp;
/* Connect to the MIF Function
*/
DEBUG(" Connect to the MIH-F ...\n");
if (eRALlte_mihf_connect() < 0 ) {
ERR(" %s : Could not connect to MIH-F...exiting\n", __FUNCTION__);
exit(-1);
}
g_enb_ral_obj[instance].ral_ip_address = strdup(g_conf_enb_ral_ip_address);
g_enb_ral_obj[instance].ral_link_address = strdup(g_conf_enb_ral_link_address);
char_tmp = calloc(1, strlen(g_conf_enb_mihf_remote_port) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%d", atoi(g_conf_enb_mihf_remote_port) + instance);
g_enb_ral_obj[instance].mihf_remote_port = char_tmp;
g_enb_ral_obj[instance].mihf_ip_address = strdup(g_conf_enb_mihf_ip_address);
char_tmp = calloc(1, strlen(g_conf_enb_mihf_id) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%s%02d",g_conf_enb_mihf_id, instance);
g_enb_ral_obj[instance].mihf_id = char_tmp;
char_tmp = calloc(1, strlen(g_conf_enb_ral_link_id) + 3); // 2 digits + \0 ->99 instances
sprintf(char_tmp, "%s%02d",g_conf_enb_ral_link_id, instance);
g_enb_ral_obj[instance].link_id = char_tmp;
char_tmp = NULL;
// excluded MIH_C_LINK_AC_TYPE_NONE
// excluded MIH_C_LINK_AC_TYPE_LINK_DISCONNECT
// excluded MIH_C_LINK_AC_TYPE_LINK_LOW_POWER
// excluded MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN
// excluded MIH_C_LINK_AC_TYPE_LINK_POWER_UP
ralpriv->mih_supported_link_action_list = (1 << MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) |
g_enb_ral_obj[instance].mih_supported_link_action_list = (1 << MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) |
(1 << MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) |
(1 << MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES);
// excluded MIH_C_BIT_LINK_DETECTED
......@@ -507,86 +355,209 @@ int RAL_initialize(int argc, const char *argv[]){
// excluded MIH_C_BIT_LINK_HANDOVER_IMMINENT
// excluded MIH_C_BIT_LINK_HANDOVER_COMPLETE
// excluded MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS
ralpriv->mih_supported_link_event_list = MIH_C_BIT_LINK_UP | MIH_C_BIT_LINK_DOWN | MIH_C_BIT_LINK_PARAMETERS_REPORT;
g_enb_ral_obj[instance].mih_supported_link_event_list = MIH_C_BIT_LINK_UP | MIH_C_BIT_LINK_DOWN | MIH_C_BIT_LINK_PARAMETERS_REPORT;
// excluded MIH_C_BIT_LINK_GET_PARAMETERS
// excluded MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS
ralpriv->mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS |
g_enb_ral_obj[instance].mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS |
MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE |
MIH_C_BIT_LINK_ACTION;
NOTICE("[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id);
NOTICE("[MSC_NEW][%s][RAL=%s]\n", getTimeStamp4Log(), g_link_id);
NOTICE("[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas");
g_enb_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_enb_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_enb_ral_obj[instance].transaction_id = (MIH_C_TRANSACTION_ID_T)rand();
//LOG_N(RAL_ENB, "[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id);
//LOG_N(RAL_ENB, "[MSC_NEW][%s][RAL=%s]\n", getTimeStamp4Log(), g_link_id);
//LOG_N(RAL_ENB, "[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas");
g_enb_ral_obj[instance].ue_htbl = hashtable_create(32, NULL, NULL);
LOG_D(RAL_ENB, " Connect to the MIH-F for instance %d...\n", instance);
g_enb_ral_obj[instance].mih_sock_desc = -1;
if (eRAL_mihf_connect(instance) < 0 ) {
LOG_E(RAL_ENB, " %s : Could not connect to MIH-F...\n", __FUNCTION__);
// TO DO RETRY LATER
//exit(-1);
} else {
itti_subscribe_event_fd(TASK_RAL_ENB, g_enb_ral_obj[instance].mih_sock_desc);
hashtable_insert(g_enb_ral_fd2instance, g_enb_ral_obj[instance].mih_sock_desc, (void*)instance);
}
}
/*Initialize the NAS driver communication channel
*/
#ifdef RAL_REALTIME
IAL_NAS_ioctl_init();
#endif
#ifdef RAL_DUMMY
NAS_Netlink_socket_init();
DEBUG(" Waiting for a connection from the NAS Driver ...\n");
t = sizeof(nas_socket);
if ((g_sockd_nas = accept(netl_s, (struct sockaddr *)&nas_socket, &t)) == -1) {
perror("RAL_initialize : g_sockd_nas - accept() failed");
exit(1);
}
#endif
DEBUG("NAS Driver Connected.\n\n");
#ifdef RAL_REALTIME
//LG IAL_NAS_ioctl_init();
#endif
#ifdef RAL_DUMMY
//LG NAS_Netlink_socket_init();
//LG LOG_D(RAL_ENB, " Waiting for a connection from the NAS Driver ...\n");
//LG t = sizeof(nas_socket);
//LG if ((g_sockd_nas = accept(netl_s, (struct sockaddr *)&nas_socket, &t)) == -1) {
//LG perror("RAL_initialize : g_sockd_nas - accept() failed");
//LG exit(1);
//LG }
#endif
LOG_D(RAL_ENB, "NAS Driver Connected.\n\n");
/* Start listening to user commands for triggers*/
#ifdef MUSER_CONTROL
lteRALenb_trigger_connect();
#endif
#ifdef MUSER_CONTROL
//LG lteRALenb_trigger_connect();
#endif
/*Get the interface IPv6 address
*/
#ifdef RAL_DUMMY
get_IPv6_addr("eth0");
#else
#ifdef RAL_REALTIME
get_IPv6_addr("oai0");
#endif
#endif
#ifdef RAL_DUMMY
//LG get_IPv6_addr("eth0");
#else
#ifdef RAL_REALTIME
//LG get_IPv6_addr("oai0");
#endif
#endif
// Get list of MTs
DEBUG("Obtaining list of MTs\n\n");
#ifdef RAL_REALTIME
init_flag=1;
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST,0,0);
RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST,0,0);
init_flag=0;
#endif
#ifdef RAL_DUMMY
eRALlte_NAS_get_MTs_list();
#endif
RAL_printInitStatus();
ralpriv->pending_req_flag = 0;
//
ralpriv->pending_mt_timer = -1;
ralpriv->pending_mt_flag = 0;
//
DEBUG(" List of MTs initialized\n\n");
// Get list of MTs
//LG LOG_D(RAL_ENB, "Obtaining list of MTs\n\n");
#ifdef RAL_REALTIME
//init_flag=1;
//LG RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST,0,0);
//LG RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST,0,0);
//init_flag=0;
#endif
#ifdef RAL_DUMMY
//LG eRALlte_NAS_get_MTs_list();
#endif
// RAL_printInitStatus(0);
// g_enb_ral_obj[instanceP].pending_req_flag = 0;
// //
// g_enb_ral_obj[instanceP].pending_mt_timer = -1;
// g_enb_ral_obj[instanceP].pending_mt_flag = 0;
// //
// LOG_D(RAL_ENB, " List of MTs initialized\n\n");
// Initialize measures for demo3
ralpriv->meas_polling_interval = RAL_DEFAULT_MEAS_POLLING_INTERVAL;
ralpriv->meas_polling_counter = 1;
// // Initialize measures for demo3
// g_enb_ral_obj[instanceP].meas_polling_interval = RAL_DEFAULT_MEAS_POLLING_INTERVAL;
// g_enb_ral_obj[instanceP].meas_polling_counter = 1;
ralpriv->congestion_flag = RAL_FALSE;
ralpriv->measures_triggered_flag = RAL_FALSE;
ralpriv->congestion_threshold = RAL_DEFAULT_CONGESTION_THRESHOLD;
transaction_id = (MIH_C_TRANSACTION_ID_T)0;
// g_enb_ral_obj[instanceP].congestion_flag = RAL_FALSE;
// g_enb_ral_obj[instanceP].measures_triggered_flag = RAL_FALSE;
// g_enb_ral_obj[instanceP].congestion_threshold = RAL_DEFAULT_CONGESTION_THRESHOLD;
// transaction_id = (MIH_C_TRANSACTION_ID_T)0;
eRALlte_send_link_register_indication(&transaction_id);
// eRALlte_send_link_register_indication(&transaction_id);
return 0;
}
void eRAL_process_file_descriptors(struct epoll_event *events, int nb_events)
{
int i;
ral_enb_instance_t instance;
hashtable_rc_t rc;
if (events == NULL) {
return;
}
for (i = 0; i < nb_events; i++) {
rc = hashtable_get(g_enb_ral_fd2instance, events[i].data.fd, (void**)&instance);
if (rc == HASH_TABLE_OK) {
eRAL_mih_link_process_message(instance);
}
}
}
void* eRAL_task(void *args_p) {
int nb_events;
struct epoll_event *events;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance = 0;
eRAL_initialize();
itti_mark_task_ready (TASK_RAL_ENB);
while(1) {
// Wait for a message
itti_receive_msg (TASK_RAL_ENB, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
// TO DO
itti_exit_task ();
break;
case TIMER_HAS_EXPIRED:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
break;
case RRC_RAL_SYSTEM_CONFIGURATION_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_system_configuration_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_ESTABLISHMENT_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_connection_establishment_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_REESTABLISHMENT_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_connection_reestablishment_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_RECONFIGURATION_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_connection_reconfiguration_indication(instance, msg_p);
break;
case RRC_RAL_MEASUREMENT_REPORT_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_measurement_report_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_RELEASE_IND:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_connection_release_indication(instance, msg_p);
break;
case RRC_RAL_CONFIGURE_THRESHOLD_CONF:
LOG_D(RAL_ENB, "Received %s\n", msg_name);
eRAL_rx_rrc_ral_configure_threshold_conf(instance, msg_p);
break;
default:
LOG_E(RAL_ENB, "Received unexpected message %s\n", msg_name);
break;
}
free(msg_p);
msg_p = NULL;
}
nb_events = itti_get_events(TASK_RAL_ENB, &events);
/* Now handle notifications for other sockets */
if (nb_events > 0) {
eRAL_process_file_descriptors(events, nb_events);
}
}
}
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
int main(int argc, const char *argv[]){
/*int main(int argc, const char *argv[]){
//-----------------------------------------------------------------------------
int rc, done;
fd_set readfds;
......@@ -595,11 +566,11 @@ int main(int argc, const char *argv[]){
RAL_initialize(argc, argv);
ralpriv->pending_mt_timer = 0;
g_enb_ral_obj[instanceP].pending_mt_timer = 0;
done = 0;
do {
/* Initialize fd_set and wait for input */
// Initialize fd_set and wait for input
FD_ZERO(&readfds);
FD_SET(g_sockd_mihf, &readfds);
#ifdef RAL_DUMMY
......@@ -616,29 +587,29 @@ int main(int argc, const char *argv[]){
perror("main : select() failed");
done = 1;
}
/* Something is ready for being read */
// Something is ready for being read
else if (rc >= 0){
/* Read data coming from the MIH Function */
// Read data coming from the MIH Function
if (FD_ISSET(g_sockd_mihf, &readfds)) {
done = eRALlte_mih_link_process_message();
}
#ifdef RAL_DUMMY
/* Read data coming from the NAS driver */
// Read data coming from the NAS driver
if (FD_ISSET(g_sockd_nas, &readfds)) {
//printf("Received something from NAS\n");
done = eRALlte_NAS_process_message();
}
#endif
#ifdef MUSER_CONTROL
/* Get triggers */
// Get triggers
if (FD_ISSET(g_sockd_user,&readfds)){
done = lteRALenb_trigger_receive(g_sockd_user);
}
#endif
/* Wait until next pending MT's timer expiration */
if (ralpriv->pending_mt_timer > 0) {
ralpriv->pending_mt_timer --;
// Wait until next pending MT's timer expiration
if (g_enb_ral_obj[instanceP].pending_mt_timer > 0) {
g_enb_ral_obj[instanceP].pending_mt_timer --;
eRALlte_process_verify_pending_mt_status();
}
......@@ -650,9 +621,9 @@ int main(int argc, const char *argv[]){
time_counter = 1;
}
//get measures from NAS - timer = 21x100ms -- impair
if (ralpriv->meas_polling_counter ++ == ralpriv->meas_polling_interval){
if (g_enb_ral_obj[instanceP].meas_polling_counter ++ == g_enb_ral_obj[instanceP].meas_polling_interval){
RAL_NAS_measures_polling();
ralpriv->meas_polling_counter =1;
g_enb_ral_obj[instanceP].meas_polling_counter =1;
}
}
......@@ -662,3 +633,4 @@ int main(int argc, const char *argv[]){
MIH_C_exit();
return 0;
}
*/
......@@ -25,7 +25,7 @@
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
*******************************************************************************/
/*! \file lteRALenb_mih_msg.c
* \brief Interface for MIH primitives in LTE-RAL-ENB
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
......@@ -34,15 +34,9 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_constants.h"
#include "lteRALenb_variables.h"
#include "lteRALenb_subscribe.h"
#include "lteRALenb_parameters.h"
#include "lteRALenb_thresholds.h"
#include "lteRALenb_action.h"
#define LTE_RAL_ENB
#define LTE_RAL_ENB_MIH_MSG_C
#include "lteRALenb.h"
/****************************************************************************/
/******************* G L O C A L D E F I N I T I O N S *****************/
......@@ -61,17 +55,6 @@ static u_int8_t g_msg_codec_send_buffer[MSG_CODEC_SEND_BUFFER_SIZE] = {};
static char g_msg_print_buffer[8192] = {};
static char g_msg_codec_print_buffer[8192] = {};
static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP);
static int eRALlte_send_to_mih(const u_int8_t *bufferP, int lenP);
static void eRALlte_print_buffer(const u_int8_t * bufferP, int lenP);
#ifdef MSCGEN_PYTOOL
#define MSC_GEN_BUF_SIZE 1024
static char g_msc_gen_buf[MSC_GEN_BUF_SIZE];
static unsigned int g_msc_gen_buffer_index;
#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......@@ -83,7 +66,7 @@ static unsigned int g_msc_gen_buffer_index;
*/
/****************************************************************************
** Name: eRALlte_send_link_register_indication() **
** Name: eRAL_send_link_register_indication() **
** Description: Sends a Link_Register.indication message to the MIHF. **
** This message is ODTONE specific and not defined by the 802.21 **
** standard. It allows the Link SAP to send informations to the MIHF **
......@@ -91,17 +74,17 @@ static unsigned int g_msc_gen_buffer_index;
** Upon receiving this message the MIHF executes its Link SAPs **
** discovery procedure in order to get the full link capabilities. **
** Inputs: tidP Transaction identifier **
** Others: g_link_id, g_mihf_id, ralpriv **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id, ralpriv **
** Outputs: None **
** Others: g_msg_codec_send_buffer **
***************************************************************************/
void eRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *tidP)
void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP)
{
MIH_C_Message_Link_Register_indication_t message;
Bit_Buffer_t *bb;
int message_total_length;
DEBUG(" Send MIH_C_MESSAGE_LINK_REGISTER_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_REGISTER_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -119,52 +102,32 @@ void eRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *tidP)
message.header.action_identifier = (MIH_C_AID_T)6;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Link_Id.link_type = MIH_C_WIRELESS_UMTS;
message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_3G_CELL_ID;
Bit_Buffer_t *plmn = new_BitBuffer_0();
BitBuffer_wrap(plmn, (unsigned char*) ralpriv->plmn, DEFAULT_PLMN_SIZE);
BitBuffer_wrap(plmn, (unsigned char*) &g_enb_ral_obj[instanceP].plmn_id, DEFAULT_PLMN_SIZE);
MIH_C_PLMN_ID_decode(plmn, &message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.plmn_id);
message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = ralpriv->curr_cellId;
message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
free_BitBuffer(plmn);
message_total_length = MIH_C_Link_Message_Encode_Link_Register_indication(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
MIH_C_LINK_ID2String(&message.primitive.Link_Id, g_msc_gen_buf);
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Register.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Register.indication\n");
} else {
DEBUG(": Sent Link_Register.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Register.indication\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_capability_discover_confirm() **
** Name: eRAL_send_capability_discover_confirm() **
** **
** Description: Sends capability discover service management response to **
** the MIH-F. **
......@@ -174,14 +137,14 @@ void eRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *tidP)
** levt_listP: List of events supported by the link layer **
** lcmd_listP: List of commands supported by the link **
** layer **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *link_evt_listP,
MIH_C_LINK_CMD_LIST_T *link_cmd_listP)
......@@ -190,7 +153,7 @@ void eRALlte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
DEBUG(" Send MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -208,8 +171,8 @@ void eRALlte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)1;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.SupportedLinkEventList = link_evt_listP;
......@@ -217,41 +180,17 @@ void eRALlte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Capability_Discover_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n\\nsupported link events=");
g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.SupportedLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nsupported commands=");
g_msc_gen_buffer_index += MIH_C_LINK_CMD_LIST2String2(message.primitive.SupportedLinkCommandList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Capability_Discover.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Capability_Discover.confirm\n");
} else {
DEBUG(": Sent Link_Capability_Discover.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Capability_Discover.confirm\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_event_subscribe_confirm() **
** Name: eRAL_send_event_subscribe_confirm() **
** **
** Description: Sends a Link_Event_Subscribe.confirm message to the MIHF. **
** **
......@@ -261,14 +200,14 @@ void eRALlte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** Inputs: tidP Transaction identifier **
** statusP: Status of operation **
** levt_listP: List of successfully subscribed link events**
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *levt_listP)
{
......@@ -276,7 +215,7 @@ void eRALlte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
DEBUG(" Send MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -294,50 +233,26 @@ void eRALlte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)4;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.ResponseLinkEventList = levt_listP;
message_total_length = MIH_C_Link_Message_Encode_Event_Subscribe_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
if (levt_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list=");
g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Event_Subscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Event_Subscribe.confirm\n");
} else {
DEBUG(": Sent Link_Event_Subscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Event_Subscribe.confirm\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_event_unsubscribe_confirm() **
** Name: eRAL_send_event_unsubscribe_confirm() **
** **
** Description: Sends a Link_Event_Unsubscribe.confirm message to the **
** MIHF. **
......@@ -348,14 +263,14 @@ void eRALlte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** Inputs: tidP Transaction identifier **
** statusP: Status of operation **
** levt_listP: List of successfully subscribed link events**
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *levt_listP)
{
......@@ -363,7 +278,7 @@ void eRALlte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
DEBUG(" Send MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -381,43 +296,19 @@ void eRALlte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)5;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.ResponseLinkEventList = levt_listP;
message_total_length = MIH_C_Link_Message_Encode_Event_Unsubscribe_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
if (levt_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list=");
g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Event_Unsubscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Event_Unsubscribe.confirm\n");
} else {
DEBUG(": Sent Link_Event_Unsubscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Event_Unsubscribe.confirm\n");
}
free_BitBuffer(bb);
}
......@@ -430,7 +321,7 @@ void eRALlte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
/****************************************************************************
** **
** Name: eRALlte_send_link_detected_indication() **
** Name: eRAL_send_link_detected_indication() **
** **
** Description: Sends a Link_Detected.indication message to the MIHF. **
** **
......@@ -442,23 +333,23 @@ void eRALlte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** **
** Inputs: tidP Transaction identifier **
** linfoP: Information of the detected link **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_link_detected_indication(MIH_C_TRANSACTION_ID_T *tidP, MIH_C_LINK_DET_INFO_T *linfoP){
void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP, MIH_C_LINK_DET_INFO_T *linfoP){
MIH_C_Message_Link_Detected_indication_t message;
Bit_Buffer_t *bb;
int message_total_length;
if (!(ralpriv->mih_supported_link_event_list & MIH_C_BIT_LINK_DETECTED)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_DETECTED)) {
return;
}
DEBUG(" Send MIH_C_MESSAGE_LINK_DETECTED_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_DETECTED_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -476,46 +367,25 @@ void eRALlte_send_link_detected_indication(MIH_C_TRANSACTION_ID_T *tidP, MIH_C_
message.header.action_identifier = (MIH_C_AID_T)1;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkDetectedInfo, linfoP,
sizeof(MIH_C_LINK_DET_INFO_T));
message_total_length = MIH_C_Link_Message_Encode_Link_Detected_indication(bb, &message);
#ifdef MSCGEN_PYTOOL
g_msc_gen_buffer_index = 0;
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = MIH_C_SIG_STRENGTH2String(&linfoP->sig_strength, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index = sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nSINR %d\\nData rate %d", linfoP->sinr, linfoP->link_data_rate);
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Detected.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Detected.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Detected.indication\n");
} else {
DEBUG(": Sent Link_Detected.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Detected.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Detected.indication\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** Name: eRALlte_send_link_up_indication() **
** Name: eRAL_send_link_up_indication() **
** Description: Sends a Link_Up.indication message to the MIHF. **
** **
** This notification is generated when a layer 2 connection is **
......@@ -529,7 +399,7 @@ void eRALlte_send_link_detected_indication(MIH_C_TRANSACTION_ID_T *tidP, MIH_C_
** mobil_mngtP: Indicates the type of Mobility Management **
** Protocol supported by the new PoA **
***************************************************************************/
void eRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_link_up_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_LINK_TUPLE_ID_T *lidP,
MIH_C_LINK_ADDR_T *old_arP,
MIH_C_LINK_ADDR_T *new_arP,
......@@ -540,11 +410,11 @@ void eRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
if (!(ralpriv->mih_supported_link_event_list & MIH_C_BIT_LINK_UP)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_UP)) {
return;
}
DEBUG(" Send MIH_C_MESSAGE_LINK_UP_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_UP_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -562,9 +432,9 @@ void eRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)2;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -575,53 +445,16 @@ void eRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Link_Up_indication(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_LINK_ID2String(&lidP->link_id, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nOldAccessRouter=");
if (old_arP) {
g_msc_gen_buffer_index += MIH_C_LINK_ADDR2String(old_arP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
else {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "null");
}
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nNewAccessRouter=");
if (old_arP) {
g_msc_gen_buffer_index += MIH_C_LINK_ADDR2String(new_arP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
else {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "null");
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Up.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Up.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Up.indication\n");
} else {
DEBUG(": Sent Link_Up.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Up.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Up.indication\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** Name: eRALlte_send_link_down_indication() **
** Name: eRAL_send_link_down_indication() **
** Description: Sends a Link_Down.indication message to the MIHF. **
** **
** This notification is generated when layer 2 connectivity is lost. **
......@@ -635,7 +468,7 @@ void eRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *tidP,
** old_arP: Old access router link address **
** reason_codeP: Reason why the link went down **
***************************************************************************/
void eRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_LINK_TUPLE_ID_T *lidP,
MIH_C_LINK_ADDR_T *old_arP,
MIH_C_LINK_DN_REASON_T *reason_codeP)
......@@ -644,11 +477,11 @@ void eRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
if (!(ralpriv->mih_supported_link_event_list & MIH_C_BIT_LINK_DOWN)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_DOWN)) {
return;
}
DEBUG(" Send MIH_C_MESSAGE_LINK_DOWN_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_DOWN_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -661,9 +494,9 @@ void eRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)3;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
message.primitive.OldAccessRouter = old_arP;
......@@ -671,46 +504,17 @@ void eRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Link_Down_indication(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_LINK_ID2String(&lidP->link_id, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nOldAccessRouter=");
if (old_arP) {
g_msc_gen_buffer_index += MIH_C_LINK_ADDR2String(old_arP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
else {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "null");
}
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nReasonCode=");
g_msc_gen_buffer_index += MIH_C_LINK_DN_REASON2String(reason_codeP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Down.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Down.indication\n");
} else {
DEBUG(": Sent Link_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Down.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Down.indication\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_link_parameters_report_indication() **
** Name: eRAL_send_link_parameters_report_indication() **
** **
** Description: Sends a Link_Parameters_Report.indication message to the **
** MIHF. **
......@@ -723,29 +527,26 @@ void eRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
** Inputs: tidP Transaction identifier **
** lidP: Link identifier **
** lparam_listP: List of link parameter reports **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_LINK_TUPLE_ID_T *lidP,
MIH_C_LINK_PARAM_RPT_LIST_T *lparam_listP)
{
MIH_C_Message_Link_Parameters_Report_indication_t message;
Bit_Buffer_t *bb;
int message_total_length;
#ifdef MSCGEN_PYTOOL
int i;
#endif
if (!(ralpriv->mih_supported_link_event_list & MIH_C_BIT_LINK_PARAMETERS_REPORT)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_PARAMETERS_REPORT)) {
return;
}
DEBUG(" Send MIH_C_MESSAGE_LINK_PARAMETERS_REPORT_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_PARAMETERS_REPORT_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -763,9 +564,9 @@ void eRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *tidP
message.header.action_identifier = (MIH_C_AID_T)5;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -773,41 +574,17 @@ void eRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *tidP
message_total_length = MIH_C_Link_Message_Encode_Link_Parameters_Report_indication(bb, &message);
#ifdef MSCGEN_PYTOOL
g_msc_gen_buffer_index = 0;
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index += MIH_C_LINK_ID2String(&lidP->link_id, &g_msc_gen_buf[g_msc_gen_buffer_index]);
for (i = 0; i < lparam_listP->length; i++) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n");
g_msc_gen_buffer_index += MIH_C_LINK_PARAM_RPT2String(&lparam_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Parameters_Report.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Parameters_Report.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Parameters_Report.indication\n");
} else {
DEBUG(": Sent Link_Parameters_Report.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Parameters_Report.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Parameters_Report.indication\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_link_going_down_indication() **
** Name: eRAL_send_link_going_down_indication() **
** **
** Description: Sends a Link_Going_Down.indication message to the MIHF. **
** **
......@@ -821,14 +598,14 @@ void eRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *tidP
** timeP: The time interval (ms) at which the link **
** is expected to go down (0 if unknown) **
** lreasonP: Reason why the link is going to be down **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_LINK_TUPLE_ID_T *lidP,
MIH_C_UNSIGNED_INT2_T *timeP,
MIH_C_LINK_GD_REASON_T *lreasonP)
......@@ -837,11 +614,11 @@ void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
Bit_Buffer_t *bb;
int message_total_length;
if (!(ralpriv->mih_supported_link_event_list & MIH_C_BIT_LINK_GOING_DOWN)) {
if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_GOING_DOWN)) {
return;
}
DEBUG(" Send MIH_C_MESSAGE_LINK_GOING_DOWN_INDICATION\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_GOING_DOWN_INDICATION\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -859,9 +636,9 @@ void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)6;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -871,22 +648,10 @@ void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Link_Going_Down_indication(bb, &message);
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Going_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Going_Down.indication ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Going_Down.indication\n");
} else {
DEBUG(": Sent Link_Going_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Going_Down.indication --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Going_Down.indication\n");
}
free_BitBuffer(bb);
}
......@@ -899,7 +664,7 @@ void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
/****************************************************************************
** **
** Name: eRALlte_send_get_parameters_confirm() **
** Name: eRAL_send_get_parameters_confirm() **
** **
** Description: Sends a Link_Get_Parameters.confirm message to the MIHF. **
** **
......@@ -912,14 +677,14 @@ void eRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *tidP,
** their current values **
** lstates_listP: List of current link state information **
** ldesc_listP: List of link descriptors **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_get_parameters_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_PARAM_LIST_T *lparam_listP,
MIH_C_LINK_STATES_RSP_LIST_T *lstates_listP,
......@@ -928,11 +693,8 @@ void eRALlte_send_get_parameters_confirm(MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_Message_Link_Get_Parameters_confirm_t message;
Bit_Buffer_t *bb;
int message_total_length;
#ifdef MSCGEN_PYTOOL
int i;
#endif
DEBUG(" Send MIH_C_MESSAGE_LINK_GET_PARAMETERS_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_GET_PARAMETERS_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -950,9 +712,9 @@ void eRALlte_send_get_parameters_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)1;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.LinkParametersStatusList_list = lparam_listP;
......@@ -961,58 +723,17 @@ void eRALlte_send_get_parameters_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Get_Parameters_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
if (lparam_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkParametersStatusList=");
for (i = 0; i < lparam_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_PARAM2String(&lparam_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
if (lstates_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkStatesResponseList=");
for (i = 0; i < lstates_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_STATES_RSP2String(&lstates_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
if (ldesc_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkDescriptorsResponseList=");
for (i = 0; i < ldesc_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_DESC_RSP2String(&ldesc_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Get_Parameters.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Get_Parameters.confirm\n");
} else {
DEBUG(": Sent Link_Get_Parameters.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Get_Parameters.confirm\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_configure_thresholds_confirm() **
** Name: eRAL_send_configure_thresholds_confirm() **
** **
** Description: Sends a Link_Configure_Thresholds.confirm message to the **
** MIHF. **
......@@ -1023,25 +744,22 @@ void eRALlte_send_get_parameters_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** Inputs: tidP Transaction identifier **
** statusP: Status of operation **
** lstatus_listP: List of link configure status **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_CFG_STATUS_LIST_T *lstatus_listP)
{
MIH_C_Message_Link_Configure_Thresholds_confirm_t message;
Bit_Buffer_t *bb;
int message_total_length;
#ifdef MSCGEN_PYTOOL
int i;
#endif
DEBUG(" Send MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -1059,50 +777,26 @@ void eRALlte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)2;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.LinkConfigureStatusList_list = lstatus_listP;
message_total_length = MIH_C_Link_Message_Encode_Configure_Thresholds_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n");
for (i = 0; i < lstatus_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_CFG_STATUS2String(&lstatus_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Configure_Threshold.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Configure_Threshold.confirm\n");
} else {
DEBUG(": Sent Link_Configure_Threshold.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Configure_Threshold.confirm\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_send_link_action_confirm() **
** Name: eRAL_send_link_action_confirm() **
** **
** Description: Sends a Link_Action.confirm message to the MIHF. **
** **
......@@ -1115,14 +809,14 @@ void eRALlte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** information **
** action_resultP: Specifies whether the link action was **
** successful **
** Others: g_link_id, g_mihf_id **
** Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id **
** **
** Outputs: None **
** Return: None **
** Others: g_msg_codec_send_buffer **
** **
***************************************************************************/
void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
void eRAL_send_link_action_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_SCAN_RSP_LIST_T *response_setP,
MIH_C_LINK_AC_RESULT_T *action_resultP)
......@@ -1130,11 +824,8 @@ void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
MIH_C_Message_Link_Action_confirm_t message;
Bit_Buffer_t *bb;
int message_total_length;
#ifdef MSCGEN_PYTOOL
unsigned int index;
#endif
DEBUG(" Send MIH_C_MESSAGE_LINK_ACTION_CONFIRM\n");
LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_ACTION_CONFIRM\n");
bb = new_BitBuffer_0();
BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
......@@ -1152,9 +843,9 @@ void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message.header.action_identifier = (MIH_C_AID_T)3;
message.header.transaction_id = *tidP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.ScanResponseSet_list = response_setP;
......@@ -1162,47 +853,17 @@ void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
message_total_length = MIH_C_Link_Message_Encode_Link_Action_confirm(bb, &message);
#ifdef MSCGEN_PYTOOL
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
if (response_setP) {
for (index = 0; index < response_setP->length; index++) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nScan resp:");
g_msc_gen_buffer_index += MIH_C_LINK_SCAN_RSP2String(&response_setP->val[index], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
}
if (action_resultP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nAction result:");
g_msc_gen_buffer_index += MIH_C_LINK_AC_RESULT2String2(action_resultP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (eRALlte_send_to_mih(bb->m_buffer, message_total_length) < 0) {
ERR(": Send Link_Action.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
LOG_E(RAL_ENB, ": Send Link_Action.confirm\n");
} else {
DEBUG(": Sent Link_Action.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_ENB, ": Sent Link_Action.confirm\n");
}
free_BitBuffer(bb);
}
/****************************************************************************
** **
** Name: eRALlte_mihf_connect() **
** Name: eRAL_mihf_connect(ral_enb_instance_t instanceP) **
** **
** Description: Connects the RAL to the remote MIH Function. **
** The calling process should exit upon connection failure **
......@@ -1211,16 +872,16 @@ void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** structure. **
** **
** Inputs: None **
** Others: g_mihf_ip_address, g_mihf_remote_port **
** g_ral_ip_address, **
** g_ral_listening_port_for_mihf **
** Others: g_enb_ral_obj[instanceP].mihf_ip_address, g_enb_ral_obj[instanceP].mihf_remote_port **
** g_enb_ral_obj[instanceP].ral_ip_address, **
** g_enb_ral_obj[instanceP].ral_listening_port **
** **
** Outputs: None **
** Return: 0 on success, -1 on failure **
** Others: g_sockd_mihf **
** **
***************************************************************************/
int eRALlte_mihf_connect(void)
****************************************************************************/
int eRAL_mihf_connect(ral_enb_instance_t instanceP)
{
struct addrinfo info; /* endpoint information */
struct addrinfo *addr, *rp; /* endpoint address */
......@@ -1238,9 +899,9 @@ int eRALlte_mihf_connect(void)
info.ai_flags = 0;
info.ai_protocol = 0; /* Any protocol */
rc = getaddrinfo(g_mihf_ip_address, g_mihf_remote_port, &info, &addr);
rc = getaddrinfo(g_enb_ral_obj[instanceP].mihf_ip_address, g_enb_ral_obj[instanceP].mihf_remote_port, &info, &addr);
if (rc != 0) {
ERR(" getaddrinfo: %s\n", gai_strerror(rc));
LOG_E(RAL_ENB, " getaddrinfo: %s\n", gai_strerror(rc));
return -1;
}
......@@ -1251,13 +912,13 @@ int eRALlte_mihf_connect(void)
*/
for (rp = addr; rp != NULL; rp = rp->ai_next) {
g_sockd_mihf = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_sockd_mihf < 0) {
g_enb_ral_obj[instanceP].mih_sock_desc = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_enb_ral_obj[instanceP].mih_sock_desc < 0) {
continue;
}
optval = 1;
setsockopt(g_sockd_mihf, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
setsockopt(g_enb_ral_obj[instanceP].mih_sock_desc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
/*
* Convert the RAL local network address
......@@ -1266,55 +927,55 @@ int eRALlte_mihf_connect(void)
/* IPv4 network address family */
struct sockaddr_in *addr4 = NULL;
DEBUG(" %s is an ipv4 address\n", g_mihf_ip_address);
LOG_D(RAL_ENB, " %s is an ipv4 address\n", g_enb_ral_obj[instanceP].mihf_ip_address);
addr4 = (struct sockaddr_in *)(&buf[0]);
addr4->sin_port = htons(atoi(g_ral_listening_port_for_mihf));
addr4->sin_port = htons(atoi(g_enb_ral_obj[instanceP].ral_listening_port));
addr4->sin_family = AF_INET;
rc = inet_pton(AF_INET, g_ral_ip_address, &addr4->sin_addr);
rc = inet_pton(AF_INET, g_enb_ral_obj[instanceP].ral_ip_address, &addr4->sin_addr);
}
else if (rp->ai_family == AF_INET6) {
/* IPv6 network address family */
struct sockaddr_in6 *addr6 = NULL;
DEBUG(" %s is an ipv6 address\n", g_mihf_ip_address);
LOG_D(RAL_ENB, " %s is an ipv6 address\n", g_enb_ral_obj[instanceP].mihf_ip_address);
addr6 = (struct sockaddr_in6 *)(&buf[0]);
addr6->sin6_port = htons(atoi(g_ral_listening_port_for_mihf));
addr6->sin6_port = htons(atoi(g_enb_ral_obj[instanceP].ral_listening_port));
addr6->sin6_family = AF_INET6;
rc = inet_pton(AF_INET, g_ral_ip_address, &addr6->sin6_addr);
rc = inet_pton(AF_INET, g_enb_ral_obj[instanceP].ral_ip_address, &addr6->sin6_addr);
}
else {
ERR(" %s is an unknown address format %d\n",
g_mihf_ip_address, rp->ai_family);
LOG_E(RAL_ENB, " %s is an unknown address format %d\n",
g_enb_ral_obj[instanceP].mihf_ip_address, rp->ai_family);
return -1;
}
if (rc < 0) {
/* The network address convertion failed */
ERR(" inet_pton(RAL IP address %s): %s\n",
g_ral_ip_address, strerror(rc));
LOG_E(RAL_ENB, " inet_pton(RAL IP address %s): %s\n",
g_enb_ral_obj[instanceP].ral_ip_address, strerror(rc));
return -1;
}
else if (rc == 0) {
/* The network address is not valid */
ERR(" RAL IP address %s is not valid\n", g_ral_ip_address);
LOG_E(RAL_ENB, " RAL IP address %s is not valid\n", g_enb_ral_obj[instanceP].ral_ip_address);
return -1;
}
/* Bind the socket to the local RAL network address */
rc = bind(g_sockd_mihf, (const struct sockaddr *)buf,
rc = bind(g_enb_ral_obj[instanceP].mih_sock_desc, (const struct sockaddr *)buf,
sizeof(struct sockaddr_in));
if (rc < 0) {
ERR(" bind(RAL IP address %s): %s\n",
g_ral_ip_address, strerror(errno));
LOG_E(RAL_ENB, " bind(RAL IP address %s): %s\n",
g_enb_ral_obj[instanceP].ral_ip_address, strerror(errno));
return -1;
}
/* Connect the socket to the remote MIH-F network address */
if (connect(g_sockd_mihf, rp->ai_addr, rp->ai_addrlen) == 0) {
NOTICE(" RAL [%s:%s] is now UDP-CONNECTED to MIH-F [%s:%s]\n",
g_ral_ip_address, g_ral_listening_port_for_mihf,
g_mihf_ip_address, g_mihf_remote_port);
if (connect(g_enb_ral_obj[instanceP].mih_sock_desc, rp->ai_addr, rp->ai_addrlen) == 0) {
LOG_N(RAL_ENB, " RAL [%s:%s] is now UDP-CONNECTED to MIH-F [%s:%s]\n",
g_enb_ral_obj[instanceP].ral_ip_address, g_enb_ral_obj[instanceP].ral_listening_port,
g_enb_ral_obj[instanceP].mihf_ip_address, g_enb_ral_obj[instanceP].mihf_remote_port);
break;
}
/*
......@@ -1322,14 +983,14 @@ int eRALlte_mihf_connect(void)
* Close the socket file descriptor and try to connect to an other
* address.
*/
close(g_sockd_mihf);
close(g_enb_ral_obj[instanceP].mih_sock_desc);
}
/*
* Unable to connect to a network address
*/
if (rp == NULL) {
ERR(" Could not connect to MIH-F\n");
LOG_E(RAL_ENB, " Could not connect to MIH-F\n");
return -1;
}
......@@ -1339,13 +1000,13 @@ int eRALlte_mihf_connect(void)
}
/****************************************************************************
** Name: eRALlte_mih_link_process_message() **
** Name: eRAL_mih_link_process_message() **
** Description: Processes messages received from the MIH-F. **
** Others: g_sockd_mihf **
** Return: Always return 0 **
** Others: g_msg_codec_recv_buffer **
***************************************************************************/
int eRALlte_mih_link_process_message(void){
int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
MIH_C_Message_Wrapper_t message_wrapper;
int nb_bytes_received ;
int nb_bytes_decoded ;
......@@ -1361,7 +1022,7 @@ int eRALlte_mih_link_process_message(void){
bb = new_BitBuffer_0();
nb_bytes_received = recvfrom(g_sockd_mihf,
nb_bytes_received = recvfrom(g_enb_ral_obj[instanceP].mih_sock_desc,
(void *)g_msg_codec_recv_buffer,
MSG_CODEC_RECV_BUFFER_SIZE,
0,
......@@ -1369,13 +1030,13 @@ int eRALlte_mih_link_process_message(void){
&sockaddr_len);
if (nb_bytes_received > 0) {
DEBUG(" \n");
DEBUG(" %s Received %d bytes\n", __FUNCTION__, nb_bytes_received);
eRALlte_print_buffer(g_msg_codec_recv_buffer, nb_bytes_received);
LOG_D(RAL_ENB, " \n");
LOG_D(RAL_ENB, " %s Received %d bytes\n", __FUNCTION__, nb_bytes_received);
eRAL_print_buffer(g_msg_codec_recv_buffer, nb_bytes_received);
total_bytes_to_decode += nb_bytes_received;
BitBuffer_wrap(bb, g_msg_codec_recv_buffer, total_bytes_to_decode);
/* Decode the message received from the MIHF */
status = eRALlte_mih_link_msg_decode(bb, &message_wrapper);
status = eRAL_mih_link_msg_decode(instanceP, bb, &message_wrapper);
if (status == MIH_MESSAGE_DECODE_OK) {
nb_bytes_decoded = BitBuffer_getPosition(bb);
if (nb_bytes_decoded > 0) {
......@@ -1410,7 +1071,7 @@ int eRALlte_mih_link_process_message(void){
/****************************************************************************
** **
** Name: eRALlte_print_buffer() **
** Name: eRAL_print_buffer() **
** **
** Description: Print the content of a buffer in hexadecimal. **
** **
......@@ -1423,7 +1084,7 @@ int eRALlte_mih_link_process_message(void){
** Others: None **
** **
***************************************************************************/
static void eRALlte_print_buffer(const u_int8_t * bufferP, int lenP)
void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
{
char c;
unsigned int buffer_index = 0;
......@@ -1485,12 +1146,12 @@ static void eRALlte_print_buffer(const u_int8_t * bufferP, int lenP)
}
buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " |\n");
buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], "------+-------------------------------------------------+------------------+\n");
DEBUG(g_msg_codec_print_buffer);
LOG_D(RAL_ENB, g_msg_codec_print_buffer);
}
/****************************************************************************
** **
** Name: eRALlte_send_to_mih() **
** Name: eRAL_send_to_mih( instanceP, ) **
** **
** Description: Sends a buffered message to the MIH-F. **
** **
......@@ -1503,28 +1164,28 @@ static void eRALlte_print_buffer(const u_int8_t * bufferP, int lenP)
** Others: None **
** **
***************************************************************************/
static int eRALlte_send_to_mih(const u_int8_t *bufferP, int lenP)
int eRAL_send_to_mih(ral_enb_instance_t instanceP, const u_int8_t *bufferP, int lenP)
{
int result;
eRALlte_print_buffer(bufferP, lenP);
result = send(g_sockd_mihf, (const void *)bufferP, lenP, 0);
eRAL_print_buffer(bufferP, lenP);
result = send(g_enb_ral_obj[instanceP].mih_sock_desc, (const void *)bufferP, lenP, 0);
if (result != lenP) {
ERR(" %s : %d bytes failed, returned %d: %s\n",
LOG_E(RAL_ENB, " %s : %d bytes failed, returned %d: %s\n",
__FUNCTION__, lenP, result, strerror(errno));
}
return result;
}
/****************************************************************************
** Name: eRALlte_mih_link_msg_decode() **
** Name: eRAL_mih_link_msg_decode() **
** Description: Decode messages received from the MIH-F. **
** Inputs: bbP: Pointer to the buffer to decode **
** Outputs: message_wrapperP: **
** Pointer to the message wrapper **
** Return: < 0 on failure, 0 otherwise **
***************************************************************************/
static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP){
//---------------------------------------------------------------------------
int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP){
//---------------------------------------------------------------------------
int status = MIH_MESSAGE_DECODE_FAILURE;
MIH_C_HEADER_T header;
MIH_C_STATUS_T mih_status;
......@@ -1561,40 +1222,24 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* The recipient responds immediately with Link_Capability_
* Discover.confirm primitive.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_capability_discover_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Capability_Discover.request */
status = MIH_C_Link_Message_Decode_Link_Capability_Discover_request(bbP, &message_wrapperP->_union_message.link_capability_discover_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.request --->][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
/* Process Link_Capability_Discover.request */
MIH_C_Link_Message_Link_Capability_Discover_request2String(&message_wrapperP->_union_message.link_capability_discover_request, g_msg_print_buffer);
DEBUG(" %s", g_msg_print_buffer);
LOG_D(RAL_ENB, " %s", g_msg_print_buffer);
mih_status = MIH_C_STATUS_SUCCESS;
DEBUG("**\n");
LOG_D(RAL_ENB, "**\n");
/* Send Link_Capability_Discover.confirm */
eRALlte_send_capability_discover_confirm(&message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id,
eRAL_send_capability_discover_confirm(instanceP, &message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id,
&mih_status,
&ralpriv->mih_supported_link_event_list,
&ralpriv->mih_supported_link_command_list);
&g_enb_ral_obj[instanceP].mih_supported_link_event_list,
&g_enb_ral_obj[instanceP].mih_supported_link_command_list);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
......@@ -1606,39 +1251,17 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* The recipient responds immediately with Link_Event_Subscribe.
* confirm primitive.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_event_subscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Event_Subscribe.request */
status = MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(bbP, &message_wrapperP->_union_message.link_event_subscribe_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_subscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
/* Process Link_Event_Subscribe.request */
DEBUG("**\n");
eRALlte_subscribe_request(&message_wrapperP->_union_message.link_event_subscribe_request);
LOG_D(RAL_ENB, "**\n");
eRAL_subscribe_request(instanceP, &message_wrapperP->_union_message.link_event_subscribe_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_subscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
......@@ -1650,38 +1273,17 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* The recipient responds immediately with Link_Event_
* Unsubscribe.confirm primitive.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_event_unsubscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Event_Unsubscribe.request */
status = MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(bbP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_unsubscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
LOG_D(RAL_ENB, "**\n");
/* Process Link_Event_Unsubscribe.request */
eRALlte_unsubscribe_request(&message_wrapperP->_union_message.link_event_unsubscribe_request);
eRAL_unsubscribe_request(instanceP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_unsubscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
......@@ -1692,43 +1294,16 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* The recipient link responds with Link_Get_Parameters.confirm
* primitive.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_get_parameters_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Get_Parameters.request */
status = MIH_C_Link_Message_Decode_Link_Get_Parameters_request(bbP, &message_wrapperP->_union_message.link_get_parameters_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
for (i = 0; i < message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkParametersRequest_list.length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_PARAM_TYPE2String(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkParametersRequest_list.val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n Link states request=");
g_msc_gen_buffer_index += MIH_C_LINK_STATES_REQ2String2(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkStatesRequest, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n Link desc request=");
g_msc_gen_buffer_index += MIH_C_LINK_DESC_REQ2String2(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkDescriptorsRequest, &g_msc_gen_buf[g_msc_gen_buffer_index]);
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
LOG_D(RAL_ENB, "**\n");
/* Process Link_Get_Parameters.request */
eRALlte_get_parameters_request(&message_wrapperP->_union_message.link_get_parameters_request);
eRAL_get_parameters_request(instanceP, &message_wrapperP->_union_message.link_get_parameters_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
......@@ -1739,38 +1314,16 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* The recipient responds immediately with Link_Configure_
* Thresholds.confirm primitive.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_configure_thresholds_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Configure_Thresholds.request */
status = MIH_C_Link_Message_Decode_Link_Configure_Thresholds_request(bbP, &message_wrapperP->_union_message.link_configure_thresholds_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
for (i = 0; i < message_wrapperP->_union_message.link_configure_thresholds_request.primitive.LinkConfigureParameterList_list.length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_CFG_PARAM2String(&message_wrapperP->_union_message.link_configure_thresholds_request.primitive.LinkConfigureParameterList_list.val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
LOG_D(RAL_ENB, "**\n");
/* Process Link_Configure_Thresholds.request */
eRALlte_configure_thresholds_request(&message_wrapperP->_union_message.link_configure_thresholds_request);
eRAL_configure_thresholds_request(instanceP, &message_wrapperP->_union_message.link_configure_thresholds_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
......@@ -1783,45 +1336,20 @@ static int eRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_
* user to perform an action on a pre-defined link-layer
* connection.
*/
DEBUG(" %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__);
LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_action_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
/* Decode Link_Action.request */
status = MIH_C_Link_Message_Decode_Link_Action_request(bbP, &message_wrapperP->_union_message.link_action_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_LINK_ACTION2String(&message_wrapperP->_union_message.link_action_request.primitive.LinkAction, g_msc_gen_buf);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nExecution Delay=%d", message_wrapperP->_union_message.link_action_request.primitive.ExecutionDelay);
if (message_wrapperP->_union_message.link_action_request.primitive.PoALinkAddress != NULL) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nPoALinkAddress=");
g_msc_gen_buffer_index += MIH_C_LINK_ADDR2String(message_wrapperP->_union_message.link_action_request.primitive.PoALinkAddress, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
LOG_D(RAL_ENB, "**\n");
/* Process Link_Action.request */
eRALlte_action_request(&message_wrapperP->_union_message.link_action_request);
eRAL_action_request(instanceP, &message_wrapperP->_union_message.link_action_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.request\\nERR DECODE --->][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
default:
WARNING(" UNKNOWN MESSAGE ID SID %d, OP_CODE %d, AID %d\n", header.service_identifier, header.operation_code, header.action_identifier);
LOG_W(RAL_ENB, " UNKNOWN MESSAGE ID SID %d, OP_CODE %d, AID %d\n", header.service_identifier, header.operation_code, header.action_identifier);
status = MIH_MESSAGE_DECODE_FAILURE;
}
}
......
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_parameters.c
* Source eRAL_parameters.c
*
* Version 0.1
*
......@@ -17,10 +17,10 @@
* Description
*
*****************************************************************************/
#define LTE_RAL_ENB
#define LTE_RAL_ENB_PARAMETERS_C
#include "lteRALenb_parameters.h"
#include "lteRALenb_mih_msg.h"
#include "lteRALenb.h"
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......@@ -28,7 +28,7 @@
/****************************************************************************
** **
** Name: eRALlte_get_parameters_request() **
** Name: eRAL_get_parameters_request() **
** **
** Description: Processes the Link_Get_Parameters.request message and **
** sends a LinK_Get_Parameters.confirm message to the MIHF. **
......@@ -41,13 +41,134 @@
** Others: None **
** **
***************************************************************************/
void eRALlte_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* msgP)
void eRAL_get_parameters_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Get_Parameters_request_t* messageP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_SUCCESS;
MIH_C_STATUS_T status;
MIH_C_LINK_PARAM_LIST_T link_parameters_status_list;
MIH_C_LINK_STATES_RSP_LIST_T link_states_response_list;
MIH_C_LINK_DESC_RSP_LIST_T link_descriptors_response_list;
unsigned int link_index;
// SAVE REQUEST
// MAY BE MERGE REQUESTS ?
//memcpy(&g_link_cfg_param_thresholds_list, &messageP->primitive.LinkConfigureParameterList_list, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
status = MIH_C_STATUS_SUCCESS;
for (link_index = 0;
link_index < messageP->primitive.LinkParametersRequest_list.length;
link_index++) {
//------------------------------------------------
// MIH_C_LINK_PARAM_LIST_T
//------------------------------------------------
memcpy(&link_parameters_status_list.val[link_index].link_param_type,
&messageP->primitive.LinkParametersRequest_list.val[link_index],
sizeof(MIH_C_LINK_PARAM_TYPE_T));
switch (messageP->primitive.LinkParametersRequest_list.val[link_index].choice) {
case MIH_C_LINK_PARAM_TYPE_CHOICE_GEN:
/*#define MIH_C_LINK_PARAM_GEN_DATA_RATE (MIH_C_LINK_PARAM_GEN_T)0
#define MIH_C_LINK_PARAM_GEN_SIGNAL_STRENGTH (MIH_C_LINK_PARAM_GEN_T)1
#define MIH_C_LINK_PARAM_GEN_SINR (MIH_C_LINK_PARAM_GEN_T)2
#define MIH_C_LINK_PARAM_GEN_THROUGHPUT (MIH_C_LINK_PARAM_GEN_T)3
#define MIH_C_LINK_PARAM_GEN_PACKET_ERROR_RATE (MIH_C_LINK_PARAM_GEN_T)4*/
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.link_param_val = MIH_C_LINK_PARAM_GEN_SIGNAL_STRENGTH;
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_QOS:
/*
* \brief A type to represent QOS_LIST parameters.
* 0: Maximum number of differentiable classes of service supported.
* 1: Minimum packet transfer delay for all CoS, the minimum delay over a class
* population of interest.
* 2: Average packet transfer delay for all CoS, the arithmetic mean of the delay
* over a class population of interest. (See B.3.4)
* 3: Maximum packet transfer delay for all CoS, the maximum delay over a class
* population of interest.
* 4: Packet transfer delay jitter for all CoS, the standard deviation of the delay
* over a class population of interest. (See B.3.5.)
* 5: Packet loss rate for all CoS, the ratio between the number of frames that are
* transmitted but not received and the total number of frames transmitted over
* a class population of interest. (See B.3.2.)
* 6–255: (Reserved)
*/
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_QOS_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.qos_param_val.choice = MIH_C_QOS_PARAM_VAL_CHOICE_AVG_PK_TX_DELAY;
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.length = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].cos_id = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].value = 20; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[1].cos_id = 3; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[2].value = 50; //??
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_LTE:
/*
#define MIH_C_LINK_PARAM_LTE_UE_RSRP 0
#define MIH_C_LINK_PARAM_LTE_UE_RSRQ 1
#define MIH_C_LINK_PARAM_LTE_UE_CQI 2
#define MIH_C_LINK_PARAM_LTE_AVAILABLE_BW 3
#define MIH_C_LINK_PARAM_LTE_PACKET_DELAY 4
#define MIH_C_LINK_PARAM_LTE_PACKET_LOSS_RATE 5
#define MIH_C_LINK_PARAM_LTE_L2_BUFFER_STATUS 6
#define MIH_C_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES 7
#define MIH_C_LINK_PARAM_LTE_EMBMS_CAPABILITY 8
#define MIH_C_LINK_PARAM_LTE_JUMBO_FEASIBILITY 9
#define MIH_C_LINK_PARAM_LTE_JUMBO_SETUP_STATUS 10
#define MIH_C_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW 11
*/
case MIH_C_LINK_PARAM_TYPE_CHOICE_GG:
case MIH_C_LINK_PARAM_TYPE_CHOICE_EDGE:
case MIH_C_LINK_PARAM_TYPE_CHOICE_ETH:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_11:
case MIH_C_LINK_PARAM_TYPE_CHOICE_C2K:
case MIH_C_LINK_PARAM_TYPE_CHOICE_FDD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_HRPD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_16:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_20:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_22:
default:
LOG_E(RAL_ENB, "%s TO DO CONTINUE PROCESSING LinkParametersRequest_list of \n", __FUNCTION__);
}
//------------------------------------------------
// MIH_C_LINK_STATES_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_OP_MODE) {
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
} else if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_CHANNEL_ID) {
link_states_response_list.val[link_index].choice = 1;
link_states_response_list.val[link_index]._union.channel_id = PREDEFINED_CHANNEL_ID;
} else {
LOG_E(RAL_ENB, "%s Invalid LinkStatesRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
}
//------------------------------------------------
// MIH_C_LINK_DESC_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_CLASSES_OF_SERVICE_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
} else if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_QUEUES_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 1;
link_descriptors_response_list.val[link_index]._union.num_queue = PREDEFINED_QUEUES_SUPPORTED;
} else {
LOG_E(RAL_ENB, "%s Invalid LinkDescriptorsRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
}
}
link_parameters_status_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_states_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_descriptors_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
/* Get parameters link command is not supported at the network side */
DEBUG(" Get Parameters request is not supported by the network\n");
eRALlte_send_get_parameters_confirm(&msgP->header.transaction_id,
LOG_D(RAL_ENB, " Get Parameters request is not supported by the network\n");
eRAL_send_get_parameters_confirm(instanceP, &messageP->header.transaction_id,
&status, NULL, NULL, NULL);
}
......
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_process.c
* Source eRAL_process.c
*
* Version 0.1
*
......@@ -17,23 +17,11 @@
* Description
*
*****************************************************************************/
#include "lteRALenb_variables.h"
#include "lteRALenb_proto.h"
#define LTE_RAL_ENB
#define LTE_RAL_ENB_PROCESS_C
#include "lteRALenb.h"
#include "lteRALenb_mih_msg.h"
#include "MIH_C.h"
/****************************************************************************/
/******************* G L O C A L D E F I N I T I O N S *****************/
/****************************************************************************/
extern int eRALlte_action_save_flow_id(MIH_C_FLOW_ID_T* flowId, int cnxid);
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
static void _eRALlte_process_clean_pending_mt(void);
static void _eRALlte_process_waiting_RB(int mt_ix);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......@@ -41,7 +29,7 @@ static void _eRALlte_process_waiting_RB(int mt_ix);
/****************************************************************************
** **
** Name: eRALlte_process_find_channel() **
** Name: eRAL_process_find_channel() **
** **
** Description: Returns the Mobile Terminal index and the Radio Bearer **
** channel index for the specified Connection identifier. **
......@@ -57,15 +45,15 @@ static void _eRALlte_process_waiting_RB(int mt_ix);
** Others: None **
** **
***************************************************************************/
int eRALlte_process_find_channel(unsigned int cnxid, int* mt_ix, int* ch_ix){
int eRAL_process_find_channel(ral_enb_instance_t instanceP, unsigned int cnxid, int* mt_ix, int* ch_ix){
int mt, ch;
int found = 0;
DEBUG(" %s : cnxid = %d\n", __FUNCTION__, cnxid);
LOG_D(RAL_ENB, " %s : cnxid = %d\n", __FUNCTION__, cnxid);
for (mt = 0; !found && (mt < RAL_MAX_MT); mt++) {
for (ch = 0; ch < RAL_MAX_RB; ch++) {
if (ralpriv->mt[mt].radio_channel[ch].cnx_id == cnxid) {
if (g_enb_ral_obj[instanceP].mt[mt].radio_channel[ch].cnx_id == cnxid) {
found = 1;
*mt_ix = mt;
*ch_ix = ch;
......@@ -79,13 +67,13 @@ int eRALlte_process_find_channel(unsigned int cnxid, int* mt_ix, int* ch_ix){
*ch_ix = 0;
}
DEBUG (" %s : return %d (mt=%d, ch=%d)\n" , __FUNCTION__, found, *mt_ix, *ch_ix);
LOG_D(RAL_ENB, " %s : return %d (mt=%d, ch=%d)\n" , __FUNCTION__, found, *mt_ix, *ch_ix);
return found;
}
/****************************************************************************
** **
** Name: eRALlte_process_find_new_channel() **
** Name: eRAL_process_find_new_channel() **
** **
** Description: Returns the index of the first available Radio Bearer **
** channel for the specified Mobile Terminal identifier. **
......@@ -100,25 +88,25 @@ int eRALlte_process_find_channel(unsigned int cnxid, int* mt_ix, int* ch_ix){
** Others: None **
** **
***************************************************************************/
int eRALlte_process_find_new_channel(int mt_ix)
int eRAL_process_find_new_channel(ral_enb_instance_t instanceP, int mt_ix)
{
int ch_ix;
DEBUG(" %s : mt_ix = %d\n", __FUNCTION__, mt_ix);
LOG_D(RAL_ENB, " %s : mt_ix = %d\n", __FUNCTION__, mt_ix);
for (ch_ix = 0; ch_ix < RAL_MAX_RB; ch_ix++) {
if (ralpriv->mt[mt_ix].radio_channel[ch_ix].cnx_id == 0) {
if (g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix].cnx_id == 0) {
break;
}
}
DEBUG (" %s : return %d\n" , __FUNCTION__, ch_ix);
LOG_D(RAL_ENB, " %s : return %d\n" , __FUNCTION__, ch_ix);
return ch_ix;
}
/****************************************************************************
** **
** Name: eRALlte_process_clean_channel() **
** Name: eRAL_process_clean_channel() **
** **
** Description: Cleans data of the specified Radio Bearer channel. **
** **
......@@ -130,16 +118,16 @@ int eRALlte_process_find_new_channel(int mt_ix)
** Others: None **
** **
***************************************************************************/
void eRALlte_process_clean_channel(struct ral_lte_channel* channel)
void eRAL_process_clean_channel(struct ral_lte_channel* channel)
{
DEBUG(" %s : cnx_id = %d, rbId = %d\n", __FUNCTION__,
LOG_D(RAL_ENB, " %s : cnx_id = %d, rbId = %d\n", __FUNCTION__,
channel->cnx_id, channel->rbId);
memset(channel, 0, sizeof (struct ral_lte_channel));
}
/****************************************************************************
** **
** Name: eRALlte_process_mt_addr_to_string() **
** Name: eRAL_process_mt_addr_to_string() **
** **
** Description: Display the specified IPv6 address. **
** **
......@@ -151,7 +139,7 @@ void eRALlte_process_clean_channel(struct ral_lte_channel* channel)
** Others: None **
** **
***************************************************************************/
char* eRALlte_process_mt_addr_to_string(const unsigned char* ip_addr)
char* eRAL_process_mt_addr_to_string(const unsigned char* ip_addr)
{
static char buffer[40];
int i, index = 0;
......@@ -166,7 +154,7 @@ char* eRALlte_process_mt_addr_to_string(const unsigned char* ip_addr)
/****************************************************************************
** **
** Name: eRALlte_process_mt_addr_to_l2id() **
** Name: eRAL_process_mt_addr_to_l2id() **
** **
** Description: Convert the specified IP address to Layer 2 identifier. **
** **
......@@ -178,10 +166,10 @@ char* eRALlte_process_mt_addr_to_string(const unsigned char* ip_addr)
** Others: None **
** **
***************************************************************************/
void eRALlte_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int* l2id)
void eRAL_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int* l2id)
{
if ( !(mt_addr) || !(l2id) ) {
ERR(" %s : input parameter is NULL\n", __FUNCTION__);
LOG_E(RAL_ENB, " %s : input parameter is NULL\n", __FUNCTION__);
return;
}
l2id[0] = mt_addr[0]+256 *(mt_addr[1]+256*(mt_addr[2]+256*(mt_addr[3])));
......@@ -190,7 +178,7 @@ void eRALlte_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int*
/****************************************************************************
** **
** Name: eRALlte_process_cmp_mt_addr() **
** Name: eRAL_process_cmp_mt_addr() **
** **
** Description: Compares MT's IP address to the specified L2 identifier. **
** **
......@@ -204,7 +192,7 @@ void eRALlte_process_mt_addr_to_l2id(const unsigned char* mt_addr, unsigned int*
** Others: None **
** **
***************************************************************************/
int eRALlte_process_cmp_mt_addr(const char* mt_addr, const char* l2id)
int eRAL_process_cmp_mt_addr(const char* mt_addr, const char* l2id)
{
int i;
for (i = 0; i < 8; i++) {
......@@ -217,7 +205,7 @@ int eRALlte_process_cmp_mt_addr(const char* mt_addr, const char* l2id)
/****************************************************************************
** **
** Name: eRALlte_process_find_mt_by_addr() **
** Name: eRAL_process_find_mt_by_addr() **
** **
** Description: Returns the index of the Mobile Terminal with the **
** specified IP address. **
......@@ -231,12 +219,12 @@ int eRALlte_process_cmp_mt_addr(const char* mt_addr, const char* l2id)
** Others: None **
** **
***************************************************************************/
int eRALlte_process_find_mt_by_addr(const char* mt_addr)
int eRAL_process_find_mt_by_addr(ral_enb_instance_t instanceP, const char* mt_addr)
{
int mt_ix;
for (mt_ix = 0; mt_ix < RAL_MAX_MT; mt_ix++) {
const char* l2id = (const char*)(&ralpriv->mt[mt_ix].ipv6_l2id[0]);
const char* l2id = (const char*)(&g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_l2id[0]);
int i;
for (i = 0; i < 8; i++) {
if ((u8)l2id[i] != (u8)mt_addr[i+8]) {
......@@ -248,13 +236,13 @@ int eRALlte_process_find_mt_by_addr(const char* mt_addr)
}
}
DEBUG (" %s : return %d\n" , __FUNCTION__, mt_ix);
LOG_D(RAL_ENB, " %s : return %d\n" , __FUNCTION__, mt_ix);
return mt_ix;
}
/****************************************************************************
** **
** Name: eRALlte_process_verify_pending_mt_status() **
** Name: eRAL_process_verify_pending_mt_status() **
** **
** Description: Checks the pending MT connection status and simulates RB **
** setup if it is ready for Radio Bearer establishment. **
......@@ -267,43 +255,43 @@ int eRALlte_process_find_mt_by_addr(const char* mt_addr)
** Others: None **
** **
***************************************************************************/
void eRALlte_process_verify_pending_mt_status(void)
void eRAL_process_verify_pending_mt_status(ral_enb_instance_t instanceP)
{
int mt_ix;
if (!ralpriv->pending_mt_timer) {
DEBUG(" Pending MT timer expired\n");
#ifdef RAL_REALTIME
_eRALlte_process_clean_pending_mt();
#endif
#ifdef RAL_DUMMY
DEBUG(" SIMULATE MT arrival\n");
mt_ix = eRALlte_NAS_update_MTs_list();
DEBUG(" SIMULATE RB setup\n");
_eRALlte_process_waiting_RB(mt_ix);
#endif
if (!g_enb_ral_obj[instanceP].pending_mt_timer) {
LOG_D(RAL_ENB, " Pending MT timer expired\n");
#ifdef RAL_REALTIME
eRAL_process_clean_pending_mt(instanceP);
#endif
#ifdef RAL_DUMMY
LOG_D(RAL_ENB, " SIMULATE MT arrival\n");
mt_ix = eRAL_NAS_update_MTs_list();
LOG_D(RAL_ENB, " SIMULATE RB setup\n");
eRAL_process_waiting_RB(mt_ix);
#endif
} else {
#ifdef RAL_REALTIME
if (!( ralpriv->pending_mt_timer % 10)) {
#ifdef RAL_REALTIME
if (!( g_enb_ral_obj[instanceP].pending_mt_timer % 10)) {
/* Get the list of MTs in the driver waiting for pending
* RB establishment */
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST, 0, 0);
RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST, 0, 0);
// LG RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_LIST, 0, 0);
// LG RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_LIST, 0, 0);
/* Check if the pending MT is in the list */
mt_ix = eRALlte_process_find_mt_by_addr((char*)ralpriv->pending_mt.ipv6_addr);
mt_ix = eRAL_process_find_mt_by_addr(instanceP, (char*)g_enb_ral_obj[instanceP].pending_mt.ipv6_addr);
if ( (mt_ix < RAL_MAX_MT) &&
(ralpriv->mt[mt_ix].mt_state == RB_CONNECTED)) {
(g_enb_ral_obj[instanceP].mt[mt_ix].mt_state == RB_CONNECTED)) {
/* The pending MT is ready for RB establishment */
_eRALlte_process_waiting_RB(mt_ix);
eRAL_process_waiting_RB(instanceP, mt_ix);
}
}
#endif
#endif
}
}
/****************************************************************************
** **
** Name: eRALlte_process_map_qos() **
** Name: eRAL_process_map_qos() **
** **
** Description: Performs mapping of reserved bit rate to Radio QoS class, **
** and mapping of traffic class to DCSP. **
......@@ -320,7 +308,7 @@ void eRALlte_process_verify_pending_mt_status(void)
** Others: ralpriv **
** **
***************************************************************************/
int eRALlte_process_map_qos(int mt_ix, int ch_ix)
int eRAL_process_map_qos(ral_enb_instance_t instanceP, int mt_ix, int ch_ix)
{
int resBitrateDL = 0, resBitrateUL = 0;
struct ral_lte_channel *currChannel;
......@@ -330,7 +318,7 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
*/
if (mt_ix == RAL_MAX_MT)
{
currChannel = &(ralpriv->mcast.radio_channel);
currChannel = &(g_enb_ral_obj[instanceP].mcast.radio_channel);
/* multicast - reserved bit rate */
resBitrateDL = (int)currChannel->resBitrate[1];
......@@ -341,7 +329,7 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
} else if (resBitrateDL <= RAL_BITRATE_384k) {
currChannel->RadioQoSclass = 22;
} else {
ERR (" %s : Invalid requested resBitrate %d - Request will be rejected.\n", __FUNCTION__, resBitrateDL);
LOG_E(RAL_ENB, " %s : Invalid requested resBitrate %d - Request will be rejected.\n", __FUNCTION__, resBitrateDL);
return 0;
}
......@@ -349,10 +337,10 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
if (currChannel->classId[1] < 64) {
currChannel->dscpDL = currChannel->classId[1];
} else {
ERR (" %s : DSCP %d > 63 - NOT SUPPORTED - Request will be rejected.\n", __FUNCTION__, currChannel->classId[1]);
LOG_E(RAL_ENB, " %s : DSCP %d > 63 - NOT SUPPORTED - Request will be rejected.\n", __FUNCTION__, currChannel->classId[1]);
return 0;
}
DEBUG (" QoS Mapping : Requested radio QoS class %d, DSCP DL %d\n",
LOG_D(RAL_ENB, " QoS Mapping : Requested radio QoS class %d, DSCP DL %d\n",
currChannel->RadioQoSclass,
currChannel->dscpDL);
}
......@@ -361,7 +349,7 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
* Map for unicast flow
*/
else {
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
/* unicast - reserved bit rate - CONVERSATIONAL */
resBitrateDL = (int)currChannel->resBitrate[1];
......@@ -386,7 +374,7 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
(resBitrateUL <= RAL_BITRATE_64k)) {
currChannel->RadioQoSclass = 14;
} else {
ERR (" %s : Invalid requested resBitrate %d , %d - Request will be rejected\n", __FUNCTION__, resBitrateDL, resBitrateUL);
LOG_E(RAL_ENB, " %s : Invalid requested resBitrate %d , %d - Request will be rejected\n", __FUNCTION__, resBitrateDL, resBitrateUL);
return 0;
}
......@@ -396,10 +384,10 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
currChannel->dscpUL = currChannel->classId[0];
currChannel->dscpDL = currChannel->classId[1];
} else {
ERR (" %s : DSCP > 63 - NOT SUPPORTED - Request will be rejected.\n", __FUNCTION__);
LOG_E(RAL_ENB, " %s : DSCP > 63 - NOT SUPPORTED - Request will be rejected.\n", __FUNCTION__);
return 0;
}
DEBUG (" QoS Mapping : Requested radio QoS class %d, DSCP UL %d, DSCP DL %d\n", currChannel->RadioQoSclass, currChannel->dscpUL, currChannel->dscpDL);
LOG_D(RAL_ENB, " QoS Mapping : Requested radio QoS class %d, DSCP UL %d, DSCP DL %d\n", currChannel->RadioQoSclass, currChannel->dscpUL, currChannel->dscpDL);
}
return 1;
......@@ -411,7 +399,7 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
/****************************************************************************
** **
** Name: _eRALlte_process_waiting_RB() **
** Name: eRAL_process_waiting_RB() **
** **
** Description: Allocates a new Radio Bearer parameters to the specified **
** Mobile Terminal which was pending for RB establishment, **
......@@ -425,39 +413,39 @@ int eRALlte_process_map_qos(int mt_ix, int ch_ix)
** Others: ralpriv **
** **
***************************************************************************/
static void _eRALlte_process_waiting_RB(int mt_ix)
void eRAL_process_waiting_RB(ral_enb_instance_t instanceP, int mt_ix)
{
struct ral_lte_channel *currChannel;
struct ral_lte_channel *pendingChannel;
int ch_ix, f_ix;
int dir, mapping_result, rc = -1;
DEBUG(" Establishment of pending RB now starting...\n");
ch_ix = eRALlte_process_find_new_channel(mt_ix);
LOG_D(RAL_ENB, " Establishment of pending RB now starting...\n");
ch_ix = eRAL_process_find_new_channel(instanceP, mt_ix);
if (ch_ix == RAL_MAX_RB) {
DEBUG(" No RB available in MT - Deleting request data\n");
_eRALlte_process_clean_pending_mt();
LOG_D(RAL_ENB, " No RB available in MT - Deleting request data\n");
eRAL_process_clean_pending_mt(instanceP);
return;
}
pendingChannel = &(ralpriv->pending_mt.radio_channel[0]);
currChannel = &(ralpriv->mt[mt_ix].radio_channel[ch_ix]);
pendingChannel = &(g_enb_ral_obj[instanceP].pending_mt.radio_channel[0]);
currChannel = &(g_enb_ral_obj[instanceP].mt[mt_ix].radio_channel[ch_ix]);
currChannel->cnx_id = (RAL_MAX_RB_PER_UE*mt_ix)+ch_ix+1;
currChannel->rbId = RAL_DEFAULT_RAB_ID+ch_ix;
currChannel->multicast = 0;
DEBUG(" mt_ix %d, ch_ix %d, cnx_id %d, rbId %d\n",
LOG_D(RAL_ENB, " mt_ix %d, ch_ix %d, cnx_id %d, rbId %d\n",
mt_ix, ch_ix, currChannel->cnx_id, currChannel->rbId);
memcpy((char *)&(ralpriv->mt[mt_ix].ipv6_addr),
(char *)&(ralpriv->pending_mt.ipv6_addr), 16);
DEBUG (" MT's address = %s\n",
eRALlte_process_mt_addr_to_string(ralpriv->mt[mt_ix].ipv6_addr));
memcpy((char *)&(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_addr),
(char *)&(g_enb_ral_obj[instanceP].pending_mt.ipv6_addr), 16);
LOG_D(RAL_ENB, " MT's address = %s\n",
eRAL_process_mt_addr_to_string(g_enb_ral_obj[instanceP].mt[mt_ix].ipv6_addr));
/* Save the pending data flow identifier into the list of active data flows */
f_ix = eRALlte_action_save_flow_id(&ralpriv->pending_req_fid, currChannel->cnx_id);
f_ix = eRAL_action_save_flow_id(instanceP, &g_enb_ral_obj[instanceP].pending_req_fid, currChannel->cnx_id);
if (f_ix < 0) {
DEBUG(" No RB available - Deleting request data\n");
_eRALlte_process_clean_pending_mt();
LOG_D(RAL_ENB, " No RB available - Deleting request data\n");
eRAL_process_clean_pending_mt(instanceP);
return;
}
/* Store resource parameters of the pending MT */
......@@ -469,100 +457,100 @@ static void _eRALlte_process_waiting_RB(int mt_ix)
currChannel->bktDepth[dir] = pendingChannel->bktDepth[dir];
currChannel->pkBitrate[dir] = pendingChannel->pkBitrate[dir];
currChannel->MTU[dir] = pendingChannel->MTU[dir];
DEBUG(" qos value : DIR %d, flowId %d, classId %d, resBitrate %.1f \n",
LOG_D(RAL_ENB, " qos value : DIR %d, flowId %d, classId %d, resBitrate %.1f \n",
dir, currChannel->flowId[dir], currChannel->classId[dir], currChannel->resBitrate[dir]);
}
/* Map Qos */
mapping_result = eRALlte_process_map_qos(mt_ix, ch_ix);
mapping_result = eRAL_process_map_qos(instanceP, mt_ix, ch_ix);
if (mapping_result) {
#ifdef RAL_DUMMY
rc = eRALlte_NAS_send_rb_establish_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_ADD, mt_ix, ch_ix);
#endif
#ifdef RAL_DUMMY
rc = eRAL_NAS_send_rb_establish_request(mt_ix, ch_ix);
#endif
#ifdef RAL_REALTIME
// LG rc = RAL_process_NAS_message(IO_OBJ_RB, IO_CMD_ADD, mt_ix, ch_ix);
#endif
}
if (rc < 0) {
/* Failed to send RB establishment request; release new RB data */
eRALlte_process_clean_channel(currChannel);
eRAL_process_clean_channel(currChannel);
}
else {
/* RB establishment request has been sent; release pending MT data */
ralpriv->pending_req_flag = 0;
_eRALlte_process_clean_pending_mt();
g_enb_ral_obj[instanceP].pending_req_flag = 0;
eRAL_process_clean_pending_mt(instanceP);
}
}
/****************************************************************************
** Name: _eRALlte_process_clean_pending_mt() **
** Name: eRAL_process_clean_pending_mt() **
** Description: Deletes previously stored pending MT data. **
***************************************************************************/
static void _eRALlte_process_clean_pending_mt(void)
void eRAL_process_clean_pending_mt(ral_enb_instance_t instanceP)
{
memset(ralpriv->pending_mt.ipv6_addr, 0 , 16);
eRALlte_process_clean_channel(&ralpriv->pending_mt.radio_channel[0]);
memset(g_enb_ral_obj[instanceP].pending_mt.ipv6_addr, 0 , 16);
eRAL_process_clean_channel(&g_enb_ral_obj[instanceP].pending_mt.radio_channel[0]);
ralpriv->pending_mt_timer = -1;
DEBUG(" Pending MT data deleted\n");
g_enb_ral_obj[instanceP].pending_mt_timer = -1;
LOG_D(RAL_ENB, " Pending MT data deleted\n");
}
/****************************************************************************
** MW Added **
***************************************************************************/
//---------------------------------------------------------------------------
void RAL_printInitStatus(void){
//---------------------------------------------------------------------------
DEBUG("Network status updated \n");
DEBUG("Mobile : %d, %d, %d, %d, %d, %d \n",
ralpriv->curr_cellId,
ralpriv->mt[0].ue_id,
ralpriv->mt[0].ipv6_l2id[0],
ralpriv->mt[0].ipv6_l2id[1],
ralpriv->mt[0].num_rbs ,
ralpriv->mt[0].nas_state );
DEBUG("Default rb : %d, %d, %d, %d, %d, %d, %d \n",
ralpriv->mt[0].radio_channel[0].rbId ,
ralpriv->mt[0].radio_channel[0].RadioQoSclass ,
ralpriv->mt[0].radio_channel[0].cnx_id ,
ralpriv->mt[0].radio_channel[0].dscpUL ,
ralpriv->mt[0].radio_channel[0].dscpDL ,
ralpriv->mt[0].radio_channel[0].nas_state ,
ralpriv->mt[0].radio_channel[0].status );
DEBUG("Number of connected MTs : %d\n\n", ralpriv->num_connected_mts);
void RAL_printInitStatus(ral_enb_instance_t instanceP){
//---------------------------------------------------------------------------
LOG_D(RAL_ENB, "Network status updated \n");
LOG_D(RAL_ENB, "Mobile : %d, %d, %d, %d, %d, %d \n",
g_enb_ral_obj[instanceP].cell_id,
g_enb_ral_obj[instanceP].mt[0].ue_id,
g_enb_ral_obj[instanceP].mt[0].ipv6_l2id[0],
g_enb_ral_obj[instanceP].mt[0].ipv6_l2id[1],
g_enb_ral_obj[instanceP].mt[0].num_rbs ,
g_enb_ral_obj[instanceP].mt[0].nas_state );
LOG_D(RAL_ENB, "Default rb : %d, %d, %d, %d, %d, %d, %d \n",
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].rbId ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].RadioQoSclass ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].cnx_id ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].dscpUL ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].dscpDL ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].nas_state ,
g_enb_ral_obj[instanceP].mt[0].radio_channel[0].status );
LOG_D(RAL_ENB, "Number of connected MTs : %d\n\n", g_enb_ral_obj[instanceP].num_connected_mts);
}
//---------------------------------------------------------------------------
// poll for measures in NAS
void RAL_NAS_measures_polling(void){
//---------------------------------------------------------------------------
#ifdef RAL_REALTIME
RAL_process_NAS_message(IO_OBJ_MEAS, IO_CMD_LIST,0,0);
#endif
#ifdef RAL_DUMMY
eRALlte_NAS_send_measure_request();
#endif
void RAL_NAS_measures_polling(ral_enb_instance_t instanceP){
//---------------------------------------------------------------------------
#ifdef RAL_REALTIME
// LG RAL_process_NAS_message(IO_OBJ_MEAS, IO_CMD_LIST,0,0);
#endif
#ifdef RAL_DUMMY
eRAL_NAS_send_measure_request();
#endif
}
//---------------------------------------------------------------------------
// Common function to report congestion
void RAL_NAS_report_congestion(int ix){
//---------------------------------------------------------------------------
void RAL_NAS_report_congestion(ral_enb_instance_t instanceP, int ix){
//---------------------------------------------------------------------------
MIH_C_TRANSACTION_ID_T transaction_id;
MIH_C_LINK_TUPLE_ID_T link_identifier;
LIST(MIH_C_LINK_PARAM_RPT, LinkParametersReportList);
DEBUG("Congestion detected for UE%d, sending congestion notification to MIH User \n", ix);
LOG_D(RAL_ENB, "Congestion detected for UE%d, sending congestion notification to MIH User \n", ix);
transaction_id = MIH_C_get_new_transaction_id();
link_identifier.link_id.link_type = MIH_C_WIRELESS_UMTS;
link_identifier.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
Bit_Buffer_t *plmn = new_BitBuffer_0();
BitBuffer_wrap(plmn, (unsigned char*) ralpriv->plmn, DEFAULT_PLMN_SIZE);
BitBuffer_wrap(plmn, (unsigned char*) &g_enb_ral_obj[instanceP].plmn_id, sizeof(g_enb_ral_obj[instanceP].plmn_id));
MIH_C_PLMN_ID_decode(plmn, &link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id);
free_BitBuffer(plmn);
link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = ralpriv->curr_cellId;
link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
//
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
......@@ -570,22 +558,24 @@ void RAL_NAS_report_congestion(int ix){
// LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_GEN;
// LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_gen = MIH_C_LINK_PARAM_LTE_L2_BUFFER_STATUS;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = ralpriv->rlcBufferOccupancy[ix];
// LG obsolete rlcBufferOccupancy LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = g_enb_ral_obj[instanceP].rlcBufferOccupancy[ix];
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_THRESHOLD;
LinkParametersReportList_list.val[LinkParametersReportList_list.length]._union.threshold.threshold_val = ralpriv->congestion_threshold;
#warning "TO DO"
//LinkParametersReportList_list.val[LinkParametersReportList_list.length]._union.threshold.threshold_val = g_enb_ral_obj[instanceP].congestion_threshold;
LinkParametersReportList_list.val[LinkParametersReportList_list.length]._union.threshold.threshold_xdir = MIH_C_ABOVE_THRESHOLD;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
//
eRALlte_send_link_parameters_report_indication(&transaction_id, &link_identifier, &LinkParametersReportList_list);
ralpriv->congestion_flag = RAL_TRUE;
eRAL_send_link_parameters_report_indication(instanceP, &transaction_id, &link_identifier, &LinkParametersReportList_list);
#warning "TO DO?"
//g_enb_ral_obj[instanceP].congestion_flag = RAL_TRUE;
}
//---------------------------------------------------------------------------
// Temp - Enter hard-coded measures in IAL
void RAL_NAS_measures_analyze(void){
//---------------------------------------------------------------------------
/*LGvoid RAL_NAS_measures_analyze(ral_enb_instance_t instanceP){
//---------------------------------------------------------------------------
MIH_C_TRANSACTION_ID_T transaction_id;
MIH_C_LINK_TUPLE_ID_T link_identifier;
LIST(MIH_C_LINK_PARAM_RPT, LinkParametersReportList);
......@@ -593,27 +583,27 @@ void RAL_NAS_measures_analyze(void){
LinkParametersReportList_list.length = 0;
if (ralpriv->congestion_flag == RAL_FALSE){
if (g_enb_ral_obj[instanceP].congestion_flag == RAL_FALSE){
// Check congestion
for (ix=0; ix<ralpriv->num_UEs; ix++){
if ((ralpriv->rlcBufferOccupancy[ix] > ralpriv->congestion_threshold)&&
((ralpriv->mih_subscribe_req_event_list && MIH_C_BIT_LINK_PARAMETERS_REPORT )>0)){
RAL_NAS_report_congestion(ix);
for (ix=0; ix<g_enb_ral_obj[instanceP].num_UEs; ix++){
if ((g_enb_ral_obj[instanceP].rlcBufferOccupancy[ix] > g_enb_ral_obj[instanceP].congestion_threshold)&&
((g_enb_ral_obj[instanceP].mih_subscribe_req_event_list && MIH_C_BIT_LINK_PARAMETERS_REPORT )>0)){
RAL_NAS_report_congestion(instanceP, ix);
break;
}
}
} else if (ralpriv->measures_triggered_flag == RAL_TRUE){
} else if (g_enb_ral_obj[instanceP].measures_triggered_flag == RAL_TRUE){
// Measures should be reported to MIH user
DEBUG("Sending traffic measures to MIH User \n");
LOG_D(RAL_ENB, "Sending traffic measures to MIH User \n");
transaction_id = MIH_C_get_new_transaction_id();
link_identifier.link_id.link_type = MIH_C_WIRELESS_UMTS;
link_identifier.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
Bit_Buffer_t *plmn = new_BitBuffer_0();
BitBuffer_wrap(plmn, (unsigned char*) ralpriv->plmn, DEFAULT_PLMN_SIZE);
BitBuffer_wrap(plmn, (unsigned char*) g_enb_ral_obj[instanceP].plmn, DEFAULT_PLMN_SIZE);
MIH_C_PLMN_ID_decode(plmn, &link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id);
free_BitBuffer(plmn);
link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = ralpriv->curr_cellId;
link_identifier.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
//
// send parameters !!! Value link_param_val must be in 0...65535 range
......@@ -621,39 +611,40 @@ void RAL_NAS_measures_analyze(void){
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_lte = MIH_C_LINK_PARAM_LTE_AVAILABLE_BW;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = ralpriv->scheduledPRB[0];
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = g_enb_ral_obj[instanceP].scheduledPRB[0];
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
// UE0 totalDataVolume
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_lte = MIH_C_LINK_PARAM_LTE_AVAILABLE_BW;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = (ralpriv->totalDataVolume[0]/1000);
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = (g_enb_ral_obj[instanceP].totalDataVolume[0]/1000);
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
// UE1 scheduledPRB
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_lte = MIH_C_LINK_PARAM_LTE_AVAILABLE_BW;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = ralpriv->scheduledPRB[1];
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = g_enb_ral_obj[instanceP].scheduledPRB[1];
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
// UE1 totalDataVolume
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_lte = MIH_C_LINK_PARAM_LTE_AVAILABLE_BW;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = (ralpriv->totalDataVolume[1]/1000);
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = (g_enb_ral_obj[instanceP].totalDataVolume[1]/1000);
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
// totalNumPRBs
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type.choice = MIH_C_LINK_PARAM_TYPE_CHOICE_LTE;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.link_param_type._union.link_param_lte = MIH_C_LINK_PARAM_LTE_AVAILABLE_BW;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param.choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = ralpriv->totalNumPRBs;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].link_param._union.link_param_val = g_enb_ral_obj[instanceP].totalNumPRBs;
LinkParametersReportList_list.val[LinkParametersReportList_list.length].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
LinkParametersReportList_list.length = LinkParametersReportList_list.length + 1;
//
eRALlte_send_link_parameters_report_indication(&transaction_id, &link_identifier, &LinkParametersReportList_list);
//
eRAL_send_link_parameters_report_indication(instanceP, &transaction_id, &link_identifier, &LinkParametersReportList_list);
}
}
*/
/*****************************************************************************
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRAL_subscribe.c
*
* Version 0.1
*
* Date 11/27/2013
*
* Product MIH RAL LTE
*
* Subsystem
*
* Authors Lionel Gauthier
*
* Description
*
*****************************************************************************/
#define LTE_RAL_ENB
#define LTE_RAL_ENB_RRC_MSG_C
#include "lteRALenb.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);
memcpy(euiP + 5, ue_idP + 3, 3);
euiP[3] = 0xFF;
euiP[4] = 0xFE;
euiP[0] ^= 2;
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_system_configuration_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
g_enb_ral_obj[instanceP].plmn_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_p).plmn_id;
g_enb_ral_obj[instanceP].cell_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_p).cell_id;
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_TUPLE_ID_T link_tuple_id;
uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH];
uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH];
uint64_t ue_id; //EUI-64
int i;
// The LINK_ID contains the MN LINK_ADDR
link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE;
link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR;
memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH);
#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t"
ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id;
for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) {
ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF);
ue_id = ue_id >> 8;
}
ueid2eui48(mn_link_addr, ue_id_array);
MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8);
//The optional LINK_ADDR may contains a link address of PoA.
link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
eRAL_send_link_up_indication(instanceP, &g_enb_ral_obj[instanceP].transaction_id,
&link_tuple_id,
NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address.
NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address.
NULL, //MIH_C_IP_RENEWAL_FLAG_T *flagP, (Optional) Indicates whether the MN needs to change IP Address in the new PoA.
NULL); //MIH_C_IP_MOB_MGMT_T *mobil_mngtP, (Optional) Indicates the type of Mobility Management Protocol supported by the new PoA.
g_enb_ral_obj[instanceP].transaction_id ++;
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
#warning "TO DO ral_rx_rrc_ral_connection_reestablishment_indication"
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_measurement_report_indication(instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_connection_release_indication(instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_subscribe.c
* Source eRAL_subscribe.c
*
* Version 0.1
*
......@@ -17,11 +17,9 @@
* Description
*
*****************************************************************************/
#include "lteRALenb_subscribe.h"
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_variables.h"
#define LTE_RAL_ENB
#define LTE_RAL_ENB_SUBSCRIBE_C
#include "lteRALenb.h"
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......@@ -29,7 +27,7 @@
/****************************************************************************
** **
** Name: eRALlte_subscribe_request() **
** Name: eRAL_subscribe_request() **
** **
** Description: Subscribes the MIH-F to receive specified link event **
** indications and sends Link Event Subscribe confirmation **
......@@ -43,27 +41,27 @@
** Others: ralpriv **
** **
***************************************************************************/
void eRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* msgP)
void eRAL_subscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
/* Check whether the action request is supported */
if (ralpriv->mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE)
if (g_enb_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE)
{
MIH_C_LINK_EVENT_LIST_T mih_subscribed_req_event_list;
ralpriv->mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & ralpriv->mih_supported_link_event_list);
g_enb_ral_obj[instanceP].mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & g_enb_ral_obj[instanceP].mih_supported_link_event_list);
mih_subscribed_req_event_list = ralpriv->mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList;
mih_subscribed_req_event_list = g_enb_ral_obj[instanceP].mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList;
status = MIH_C_STATUS_SUCCESS;
eRALlte_send_event_subscribe_confirm(&msgP->header.transaction_id,
eRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
&mih_subscribed_req_event_list);
}
else
{
eRALlte_send_event_subscribe_confirm(&msgP->header.transaction_id,
eRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL);
}
......@@ -71,7 +69,7 @@ void eRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* msg
/****************************************************************************
** **
** Name: eRALlte_unsubscribe_request() **
** Name: eRAL_unsubscribe_request() **
** **
** Description: Unsubscribes the MIH-F to receive specified link event **
** indications and sends Link Event Unsubscribe confirmation **
......@@ -85,29 +83,29 @@ void eRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* msg
** Others: ralpriv **
** **
***************************************************************************/
void eRALlte_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP)
void eRAL_unsubscribe_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
/* Check whether the action request is supported */
if (ralpriv->mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE)
if (g_enb_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE)
{
MIH_C_LINK_EVENT_LIST_T mih_unsubscribed_req_event_list;
MIH_C_LINK_EVENT_LIST_T saved_req_event_list;
saved_req_event_list = ralpriv->mih_subscribe_req_event_list;
saved_req_event_list = g_enb_ral_obj[instanceP].mih_subscribe_req_event_list;
ralpriv->mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & ralpriv->mih_supported_link_event_list);
mih_unsubscribed_req_event_list = ralpriv->mih_subscribe_req_event_list ^ saved_req_event_list;
g_enb_ral_obj[instanceP].mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & g_enb_ral_obj[instanceP].mih_supported_link_event_list);
mih_unsubscribed_req_event_list = g_enb_ral_obj[instanceP].mih_subscribe_req_event_list ^ saved_req_event_list;
status = MIH_C_STATUS_SUCCESS;
eRALlte_send_event_unsubscribe_confirm(&msgP->header.transaction_id,
eRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
&mih_unsubscribed_req_event_list);
}
else
{
eRALlte_send_event_unsubscribe_confirm(&msgP->header.transaction_id,
eRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL);
}
......
......@@ -2,7 +2,7 @@
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source eRALlte_thresholds.c
* Source eRAL_thresholds.c
*
* Version 0.1
*
......@@ -17,13 +17,11 @@
* Description
*
*****************************************************************************/
#define LTE_RAL_ENB
#define LTE_RAL_ENB_THRESHOLDS_C
#include <assert.h>
#include "lteRALenb.h"
#include "lteRALenb_thresholds.h"
#include "lteRALenb_mih_msg.h"
#include "lteRALenb_variables.h"
#include "lteRALenb_constants.h"
#include "lteRALenb_proto.h"
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
......@@ -31,11 +29,10 @@
/****************************************************************************
** **
** Name: eRALlte_configure_thresholds_request() **
** Name: eRAL_configure_thresholds_request() **
** **
** Description: Processes the Link_Configure_Thresholds.request message **
** and sends a Link_Configure_Thresholds.confirm message to **
** the MIHF. **
** Description: Forwards the Link_Configure_Thresholds.request message **
** to the RRC layer. **
** **
** Inputs: msgP: Pointer to the received message **
** Others: ralpriv **
......@@ -45,89 +42,115 @@
** Others: None **
** **
***************************************************************************/
void eRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* msgP)
void eRAL_configure_thresholds_request(ral_enb_instance_t instanceP, MIH_C_Message_Link_Configure_Thresholds_request_t* msgP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_SUCCESS;
unsigned int index;
//unsigned int temp_polling_interval;
DEBUG("\n");
//DEBUG(" Configure thresholds request only returns success status to MIH_USER\n");
// SAVE REQUEST
memcpy(&ralpriv->mih_link_cfg_param_thresholds_list, &msgP->primitive.LinkConfigureParameterList_list, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
for (index = 0; index < ralpriv->mih_link_cfg_param_thresholds_list.length; index++) {
ralpriv->active_mih_link_cfg_param_threshold[index] = MIH_C_BOOLEAN_TRUE;
if ( ralpriv->mih_link_cfg_param_thresholds_list.val[index].th_action== MIH_C_SET_NORMAL_THRESHOLD){
ralpriv->measures_triggered_flag = RAL_TRUE;
// read period
ralpriv->requested_period = ralpriv->mih_link_cfg_param_thresholds_list.val[index]._union.timer_interval;
ralpriv->meas_polling_interval = 1 + ((ralpriv->requested_period *1000)/ MIH_C_RADIO_POLLING_INTERVAL_MICRO_SECONDS);
//DEBUG(" Polling interval %d\n\n\n", temp_polling_interval);
ralpriv->meas_polling_counter = 1;
unsigned int th_index;
rrc_ral_configure_threshold_req_t configure_threshold_req;
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RAL_ENB, RRC_RAL_CONFIGURE_THRESHOLD_REQ);
memset(&configure_threshold_req, 0, sizeof(rrc_ral_configure_threshold_req_t));
// copy transaction id
configure_threshold_req.transaction_id = msgP->header.transaction_id;
// configure_threshold_req.num_link_cfg_params = 0; // done
for (index = 0; index < msgP->primitive.LinkConfigureParameterList_list.length; index++) {
// copy link_param_type
configure_threshold_req.link_cfg_params[index].link_param_type.choice = msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type.choice;
switch (configure_threshold_req.link_cfg_params[index].link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_gen,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_gen,
sizeof(ral_link_param_gen_t));
break;
} else if ( ralpriv->mih_link_cfg_param_thresholds_list.val[index].th_action == MIH_C_CANCEL_THRESHOLD){
ralpriv->measures_triggered_flag = RAL_FALSE;
// read period
ralpriv->requested_period = 0;
ralpriv->meas_polling_interval = RAL_DEFAULT_MEAS_POLLING_INTERVAL;
ralpriv->meas_polling_counter = 1;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_qos,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_qos,
sizeof(ral_link_param_qos_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_lte,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_lte,
sizeof(ral_link_param_lte_t));
break;
default:
assert(1==0);
}
}
DEBUG(" Measurement values configured : Measures active %d, Requested period %d, Polling interval %d\n\n",
ralpriv->measures_triggered_flag, ralpriv->requested_period, ralpriv->meas_polling_interval);
configure_threshold_req.num_link_cfg_params += 1;
eRALlte_send_configure_thresholds_confirm(&msgP->header.transaction_id, &status, NULL);
// copy choice
configure_threshold_req.link_cfg_params[index].union_choice = msgP->primitive.LinkConfigureParameterList_list.val[index].choice;
/* MIH_C_STATUS_T status;
MIH_C_LINK_CFG_STATUS_LIST_T link_cfg_status_list;
unsigned int threshold_index;
unsigned int link_index;
unsigned int result_index;
// SAVE REQUEST
// IT IS ASSUMED SINCE IT IS NOT CLEAR IN SPECs THAT THERE IS NO NEED TO MERGE CONFIGURE_THRESHOLDS_requests
//memset(&ralpriv->mih_link_cfg_param_thresholds_list, 0, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
memcpy(&ralpriv->mih_link_cfg_param_thresholds_list, &messageP->primitive.LinkConfigureParameterList_list, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
status = MIH_C_STATUS_SUCCESS;
result_index = 0;
for (link_index = 0;
link_index < messageP->primitive.LinkConfigureParameterList_list.length;
link_index++) {
// copy _union
switch (configure_threshold_req.link_cfg_params[index].union_choice) {
case RAL_LINK_CFG_PARAM_CHOICE_TIMER_NULL:
configure_threshold_req.link_cfg_params[index]._union.null_attr = 0;
break;
case RAL_LINK_CFG_PARAM_CHOICE_TIMER:
configure_threshold_req.link_cfg_params[index]._union.timer_interval = msgP->primitive.LinkConfigureParameterList_list.val[index]._union.timer_interval;
default:
assert(1==0);
}
ralpriv->active_mih_link_cfg_param_threshold[link_index] = MIH_C_BOOLEAN_TRUE;
for (threshold_index = 0;
threshold_index < messageP->primitive.LinkConfigureParameterList_list.val[link_index].threshold_list.length;
threshold_index ++) {
// copy th_action
configure_threshold_req.link_cfg_params[index].th_action = msgP->primitive.LinkConfigureParameterList_list.val[index].th_action;
memcpy(&link_cfg_status_list.val[result_index].link_param_type,
&messageP->primitive.LinkConfigureParameterList_list.val[link_index].link_param_type,
sizeof(MIH_C_LINK_PARAM_TYPE_T));
// configure_threshold_req.link_cfg_params[index].num_thresholds = 0; // done
for (th_index = 0; th_index < msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.length;th_index++) {
configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_val = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_val;
configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_xdir = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_xdir;
configure_threshold_req.link_cfg_params[index].num_thresholds += 1;
}
}
memcpy(&link_cfg_status_list.val[result_index].threshold,
&messageP->primitive.LinkConfigureParameterList_list.val[link_index].threshold_list.val[threshold_index],
sizeof(MIH_C_THRESHOLD_T));
// NOW, ALWAYS SAY OK FOR PARAMETERS, BUT MAY BE WE WILL PUT MIH_C_BOOLEAN_FALSE in active_mih_link_cfg_param_threshold[link_index]
link_cfg_status_list.val[result_index].config_status = MIH_C_CONFIG_STATUS_SUCCESS;
memcpy (&message_p->ittiMsg, (void *) &configure_threshold_req, sizeof(rrc_ral_configure_threshold_req_t));
itti_send_msg_to_task (TASK_RRC_ENB, instanceP, message_p);
}
result_index += 1;
//---------------------------------------------------------------------------------------------------------------------
void eRAL_rx_rrc_ral_configure_threshold_conf(instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_STATUS_T status;
// This parameter is not included if Status does not indicate “Success.”
MIH_C_LINK_CFG_STATUS_LIST_T link_cfg_status_list;
unsigned int i;
status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).status;
if (status == RAL_STATUS_SUCCESS) {
link_cfg_status_list.length = 0;
for (i = 0; i < RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).num_link_cfg_params; i++) {
link_cfg_status_list.val[i].link_param_type.choice = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type.choice;
switch (link_cfg_status_list.val[i].link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_gen,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_gen,
sizeof(ral_link_param_gen_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_qos,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_qos,
sizeof(ral_link_param_qos_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_lte,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_lte,
sizeof(ral_link_param_lte_t));
break;
default:
assert(1==0);
}
link_cfg_status_list.val[i].threshold.threshold_val = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_val;
link_cfg_status_list.val[i].threshold.threshold_xdir = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_xdir;
link_cfg_status_list.val[i].config_status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].config_status;
link_cfg_status_list.length += 1;
}
// Say following thresholds entries are not configured
for (link_index = messageP->primitive.LinkConfigureParameterList_list.length;
link_index < MIH_C_LINK_CFG_PARAM_LIST_LENGTH;
link_index++) {
ralpriv->active_mih_link_cfg_param_threshold[link_index] = MIH_C_BOOLEAN_FALSE;
eRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, &link_cfg_status_list);
} else {
eRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, NULL);
}
link_cfg_status_list.length = result_index;
eRALte_send_configure_thresholds_confirm(&messageP->header.transaction_id,&status, &link_cfg_status_list);
*/
}
/*****************************************************************************
* Eurecom OpenAirInterface 3
* Copyright(c) 2013 Eurecom
*
* Source lteRALue.h
*
* Version 0.1
*
* Date 11/27/2013
*
* Product MIH RAL LTE
*
* Subsystem RAL-LTE
*
* Authors Lionel Gauthier
*
* Description Header file to be included by any module that wants to interface with RAL UE.
*
*****************************************************************************/
#ifndef __LTE_RAL_UE_H__
#define __LTE_RAL_UE_H__
#include "MIH_C.h"
#include "openair_types.h"
#include "platform_constants.h"
#include "platform_types.h"
#include "lteRALue_constants.h"
#include "lteRALue_variables.h"
#include "lteRALue_main.h"
#include "lteRALue_action.h"
#include "lteRALue_mih_msg.h"
#include "lteRALue_rrc_msg.h"
#include "lteRALue_parameters.h"
//#include "lteRALue_process.h"
#include "lteRALue_subscribe.h"
#include "lteRALue_thresholds.h"
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2013 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteralue_action.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_UE_ACTION_H__
#define __LTE_RAL_UE_ACTION_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_UE_ACTION_C
# define private_lteralue_action(x) x
# define protected_lteralue_action(x) x
# define public_lteralue_action(x) x
# else
# ifdef LTE_RAL_UE
# define private_lteralue_action(x)
# define protected_lteralue_action(x) extern x
# define public_lteralue_action(x) extern x
# else
# define private_lteralue_action(x)
# define protected_lteralue_action(x)
# define public_lteralue_action(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
#endif // MIH_C_MEDIEVAL_EXTENSIONS
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
protected_lteralue_action(void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_request_t* messageP);)
#endif
......@@ -34,21 +34,19 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __MRALLTE_CONSTANTS_H__
#define __MRALLTE_CONSTANTS_H__
#ifndef __LTERALUE_CONSTANTS_H__
#define __LTERALUE_CONSTANTS_H__
//-----------------------------------------------------------------------------
#define DEFAULT_LOCAL_PORT_RAL "1235"
#define DEFAULT_REMOTE_PORT_MIHF "1025"
#define DEFAULT_IP_ADDRESS_MIHF "127.0.0.1"
#define DEFAULT_IP_ADDRESS_RAL "127.0.0.1"
#define DEFAULT_LINK_ID "link" //"lte"
#define DEFAULT_MIHF_ID "mihf1"
#define UE_DEFAULT_LOCAL_PORT_RAL "1335"
#define UE_DEFAULT_REMOTE_PORT_MIHF "1125"
#define UE_DEFAULT_IP_ADDRESS_MIHF "127.0.0.1"
#define UE_DEFAULT_IP_ADDRESS_RAL "127.0.0.1"
#define UE_DEFAULT_LINK_ID_RAL "ue_lte_link"
#define UE_DEFAULT_LINK_ADDRESS_RAL "060080149150"
#define UE_DEFAULT_MIHF_ID "mihf_ue"
#define DEFAULT_ADDRESS_3GPP "0335060080149150"
#define DEFAULT_ADDRESS_eNB "0000000000000001"
//-----------------------------------------------------------------------------
#define MIH_C_RADIO_POLLING_INTERVAL_MICRO_SECONDS 50000
#define MIH_C_RADIO_POLLING_INTERVAL_SECONDS 0
//-----------------------------------------------------------------------------
// Constants for scenario
#define PREDEFINED_MIH_NETWORK_ID "eurecom"
......@@ -58,9 +56,4 @@
#define PREDEFINED_CLASSES_SERVICE_SUPPORTED 2
#define PREDEFINED_QUEUES_SUPPORTED 2
#define PREDEFINED_LINK_GOING_DOWN_INDICATION_SIG_STRENGTH 20
#define PREDEFINED_LINK_DETECTED_INDICATION_SIG_STRENGTH 10
#define PREDEFINED_LINK_DETECTED_INDICATION_SINR 45
#define PREDEFINED_LINK_DETECTED_INDICATION_LINK_DATA_RATE 1000
#endif
......@@ -34,22 +34,22 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __MRALLTE_MAIN_H__
# define __MRALLTE_MAIN_H__
#ifndef __LTERALUE_MAIN_H__
# define __LTERALUE_MAIN_H__
//-----------------------------------------------------------------------------
# ifdef MRALLTE_MAIN_C
# define private_mRALlte_main(x) x
# define protected_mRALlte_main(x) x
# define public_mRALlte_main(x) x
# ifdef LTERALUE_MAIN_C
# define private_mrallte_main(x) x
# define protected_mrallte_main(x) x
# define public_mrallte_main(x) x
# else
# ifdef MRAL_MODULE
# define private_mRALlte_main(x)
# define protected_mRALlte_main(x) extern x
# define public_mRALlte_main(x) extern x
# ifdef LTE_RAL_UE
# define private_mrallte_main(x)
# define protected_mrallte_main(x) extern x
# define public_mrallte_main(x) extern x
# else
# define private_mRALlte_main(x)
# define protected_mRALlte_main(x)
# define public_mRALlte_main(x) extern x
# define private_mrallte_main(x)
# define protected_mrallte_main(x)
# define public_mrallte_main(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
......@@ -69,6 +69,112 @@
#include <getopt.h>
#include <libgen.h>
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "commonDef.h"
#include "collection/hashtable/hashtable.h"
public_mrallte_main(char* g_conf_ue_ral_listening_port;)
public_mrallte_main(char* g_conf_ue_ral_ip_address;)
public_mrallte_main(char* g_conf_ue_ral_link_id;)
public_mrallte_main(char* g_conf_ue_ral_link_address;)
public_mrallte_main(char* g_conf_ue_mihf_remote_port;)
public_mrallte_main(char* g_conf_ue_mihf_ip_address;)
public_mrallte_main(char* g_conf_ue_mihf_id;)
typedef int ral_ue_instance_t;
typedef struct lte_ral_ue_object_s {
//------------------------
// CONFIG PARAMETERS
//------------------------
char* ral_listening_port;
char* ral_ip_address;
char* ral_link_address;
char* mihf_remote_port;
char* mihf_ip_address;
char* link_id;
char* mihf_id;
MIH_C_LINK_MIHCAP_FLAG_T link_mihcap_flag; // hardcoded parameters
MIH_C_NET_CAPS_T net_caps;// hardcoded parameters
// only to call ralu_verifyPendingConnection
u8 pending_req_flag;
// network parameters
u16 cell_id;
u16 nas_state;
int state;
u32 curr_signal_level;
u32 ipv6_l2id[2];
//measures
u8 req_num_bs;
u16 req_cell_id[MAX_NUMBER_BS];
u32 req_prov_id[MAX_NUMBER_BS];
u16 req_order_index[MAX_NUMBER_BS];
int num_measures;
u16 meas_cell_id[MAX_NUMBER_BS];
u32 last_meas_level[MAX_NUMBER_BS];
u32 integrated_meas_level[MAX_NUMBER_BS];
u32 prev_integrated_meas_level[MAX_NUMBER_BS];
u32 provider_id[MAX_NUMBER_BS];
//Radio Bearers
u16 num_rb;
int num_class;
u16 rbId[RAL_MAX_RB];
u16 QoSclass[RAL_MAX_RB];
u16 dscp[RAL_MAX_RB];
// statistics
//u32 rx_packets;
//u32 tx_packets;
//u32 rx_bytes;
//u32 tx_bytes;
//u32 rx_errors;
//u32 tx_errors;
//u32 rx_dropped;
//u32 tx_dropped;
//char buffer[800]; // For ioctl with NAS driver
// MIH-INTERFACE data
// MIH-INTERFACE data
int mih_sock_desc;
// Initialised, then read-only, supported actions
MIH_C_LINK_AC_TYPE_T mih_supported_action_list;
// action currently processed
MIH_C_LINK_AC_TYPE_T pending_req_action;
// actions requested by MIH-H
MIH_C_LINK_AC_TYPE_T req_action_list;
//MIH_C_STATUS_T pending_req_status;
MIH_C_LINK_AC_RESULT_T pending_req_ac_result;
//MIH_C_TRANSACTION_ID_T pending_req_transaction_id;
// set unset bits by MIH_C_Message_Link_Event_Subscribe_request MIH_C_Message_Link_Event_Unsubscribe_request
MIH_C_LINK_EVENT_LIST_T mih_subscribe_req_event_list;
// Initialised, then read-only
MIH_C_LINK_EVENT_LIST_T mih_supported_link_event_list;
// Initialised, then read-only
MIH_C_LINK_CMD_LIST_T mih_supported_link_command_list;
LIST(MIH_C_LINK_CFG_PARAM, mih_link_cfg_param_thresholds);
// to tell what are the configured thresholds in mih_link_cfg_param_thresholds_list
MIH_C_BOOLEAN_T active_mih_link_cfg_param_threshold[MIH_C_LINK_CFG_PARAM_LIST_LENGTH];
MIH_C_BOOLEAN_T link_to_be_detected;
MIH_C_TRANSACTION_ID_T transaction_id;
}lte_ral_ue_object_t;
/* RAL LTE internal data */
protected_mrallte_main(lte_ral_ue_object_t g_ue_ral_obj[MAX_MODULES];)
private_mrallte_main(hash_table_t *g_ue_ral_fd2instance;);
public_mrallte_main( void mRAL_init_default_values(void);)
public_mrallte_main( int mRAL_initialize(void);)
private_mrallte_main(void mRAL_process_file_descriptors(struct epoll_event *events, int nb_events);)
public_mrallte_main( void* mRAL_task(void *args_p);)
#endif
......
......@@ -38,18 +38,18 @@
# define __MRALLTE_MIH_EXECUTE_H__
//-----------------------------------------------------------------------------
# ifdef MRALLTE_MIH_EXECUTE_C
# define private_mRALlte_mih_execute(x) x
# define protected_mRALlte_mih_execute(x) x
# define public_mRALlte_mih_execute(x) x
# define private_mRAL_mih_execute(x) x
# define protected_mRAL_mih_execute(x) x
# define public_mRAL_mih_execute(x) x
# else
# ifdef MRAL_MODULE
# define private_mRALlte_mih_execute(x)
# define protected_mRALlte_mih_execute(x) extern x
# define public_mRALlte_mih_execute(x) extern x
# ifdef LTE_RAL_UE
# define private_mRAL_mih_execute(x)
# define protected_mRAL_mih_execute(x) extern x
# define public_mRAL_mih_execute(x) extern x
# else
# define private_mRALlte_mih_execute(x)
# define protected_mRALlte_mih_execute(x)
# define public_mRALlte_mih_execute(x) extern x
# define private_mRAL_mih_execute(x)
# define protected_mRAL_mih_execute(x)
# define public_mRAL_mih_execute(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
......@@ -61,21 +61,20 @@
#include <sys/types.h>
#include <ctype.h>
//-----------------------------------------------------------------------------
#include "MIH_C.h"
#include "lteRALue_constants.h"
#include "lteRALue_mih_msg.h"
#include "lteRALue.h"
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(MIH_C_LINK_ACTION_T g_link_action;)
protected_mRAL_mih_execute(MIH_C_LINK_ACTION_T g_link_action;)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(void mRALlte_action_request(MIH_C_Message_Link_Action_request_t* messageP);)
protected_mRAL_mih_execute(void mRAL_action_request(MIH_C_Message_Link_Action_request_t* messageP);)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(void mRALlte_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* messageP);)
protected_mRAL_mih_execute(void mRAL_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* messageP);)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(void mRALlte_subscribe_request (MIH_C_Message_Link_Event_Subscribe_request_t* messageP);)
protected_mRALlte_mih_execute(void mRALlte_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* messageP);)
protected_mRAL_mih_execute(void mRAL_subscribe_request (MIH_C_Message_Link_Event_Subscribe_request_t* messageP);)
protected_mRAL_mih_execute(void mRAL_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* messageP);)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(LIST(MIH_C_LINK_CFG_PARAM, g_link_cfg_param_thresholds);)
protected_mRAL_mih_execute(LIST(MIH_C_LINK_CFG_PARAM, g_link_cfg_param_thresholds);)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_execute(void mRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);)
public_mRALlte_mih_execute(void mRALlte_check_thresholds_signal_strength(MIH_C_THRESHOLD_VAL_T new_valP, MIH_C_THRESHOLD_VAL_T old_valP);)
protected_mRAL_mih_execute(void mRAL_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);)
public_mRAL_mih_execute(void mRAL_check_thresholds_signal_strength(MIH_C_THRESHOLD_VAL_T new_valP, MIH_C_THRESHOLD_VAL_T old_valP);)
#endif
......@@ -34,120 +34,113 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __MRALLTE_MIH_MSG_H__
# define __MRALLTE_MIH_MSG_H__
#ifndef __LTERALUE_MIH_MSG_H__
# define __LTERALUE_MIH_MSG_H__
//-----------------------------------------------------------------------------
# ifdef MRALLTE_MIH_MSG_C
# define private_mRALlte_mih_msg(x) x
# define protected_mRALlte_mih_msg(x) x
# define public_mRALlte_mih_msg(x) x
# ifdef LTERALUE_MIH_MSG_C
# define private_mRAL_mih_msg(x) x
# define protected_mRAL_mih_msg(x) x
# define public_mRAL_mih_msg(x) x
# else
# ifdef MRAL_MODULE
# define private_mRALlte_mih_msg(x)
# define protected_mRALlte_mih_msg(x) extern x
# define public_mRALlte_mih_msg(x) extern x
# ifdef LTE_RAL_UE
# define private_mRAL_mih_msg(x)
# define protected_mRAL_mih_msg(x) extern x
# define public_mRAL_mih_msg(x) extern x
# else
# define private_mRALlte_mih_msg(x)
# define protected_mRALlte_mih_msg(x)
# define public_mRALlte_mih_msg(x) extern x
# define private_mRAL_mih_msg(x)
# define protected_mRAL_mih_msg(x)
# define public_mRAL_mih_msg(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#include <ctype.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <getopt.h>
#include <libgen.h>
//-----------------------------------------------------------------------------
#include "MIH_C.h"
#include "lteRALue_constants.h"
//#include "lteRALue_get.h"
//-----------------------------------------------------------------------------
#include "lteRALue.h"
//-----------------------------------------------------------------------------
#define MSG_CODEC_RECV_BUFFER_SIZE 16400
#define MSG_CODEC_SEND_BUFFER_SIZE 16400
//-----------------------------------------------------------------------------
protected_mRALlte_mih_msg(char* g_mihf_remote_port;)
protected_mRALlte_mih_msg(char* g_mihf_ip_address;)
protected_mRALlte_mih_msg(char* g_ral_ip_address;)
protected_mRALlte_mih_msg(char* g_ral_listening_port_for_mihf;)
protected_mRALlte_mih_msg(char* g_link_id;)
protected_mRALlte_mih_msg(char* g_mihf_id;)
protected_mRALlte_mih_msg(int g_sockd_mihf;)
protected_mRALlte_mih_msg(char g_msg_print_buffer[8192];)
//-----------------------------------------------------------------------------
protected_mRALlte_mih_msg(u_int8_t g_msg_codec_recv_buffer[MSG_CODEC_RECV_BUFFER_SIZE];)
protected_mRALlte_mih_msg(u_int8_t g_msg_codec_send_buffer[MSG_CODEC_SEND_BUFFER_SIZE];)
//-----------------------------------------------------------------------------
public_mRALlte_mih_msg( int mRALlte_send_to_mih(u_int8_t *bufferP, size_t lenP);)
protected_mRALlte_mih_msg( void mRALlte_print_buffer (char * bufferP, int lengthP);)
protected_mRALlte_mih_msg( int mRALlte_mihf_connect (void);)
protected_mRALlte_mih_msg( void mRALlte_send_link_register_indication (MIH_C_TRANSACTION_ID_T *transaction_idP);)
protected_mRALlte_mih_msg( void mRALlte_send_link_detected_indication (MIH_C_TRANSACTION_ID_T *transaction_idP,
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 mRAL_send_link_register_indication (\
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,\
MIH_C_TRANSACTION_ID_T *transaction_idP,\
MIH_C_LINK_DET_INFO_T *link_detected_infoP);)
protected_mRALlte_mih_msg( void mRALlte_send_link_up_indication(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_ADDR_T *new_access_routerP,
MIH_C_IP_RENEWAL_FLAG_T *ip_renewal_flagP,
protected_mRAL_mih_msg( void mRAL_send_link_up_indication(\
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_ADDR_T *new_access_routerP,\
MIH_C_IP_RENEWAL_FLAG_T *ip_renewal_flagP,\
MIH_C_IP_MOB_MGMT_T *mobility_management_supportP);)
protected_mRALlte_mih_msg( void mRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_LINK_TUPLE_ID_T *link_identifierP,
protected_mRAL_mih_msg( void mRAL_send_link_parameters_report_indication(\
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_mRALlte_mih_msg( void mRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_LINK_TUPLE_ID_T *link_identifierP,
MIH_C_UNSIGNED_INT2_T *time_intervalP,
protected_mRAL_mih_msg( void mRAL_send_link_going_down_indication(\
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_mRALlte_mih_msg( void mRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_LINK_TUPLE_ID_T *link_identifierP,
MIH_C_LINK_ADDR_T *old_access_routerP,
protected_mRAL_mih_msg( void mRAL_send_link_down_indication(\
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_mRALlte_mih_msg( void mRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_SCAN_RSP_LIST_T *scan_response_setP,
protected_mRAL_mih_msg( void mRAL_send_link_action_confirm(\
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_mRALlte_mih_msg( void mRALte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_EVENT_LIST_T *supported_link_event_listP,
protected_mRAL_mih_msg( void mRAL_send_capability_discover_confirm(\
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_mRALlte_mih_msg( void mRALte_send_event_subscribe_confirm (MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
protected_mRAL_mih_msg( void mRAL_send_event_subscribe_confirm (\
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_mRALlte_mih_msg( void mRALte_send_event_unsubscribe_confirm (MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
protected_mRAL_mih_msg( void mRAL_send_event_unsubscribe_confirm (\
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_mRALlte_mih_msg( void mRALte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
protected_mRAL_mih_msg( void mRAL_send_configure_thresholds_confirm(\
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_mRALlte_mih_msg( void mRALte_send_get_parameters_confirm (MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_STATUS_T *statusP,
MIH_C_LINK_PARAM_LIST_T *link_parameters_status_listP,
MIH_C_LINK_STATES_RSP_LIST_T *link_states_response_listP,
protected_mRAL_mih_msg( void mRAL_send_get_parameters_confirm (\
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,\
MIH_C_LINK_STATES_RSP_LIST_T *link_states_response_listP,\
MIH_C_LINK_DESC_RSP_LIST_T *link_descriptors_response_listP);)
private_mRALlte_mih_msg( int mRALlte_mih_link_msg_decode (Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP);)
protected_mRALlte_mih_msg( int mRALlte_mih_link_process_message (void);)
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
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2013 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_parameters.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_UE_PARAMETERS_H__
#define __LTE_RAL_UE_PARAMETERS_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_UE_PARAMETERS_C
# define private_lteralue_parameters(x) x
# define protected_lteralue_parameters(x) x
# define public_lteralue_parameters(x) x
# else
# ifdef LTE_RAL_UE
# define private_lteralue_parameters(x)
# define protected_lteralue_parameters(x) extern x
# define public_lteralue_parameters(x) extern x
# else
# define private_lteralue_parameters(x)
# define protected_lteralue_parameters(x)
# define public_lteralue_parameters(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
protected_lteralue_parameters(void mRAL_get_parameters_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Get_Parameters_request_t* messageP);)
#endif
......@@ -34,19 +34,21 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __RAL_LTE_PROTO_H__
#define __RAL_LTE_PROTO_H__
#ifndef __RAL_UE_LTE_PROTO_H__
#define __RAL_UE_LTE_PROTO_H__
//lteRALue_ioctl.c
int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int ioctl_cellid);
int RAL_ue_process_NAS_message(int ioctl_obj, int ioctl_cmd, int ioctl_cellid);
//mRALuD_process.c
void IAL_NAS_measures_init(void);
void IAL_NAS_measures_update(int i);
void IAL_integrate_measure(int measure, int i);
void rallte_NAS_measures_polling(void);
int rallte_NAS_corresponding_cell(int req_index);
void rallte_verifyPendingConnection(void);
void IAL_ue_NAS_measures_init(void);
void IAL_ue_NAS_measures_update(int i);
void IAL_ue_integrate_measure(int measure, int i);
void rallte_ue_NAS_measures_polling(void);
int rallte_ue_NAS_corresponding_cell(int req_index);
void rallte_ue_verifyPendingConnection(void);
void* ral_ue_task(void *args_p);
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_rrc_msg.h
* \brief
* \author GAUTHIER Lionel
* \date 2013
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_UE_RRC_MSG_H__
#define __LTE_RAL_UE_RRC_MSG_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_UE_RRC_MSG_C
# define private_lteralue_rrc_msg(x) x
# define protected_lteralue_rrc_msg(x) x
# define public_lteralue_rrc_msg(x) x
# else
# ifdef LTE_RAL_UE
# define private_lteralue_rrc_msg(x)
# define protected_lteralue_rrc_msg(x) extern x
# define public_lteralue_rrc_msg(x) extern x
# else
# define private_lteralue_rrc_msg(x)
# define protected_lteralue_rrc_msg(x)
# define public_lteralue_rrc_msg(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "intertask_interface.h"
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);)
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_reconfiguration_indication (instance_t instance, MessageDef *msg_p);)
protected_lteralue_rrc_msg(void mRAL_rx_rrc_ral_connection_release_indication (instance_t instance, MessageDef *msg_p);)
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2013 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_subscribe.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_UE_SUBSCRIBE_H__
#define __LTE_RAL_UE_SUBSCRIBE_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_UE_PROCESS_C
# define private_lteralue_subscribe(x) x
# define protected_lteralue_subscribe(x) x
# define public_lteralue_subscribe(x) x
# else
# ifdef LTE_RAL_UE
# define private_lteralue_subscribe(x)
# define protected_lteralue_subscribe(x) extern x
# define public_lteralue_subscribe(x) extern x
# else
# define private_lteralue_subscribe(x)
# define protected_lteralue_subscribe(x)
# define public_lteralue_subscribe(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
protected_lteralue_subscribe(void mRAL_subscribe_request (ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP);)
protected_lteralue_subscribe(void mRAL_unsubscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP);)
#endif
/*******************************************************************************
*
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
* Contact Information
* Openair Admin: openair_admin@eurecom.fr
* Openair Tech : openair_tech@eurecom.fr
* Forums : http://forums.eurecom.fsr/openairinterface
* Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*
*******************************************************************************/
/*! \file lteRALenb_thresholds.h
* \brief
* \author GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
* \date 2012
* \version
* \note
* \bug
* \warning
*/
#ifndef __LTE_RAL_UE_THRESHOLDS_H__
#define __LTE_RAL_UE_THRESHOLDS_H__
//-----------------------------------------------------------------------------
# ifdef LTE_RAL_UE_PROCESS_C
# define private_lteralue_thresholds(x) x
# define protected_lteralue_thresholds(x) x
# define public_lteralue_thresholds(x) x
# else
# ifdef LTE_RAL_UE
# define private_lteralue_thresholds(x)
# define protected_lteralue_thresholds(x) extern x
# define public_lteralue_thresholds(x) extern x
# else
# define private_lteralue_thresholds(x)
# define protected_lteralue_thresholds(x)
# define public_lteralue_thresholds(x) extern x
# endif
# endif
//-----------------------------------------------------------------------------
#include "lteRALue.h"
#include "intertask_interface.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
//LIST(MIH_C_LINK_CFG_PARAM, g_link_cfg_param_thresholds);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
protected_lteralue_thresholds(void mRAL_configure_thresholds_request (ral_ue_instance_t instanceP, MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);)
protected_lteralue_thresholds(void mRAL_rx_rrc_ral_configure_threshold_conf (ral_ue_instance_t instance, MessageDef *msg_p);)
protected_lteralue_thresholds(void mRAL_rx_rrc_ral_measurement_report_indication (ral_ue_instance_t instance, MessageDef *msg_p);)
#endif
......@@ -34,13 +34,11 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#ifndef __RAL_LTE_VAR_H__
#define __RAL_LTE_VAR_H__
#ifndef __LTERALUE_VARIABLES_H__
#define __LTERALUE_VARIABLES_H__
//-------------------------------------------------------------------
#include "rrc_d_types.h"
#include "lteRALue_constants.h"
#include "MIH_C.h"
#include "lteRALue.h"
/***************************************************************************
CONSTANTS
......@@ -74,69 +72,12 @@
/***************************************************************************
VARIABLES
***************************************************************************/
struct ral_lte_priv {
// only to call ralu_verifyPendingConnection
u8 pending_req_flag;
// network parameters
u16 cell_id;
u16 nas_state;
int state;
u32 curr_signal_level;
u32 ipv6_l2id[2];
//measures
u8 req_num_bs;
u16 req_cell_id[MAX_NUMBER_BS];
u32 req_prov_id[MAX_NUMBER_BS];
u16 req_order_index[MAX_NUMBER_BS];
int num_measures;
u16 meas_cell_id[MAX_NUMBER_BS];
u32 last_meas_level[MAX_NUMBER_BS];
u32 integrated_meas_level[MAX_NUMBER_BS];
u32 prev_integrated_meas_level[MAX_NUMBER_BS];
u32 provider_id[MAX_NUMBER_BS];
//Radio Bearers
u16 num_rb;
int num_class;
u16 rbId[RAL_MAX_RB];
u16 QoSclass[RAL_MAX_RB];
u16 dscp[RAL_MAX_RB];
// statistics
u32 rx_packets;
u32 tx_packets;
u32 rx_bytes;
u32 tx_bytes;
u32 rx_errors;
u32 tx_errors;
u32 rx_dropped;
u32 tx_dropped;
char buffer[800]; // For ioctl with NAS driver
// MIH-INTERFACE data
// Initialised, then read-only, supported actions
MIH_C_LINK_AC_TYPE_T mih_supported_action_list;
// action currently processed
MIH_C_LINK_AC_TYPE_T pending_req_action;
// actions requested by MIH-H
MIH_C_LINK_AC_TYPE_T req_action_list;
MIH_C_STATUS_T pending_req_status;
MIH_C_LINK_AC_RESULT_T pending_req_ac_result;
MIH_C_TRANSACTION_ID_T pending_req_transaction_id;
// set unset bits by MIH_C_Message_Link_Event_Subscribe_request MIH_C_Message_Link_Event_Unsubscribe_request
MIH_C_LINK_EVENT_LIST_T mih_subscribe_req_event_list;
// Initialised, then read-only
MIH_C_LINK_EVENT_LIST_T mih_supported_link_event_list;
// Initialised, then read-only
MIH_C_LINK_CMD_LIST_T mih_supported_link_command_list;
LIST(MIH_C_LINK_CFG_PARAM, mih_link_cfg_param_thresholds);
// to tell what are the configured thresholds in mih_link_cfg_param_thresholds_list
MIH_C_BOOLEAN_T active_mih_link_cfg_param_threshold[MIH_C_LINK_CFG_PARAM_LIST_LENGTH];
MIH_C_BOOLEAN_T link_to_be_detected;
};
//struct ral_lte_priv {
//};
//-----------------------------------------------------------------------------
extern struct ral_lte_priv *ralpriv;
//extern struct ral_lte_priv *ralpriv;
#endif
/***************************************************************************
lteRALue_action.c - description
***************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
/*! \file lteRALue_mih_execute.c
* \brief Execution of MIH primitives in LTE-RAL-UE
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
* \date 2013
* \company EURECOM
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define LTE_RAL_UE
#define LTERALUE_ACTION_C
//-----------------------------------------------------------------------------
#include "lteRALue.h"
//-----------------------------------------------------------------------------
void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
LIST(MIH_C_LINK_SCAN_RSP, scan_response_set);
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;
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) {
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));
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) {
// TO DO
// The link will be disconnected but the resource for the link connection still remains so
// reestablishing the link connection later can be more efficient.
}
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_DATA_FWD_REQ) {
// TO DO
// This indication requires the buffered data at the old serving PoA entity to be forwarded
// to the new target PoA entity in order to avoid data loss. This action can be taken imme-
// diately after the old serving PoS receives MIH_N2N_HO_Commit response message
// from the new target PoS, or the old serving PoS receives MIH_Net_HO_Commit
// response message from the MN. This is not valid on UMTS link type.
}
// do not make actions if SCAN required
if (( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN) == 0) {
switch (messageP->primitive.LinkAction.link_ac_type) {
case MIH_C_LINK_AC_TYPE_NONE:
LOG_D(RAL_UE, "%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_NONE: NO ACTION\n", __FUNCTION__);
break;
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) {
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
release_req.transaction_id = messageP->header.transaction_id;
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);
} 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);
}
break;
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) {
// TO DO
} 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);
}
break;
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) {
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;
//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);
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
release_req.transaction_id = messageP->header.transaction_id;
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);
}
} else {
g_ue_ral_obj[instanceP].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);
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
release_req.transaction_id = messageP->header.transaction_id;
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);
}
} else {
LOG_D(RAL_UE, " command POWER DOWN not available \n\n");
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, NULL, &link_action_result);
}
break;
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) {
// 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) {
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);
}
} 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
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
connection_establishment_req.transaction_id = messageP->header.transaction_id;
memcpy (&message_p->ittiMsg, (void *) &connection_establishment_req, sizeof(rrc_ral_connection_establishment_req_t));
itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
}
} else {
LOG_D(RAL_UE, "[mRAL]: command POWER UP not available \n\n");
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);
}
break;
/* 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) {
} 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);
}
break;
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) {
} 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);
}
break;
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) {
} 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);
}
break;*/
default:
LOG_E(RAL_UE, "%s Invalid LinkAction.link_ac_type in MIH_C_Message_Link_Action_request\n", __FUNCTION__);
status = MIH_C_STATUS_UNSPECIFIED_FAILURE;
mRAL_send_link_action_confirm(instanceP, &messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
}
}
......@@ -172,7 +172,7 @@ int RAL_process_NAS_message(int ioctl_obj, int ioctl_cmd, int ioctl_cellid){
ralpriv->pending_req_flag = 1;
DEBUG(" Connexion establishment pending: pending_req_flag %d\n",ralpriv->pending_req_flag);
}
//mRALlte_send_link_action_confirm(&ralpriv->pending_req_transaction_id, &ralpriv->pending_req_status, NULL, &ralpriv->pending_req_ac_result);
//mRAL_send_link_action_confirm(&ralpriv->pending_req_transaction_id, &ralpriv->pending_req_status, NULL, &ralpriv->pending_req_ac_result);
rc = 0;
}
break;
......
......@@ -26,7 +26,7 @@
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
/*! \file lteRALue_main.c
/*! \file ltmRALue_main.c
* \brief This file contains the main() function for the LTE-RAL-UE
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
* \date 2013
......@@ -34,34 +34,26 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define MRAL_MODULE
#define MRALLTE_MAIN_C
#define LTE_RAL_UE
#define LTERALUE_MAIN_C
//-----------------------------------------------------------------------------
#include "lteRALue_main.h"
#include "lteRALue_constants.h"
#include "lteRALue_variables.h"
#include "lteRALue_proto.h"
#include "lteRALue_mih_msg.h"
// UMTS sub-system
#include "nas_ue_ioctl.h"
#include "rrc_nas_primitives.h"
#include "nasmt_constant.h"
#include "nasmt_iocontrol.h"
/*#include "nas_ue_netlink.h"
#include "nasUE_config.h"*/
#include <stdio.h>
# include <sys/epoll.h>
#include <sys/select.h>
#include <net/if.h>
#include <getopt.h>
#include <stdlib.h>
#include <time.h>
//-----------------------------------------------------------------------------
#include "MIH_C.h"
#include "lteRALue.h"
#include "intertask_interface.h"
#include "OCG.h"
//-----------------------------------------------------------------------------
#define NAS_UE_NETL_MAXLEN 500
// TO DO
#ifndef SVN_REV
#define SVN_REV "0.1"
#endif
// Global variables
int fd;
extern OAI_Emulation oai_emulation;
/*
//int netl_s, s_nas;
//struct sockaddr_un ralu_socket;
int wait_start_mihf;
......@@ -70,115 +62,25 @@ struct ral_lte_priv rl_priv;
struct ral_lte_priv *ralpriv;
//ioctl
struct nas_ioctl gifr;
*/
static int g_log_output;
//-----------------------------------------------------------------------------
static void arg_usage(char *exec_nameP) {
//-----------------------------------------------------------------------------
fprintf(stderr,
"Usage: %s [options]\nOptions:\n"
" -V, --version Display version information\n"
" -?, -h, --help Display this help text\n"
" -P <number>, --ral-listening-port Listening port for incoming MIH-F messages\n"
" -I <string>, --ral-ip-address Binding IP(v4 or v6) address for RAL\n"
" -p <number>, --mihf-remote-port MIH-F remote port\n"
" -i <string>, --mihf-ip-address MIH-F IP(v4 or v6) address\n"
" -c, --output-to-console All stream outputs are redirected to console\n"
" -f, --output-to-syslog All stream outputs are redirected to file\n"
" -s, --output-to-syslog All stream outputs are redirected to syslog\n",
exec_nameP);
}
//---------------------------------------------------------------------------
int parse_opts(int argc, char *argv[]) {
//---------------------------------------------------------------------------
static struct option long_opts[] = {
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
{"ral-listening-port", optional_argument, 0, 'P'},
{"ral-ip-address", optional_argument, 0, 'I'},
{"mihf-remote-port", optional_argument, 0, 'p'},
{"mihf-ip-address", optional_argument, 0, 'i'},
{"link.id", optional_argument, 0, 'l'},
{"mihf.id", optional_argument, 0, 'm'},
{"output-to-console", 0, 0, 'c'},
{"output-to-file", 0, 0, 'f'},
{"output-to-syslog", 0, 0, 's'},
{0, 0, 0, 0}
};
/* parse all other cmd line parameters than -c */
while (1) {
int idx, c;
c = getopt_long(argc, argv, "PIpil:Vh?cfs", long_opts, &idx);
if (c == -1) break;
switch (c) {
case 'V':
fprintf(stderr, "SVN MODULE VERSION: %s\n", SVN_REV);
return -1;
case '?':
case 'h':
arg_usage(basename(argv[0]));
return -1;
case 'i':
fprintf(stderr, "Option mihf-ip-address:\t%s\n", optarg);
g_mihf_ip_address = optarg;
break;
case 'p':
fprintf(stderr, "Option mihf-remote-port:\t%s\n", optarg);
g_mihf_remote_port = optarg;
break;
case 'P':
fprintf(stderr, "Option ral-listening-port:\t%s\n", optarg);
g_ral_listening_port_for_mihf = optarg;
break;
case 'I':
fprintf(stderr, "Option ral-ip-address:\t%s\n", optarg);
g_ral_ip_address = optarg;
break;
case 'l':
fprintf(stderr, "Option link.id:\t%s\n", optarg);
g_link_id = optarg;
break;
case 'm':
fprintf(stderr, "Option mihf.id:\t%s\n", optarg);
g_mihf_id = optarg;
break;
case 'c':
fprintf(stderr, "Option output-to-console\n");
g_log_output = LOG_TO_CONSOLE;
break;
case 'f':
fprintf(stderr, "Option output-to-file\n");
g_log_output = LOG_TO_FILE;
break;
case 's':
fprintf(stderr, "Option output-to-syslog\n");
g_log_output = LOG_TO_SYSTEM;
break;
default:
WARNING("UNKNOWN OPTION\n");
break;
};
}
return 0;
}
//---------------------------------------------------------------------------
void IAL_NAS_ioctl_init(void){
//---------------------------------------------------------------------------
/*
// Get an UDP IPv6 socket ??
fd=socket(AF_INET6, SOCK_DGRAM, 0);
if (fd<0) {
ERR("Error opening socket for ioctl\n");
LOG_E(RAL_UE, "Error opening socket for ioctl\n");
exit(1);
}
strcpy(gifr.name, "oai0");
*/
}
//---------------------------------------------------------------------------
void mRALlte_get_IPv6_addr(void) {
void mRAL_get_IPv6_addr(void) {
//---------------------------------------------------------------------------
#define IPV6_ADDR_LINKLOCAL 0x0020U
......@@ -212,21 +114,21 @@ void mRALlte_get_IPv6_addr(void) {
intf_found = 1;
// retrieve numerical value
if ((scope ==0)||(scope== IPV6_ADDR_LINKLOCAL)){
DEBUG(" adresse %s:%s:%s:%s:%s:%s:%s:%s",
LOG_D(RAL_UE, " adresse %s:%s:%s:%s:%s:%s:%s:%s",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
DEBUG(" Scope:");
LOG_D(RAL_UE, " Scope:");
switch (scope) {
case 0:
DEBUG("Global");
LOG_D(RAL_UE, "Global");
break;
case IPV6_ADDR_LINKLOCAL:
DEBUG("Link");
LOG_D(RAL_UE, "Link");
break;
default:
DEBUG("Unknown");
LOG_D(RAL_UE, "Unknown");
}
DEBUG("\n Numerical value: ");
LOG_D(RAL_UE, "\n Numerical value: ");
for (i = 0; i < 8; i++) {
for (j=0;j<4;j++){
addr6p[i][j]= toupper(addr6p[i][j]);
......@@ -241,54 +143,71 @@ void mRALlte_get_IPv6_addr(void) {
}
for (i=0;i<16;i++){
DEBUG("-%hhx-",my_addr[i]);
LOG_D(RAL_UE, "-%hhx-",my_addr[i]);
}
DEBUG("\n\n");
LOG_D(RAL_UE, "\n\n");
}
}
}
fclose(f);
if (!intf_found) {
ERR("interface not found\n\n");
LOG_E(RAL_UE, "interface not found\n\n");
}
}
}
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;
g_conf_ue_ral_link_address = UE_DEFAULT_LINK_ADDRESS_RAL;
g_conf_ue_mihf_remote_port = UE_DEFAULT_REMOTE_PORT_MIHF;
g_conf_ue_mihf_ip_address = UE_DEFAULT_IP_ADDRESS_MIHF;
g_conf_ue_mihf_id = UE_DEFAULT_MIHF_ID;
}
//---------------------------------------------------------------------------
int inits(int argc, char *argv[]) {
int mRAL_initialize(void) {
//---------------------------------------------------------------------------
MIH_C_TRANSACTION_ID_T transaction_id;
ralpriv = &rl_priv;
memset(ralpriv, 0, sizeof(struct ral_lte_priv));
memset(g_msg_codec_recv_buffer, 0, MSG_CODEC_RECV_BUFFER_SIZE);
// Initialize defaults
g_ral_ip_address = DEFAULT_IP_ADDRESS_RAL;
g_ral_listening_port_for_mihf = DEFAULT_LOCAL_PORT_RAL;
g_mihf_remote_port = DEFAULT_REMOTE_PORT_MIHF;
g_mihf_ip_address = DEFAULT_IP_ADDRESS_MIHF;
g_link_id = DEFAULT_LINK_ID;
g_mihf_id = DEFAULT_MIHF_ID;
g_sockd_mihf = -1;
g_log_output = LOG_TO_CONSOLE;
MIH_C_init(g_log_output);
if (parse_opts( argc, argv) < 0) {
exit(0);
}
ral_ue_instance_t instance = 0;
char *char_tmp = NULL;
MIH_C_init();
if (mRALlte_mihf_connect() < 0 ) {
ERR("Could not connect to MIH-F...exiting\n");
exit(-1);
}
DEBUG("MT-MIHF socket initialized.\n\n");
srand(time(NULL));
memset(g_ue_ral_obj, 0, sizeof(lte_ral_ue_object_t)*MAX_MODULES);
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;
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);
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;
g_ue_ral_obj[instance].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_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 = NULL;
printf("g_ue_ral_obj[%d].link_id=%s\n", instance, g_ue_ral_obj[instance].link_id);
// excluded MIH_C_LINK_AC_TYPE_NONE
// excluded MIH_C_LINK_AC_TYPE_LINK_LOW_POWER
// excluded MIH_C_LINK_AC_TYPE_NONE
ralpriv->mih_supported_action_list = MIH_C_LINK_AC_TYPE_LINK_DISCONNECT |
g_ue_ral_obj[instance].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 |
......@@ -297,7 +216,7 @@ int inits(int argc, char *argv[]) {
ralpriv->mih_supported_link_event_list = MIH_C_BIT_LINK_DETECTED |
g_ue_ral_obj[instance].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 |
......@@ -306,91 +225,131 @@ int inits(int argc, char *argv[]) {
MIH_C_BIT_LINK_HANDOVER_COMPLETE |
MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS;
ralpriv->mih_supported_link_command_list = MIH_C_BIT_LINK_EVENT_SUBSCRIBE | MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE | \
g_ue_ral_obj[instance].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;
ralpriv->link_to_be_detected = MIH_C_BOOLEAN_TRUE;
g_ue_ral_obj[instance].link_to_be_detected = MIH_C_BOOLEAN_TRUE;
NOTICE("[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id);
NOTICE("[MSC_NEW][%s][RAL=%s]\n", getTimeStamp4Log(), g_link_id);
NOTICE("[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas");
IAL_NAS_ioctl_init();
DEBUG("NAS Driver Connected.\n\n");
// get interface ipv6 address
mRALlte_get_IPv6_addr();
// get L2 identifier
RAL_process_NAS_message(IO_OBJ_IMEI, IO_CMD_ADD, 0);
DEBUG ("IMEI value: = ");
mRALlte_print_buffer((char *)(&ralpriv->ipv6_l2id[0]),8);
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;
// Initialize measurements
IAL_NAS_measures_init();
ralpriv->state = DISCONNECTED;
// should be commented? MW, 7/05/2013
RAL_process_NAS_message(IO_OBJ_MEAS, IO_CMD_LIST, ralpriv->cell_id);
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;
transaction_id = (MIH_C_TRANSACTION_ID_T)0;
mRALlte_send_link_register_indication(&transaction_id);
g_ue_ral_obj[instance].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;
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);
}
mRAL_send_link_register_indication(instance, &g_ue_ral_obj[instance].transaction_id);
}
return 0;
}
//---------------------------------------------------------------------------
int main(int argc, char *argv[]){
//---------------------------------------------------------------------------
int rc, done;
int meas_polling_counter;
fd_set readfds;
struct timeval tv;
void mRAL_process_file_descriptors(struct epoll_event *events, int nb_events)
{
int i;
ral_ue_instance_t instance;
hashtable_rc_t rc;
inits(argc, argv);
if (events == NULL) {
return;
}
done = 0;
ralpriv->pending_req_flag = 0;
meas_polling_counter = 1;
for (i = 0; i < nb_events; i++) {
rc = hashtable_get(g_ue_ral_fd2instance, events[i].data.fd, (void**)&instance);
if (rc == HASH_TABLE_OK) {
mRAL_mih_link_process_message(instance);
}
}
}
do{
// Create fd_set and wait for input;
FD_ZERO(&readfds);
FD_SET(g_sockd_mihf, &readfds);
void* mRAL_task(void *args_p) {
int nb_events;
struct epoll_event *events;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance = 0;
tv.tv_sec = MIH_C_RADIO_POLLING_INTERVAL_SECONDS;
tv.tv_usec = MIH_C_RADIO_POLLING_INTERVAL_MICRO_SECONDS;
rc= select(FD_SETSIZE, &readfds, NULL, NULL, &tv);
if(rc == -1) {
perror("select");
done = 1;
}
mRAL_initialize();
//something received!
if(rc >= 0){
if(FD_ISSET(g_sockd_mihf, &readfds)){
done=mRALlte_mih_link_process_message();
}
itti_mark_task_ready (TASK_RAL_UE);
//get measures from NAS - timer = 21x100ms -- impair
if (meas_polling_counter ++ == 21){
// if (meas_polling_counter ++ == 51){
IAL_NAS_measures_update(meas_polling_counter);
rallte_NAS_measures_polling();
meas_polling_counter =1;
}
while(1) {
// Wait for a message
itti_receive_msg (TASK_RAL_UE, &msg_p);
if (ralpriv->pending_req_flag > 0){ //wait until next time
ralpriv->pending_req_flag ++;
rallte_verifyPendingConnection();
}
if (msg_p != NULL) {
}
}while(!done);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
close(g_sockd_mihf);
MIH_C_exit();
return 0;
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
// TO DO
itti_exit_task ();
break;
case TIMER_HAS_EXPIRED:
LOG_D(RAL_UE, "Received %s\n", msg_name);
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);
break;
case RRC_RAL_CONNECTION_ESTABLISHMENT_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_connection_establishment_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_REESTABLISHMENT_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_connection_reestablishment_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_RECONFIGURATION_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance, msg_p);
break;
case RRC_RAL_MEASUREMENT_REPORT_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_measurement_report_indication(instance, msg_p);
break;
case RRC_RAL_CONNECTION_RELEASE_IND:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_connection_release_indication(instance, msg_p);
break;
case RRC_RAL_CONFIGURE_THRESHOLD_CONF:
LOG_D(RAL_UE, "Received %s\n", msg_name);
mRAL_rx_rrc_ral_configure_threshold_conf(instance, msg_p);
break;
default:
LOG_E(RAL_UE, "Received unexpected message %s\n", msg_name);
break;
}
free(msg_p);
msg_p = NULL;
}
nb_events = itti_get_events(TASK_RAL_UE, &events);
/* Now handle notifications for other sockets */
if (nb_events > 0) {
mRAL_process_file_descriptors(events, nb_events);
}
}
}
......@@ -34,332 +34,19 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define MRAL_MODULE
#define MRALLTE_MIH_EXECUTE_C
#include <assert.h>
#include "lteRALue_mih_execute.h"
#include "lteRALue_variables.h"
#include "nas_ue_ioctl.h"
#include "lteRALue_proto.h"
//-----------------------------------------------------------------------------
void mRALlte_action_request(MIH_C_Message_Link_Action_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
LIST(MIH_C_LINK_SCAN_RSP, scan_response_set);
MIH_C_LINK_AC_RESULT_T link_action_result;
MIH_C_TRANSACTION_ID_T transaction_id;
unsigned int scan_index, meas_to_send;
memcpy(&g_link_action, &messageP->primitive.LinkAction, sizeof(MIH_C_LINK_ACTION_T));
status = MIH_C_STATUS_SUCCESS;
link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS;
scan_response_set_list.length = 0;
meas_to_send = ralpriv->num_measures;
#ifdef RAL_REALTIME
meas_to_send = 1; // MW-TEMP - For real Time, block reporting to one measure only
#endif
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN) {
for (scan_index = 0; scan_index < meas_to_send; scan_index++) {
//MIH_C_LINK_ADDR_T - MW-TEMP, set to DEFAULT_ADDRESS_eNB (should not be UE address here)
scan_response_set_list.val[scan_index].link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
//MIH_C_3GPP_ADDR_set(&scan_response_set_list.val[scan_index].link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
MIH_C_3GPP_ADDR_set(&scan_response_set_list.val[scan_index].link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_eNB, strlen(DEFAULT_ADDRESS_eNB));
// MIH_C_NETWORK_ID_T
MIH_C_NETWORK_ID_set(&scan_response_set_list.val[scan_index].network_id, (u_int8_t *)PREDEFINED_MIH_NETWORK_ID, strlen(PREDEFINED_MIH_NETWORK_ID));
// MIH_C_SIG_STRENGTH_T
scan_response_set_list.val[scan_index].sig_strength.choice = MIH_C_SIG_STRENGTH_CHOICE_PERCENTAGE;
scan_response_set_list.val[scan_index].sig_strength._union.percentage = ralpriv->integrated_meas_level[scan_index];
scan_response_set_list.length += 1;
}
transaction_id = messageP->header.transaction_id;
mRALlte_send_link_action_confirm(&transaction_id, &status, &scan_response_set_list, &link_action_result);
}
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN) {
// TO DO
}
if ( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_DATA_FWD_REQ) {
// TO DO
}
// do not make actions if SCAN required
if (( messageP->primitive.LinkAction.link_ac_attr & MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN) == 0) {
switch (messageP->primitive.LinkAction.link_ac_type) {
case MIH_C_LINK_AC_TYPE_NONE:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_NONE: NO ACTION\n", __FUNCTION__);
break;
case MIH_C_LINK_AC_TYPE_LINK_DISCONNECT:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DISCONNECT: NO ACTION\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DISCONNECT) {
// TO DO
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
case MIH_C_LINK_AC_TYPE_LINK_LOW_POWER:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_LOW_POWER\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_LOW_POWER) {
// TO DO
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
#define LTE_RAL_UE
#define LTERALUE_MIH_MSG_C
case MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN) {
if ( ralpriv->pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN ) {
if (ralpriv->state == DISCONNECTED) {
DEBUG("Deactivation requested, but interface already inactive ==> NO OP\n");
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
} else {
ralpriv->pending_req_action = ralpriv->pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
ralpriv->pending_req_status = 0;
ralpriv->pending_req_transaction_id = messageP->header.transaction_id;
DEBUG("Deactivation requested to NAS interface\n");
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, ralpriv->cell_id);
//Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, NULL, &link_action_result);
}
} else {
ralpriv->pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN;
ralpriv->pending_req_status = 0;
ralpriv->pending_req_transaction_id = messageP->header.transaction_id;
DEBUG("Deactivation requested to NAS interface\n");
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_DEL, ralpriv->cell_id);
//Send immediatly a confirm, otherwise it will arrive to late and MIH-F will report a failure to the MIH-USER
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, NULL, &link_action_result);
}
} else {
DEBUG ("[mRAL]: command POWER DOWN not available \n\n");
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, NULL, &link_action_result);
}
break;
case MIH_C_LINK_AC_TYPE_LINK_POWER_UP:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_POWER_UP\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
// Activation requested - check it is not already active
if(ralpriv->pending_req_action & MIH_C_LINK_AC_TYPE_LINK_POWER_UP) {
if (ralpriv->state == CONNECTED) {
DEBUG("Activation requested, but interface already active ==> NO OP\n");
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
} else {
ralpriv->pending_req_action = ralpriv->pending_req_action | MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
ralpriv->pending_req_status = 0;
ralpriv->pending_req_transaction_id = messageP->header.transaction_id;
ralpriv->cell_id = ralpriv->meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
DEBUG("Activation requested to NAS interface on cell %d\n", ralpriv->cell_id);
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, ralpriv->cell_id);
}
} else {
ralpriv->pending_req_action |= MIH_C_LINK_AC_TYPE_LINK_POWER_UP;
ralpriv->pending_req_status = 0;
ralpriv->pending_req_transaction_id = messageP->header.transaction_id;
ralpriv->cell_id = ralpriv->meas_cell_id[0]; // Default cell #0 - Next, choose cell with best conditions
DEBUG("Activation requested to NAS interface on cell %d\n", ralpriv->cell_id);
RAL_process_NAS_message(IO_OBJ_CNX, IO_CMD_ADD, ralpriv->cell_id);
}
} else {
DEBUG ("[mRAL]: command POWER UP not available \n\n");
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
case MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR: NO ACTION\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
case MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
case MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES:
DEBUG("%s ACTION REQUESTED: MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES: NO ACTION\n", __FUNCTION__);
if (ralpriv->mih_supported_action_list & MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES) {
} else {
link_action_result = MIH_C_LINK_AC_RESULT_INCAPABLE;
ralpriv->pending_req_status = 0;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
break;
default:
ERR("%s Invalid LinkAction.link_ac_type in MIH_C_Message_Link_Action_request\n", __FUNCTION__);
status = MIH_C_STATUS_UNSPECIFIED_FAILURE;
mRALlte_send_link_action_confirm(&messageP->header.transaction_id, &status, &scan_response_set_list, &link_action_result);
}
}
}
//-----------------------------------------------------------------------------
void mRALlte_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
MIH_C_LINK_PARAM_LIST_T link_parameters_status_list;
MIH_C_LINK_STATES_RSP_LIST_T link_states_response_list;
MIH_C_LINK_DESC_RSP_LIST_T link_descriptors_response_list;
unsigned int link_index;
// SAVE REQUEST
// MAY BE MERGE REQUESTS ?
//memcpy(&g_link_cfg_param_thresholds_list, &messageP->primitive.LinkConfigureParameterList_list, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
status = MIH_C_STATUS_SUCCESS;
for (link_index = 0;
link_index < messageP->primitive.LinkParametersRequest_list.length;
link_index++) {
//------------------------------------------------
// MIH_C_LINK_PARAM_LIST_T
//------------------------------------------------
memcpy(&link_parameters_status_list.val[link_index].link_param_type,
&messageP->primitive.LinkParametersRequest_list.val[link_index],
sizeof(MIH_C_LINK_PARAM_TYPE_T));
switch (messageP->primitive.LinkParametersRequest_list.val[link_index].choice) {
case MIH_C_LINK_PARAM_TYPE_CHOICE_GEN:
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.link_param_val = MIH_C_LINK_PARAM_GEN_SIGNAL_STRENGTH;
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_QOS:
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_QOS_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.qos_param_val.choice = MIH_C_QOS_PARAM_VAL_CHOICE_AVG_PK_TX_DELAY;
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.length = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].cos_id = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].value = 20; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[1].cos_id = 3; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[2].value = 50; //??
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_LTE:
case MIH_C_LINK_PARAM_TYPE_CHOICE_GG:
case MIH_C_LINK_PARAM_TYPE_CHOICE_EDGE:
case MIH_C_LINK_PARAM_TYPE_CHOICE_ETH:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_11:
case MIH_C_LINK_PARAM_TYPE_CHOICE_C2K:
case MIH_C_LINK_PARAM_TYPE_CHOICE_FDD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_HRPD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_16:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_20:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_22:
default:
ERR("%s TO DO CONTINUE PROCESSING LinkParametersRequest_list of \n", __FUNCTION__);
}
//------------------------------------------------
// MIH_C_LINK_STATES_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_OP_MODE) {
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
} else if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_CHANNEL_ID) {
link_states_response_list.val[link_index].choice = 1;
link_states_response_list.val[link_index]._union.channel_id = PREDEFINED_CHANNEL_ID;
} else {
ERR("%s Invalid LinkStatesRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
}
//------------------------------------------------
// MIH_C_LINK_DESC_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_CLASSES_OF_SERVICE_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
} else if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_QUEUES_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 1;
link_descriptors_response_list.val[link_index]._union.num_queue = PREDEFINED_QUEUES_SUPPORTED;
} else {
ERR("%s Invalid LinkDescriptorsRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
}
}
link_parameters_status_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_states_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_descriptors_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
mRALte_send_get_parameters_confirm(&messageP->header.transaction_id,
&status,
&link_parameters_status_list,
&link_states_response_list,
&link_descriptors_response_list);
}
//-----------------------------------------------------------------------------
void mRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
MIH_C_LINK_EVENT_LIST_T mih_subscribed_req_event_list;
ralpriv->mih_subscribe_req_event_list |= (messageP->primitive.RequestedLinkEventList & ralpriv->mih_supported_link_event_list);
mih_subscribed_req_event_list = ralpriv->mih_subscribe_req_event_list & messageP->primitive.RequestedLinkEventList;
status = MIH_C_STATUS_SUCCESS;
mRALte_send_event_subscribe_confirm(&messageP->header.transaction_id,
&status,
&mih_subscribed_req_event_list);
}
//-----------------------------------------------------------------------------
void mRALlte_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* messageP) {
#include <assert.h>
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
MIH_C_LINK_EVENT_LIST_T mih_unsubscribed_req_event_list;
MIH_C_LINK_EVENT_LIST_T saved_req_event_list;
#include "lteRALue.h"
saved_req_event_list = ralpriv->mih_subscribe_req_event_list;
ralpriv->mih_subscribe_req_event_list &= ((messageP->primitive.RequestedLinkEventList & ralpriv->mih_supported_link_event_list) ^
messageP->primitive.RequestedLinkEventList);
mih_unsubscribed_req_event_list = ralpriv->mih_subscribe_req_event_list ^ saved_req_event_list;
status = MIH_C_STATUS_SUCCESS;
mRALte_send_event_unsubscribe_confirm(&messageP->header.transaction_id,
&status,
&mih_unsubscribed_req_event_list);
}
//-----------------------------------------------------------------------------
void mRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP) {
void mRAL_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
MIH_C_LINK_CFG_STATUS_LIST_T link_cfg_status_list;
......@@ -409,8 +96,9 @@ void mRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Threshold
mRALte_send_configure_thresholds_confirm(&messageP->header.transaction_id,&status, &link_cfg_status_list);
}
/*
//-----------------------------------------------------------------------------
void mRALlte_check_thresholds_signal_strength(MIH_C_THRESHOLD_VAL_T new_valP, MIH_C_THRESHOLD_VAL_T old_valP) {
void mRAL_check_thresholds_signal_strength(MIH_C_THRESHOLD_VAL_T new_valP, MIH_C_THRESHOLD_VAL_T old_valP) {
//-----------------------------------------------------------------------------
unsigned int threshold_index, threshold_index_mov;
......@@ -524,7 +212,9 @@ void mRALlte_check_thresholds_signal_strength(MIH_C_THRESHOLD_VAL_T new_valP, MI
MIH_C_3GPP_ADDR_set(&link_identifier.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
mRALlte_send_link_parameters_report_indication(&transaction_id, &link_identifier, &LinkParametersReportList_list);
mRAL_send_link_parameters_report_indication(&transaction_id, &link_identifier, &LinkParametersReportList_list);
}
}
*/
......@@ -34,206 +34,153 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define MRAL_MODULE
#define MRALLTE_MIH_MSG_C
#define LTE_RAL_UE
#define LTERALUE_MIH_MSG_C
//-----------------------------------------------------------------------------
#include "lteRALue_mih_msg.h"
#include "lteRALue_variables.h"
#include "lteRALue_mih_execute.h"
#include "lteRALue.h"
//-----------------------------------------------------------------------------
#define MSG_CODEC_RECV_BUFFER_SIZE 16400
#define MSG_CODEC_SEND_BUFFER_SIZE 16400
static char g_msg_codec_tmp_print_buffer[8192];
#ifdef MSCGEN_PYTOOL
#define MSC_GEN_BUF_SIZE 1024
// global instead of poisonning the stack
static char g_msc_gen_buf[MSC_GEN_BUF_SIZE];
static unsigned int g_msc_gen_buffer_index;
#endif
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
static u_int8_t g_msg_codec_recv_buffer[MSG_CODEC_RECV_BUFFER_SIZE] = {};
static u_int8_t g_msg_codec_send_buffer[MSG_CODEC_SEND_BUFFER_SIZE] = {};
static char g_msg_print_buffer[8192] = {};
static char g_msg_codec_print_buffer[8192] = {};
//-----------------------------------------------------------------------------
int mRALlte_send_to_mih(u_int8_t *bufferP, size_t lenP) {
int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t *bufferP, size_t lenP) {
//-----------------------------------------------------------------------------
int result;
mRALlte_print_buffer((char*)bufferP, lenP);
result = send(g_sockd_mihf, (const void *)bufferP, lenP, 0);
result = send(g_ue_ral_obj[instanceP].mih_sock_desc, (const void *)bufferP, lenP, 0);
if (result != lenP) {
ERR("send_to_mih %d bytes failed, returned %d: %s\n", lenP, result, strerror(errno));
LOG_E(RAL_UE, "send_to_mih %d bytes failed, returned %d: %s\n", lenP, result, strerror(errno));
}
return result;
}
//-----------------------------------------------------------------------------
// Print the content of a buffer in hexadecimal
void mRALlte_print_buffer(char * bufferP, int lengthP) {
//-----------------------------------------------------------------------------
char c;
unsigned int buffer_index = 0;
unsigned int index;
unsigned int octet_index = 0;
unsigned long char_index = 0;
if (bufferP == NULL) {
return;
}
//---------------------------------------------------------------------------
int mRAL_mihf_connect(ral_ue_instance_t instanceP){
//---------------------------------------------------------------------------
struct addrinfo info; /* endpoint information */
struct addrinfo *addr, *rp; /* endpoint address */
int rc; /* returned error code */
int optval; /* socket option value */
unsigned char buf[sizeof(struct sockaddr_in6)];
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], "\n------+-------------------------------------------------+------------------+\n");
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f | 0123456789abcdef |\n");
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], "------+-------------------------------------------------+------------------+\n");
for (octet_index = 0; octet_index < lengthP; octet_index++) {
if ((octet_index % 16) == 0){
if (octet_index != 0) {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " | ");
for (char_index = octet_index - 16; char_index < octet_index; char_index++) {
c = (char) bufferP[char_index] & 0177;
if (iscntrl(c) || isspace(c)) {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " ");
} else {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], "%c", c);
}
}
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " |\n");
}
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " %04d |", octet_index);
}
/*
* Print every single octet in hexadecimal form
*/
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " %02x", (u_int8_t)(bufferP[octet_index] & 0x00FF));
/*
* Align newline and pipes according to the octets in groups of 2
* Initialize the remote MIH-F endpoint address information
*/
memset(&info, 0, sizeof(struct addrinfo));
info.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
info.ai_socktype = SOCK_DGRAM; /* Datagram socket */
info.ai_flags = 0;
info.ai_protocol = 0; /* Any protocol */
rc = getaddrinfo(g_ue_ral_obj[instanceP].mihf_ip_address, g_ue_ral_obj[instanceP].mihf_remote_port, &info, &addr);
if (rc != 0) {
LOG_E(RAL_UE, " getaddrinfo: %s\n", gai_strerror(rc));
return -1;
}
/*
* Append enough spaces and put final pipe
* getaddrinfo() returns a linked list of address structures.
* Try each address until we successfully connect(2). If socket(2)
* (or connect(2)) fails, we (close the socket and) try the next address.
*/
if ((lengthP % 16) > 0) {
for (index = (octet_index % 16); index < 16; ++index) {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " ");
}
}
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " | ");
for (char_index = (octet_index / 16) * 16; char_index < octet_index; char_index++) {
c = (char) bufferP[char_index] & 0177;
if (iscntrl(c) || isspace(c)) {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " ");
} else {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], "%c", c);
}
}
if ((lengthP % 16) > 0) {
for (index = (octet_index % 16); index < 16; ++index) {
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " ");
}
}
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], " |\n");
buffer_index += sprintf(&g_msg_codec_tmp_print_buffer[buffer_index], "------+-------------------------------------------------+------------------+\n");
DEBUG(g_msg_codec_tmp_print_buffer);
}
//---------------------------------------------------------------------------
int mRALlte_mihf_connect(void){
//---------------------------------------------------------------------------
struct addrinfo hints;
struct addrinfo *result, *rp;
int s, on;
struct sockaddr_in *addr = NULL;
struct sockaddr_in6 *addr6 = NULL;
unsigned char buf[sizeof(struct sockaddr_in6)];
for (rp = addr; rp != NULL; rp = rp->ai_next) {
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
hints.ai_flags = 0;
hints.ai_protocol = 0; /* Any protocol */
s = getaddrinfo(g_mihf_ip_address, g_mihf_remote_port, &hints, &result);
if (s != 0) {
ERR(" getaddrinfo: %s\n", gai_strerror(s));
freeaddrinfo(result);
return -1;
g_ue_ral_obj[instanceP].mih_sock_desc = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_ue_ral_obj[instanceP].mih_sock_desc < 0) {
continue;
}
/* getaddrinfo() returns a list of address structures.
Try each address until we successfully connect(2).
If socket(2) (or connect(2)) fails, we (close the socket
and) try the next address. */
optval = 1;
setsockopt(g_ue_ral_obj[instanceP].mih_sock_desc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
for (rp = result; rp != NULL; rp = rp->ai_next) {
g_sockd_mihf = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_sockd_mihf == -1)
continue;
/*
* Convert the RAL local network address
*/
if (rp->ai_family == AF_INET) {
/* IPv4 network address family */
struct sockaddr_in *addr4 = NULL;
LOG_D(RAL_UE, " %s is an ipv4 address\n", g_ue_ral_obj[instanceP].mihf_ip_address);
addr4 = (struct sockaddr_in *)(&buf[0]);
addr4->sin_port = htons(atoi(g_ue_ral_obj[instanceP].ral_listening_port));
addr4->sin_family = AF_INET;
rc = inet_pton(AF_INET, g_ue_ral_obj[instanceP].ral_ip_address, &addr4->sin_addr);
}
else if (rp->ai_family == AF_INET6) {
/* IPv6 network address family */
struct sockaddr_in6 *addr6 = NULL;
on = 1;
setsockopt( g_sockd_mihf, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
if(rp->ai_family == AF_INET) {
DEBUG(" %s is an ipv4 address\n",g_mihf_ip_address);
addr = (struct sockaddr_in *)(&buf[0]);
addr->sin_port = htons(atoi(g_ral_listening_port_for_mihf));
addr->sin_family = AF_INET;
s = inet_pton(AF_INET, g_ral_ip_address, &addr->sin_addr);
if (s <= 0) {
if (s == 0) {
ERR(" IP RAL address should be a IPv4 ADDR - But found not in presentation format : %s\n", g_ral_ip_address);
} else {
ERR(" %s - inet_pton(RAL IPv4 ADDR %s): %s\n", __FUNCTION__, g_ral_ip_address, strerror(s));
LOG_D(RAL_UE, " %s is an ipv6 address\n", g_ue_ral_obj[instanceP].mihf_ip_address);
addr6 = (struct sockaddr_in6 *)(&buf[0]);
addr6->sin6_port = htons(atoi(g_ue_ral_obj[instanceP].ral_listening_port));
addr6->sin6_family = AF_INET6;
rc = inet_pton(AF_INET, g_ue_ral_obj[instanceP].ral_ip_address, &addr6->sin6_addr);
}
else {
LOG_E(RAL_UE, " %s is an unknown address format %d\n",
g_ue_ral_obj[instanceP].mihf_ip_address, rp->ai_family);
return -1;
}
s = bind(g_sockd_mihf, (const struct sockaddr *)addr, sizeof(struct sockaddr_in));
if (s == -1) {
ERR(" RAL IPv4 Address Bind: %s\n", strerror(errno));
if (rc < 0) {
/* The network address convertion failed */
LOG_E(RAL_UE, " inet_pton(RAL IP address %s): %s\n",
g_ue_ral_obj[instanceP].ral_ip_address, strerror(rc));
return -1;
}
// sockd_mihf is of type SOCK_DGRAM, rp->ai_addr is the address to which datagrams are sent by default
if (connect(g_sockd_mihf, rp->ai_addr, rp->ai_addrlen) != -1) {
NOTICE(" RAL is now UDP-CONNECTED to MIH-F\n");
freeaddrinfo(result);
return 0;
} else {
close(g_sockd_mihf);
}
} else if (rp->ai_family == AF_INET6) {
DEBUG(" %s is an ipv6 address\n",g_mihf_ip_address);
addr6 = (struct sockaddr_in6 *)(&buf[0]);
addr6->sin6_port = htons(atoi(g_ral_listening_port_for_mihf));
addr6->sin6_family = AF_INET6;
s = inet_pton(AF_INET, g_ral_ip_address, &addr6->sin6_addr);
if (s <= 0) {
if (s == 0) {
ERR(" IP RAL address should be a IPv6 ADDR, But found not in presentation format : %s\n", g_ral_ip_address);
} else {
ERR(" %s - inet_pton(RAL IPv6 ADDR %s): %s\n", __FUNCTION__, g_ral_ip_address, strerror(s));
}
else if (rc == 0) {
/* The network address is not valid */
LOG_E(RAL_UE, " RAL IP address %s is not valid\n", g_ue_ral_obj[instanceP].ral_ip_address);
return -1;
}
s = bind(g_sockd_mihf, (const struct sockaddr *)addr6, sizeof(struct sockaddr_in));
if (s == -1) {
ERR(" RAL IPv6 Address Bind: %s\n", strerror(errno));
/* Bind the socket to the local RAL network address */
rc = bind(g_ue_ral_obj[instanceP].mih_sock_desc, (const struct sockaddr *)buf,
sizeof(struct sockaddr_in));
if (rc < 0) {
LOG_E(RAL_UE, " bind(RAL IP address %s): %s\n",
g_ue_ral_obj[instanceP].ral_ip_address, strerror(errno));
return -1;
}
if (connect(g_sockd_mihf, rp->ai_addr, rp->ai_addrlen) != -1) {
NOTICE(" RAL is now UDP-CONNECTED to MIH-F\n");
freeaddrinfo(result);
return 0;
} else {
close(g_sockd_mihf);
}
} else {
ERR(" %s is an unknown address format %d\n",g_mihf_ip_address,rp->ai_family);
/* Connect the socket to the remote MIH-F network address */
if (connect(g_ue_ral_obj[instanceP].mih_sock_desc, rp->ai_addr, rp->ai_addrlen) == 0) {
LOG_N(RAL_UE, " RAL [%s:%s] is now UDP-CONNECTED to MIH-F [%s:%s]\n",
g_ue_ral_obj[instanceP].ral_ip_address, g_ue_ral_obj[instanceP].ral_listening_port,
g_ue_ral_obj[instanceP].mihf_ip_address, g_ue_ral_obj[instanceP].mihf_remote_port);
break;
}
close(g_sockd_mihf);
/*
* We failed to connect:
* Close the socket file descriptor and try to connect to an other
* address.
*/
close(g_ue_ral_obj[instanceP].mih_sock_desc);
}
if (rp == NULL) { /* No address succeeded */
ERR(" Could not connect to MIH-F\n");
/*
* Unable to connect to a network address
*/
if (rp == NULL) {
LOG_E(RAL_UE, " Could not connect to MIH-F\n");
return -1;
}
return -1;
freeaddrinfo(addr);
return 0;
}
/***************************************************************************
......@@ -241,7 +188,8 @@ int mRALlte_mihf_connect(void){
***************************************************************************/
//-----------------------------------------------------------------------------
void mRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *transaction_idP) {
void mRAL_send_link_register_indication(ral_ue_instance_t instanceP,
MIH_C_TRANSACTION_ID_T *transaction_idP) {
//-----------------------------------------------------------------------------
MIH_C_Message_Link_Register_indication_t message;
Bit_Buffer_t *bb;
......@@ -259,15 +207,15 @@ void mRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *transaction_
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Link_Id.link_type = MIH_C_WIRELESS_UMTS;
message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_ue_ral_obj[instanceP].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
//MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP, strlen(DEFAULT_ADDRESS_3GPP));
//MIH_C_3GPP_ADDR_load_3gpp_str_address(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
......@@ -279,29 +227,17 @@ void mRALlte_send_link_register_indication(MIH_C_TRANSACTION_ID_T *transaction_
MIH_C_LINK_ID2String(&message.primitive.Link_Id, g_msc_gen_buf);
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Register.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Register.indication\n");
} else {
DEBUG(": Sent Link_Register.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Register.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_detected_indication(MIH_C_TRANSACTION_ID_T *transaction_idP, MIH_C_LINK_DET_INFO_T *link_detected_infoP) {
void mRAL_send_link_detected_indication(ral_ue_instance_t instanceP,
MIH_C_TRANSACTION_ID_T *transaction_idP,
MIH_C_LINK_DET_INFO_T *link_detected_infoP) {
//-----------------------------------------------------------------------------
MIH_C_Message_Link_Detected_indication_t message;
Bit_Buffer_t *bb;
......@@ -319,47 +255,25 @@ void mRALlte_send_link_detected_indication(MIH_C_TRANSACTION_ID_T *transaction_
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkDetectedInfo, link_detected_infoP, sizeof(MIH_C_LINK_DET_INFO_T));
message_total_length = MIH_C_Link_Message_Encode_Link_Detected_indication(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Detected.indication\n");
#ifdef MSCGEN_PYTOOL
g_msc_gen_buffer_index = 0;
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = MIH_C_SIG_STRENGTH2String(&link_detected_infoP->sig_strength, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index = sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nSINR %d\\nData rate %d", link_detected_infoP->sinr, link_detected_infoP->link_data_rate);
NOTICE("[MSC_MSG][%s][%s][--- Link_Detected.indication\\n%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Detected.indication\n");
} else {
DEBUG(": Sent Link_Detected.indication\n");
#ifdef MSCGEN_PYTOOL
g_msc_gen_buffer_index = 0;
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = MIH_C_SIG_STRENGTH2String(&link_detected_infoP->sig_strength, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index = sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nSINR %d\\nData rate %d", link_detected_infoP->sinr, link_detected_infoP->link_data_rate);
NOTICE("[MSC_MSG][%s][%s][--- Link_Detected.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Detected.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_link_up_indication(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_ADDR_T *new_access_routerP,
......@@ -382,9 +296,9 @@ void mRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -396,27 +310,16 @@ void mRALlte_send_link_up_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
message_total_length = MIH_C_Link_Message_Encode_Link_Up_indication(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Up.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Up.indication ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Up.indication\n");
} else {
DEBUG(": Sent Link_Up.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Up.indication --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Up.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_link_parameters_report_indication(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) {
//-----------------------------------------------------------------------------
......@@ -439,9 +342,9 @@ void mRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -449,36 +352,17 @@ void mRALlte_send_link_parameters_report_indication(MIH_C_TRANSACTION_ID_T
message_total_length = MIH_C_Link_Message_Encode_Link_Parameters_Report_indication(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Parameters_Report.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Parameters_Report.indication ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Parameters_Report.indication\n");
} else {
DEBUG(": Sent Link_Parameters_Report.indication\n");
#ifdef MSCGEN_PYTOOL
g_msc_gen_buffer_index = 0;
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index += MIH_C_LINK_ID2String(&link_identifierP->link_id, &g_msc_gen_buf[g_msc_gen_buffer_index]);
for (index = 0; index < link_parameters_report_listP->length; index++) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n");
g_msc_gen_buffer_index += MIH_C_LINK_PARAM_RPT2String(&link_parameters_report_listP->val[index], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Parameters_Report.indication\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Parameters_Report.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_link_going_down_indication(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) {
......@@ -499,9 +383,9 @@ void mRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *transa
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -511,28 +395,17 @@ void mRALlte_send_link_going_down_indication(MIH_C_TRANSACTION_ID_T *transa
message_total_length = MIH_C_Link_Message_Encode_Link_Going_Down_indication(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Going_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Going_Down.indication ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Going_Down.indication\n");
} else {
DEBUG(": Sent Link_Going_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Going_Down.indication --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Going_Down.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_link_down_indication(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) {
......@@ -553,9 +426,9 @@ void mRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *transaction_
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
memcpy(&message.primitive.LinkIdentifier, link_identifierP, sizeof(MIH_C_LINK_TUPLE_ID_T));
......@@ -565,28 +438,17 @@ void mRALlte_send_link_down_indication(MIH_C_TRANSACTION_ID_T *transaction_
message_total_length = MIH_C_Link_Message_Encode_Link_Down_indication(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Down.indication ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Down.indication\n");
} else {
DEBUG(": Sent Link_Down.indication\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Down.indication --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Down.indication\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_link_action_confirm(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) {
......@@ -610,9 +472,9 @@ void mRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *transaction_id
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
......@@ -637,30 +499,17 @@ void mRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *transaction_id
g_msc_gen_buffer_index += MIH_C_LINK_AC_RESULT2String2(link_action_resultP, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Action.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Action.confirm\n");
} else {
DEBUG(": Sent Link_Action.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Action.confirm\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_capability_discover_confirm(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) {
......@@ -681,8 +530,8 @@ void mRALte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *transactio
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.SupportedLinkEventList = supported_link_event_listP;
......@@ -699,30 +548,17 @@ void mRALte_send_capability_discover_confirm(MIH_C_TRANSACTION_ID_T *transactio
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nsupported commands=");
g_msc_gen_buffer_index += MIH_C_LINK_CMD_LIST2String2(message.primitive.SupportedLinkCommandList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Capability_Discover.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Capability_Discover.confirm\n");
} else {
DEBUG(": Sent Link_Capability_Discover.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Capability_Discover.confirm\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_event_subscribe_confirm(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) {
//-----------------------------------------------------------------------------
......@@ -742,8 +578,8 @@ void mRALte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_id
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.ResponseLinkEventList = response_link_event_listP;
......@@ -757,30 +593,17 @@ void mRALte_send_event_subscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_id
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list=");
g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Event_Subscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Event_Subscribe.confirm\n");
} else {
DEBUG(": Sent Link_Event_Subscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Event_Subscribe.confirm\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_event_unsubscribe_confirm(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) {
//-----------------------------------------------------------------------------
......@@ -800,8 +623,8 @@ void mRALte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.ResponseLinkEventList = response_link_event_listP;
......@@ -815,30 +638,17 @@ void mRALte_send_event_unsubscribe_confirm(MIH_C_TRANSACTION_ID_T *transaction_
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nlink event list=");
g_msc_gen_buffer_index += MIH_C_LINK_EVENT_LIST2String2(message.primitive.ResponseLinkEventList, &g_msc_gen_buf[g_msc_gen_buffer_index]);
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Event_Unsubscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Event_Unsubscribe.confirm\n");
} else {
DEBUG(": Sent Link_Event_Unsubscribe.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Event_Unsubscribe.confirm\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_configure_thresholds_confirm(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) {
//-----------------------------------------------------------------------------
......@@ -861,8 +671,8 @@ void mRALte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *transact
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.LinkConfigureStatusList_list = link_configure_status_listP;
......@@ -878,30 +688,17 @@ void mRALte_send_configure_thresholds_confirm(MIH_C_TRANSACTION_ID_T *transact
g_msc_gen_buffer_index += MIH_C_LINK_CFG_STATUS2String(&link_configure_status_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
#endif
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Configure_Threshold.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.confirm\\nstatus=%s ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Configure_Threshold.confirm\n");
} else {
DEBUG(": Sent Link_Configure_Threshold.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.confirm\\nstatus=%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Configure_Threshold.confirm\n");
}
free_BitBuffer(bb);
}
//-----------------------------------------------------------------------------
void mRALte_send_get_parameters_confirm (MIH_C_TRANSACTION_ID_T *transaction_idP,
void mRAL_send_get_parameters_confirm (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,
MIH_C_LINK_STATES_RSP_LIST_T *link_states_response_listP,
......@@ -928,8 +725,8 @@ void mRALte_send_get_parameters_confirm (MIH_C_TRANSACTION_ID_T *trans
message.header.transaction_id = *transaction_idP;
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_link_id, strlen(g_link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_mihf_id, strlen(g_mihf_id));
MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_ue_ral_obj[instanceP].link_id, strlen(g_ue_ral_obj[instanceP].link_id));
MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_ue_ral_obj[instanceP].mihf_id, strlen(g_ue_ral_obj[instanceP].mihf_id));
message.primitive.Status = *statusP;
message.primitive.LinkParametersStatusList_list = link_parameters_status_listP;
......@@ -938,49 +735,10 @@ void mRALte_send_get_parameters_confirm (MIH_C_TRANSACTION_ID_T *trans
message_total_length = MIH_C_Link_Message_Encode_Get_Parameters_confirm(bb, &message);
if (mRALlte_send_to_mih(bb->m_buffer,message_total_length)<0){
ERR(": Send Link_Get_Parameters.confirm\n");
#ifdef MSCGEN_PYTOOL
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.confirm ---x][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_mihf_id);
#endif
if (mRAL_send_to_mih(instanceP, bb->m_buffer,message_total_length)<0){
LOG_E(RAL_UE, ": Send Link_Get_Parameters.confirm\n");
} else {
DEBUG(": Sent Link_Get_Parameters.confirm\n");
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&message.source, msg_src);
MIH_C_MIHF_ID2String(&message.destination, msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_STATUS2String(&message.primitive.Status, &g_msc_gen_buf[g_msc_gen_buffer_index]);
if (link_parameters_status_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkParametersStatusList=");
for (i = 0; i < link_parameters_status_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_PARAM2String(&link_parameters_status_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
if (link_states_response_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkStatesResponseList=");
for (i = 0; i < link_states_response_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_STATES_RSP2String(&link_states_response_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
if (link_descriptors_response_listP) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n LinkDescriptorsResponseList=");
for (i = 0; i < link_descriptors_response_listP->length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_DESC_RSP2String(&link_descriptors_response_listP->val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], ", ");
}
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.confirm\\n%s --->][%s]\n",
getTimeStamp4Log(),
g_link_id,
g_msc_gen_buf,
g_mihf_id);
#endif
LOG_D(RAL_UE, ": Sent Link_Get_Parameters.confirm\n");
}
free_BitBuffer(bb);
}
......@@ -990,7 +748,7 @@ void mRALte_send_get_parameters_confirm (MIH_C_TRANSACTION_ID_T *trans
***************************************************************************/
//-----------------------------------------------------------------------------
int mRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP) {
int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP) {
//-----------------------------------------------------------------------------
int status = MIH_MESSAGE_DECODE_FAILURE;
MIH_C_HEADER_T header;
......@@ -1014,215 +772,84 @@ int mRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *mess
switch (message_wrapperP->message_id) {
case MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_capability_discover_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Capability_Discover_request(bbP, &message_wrapperP->_union_message.link_capability_discover_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.request --->][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
MIH_C_Link_Message_Link_Capability_Discover_request2String(&message_wrapperP->_union_message.link_capability_discover_request, g_msg_print_buffer);
DEBUG("%s", g_msg_print_buffer);
LOG_D(RAL_UE, "%s", g_msg_print_buffer);
mih_status = MIH_C_STATUS_SUCCESS;
DEBUG("**\n");
DEBUG(" %s Sending MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM\n\n", __FUNCTION__);
LOG_D(RAL_UE, "**\n");
LOG_D(RAL_UE, " %s Sending MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM\n\n", __FUNCTION__);
mRALte_send_capability_discover_confirm(&message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id,
mRAL_send_capability_discover_confirm(instanceP,
&message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id,
&mih_status,
&ralpriv->mih_supported_link_event_list,
&ralpriv->mih_supported_link_command_list);
&g_ue_ral_obj[instanceP].mih_supported_link_event_list,
&g_ue_ral_obj[instanceP].mih_supported_link_command_list);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_capability_discover_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Capability_Discover.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
case MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_event_subscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(bbP, &message_wrapperP->_union_message.link_event_subscribe_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_subscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
LOG_D(RAL_UE, "**\n");
mRALlte_subscribe_request(&message_wrapperP->_union_message.link_event_subscribe_request);
mRAL_subscribe_request(instanceP, &message_wrapperP->_union_message.link_event_subscribe_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_subscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_subscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Subscribe.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
case MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_event_unsubscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(bbP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_unsubscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
mRALlte_unsubscribe_request(&message_wrapperP->_union_message.link_event_unsubscribe_request);
LOG_D(RAL_UE, "**\n");
mRAL_unsubscribe_request(instanceP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_event_unsubscribe_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
MIH_C_LINK_EVENT_LIST2String2(&message_wrapperP->_union_message.link_event_unsubscribe_request.primitive.RequestedLinkEventList, g_msc_gen_buf);
NOTICE("[MSC_MSG][%s][%s][--- Link_Event_Unsubscribe.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
case MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_get_parameters_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Get_Parameters_request(bbP, &message_wrapperP->_union_message.link_get_parameters_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
for (i = 0; i < message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkParametersRequest_list.length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_PARAM_TYPE2String(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkParametersRequest_list.val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n Link states request=");
g_msc_gen_buffer_index += MIH_C_LINK_STATES_REQ2String2(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkStatesRequest, &g_msc_gen_buf[g_msc_gen_buffer_index]);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\n Link desc request=");
g_msc_gen_buffer_index += MIH_C_LINK_DESC_REQ2String2(&message_wrapperP->_union_message.link_get_parameters_request.primitive.LinkDescriptorsRequest, &g_msc_gen_buf[g_msc_gen_buffer_index]);
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
mRALlte_get_parameters_request(&message_wrapperP->_union_message.link_get_parameters_request);
LOG_D(RAL_UE, "**\n");
mRAL_get_parameters_request(instanceP, &message_wrapperP->_union_message.link_get_parameters_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_get_parameters_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Get_Parameters.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
case MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_configure_thresholds_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Configure_Thresholds_request(bbP, &message_wrapperP->_union_message.link_configure_thresholds_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
for (i = 0; i < message_wrapperP->_union_message.link_configure_thresholds_request.primitive.LinkConfigureParameterList_list.length; i++) {
g_msc_gen_buffer_index += MIH_C_LINK_CFG_PARAM2String(&message_wrapperP->_union_message.link_configure_thresholds_request.primitive.LinkConfigureParameterList_list.val[i], &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
mRALlte_configure_thresholds_request(&message_wrapperP->_union_message.link_configure_thresholds_request);
LOG_D(RAL_UE, "**\n");
mRAL_configure_thresholds_request(instanceP, &message_wrapperP->_union_message.link_configure_thresholds_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_configure_thresholds_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Configure_Thresholds.request\\nERR DECODE ---x][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
case MIH_C_MESSAGE_LINK_ACTION_REQUEST_ID:
DEBUG(" %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__);
LOG_D(RAL_UE, " %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__);
memcpy(&message_wrapperP->_union_message.link_action_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
status = MIH_C_Link_Message_Decode_Link_Action_request(bbP, &message_wrapperP->_union_message.link_action_request);
if (status == MIH_MESSAGE_DECODE_OK) {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.destination), msg_dst);
memset(g_msc_gen_buf, 0, MSC_GEN_BUF_SIZE);
g_msc_gen_buffer_index = 0;
g_msc_gen_buffer_index += MIH_C_LINK_ACTION2String(&message_wrapperP->_union_message.link_action_request.primitive.LinkAction, g_msc_gen_buf);
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nExecution Delay=%d", message_wrapperP->_union_message.link_action_request.primitive.ExecutionDelay);
if (message_wrapperP->_union_message.link_action_request.primitive.PoALinkAddress != NULL) {
g_msc_gen_buffer_index += sprintf(&g_msc_gen_buf[g_msc_gen_buffer_index], "\\nPoALinkAddress=");
g_msc_gen_buffer_index += MIH_C_LINK_ADDR2String(message_wrapperP->_union_message.link_action_request.primitive.PoALinkAddress, &g_msc_gen_buf[g_msc_gen_buffer_index]);
}
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.request\\n%s --->][%s]\n",
getTimeStamp4Log(),
msg_src,
g_msc_gen_buf,
msg_dst);
#endif
DEBUG("**\n");
mRALlte_action_request(&message_wrapperP->_union_message.link_action_request);
LOG_D(RAL_UE, "**\n");
mRAL_action_request(instanceP, &message_wrapperP->_union_message.link_action_request);
} else {
#ifdef MSCGEN_PYTOOL
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.source), msg_src);
MIH_C_MIHF_ID2String(&(message_wrapperP->_union_message.link_action_request.destination), msg_dst);
NOTICE("[MSC_MSG][%s][%s][--- Link_Action.request\\nERR DECODE --->][%s]\n",
getTimeStamp4Log(),
msg_src,
msg_dst);
#endif
}
break;
default:
WARNING("UNKNOWN MESSAGE ID SID %d, OP_CODE %d, AID %d\n", header.service_identifier, header.operation_code, header.action_identifier);
LOG_W(RAL_UE, "UNKNOWN MESSAGE ID SID %d, OP_CODE %d, AID %d\n", header.service_identifier, header.operation_code, header.action_identifier);
status = MIH_MESSAGE_DECODE_FAILURE;
return status;
......@@ -1234,7 +861,7 @@ int mRALlte_mih_link_msg_decode(Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *mess
}
//-----------------------------------------------------------------------------
int mRALlte_mih_link_process_message(void){
int mRAL_mih_link_process_message(ral_ue_instance_t instanceP){
//-----------------------------------------------------------------------------
MIH_C_Message_Wrapper_t message_wrapper;
int nb_bytes_received ;
......@@ -1250,7 +877,7 @@ int mRALlte_mih_link_process_message(void){
bb = new_BitBuffer_0();
nb_bytes_received = recvfrom(g_sockd_mihf,
nb_bytes_received = recvfrom(g_ue_ral_obj[instanceP].mih_sock_desc,
(void *)g_msg_codec_recv_buffer,
MSG_CODEC_RECV_BUFFER_SIZE,
0,
......@@ -1258,12 +885,11 @@ int mRALlte_mih_link_process_message(void){
&sockaddr_len);
if (nb_bytes_received > 0) {
DEBUG(" \n");
DEBUG(" %s: Received %d bytes from MIHF\n", __FUNCTION__, nb_bytes_received);
mRALlte_print_buffer((char*)g_msg_codec_recv_buffer, nb_bytes_received);
LOG_D(RAL_UE, " \n");
LOG_D(RAL_UE, " %s: Received %d bytes from MIHF\n", __FUNCTION__, nb_bytes_received);
total_bytes_to_decode += nb_bytes_received;
BitBuffer_wrap(bb, g_msg_codec_recv_buffer, total_bytes_to_decode);
status = mRALlte_mih_link_msg_decode(bb, &message_wrapper);
status = mRAL_mih_link_msg_decode(instanceP, bb, &message_wrapper);
nb_bytes_decoded = BitBuffer_getPosition(bb);
if (status == MIH_MESSAGE_DECODE_OK) {
if (nb_bytes_decoded > 0) {
......@@ -1287,7 +913,7 @@ int mRALlte_mih_link_process_message(void){
total_bytes_to_decode = 0;
} else if (status == MIH_MESSAGE_DECODE_TOO_SHORT) {
}
DEBUG(" \n");
LOG_D(RAL_UE, " \n");
}
free_BitBuffer(bb);
return 0;
......
/***************************************************************************
lteRALue_parameters.c - description
***************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
/*! \file lteRALue_mih_execute.c
* \brief Execution of MIH primitives in LTE-RAL-UE
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
* \date 2013
* \company EURECOM
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define LTE_RAL_UE
#define LTERALUE_PARAMETERS_C
//-----------------------------------------------------------------------------
#include "lteRALue.h"
//-----------------------------------------------------------------------------
void mRAL_get_parameters_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Get_Parameters_request_t* messageP) {
//-----------------------------------------------------------------------------
MIH_C_STATUS_T status;
MIH_C_LINK_PARAM_LIST_T link_parameters_status_list;
MIH_C_LINK_STATES_RSP_LIST_T link_states_response_list;
MIH_C_LINK_DESC_RSP_LIST_T link_descriptors_response_list;
unsigned int link_index;
// SAVE REQUEST
// MAY BE MERGE REQUESTS ?
//memcpy(&g_link_cfg_param_thresholds_list, &messageP->primitive.LinkConfigureParameterList_list, sizeof(MIH_C_LINK_CFG_PARAM_LIST_T));
status = MIH_C_STATUS_SUCCESS;
for (link_index = 0;
link_index < messageP->primitive.LinkParametersRequest_list.length;
link_index++) {
//------------------------------------------------
// MIH_C_LINK_PARAM_LIST_T
//------------------------------------------------
memcpy(&link_parameters_status_list.val[link_index].link_param_type,
&messageP->primitive.LinkParametersRequest_list.val[link_index],
sizeof(MIH_C_LINK_PARAM_TYPE_T));
switch (messageP->primitive.LinkParametersRequest_list.val[link_index].choice) {
case MIH_C_LINK_PARAM_TYPE_CHOICE_GEN:
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.link_param_val = MIH_C_LINK_PARAM_GEN_SIGNAL_STRENGTH;
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_QOS:
link_parameters_status_list.val[link_index].choice = MIH_C_LINK_PARAM_CHOICE_QOS_PARAM_VAL;
link_parameters_status_list.val[link_index]._union.qos_param_val.choice = MIH_C_QOS_PARAM_VAL_CHOICE_AVG_PK_TX_DELAY;
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.length = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].cos_id = 2; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[0].value = 20; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[1].cos_id = 3; //??
link_parameters_status_list.val[link_index]._union.qos_param_val._union.avg_pk_tx_delay_list.val[2].value = 50; //??
break;
case MIH_C_LINK_PARAM_TYPE_CHOICE_LTE:
case MIH_C_LINK_PARAM_TYPE_CHOICE_GG:
case MIH_C_LINK_PARAM_TYPE_CHOICE_EDGE:
case MIH_C_LINK_PARAM_TYPE_CHOICE_ETH:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_11:
case MIH_C_LINK_PARAM_TYPE_CHOICE_C2K:
case MIH_C_LINK_PARAM_TYPE_CHOICE_FDD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_HRPD:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_16:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_20:
case MIH_C_LINK_PARAM_TYPE_CHOICE_802_22:
default:
LOG_E(RAL_UE, "%s TO DO CONTINUE PROCESSING LinkParametersRequest_list of \n", __FUNCTION__);
}
//------------------------------------------------
// MIH_C_LINK_STATES_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_OP_MODE) {
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
} else if (messageP->primitive.LinkStatesRequest & MIH_C_BIT_LINK_STATES_REQ_CHANNEL_ID) {
link_states_response_list.val[link_index].choice = 1;
link_states_response_list.val[link_index]._union.channel_id = PREDEFINED_CHANNEL_ID;
} else {
LOG_E(RAL_UE, "%s Invalid LinkStatesRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_states_response_list.val[link_index].choice = 0;
link_states_response_list.val[link_index]._union.op_mode = MIH_C_OPMODE_NORMAL_MODE;
}
//------------------------------------------------
// MIH_C_LINK_DESC_RSP_LIST_T
//------------------------------------------------
if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_CLASSES_OF_SERVICE_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
} else if (messageP->primitive.LinkDescriptorsRequest & MIH_C_BIT_NUMBER_OF_QUEUES_SUPPORTED) {
link_descriptors_response_list.val[link_index].choice = 1;
link_descriptors_response_list.val[link_index]._union.num_queue = PREDEFINED_QUEUES_SUPPORTED;
} else {
LOG_E(RAL_UE, "%s Invalid LinkDescriptorsRequest in MIH_C_Link_Get_Parameters_request\n", __FUNCTION__);
// DEFAULT VALUES
link_descriptors_response_list.val[link_index].choice = 0;
link_descriptors_response_list.val[link_index]._union.num_cos = PREDEFINED_CLASSES_SERVICE_SUPPORTED;
}
}
link_parameters_status_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_states_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
link_descriptors_response_list.length = messageP->primitive.LinkParametersRequest_list.length;
mRAL_send_get_parameters_confirm(instanceP,
&messageP->header.transaction_id,
&status,
&link_parameters_status_list,
&link_states_response_list,
&link_descriptors_response_list);
}
......@@ -34,28 +34,16 @@
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define MRAL_MODULE
#define LTE_RAL_UE
#define LTERALUE_PROCESS_C
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include "lteRALue_variables.h"
#include "lteRALue_proto.h"
#include "MIH_C.h"
#include "lteRALue_mih_msg.h"
#include "lteRALue_mih_execute.h"
// for real-time
#include "nas_ue_ioctl.h"
#include "nasmt_constant.h"
// for dummy
//#include "nas_ue_netlink.h"
//global variables
extern int meas_counter;
extern int s_nas;
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/*
//---------------------------------------------------------------------------
// Temp - Enter hard-coded measures in IAL
void IAL_NAS_measures_init(void){
......@@ -187,7 +175,7 @@ void rallte_NAS_measures_polling(void){
MIH_C_3GPP_ADDR_set(&link_identifier.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
mRALlte_send_link_down_indication(&transaction_id, &link_identifier, NULL, &down_reason_code);
mRAL_send_link_down_indication(&transaction_id, &link_identifier, NULL, &down_reason_code);
ralpriv->link_to_be_detected = MIH_C_BOOLEAN_TRUE;
// warning may be repeated several times
......@@ -208,7 +196,7 @@ void rallte_NAS_measures_polling(void){
time_interval = (MIH_C_UNSIGNED_INT2_T)0; // unknown
going_down_reason_code = MIH_C_LINK_GOING_DOWN_REASON_LINK_PARAMETER_DEGRADING;
//
mRALlte_send_link_going_down_indication(&transaction_id, &link_identifier, &time_interval, &going_down_reason_code);
mRAL_send_link_going_down_indication(&transaction_id, &link_identifier, &time_interval, &going_down_reason_code);
} else
if ((ralpriv->link_to_be_detected == MIH_C_BOOLEAN_TRUE) &&
......@@ -240,11 +228,11 @@ void rallte_NAS_measures_polling(void){
MIH_C_BIT_NET_CAPS_QOS_CLASS1 |
MIH_C_BIT_NET_CAPS_INTERNET_ACCESS;
//
mRALlte_send_link_detected_indication(&transaction_id, &link_detected_info);
mRAL_send_link_detected_indication(&transaction_id, &link_detected_info);
ralpriv->link_to_be_detected = MIH_C_BOOLEAN_FALSE;
}
// LG: TO DO CHECK IF INDEX IS 0
mRALlte_check_thresholds_signal_strength(ralpriv->integrated_meas_level[0], ralpriv->prev_integrated_meas_level[0]);
mRAL_check_thresholds_signal_strength(ralpriv->integrated_meas_level[0], ralpriv->prev_integrated_meas_level[0]);
}
//---------------------------------------------------------------------------
......@@ -291,16 +279,16 @@ void rallte_verifyPendingConnection(void){
if (ralpriv->pending_req_flag > 100){
ralpriv->pending_req_ac_result = MIH_C_LINK_AC_RESULT_FAILURE;
}
mRALlte_send_link_action_confirm(&ralpriv->pending_req_transaction_id, &ralpriv->pending_req_status, NULL, &ralpriv->pending_req_ac_result);
mRAL_send_link_action_confirm(&ralpriv->pending_req_transaction_id, &ralpriv->pending_req_status, NULL, &ralpriv->pending_req_ac_result);
////alternative : send linkup
//link_identifier.link_id.link_type = MIH_C_WIRELESS_UMTS;
//link_identifier.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
//MIH_C_3GPP_ADDR_set(&link_identifier.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
//link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
//mRAL_send_link_up_indication(&ralpriv->pending_req_transaction_id, &link_identifier, NULL, NULL, NULL, NULL);
/*
//alternative : send linkup
link_identifier.link_id.link_type = MIH_C_WIRELESS_UMTS;
link_identifier.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
MIH_C_3GPP_ADDR_set(&link_identifier.link_id.link_addr._union._3gpp_addr, (u_int8_t*)&(ralpriv->ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
link_identifier.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
mRALlte_send_link_up_indication(&ralpriv->pending_req_transaction_id, &link_identifier, NULL, NULL, NULL, NULL);
*/
DEBUG("After response, Pending Req Flag = %d, cell_id = %d\n", ralpriv->pending_req_flag, ralpriv->cell_id);
ralpriv->pending_req_flag = 0;
......@@ -309,4 +297,4 @@ void rallte_verifyPendingConnection(void){
//mRALte_send_link_up_indication();
}
}
}
}*/
/*****************************************************************************
* Eurecom OpenAirInterface 3
* Copyright(c) 2012 Eurecom
*
* Source mRAL_subscribe.c
*
* Version 0.1
*
* Date 11/27/2013
*
* Product MIH RAL LTE
*
* Subsystem
*
* Authors Lionel Gauthier
*
* Description
*
*****************************************************************************/
#define LTE_RAL_UE
#define LTE_RAL_UE_RRC_MSG_C
#include "lteRALue.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);
memcpy(euiP + 5, ue_idP + 3, 3);
euiP[3] = 0xFF;
euiP[4] = 0xFE;
euiP[0] ^= 2;
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_DET_INFO_T link_det_info;
// link id
link_det_info.link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE;
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;
// 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.choice = MIH_C_CHOICE_3GPP_3G_CELL_ID;
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;
MIH_C_NETWORK_ID_set(&link_det_info.network_id, (u_int8_t *)PREDEFINED_MIH_NETWORK_ID, strlen(PREDEFINED_MIH_NETWORK_ID));
MIH_C_NET_AUX_ID_set(&link_det_info.net_aux_id, (u_int8_t *)PREDEFINED_MIH_NETAUX_ID, strlen(PREDEFINED_MIH_NETAUX_ID));
link_det_info.sig_strength.choice = MIH_C_SIG_STRENGTH_CHOICE_DBM;
link_det_info.sig_strength._union.dbm = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).dbm;
link_det_info.sinr = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).sinr;
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.net_caps = g_ue_ral_obj[instanceP].net_caps;
mRAL_send_link_detected_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id, &link_det_info);
g_ue_ral_obj[instanceP].transaction_id ++;
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_TUPLE_ID_T link_tuple_id;
uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH];
uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH];
uint64_t ue_id; //EUI-64
int i;
// The LINK_ID contains the MN LINK_ADDR
link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE;
link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR;
memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH);
#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t"
ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id;
for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) {
ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF);
ue_id = ue_id >> 8;
}
ueid2eui48(mn_link_addr, ue_id_array);
MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8);
//The optional LINK_ADDR may contains a link address of PoA.
link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id,
&link_tuple_id,
NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address.
NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address.
NULL, //MIH_C_IP_RENEWAL_FLAG_T *flagP, (Optional) Indicates whether the MN needs to change IP Address in the new PoA.
NULL); //MIH_C_IP_MOB_MGMT_T *mobil_mngtP, (Optional) Indicates the type of Mobility Management Protocol supported by the new PoA.
g_ue_ral_obj[instanceP].transaction_id ++;
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_LINK_TUPLE_ID_T link_tuple_id;
uint8_t ue_id_array[MIH_C_3GPP_ADDR_LENGTH];
uint8_t mn_link_addr[MIH_C_3GPP_ADDR_LENGTH];
uint64_t ue_id; //EUI-64
int i;
// The LINK_ID contains the MN LINK_ADDR
link_tuple_id.link_id.link_type = MIH_C_WIRELESS_LTE;
link_tuple_id.link_id.link_addr.choice = MIH_C_CHOICE_3GPP_ADDR;
memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH);
#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t"
ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id;
for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) {
ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF);
ue_id = ue_id >> 8;
}
ueid2eui48(mn_link_addr, ue_id_array);
MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8);
//The optional LINK_ADDR may contains a link address of PoA.
link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
LOG_D(RAL_UE, "RRC_RAL_CONNECTION_ESTABLISHMENT_IND num srb %d num drb %d\n", RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb,RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb);
if ((RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb > 0) && (RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb > 0)) {
mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id,
&link_tuple_id,
NULL, //MIH_C_LINK_ADDR_T *old_arP,(Optional) Old Access Router link address.
NULL, //MIH_C_LINK_ADDR_T *new_arP,(Optional) New Access Router link address.
NULL, //MIH_C_IP_RENEWAL_FLAG_T *flagP, (Optional) Indicates whether the MN needs to change IP Address in the new PoA.
NULL); //MIH_C_IP_MOB_MGMT_T *mobil_mngtP, (Optional) Indicates the type of Mobility Management Protocol supported by the new PoA.
} else {
MIH_C_LINK_DN_REASON_T reason_code = MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT;
mRAL_send_link_down_indication(instanceP, &g_ue_ral_obj[instanceP].transaction_id,
&link_tuple_id,
NULL,
&reason_code);
}
g_ue_ral_obj[instanceP].transaction_id ++;}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
/***************************************************************************
ltmRALue_subscribe.c - description
***************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
/*! \file ltmRALue_subscribe.c
* \brief
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
* \date 2013
* \company EURECOM
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define LTE_RAL_UE
#define LTERALUE_SUBSCRIBE_C
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************
** **
** Name: mRAL_subscribe_request() **
** **
** Description: Subscribes the MIH-F to receive specified link event **
** indications and sends Link Event Subscribe confirmation **
** to the MIH-F. **
** **
** Inputs: msgP: Pointer to the received MIH message **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: ralpriv **
** **
***************************************************************************/
void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
/* Check whether the action request is supported */
if (g_ue_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE)
{
MIH_C_LINK_EVENT_LIST_T mih_subscribed_req_event_list;
g_ue_ral_obj[instanceP].mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[instanceP].mih_supported_link_event_list);
mih_subscribed_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList;
status = MIH_C_STATUS_SUCCESS;
mRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
&mih_subscribed_req_event_list);
}
else
{
mRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL);
}
}
/****************************************************************************
** **
** Name: mRAL_unsubscribe_request() **
** **
** Description: Unsubscribes the MIH-F to receive specified link event **
** indications and sends Link Event Unsubscribe confirmation **
** to the MIH-F. **
** **
** Inputs: msgP: Pointer to the received MIH message **
** Others: None **
** **
** Outputs: None **
** Return: None **
** Others: ralpriv **
** **
***************************************************************************/
void mRAL_unsubscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP)
{
MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
/* Check whether the action request is supported */
if (g_ue_ral_obj[instanceP].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE)
{
MIH_C_LINK_EVENT_LIST_T mih_unsubscribed_req_event_list;
MIH_C_LINK_EVENT_LIST_T saved_req_event_list;
saved_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list;
g_ue_ral_obj[instanceP].mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[instanceP].mih_supported_link_event_list);
mih_unsubscribed_req_event_list = g_ue_ral_obj[instanceP].mih_subscribe_req_event_list ^ saved_req_event_list;
status = MIH_C_STATUS_SUCCESS;
mRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
&mih_unsubscribed_req_event_list);
}
else
{
mRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
&status,
NULL);
}
}
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
/***************************************************************************
ltmRALue_thresholds.c - description
***************************************************************************
Eurecom OpenAirInterface 3
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : Eurecom, 450 route des Chappes, 06410 Biot Sophia Antipolis, France
*******************************************************************************/
/*! \file ltmRALue_thresholds.c
* \brief
* \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
* \date 2013
* \company EURECOM
* \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
*/
/*******************************************************************************/
#define LTE_RAL_UE
#define LTERALUE_THRESHOLDS_C
//-----------------------------------------------------------------------------
#include "lteRALue.h"
/****************************************************************************
** **
** Name: mRAL_configure_thresholds_request() **
** **
** Description: Forwards the Link_Configure_Thresholds.request message **
** to the RRC layer. **
** **
** Inputs: msgP: Pointer to the received message **
** Others: **
** **
** Outputs: None **
** Return: None **
** Others: None **
** **
***************************************************************************/
void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Configure_Thresholds_request_t* msgP)
{
unsigned int index;
unsigned int th_index;
rrc_ral_configure_threshold_req_t configure_threshold_req;
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RAL_UE, RRC_RAL_CONFIGURE_THRESHOLD_REQ);
memset(&configure_threshold_req, 0, sizeof(rrc_ral_configure_threshold_req_t));
// copy transaction id
configure_threshold_req.transaction_id = msgP->header.transaction_id;
// configure_threshold_req.num_link_cfg_params = 0; // done
for (index = 0; index < msgP->primitive.LinkConfigureParameterList_list.length; index++) {
// copy link_param_type
configure_threshold_req.link_cfg_params[index].link_param_type.choice = msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type.choice;
switch (configure_threshold_req.link_cfg_params[index].link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_gen,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_gen,
sizeof(ral_link_param_gen_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_qos,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_qos,
sizeof(ral_link_param_qos_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_lte,
&msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_lte,
sizeof(ral_link_param_lte_t));
break;
default:
assert(1==0);
}
configure_threshold_req.num_link_cfg_params += 1;
// copy choice
configure_threshold_req.link_cfg_params[index].union_choice = msgP->primitive.LinkConfigureParameterList_list.val[index].choice;
// copy _union
switch (configure_threshold_req.link_cfg_params[index].union_choice) {
case RAL_LINK_CFG_PARAM_CHOICE_TIMER_NULL:
configure_threshold_req.link_cfg_params[index]._union.null_attr = 0;
break;
case RAL_LINK_CFG_PARAM_CHOICE_TIMER:
configure_threshold_req.link_cfg_params[index]._union.timer_interval = msgP->primitive.LinkConfigureParameterList_list.val[index]._union.timer_interval;
default:
assert(1==0);
}
// copy th_action
configure_threshold_req.link_cfg_params[index].th_action = msgP->primitive.LinkConfigureParameterList_list.val[index].th_action;
// configure_threshold_req.link_cfg_params[index].num_thresholds = 0; // done
for (th_index = 0; th_index < msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.length;th_index++) {
configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_val = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_val;
configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_xdir = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_xdir;
configure_threshold_req.link_cfg_params[index].num_thresholds += 1;
}
}
memcpy (&message_p->ittiMsg, (void *) &configure_threshold_req, sizeof(rrc_ral_configure_threshold_req_t));
itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_configure_threshold_conf(ral_ue_instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
MIH_C_STATUS_T status;
// This parameter is not included if Status does not indicate “Success.”
MIH_C_LINK_CFG_STATUS_LIST_T link_cfg_status_list;
unsigned int i;
status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).status;
if (status == RAL_STATUS_SUCCESS) {
link_cfg_status_list.length = 0;
for (i = 0; i < RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).num_link_cfg_params; i++) {
link_cfg_status_list.val[i].link_param_type.choice = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type.choice;
switch (link_cfg_status_list.val[i].link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_gen,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_gen,
sizeof(ral_link_param_gen_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_QOS:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_qos,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_qos,
sizeof(ral_link_param_qos_t));
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_lte,
&RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_lte,
sizeof(ral_link_param_lte_t));
break;
default:
assert(1==0);
}
link_cfg_status_list.val[i].threshold.threshold_val = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_val;
link_cfg_status_list.val[i].threshold.threshold_xdir = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_xdir;
link_cfg_status_list.val[i].config_status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].config_status;
link_cfg_status_list.length += 1;
}
mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, &link_cfg_status_list);
} else {
mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, NULL);
}
}
//---------------------------------------------------------------------------------------------------------------------
void mRAL_rx_rrc_ral_measurement_report_indication(ral_ue_instance_t instance, MessageDef *msg_p)
//---------------------------------------------------------------------------------------------------------------------
{
}
......@@ -1241,7 +1241,7 @@ void eRALlte_send_link_action_confirm(MIH_C_TRANSACTION_ID_T *tidP,
** Others: g_sockd_mihf **
** **
***************************************************************************/
int eRALlte_mihf_connect(void)
int eRALlte_mihf_connect(ral_enb_instance_t instanceP)
{
struct addrinfo info; /* endpoint information */
struct addrinfo *addr, *rp; /* endpoint address */
......@@ -1259,7 +1259,7 @@ int eRALlte_mihf_connect(void)
info.ai_flags = 0;
info.ai_protocol = 0; /* Any protocol */
rc = getaddrinfo(g_mihf_ip_address, g_mihf_remote_port, &info, &addr);
rc = getaddrinfo(g_enb_ral_obj[instanceP].mihf_ip_address, g_enb_ral_obj[instanceP].mihf_remote_port, &info, &addr);
if (rc != 0) {
ERR(" getaddrinfo: %s\n", gai_strerror(rc));
return -1;
......@@ -1271,91 +1271,78 @@ int eRALlte_mihf_connect(void)
* (or connect(2)) fails, we (close the socket and) try the next address.
*/
for (rp = addr; rp != NULL; rp = rp->ai_next) {
g_sockd_mihf = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_sockd_mihf < 0) {
g_enb_ral_obj[instance].mih_sock_desc = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (g_enb_ral_obj[instance].mih_sock_desc < 0) {
continue;
}
optval = 1;
setsockopt(g_sockd_mihf, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
setsockopt(g_enb_ral_obj[instance].mih_sock_desc, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
// Convert the RAL local network address
/*
* Convert the RAL local network address
*/
if (rp->ai_family == AF_INET) {
/* IPv4 network address family */
struct sockaddr_in *addr4 = NULL;
DEBUG(" %s is an ipv4 address\n", g_mihf_ip_address);
DEBUG(" %s is an ipv4 address\n", g_enb_ral_obj[instanceP].mihf_ip_address);
addr4 = (struct sockaddr_in *)(&buf[0]);
addr4->sin_port = htons(atoi(g_ral_listening_port_for_mihf));
addr4->sin_port = htons(atoi(g_enb_ral_obj[instanceP].ral_listening_port));
addr4->sin_family = AF_INET;
rc = inet_pton(AF_INET, g_ral_ip_address, &addr4->sin_addr);
}
else if (rp->ai_family == AF_INET6) {
rc = inet_pton(AF_INET, g_enb_ral_obj[instanceP].ral_ip_address, &addr4->sin_addr);
} else if (rp->ai_family == AF_INET6) {
/* IPv6 network address family */
struct sockaddr_in6 *addr6 = NULL;
DEBUG(" %s is an ipv6 address\n", g_mihf_ip_address);
DEBUG(" %s is an ipv6 address\n", g_enb_ral_obj[instanceP].mihf_ip_address);
addr6 = (struct sockaddr_in6 *)(&buf[0]);
addr6->sin6_port = htons(atoi(g_ral_listening_port_for_mihf));
addr6->sin6_port = htons(atoi(g_enb_ral_obj[instanceP].ral_listening_port));
addr6->sin6_family = AF_INET6;
rc = inet_pton(AF_INET, g_ral_ip_address, &addr6->sin6_addr);
}
else {
rc = inet_pton(AF_INET, g_enb_ral_obj[instanceP].ral_ip_address, &addr6->sin6_addr);
} else {
ERR(" %s is an unknown address format %d\n",
g_mihf_ip_address, rp->ai_family);
g_enb_ral_obj[instanceP].mihf_ip_address, rp->ai_family);
return -1;
}
if (rc < 0) {
/* The network address convertion failed */
// The network address convertion failed
ERR(" inet_pton(RAL IP address %s): %s\n",
g_ral_ip_address, strerror(rc));
g_enb_ral_obj[instanceP].ral_ip_address, strerror(rc));
return -1;
}
else if (rc == 0) {
/* The network address is not valid */
ERR(" RAL IP address %s is not valid\n", g_ral_ip_address);
} else if (rc == 0) {
// The network address is not valid
ERR(" RAL IP address %s is not valid\n", g_enb_ral_obj[instanceP].ral_ip_address);
return -1;
}
/* Bind the socket to the local RAL network address */
rc = bind(g_sockd_mihf, (const struct sockaddr *)buf,
// Bind the socket to the local RAL network address */
rc = bind(g_enb_ral_obj[instance].mih_sock_desc, (const struct sockaddr *)buf,
sizeof(struct sockaddr_in));
if (rc < 0) {
ERR(" bind(RAL IP address %s): %s\n",
g_ral_ip_address, strerror(errno));
ERR(" bind(RAL IP address %s): %s\n", g_enb_ral_obj[instanceP].ral_ip_address, strerror(errno));
return -1;
}
/* Connect the socket to the remote MIH-F network address */
if (connect(g_sockd_mihf, rp->ai_addr, rp->ai_addrlen) == 0) {
// Connect the socket to the remote MIH-F network address
if (connect(g_enb_ral_obj[instance].mih_sock_desc, rp->ai_addr, rp->ai_addrlen) == 0) {
NOTICE(" RAL [%s:%s] is now UDP-CONNECTED to MIH-F [%s:%s]\n",
g_ral_ip_address, g_ral_listening_port_for_mihf,
g_mihf_ip_address, g_mihf_remote_port);
g_enb_ral_obj[instanceP].ral_ip_address, g_enb_ral_obj[instanceP].ral_listening_port,
g_enb_ral_obj[instanceP].mihf_ip_address, g_enb_ral_obj[instanceP].mihf_remote_port);
break;
}
/*
* We failed to connect:
* Close the socket file descriptor and try to connect to an other
* address.
*/
close(g_sockd_mihf);
// We failed to connect:
// Close the socket file descriptor and try to connect to an other address.
close(g_enb_ral_obj[instanceP].mih_sock_desc);
}
/*
* Unable to connect to a network address
*/
// Unable to connect to a network address
if (rp == NULL) {
ERR(" Could not connect to MIH-F\n");
return -1;
}
freeaddrinfo(addr);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment