Commit df60cb90 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/x2' into develop_integration_2018_w39

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parents 85b5d94c e8a1fb5f
......@@ -474,12 +474,12 @@ include_directories ("${X2AP_DIR}")
add_library(X2AP_ENB
${X2AP_DIR}/x2ap_eNB.c
# ${X2AP_DIR}/x2ap_eNB_decoder.c
# ${X2AP_DIR}/x2ap_eNB_encoder.c
${X2AP_DIR}/x2ap_eNB_decoder.c
${X2AP_DIR}/x2ap_eNB_encoder.c
${X2AP_DIR}/x2ap_eNB_handler.c
# ${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_management_procedures.c
# ${X2AP_DIR}/x2ap_eNB_generate_messages.c
${X2AP_DIR}/x2ap_eNB_generate_messages.c
)
# Hardware dependant options
......
......@@ -63,6 +63,8 @@ typedef enum {
MSC_S6A_MME,
MSC_HSS,
MAX_MSC_PROTOS,
MSC_X2AP_SRC_ENB,
MSC_X2AP_TARGET_ENB,
} msc_proto_t;
......
......@@ -63,17 +63,21 @@ typedef struct x2ap_register_enb_req_s {
uint8_t mnc_digit_length;
/*
* EARFCN
* CC Params
*/
uint16_t fdd_uL_EARFCN;
uint16_t fdd_dL_EARFCN;
uint16_t tdd_EARFCN;
uint16_t fdd_uL_Transmission_Bandwidth;
uint16_t fdd_dL_Transmission_Bandwidth;
uint16_t tdd_Transmission_Bandwidth;
int16_t eutra_band[MAX_NUM_CCs];
uint32_t downlink_frequency[MAX_NUM_CCs];
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
/* To be considered for TDD */
//uint16_t tdd_EARFCN;
//uint16_t tdd_Transmission_Bandwidth;
/* The local eNB IP address to bind */
net_ip_address_t enb_x2_ip_address;
......
......@@ -65,6 +65,8 @@ extern void set_parallel_conf(char* parallel_conf);
extern void set_worker_conf(char* worker_conf);
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void);
extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw);
extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw);
void RCconfig_flexran() {
uint16_t i;
......@@ -2172,7 +2174,7 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) {
}
int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
int j, k, l;
int I, J, j, k, l;
int enb_id;
char *address = NULL;
char *cidr = NULL;
......@@ -2181,7 +2183,89 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};
/* get global parameters, defined outside any section in the config file */
config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
/*#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
/* define CC params */
int32_t Nid_cell = 0;
char *frame_type, *prefix_type, *pbch_repetition, *prach_high_speed,
*pusch_hoppingMode, *pusch_enable64QAM, *pusch_groupHoppingEnabled,
*pusch_sequenceHoppingEnabled, *phich_duration, *phich_resource,
*srs_enable, *srs_ackNackST, *srs_MaxUpPts, *pusch_alpha,
*pucch_deltaF_Format1, *pucch_deltaF_Format1b, *pucch_deltaF_Format2,
*pucch_deltaF_Format2a, *pucch_deltaF_Format2b,
*rach_preamblesGroupAConfig, *rach_messagePowerOffsetGroupB, *pcch_nB;
long long int downlink_frequency;
int32_t tdd_config, tdd_config_s, eutra_band, uplink_frequency_offset,
Nid_cell_mbsfn, N_RB_DL, nb_antenna_ports, prach_root, prach_config_index,
prach_zero_correlation, prach_freq_offset, pucch_delta_shift,
pucch_nRB_CQI, pucch_nCS_AN, pucch_n1_AN, pdsch_referenceSignalPower,
pdsch_p_b, pusch_n_SB, pusch_hoppingOffset, pusch_groupAssignment,
pusch_nDMRS1, srs_BandwidthConfig, srs_SubframeConfig, pusch_p0_Nominal,
pucch_p0_Nominal, msg3_delta_Preamble, rach_numberOfRA_Preambles,
rach_sizeOfRA_PreamblesGroupA, rach_messageSizeGroupA,
rach_powerRampingStep, rach_preambleInitialReceivedTargetPower,
rach_preambleTransMax, rach_raResponseWindowSize,
rach_macContentionResolutionTimer, rach_maxHARQ_Msg3Tx,
pcch_defaultPagingCycle, bcch_modificationPeriodCoeff,
ue_TimersAndConstants_t300, ue_TimersAndConstants_t301,
ue_TimersAndConstants_t310, ue_TimersAndConstants_t311,
ue_TimersAndConstants_n310, ue_TimersAndConstants_n311,
ue_TransmissionMode, ue_multiple_max;
const char* rxPool_sc_CP_Len;
const char* rxPool_sc_Period;
const char* rxPool_data_CP_Len;
libconfig_int rxPool_ResourceConfig_prb_Num;
libconfig_int rxPool_ResourceConfig_prb_Start;
libconfig_int rxPool_ResourceConfig_prb_End;
const char* rxPool_ResourceConfig_offsetIndicator_present;
libconfig_int rxPool_ResourceConfig_offsetIndicator_choice;
const char* rxPool_ResourceConfig_subframeBitmap_present;
char* rxPool_ResourceConfig_subframeBitmap_choice_bs_buf;
libconfig_int rxPool_ResourceConfig_subframeBitmap_choice_bs_size;
libconfig_int rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
//SIB19
//for discRxPool
const char* discRxPool_cp_Len;
const char* discRxPool_discPeriod;
libconfig_int discRxPool_numRetx;
libconfig_int discRxPool_numRepetition;
libconfig_int discRxPool_ResourceConfig_prb_Num;
libconfig_int discRxPool_ResourceConfig_prb_Start;
libconfig_int discRxPool_ResourceConfig_prb_End;
const char* discRxPool_ResourceConfig_offsetIndicator_present;
libconfig_int discRxPool_ResourceConfig_offsetIndicator_choice;
const char* discRxPool_ResourceConfig_subframeBitmap_present;
char* discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf;
libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_size;
libconfig_int discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
//for discRxPoolPS
const char* discRxPoolPS_cp_Len;
const char* discRxPoolPS_discPeriod;
libconfig_int discRxPoolPS_numRetx;
libconfig_int discRxPoolPS_numRepetition;
libconfig_int discRxPoolPS_ResourceConfig_prb_Num;
libconfig_int discRxPoolPS_ResourceConfig_prb_Start;
libconfig_int discRxPoolPS_ResourceConfig_prb_End;
const char* discRxPoolPS_ResourceConfig_offsetIndicator_present;
libconfig_int discRxPoolPS_ResourceConfig_offsetIndicator_choice;
const char* discRxPoolPS_ResourceConfig_subframeBitmap_present;
char* discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf;
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size;
libconfig_int discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
paramdef_t CCsParams[] = CCPARAMS_DESC;
paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
/* map parameter checking array instances to parameter definition array instances */
for (I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
CCsParams[I].chkPptr = &(config_check_CCparams[I]);
}
/*#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
asn_debug = 0;
asn1_xer_print = 0;
......@@ -2195,7 +2279,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
asn_debug = 0;
asn1_xer_print = 0;
}
#endif */
#endif */
AssertFatal(i < ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt,
"Failed to parse config file %s, %uth attribute %s \n",
RC.config_file_name, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
......@@ -2226,7 +2311,9 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
paramlist_def_t X2ParamList = {ENB_CONFIG_STRING_TARGET_ENB_X2_IP_ADDRESS,NULL,0};
paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
paramdef_t NETParams[] = NETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
/* TODO: fix the size - if set lower we have a crash (MAX_OPTNAME_SIZE was 64 when this code was written) */
/* this is most probably a problem with the config module */
char aprefix[MAX_OPTNAME_SIZE*80 + 8];
/* Some default/random parameters */
X2AP_REGISTER_ENB_REQ (msg_p).eNB_id = enb_id;
......@@ -2249,6 +2336,56 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
(X2AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length == 3),
"BAD MNC DIGIT LENGTH %d",
X2AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length);
/* CC params */
sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k);
config_getlist(&CCsParamList, NULL, 0, aprefix);
X2AP_REGISTER_ENB_REQ (msg_p).num_cc = CCsParamList.numelt;
if (CCsParamList.numelt > 0) {
//char ccspath[MAX_OPTNAME_SIZE*2 + 16];
for (J = 0; J < CCsParamList.numelt ; J++) {
sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, k, ENB_CONFIG_STRING_COMPONENT_CARRIERS, J);
config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
X2AP_REGISTER_ENB_REQ (msg_p).eutra_band[J] = eutra_band;
X2AP_REGISTER_ENB_REQ (msg_p).downlink_frequency[J] = (uint32_t) downlink_frequency;
X2AP_REGISTER_ENB_REQ (msg_p).uplink_frequency_offset[J] = (unsigned int) uplink_frequency_offset;
X2AP_REGISTER_ENB_REQ (msg_p).Nid_cell[J]= Nid_cell;
if (Nid_cell>503) {
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n",
RC.config_file_name, k, Nid_cell);
}
X2AP_REGISTER_ENB_REQ (msg_p).N_RB_DL[J]= N_RB_DL;
if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) {
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n",
RC.config_file_name, k, N_RB_DL);
}
if (strcmp(frame_type, "FDD") == 0) {
X2AP_REGISTER_ENB_REQ (msg_p).frame_type[J] = FDD;
} else if (strcmp(frame_type, "TDD") == 0) {
X2AP_REGISTER_ENB_REQ (msg_p).frame_type[J] = TDD;
} else {
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n",
RC.config_file_name, k, frame_type);
}
X2AP_REGISTER_ENB_REQ (msg_p).fdd_earfcn_DL[J] = to_earfcn_DL(eutra_band, downlink_frequency, N_RB_DL);
X2AP_REGISTER_ENB_REQ (msg_p).fdd_earfcn_UL[J] = to_earfcn_UL(eutra_band, downlink_frequency + uplink_frequency_offset, N_RB_DL);
}
}
sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
config_getlist( &X2ParamList,X2Params,sizeof(X2Params)/sizeof(paramdef_t),aprefix);
......
......@@ -160,6 +160,58 @@ uint32_t to_earfcn(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw)
(eutra_bandtable[i].N_OFFs_DL / 10));
}
uint32_t to_earfcn_DL(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw)
{
uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000;
int bw_by_100 = bw / 100;
int i;
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
AssertFatal(dl_CarrierFreq_by_100k >= eutra_bandtable[i].dl_min,
"Band %d, bw %u : DL carrier frequency %lld Hz < %u\n",
eutra_bandP, bw, dl_CarrierFreq,
eutra_bandtable[i].dl_min);
AssertFatal(dl_CarrierFreq_by_100k <=
(eutra_bandtable[i].dl_max - bw_by_100),
"Band %d, bw %u : DL carrier frequency %lld Hz > %d\n",
eutra_bandP, bw, dl_CarrierFreq,
eutra_bandtable[i].dl_max - bw_by_100);
return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min +
(eutra_bandtable[i].N_OFFs_DL / 10));
}
uint32_t to_earfcn_UL(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw)
{
uint32_t ul_CarrierFreq_by_100k = ul_CarrierFreq / 100000;
int bw_by_100 = bw / 100;
int i;
AssertFatal(eutra_bandP < 69, "eutra_band %d > 68\n", eutra_bandP);
for (i = 0; i < 69 && eutra_bandtable[i].band != eutra_bandP; i++);
AssertFatal(ul_CarrierFreq_by_100k >= eutra_bandtable[i].ul_min,
"Band %d, bw %u : UL carrier frequency %lld Hz < %u\n",
eutra_bandP, bw, ul_CarrierFreq,
eutra_bandtable[i].ul_min);
AssertFatal(ul_CarrierFreq_by_100k <=
(eutra_bandtable[i].ul_max - bw_by_100),
"Band %d, bw %u : UL carrier frequency %lld Hz > %d\n",
eutra_bandP, bw, ul_CarrierFreq,
eutra_bandtable[i].ul_max - bw_by_100);
return (ul_CarrierFreq_by_100k - eutra_bandtable[i].ul_min +
((eutra_bandtable[i].N_OFFs_DL + 180000) / 10));
}
uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn)
{
......
......@@ -28,12 +28,12 @@
#include "X2AP_InitiatingMessage.h"
#include "X2AP_SuccessfulOutcome.h"
#include "X2AP_UnsuccessfulOutcome.h"
#include "X2AP_ProtocolIE-Field.h"
#include "X2AP_ProtocolIE-FieldPair.h"
#include "X2AP_ProtocolIE-ContainerPair.h"
#include "X2AP_ProtocolExtensionField.h"
#include "X2AP_ProtocolExtensionContainer.h"
#include "X2AP_asn_constant.h"
#include "intertask_interface.h"
#ifndef X2AP_COMMON_H_
#define X2AP_COMMON_H_
......@@ -87,15 +87,13 @@ extern int asn1_xer_print;
if (mandatory) DevAssert(ie != NULL); \
} while(0)
//Forward declaration
struct x2ap_message_s;
/** \brief Function callback prototype.
**/
typedef int (*x2ap_message_decoded_callback)(
instance_t instance,
uint32_t assocId,
uint32_t stream,
struct x2ap_message_s *message);
X2AP_X2AP_PDU_t *pdu);
/** \brief Encode a successfull outcome message
\param buffer pointer to buffer in which data will be encoded
......
......@@ -31,6 +31,7 @@
#include "x2ap_eNB_defs.h"
#include "x2ap_eNB_management_procedures.h"
#include "x2ap_eNB_handler.h"
#include "x2ap_eNB_generate_messages.h"
#include "x2ap_common.h"
#include "queue.h"
......@@ -42,9 +43,9 @@ struct x2ap_eNB_data_s;
RB_PROTOTYPE(x2ap_enb_map, x2ap_eNB_data_s, entry, x2ap_eNB_compare_assoc_id);
//static
//void x2ap_eNB_handle_sctp_data_ind(instance_t instance,
// sctp_data_ind_t *sctp_data_ind);
static
void x2ap_eNB_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind);
static
void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
......@@ -63,22 +64,21 @@ void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
uint32_t enb_port_for_X2C,
int multi_sd);
/*
static
void x2ap_eNB_handle_sctp_data_ind(instance_t instance,
sctp_data_ind_t *sctp_data_ind) {
void x2ap_eNB_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
int result;
DevAssert(sctp_data_ind != NULL);
x2ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
x2ap_eNB_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}*/
}
static
void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
......@@ -143,7 +143,7 @@ printf("x2ap_eNB_handle_sctp_association_resp at 4\n");
dump_trees();
/* Prepare new x2 Setup Request */
//x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p);
x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p);
}
static
......@@ -325,6 +325,19 @@ void x2ap_eNB_handle_register_eNB(instance_t instance,
new_instance->mnc = x2ap_register_eNB->mnc;
new_instance->mnc_digit_length = x2ap_register_eNB->mnc_digit_length;
new_instance->num_cc = x2ap_register_eNB->num_cc;
for (int i = 0; i< x2ap_register_eNB->num_cc; i++){
new_instance->eutra_band[i] = x2ap_register_eNB->eutra_band[i];
new_instance->downlink_frequency[i] = x2ap_register_eNB->downlink_frequency[i];
new_instance->uplink_frequency_offset[i] = x2ap_register_eNB->uplink_frequency_offset[i];
new_instance->Nid_cell[i] = x2ap_register_eNB->Nid_cell[i];
new_instance->N_RB_DL[i] = x2ap_register_eNB->N_RB_DL[i];
new_instance->frame_type[i] = x2ap_register_eNB->frame_type[i];
new_instance->fdd_earfcn_DL[i] = x2ap_register_eNB->fdd_earfcn_DL[i];
new_instance->fdd_earfcn_UL[i] = x2ap_register_eNB->fdd_earfcn_UL[i];
}
DevCheck(x2ap_register_eNB->nb_x2 <= X2AP_MAX_NB_ENB_IP_ADDRESS,
X2AP_MAX_NB_ENB_IP_ADDRESS, x2ap_register_eNB->nb_x2, 0);
memcpy(new_instance->target_enb_x2_ip_address,
......@@ -432,8 +445,8 @@ void *x2ap_task(void *arg)
break;
case SCTP_DATA_IND:
//x2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// &received_msg->ittiMsg.sctp_data_ind);
x2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_data_ind);
break;
default:
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include "assertions.h"
#include "intertask_interface.h"
#include "x2ap_common.h"
#include "x2ap_eNB_decoder.h"
static int x2ap_eNB_decode_initiating_message(X2AP_X2AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case X2AP_ProcedureCode_id_x2Setup:
asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_X2AP_X2AP_PDU, pdu);
X2AP_INFO("x2ap_eNB_decode_initiating_message!\n");
break;
default:
X2AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
return -1;
}
return 0;
}
static int x2ap_eNB_decode_successful_outcome(X2AP_X2AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case X2AP_ProcedureCode_id_x2Setup:
asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_X2AP_X2AP_PDU, pdu);
X2AP_INFO("x2ap_eNB_decode_successfuloutcome_message!\n");
break;
default:
X2AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome.procedureCode);
return -1;
}
return 0;
}
static int x2ap_eNB_decode_unsuccessful_outcome(X2AP_X2AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case X2AP_ProcedureCode_id_x2Setup:
asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_X2AP_X2AP_PDU, pdu);
X2AP_INFO("x2ap_eNB_decode_unsuccessfuloutcome_message!\n");
break;
default:
X2AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
return -1;
}
return 0;
}
int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(buffer != NULL);
dec_ret = aper_decode(NULL,
&asn_DEF_X2AP_X2AP_PDU,
(void **)&pdu,
buffer,
length,
0,
0);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, pdu);
if (dec_ret.code != RC_OK) {
X2AP_ERROR("Failed to decode pdu\n");
return -1;
}
switch(pdu->present) {
case X2AP_X2AP_PDU_PR_initiatingMessage:
return x2ap_eNB_decode_initiating_message(pdu);
case X2AP_X2AP_PDU_PR_successfulOutcome:
return x2ap_eNB_decode_successful_outcome(pdu);
case X2AP_X2AP_PDU_PR_unsuccessfulOutcome:
return x2ap_eNB_decode_unsuccessful_outcome(pdu);
default:
X2AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef X2AP_ENB_DECODER_H_
#define X2AP_ENB_DECODER_H_
int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length)
__attribute__ ((warn_unused_result));
#endif /* X2AP_ENB_DECODER_H_ */
......@@ -151,6 +151,17 @@ typedef struct x2ap_eNB_instance_s {
uint16_t mnc;
uint8_t mnc_digit_length;
/* CC params */
int16_t eutra_band[MAX_NUM_CCs];
uint32_t downlink_frequency[MAX_NUM_CCs];
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
net_ip_address_t target_enb_x2_ip_address[X2AP_MAX_NB_ENB_IP_ADDRESS];
uint8_t nb_x2;
net_ip_address_t enb_x2_ip_address;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
#include "x2ap_common.h"
#include "x2ap_eNB_encoder.h"
int x2ap_eNB_encode_pdu(X2AP_X2AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
ssize_t encoded;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)pdu);
}
encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, pdu, (void **)buffer);
if (encoded < 0) {
return -1;
}
*len = encoded;
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_X2AP_X2AP_PDU, pdu);
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef X2AP_ENB_ENCODER_H_
#define X2AP_ENB_ENCODER_H_
int x2ap_eNB_encode_pdu(X2AP_X2AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result));
#endif /* X2AP_ENB_ENCODER_H_ */
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef X2AP_ENB_GENERATE_MESSAGES_H_
#define X2AP_ENB_GENERATE_MESSAGES_H_
#include "x2ap_eNB_defs.h"
#include "x2ap_common.h"
int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_data_t *x2ap_enb_data_p);
int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_data_t *x2ap_enb_data_p);
int x2ap_eNB_generate_x2_setup_failure(instance_t instance,
uint32_t assoc_id,
X2AP_Cause_PR cause_type,
long cause_value,
long time_to_wait);
int x2ap_eNB_set_cause (X2AP_Cause_t * cause_p,
X2AP_Cause_PR cause_type,
long cause_value);
#endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */
This diff is collapsed.
......@@ -24,10 +24,10 @@
#include "x2ap_eNB_defs.h"
void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *mme_desc_p, int sctp_shutdown);
void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown);
//int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
// const uint8_t * const data, const uint32_t data_length);
int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length);
#endif /* X2AP_ENB_HANDLERS_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "intertask_interface.h"
#include "x2ap_eNB_itti_messaging.h"
void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream)
{
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_X2AP, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id)
{
MessageDef *message_p = NULL;
sctp_close_association_t *sctp_close_association_p = NULL;
message_p = itti_alloc_new_message(TASK_X2AP, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
sctp_close_association_p->assoc_id = assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef X2AP_ENB_ITTI_MESSAGING_H_
#define X2AP_ENB_ITTI_MESSAGING_H_
void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id);
#endif /* X2AP_ENB_ITTI_MESSAGING_H_ */
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