Merge remote-tracking branch 'origin/noCore' into integration_2020_wk45_2
Conflicts: openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
This commit is contained in:
@@ -56,6 +56,8 @@
|
||||
#include "flexran.pb-c.h"
|
||||
#include "flexran_agent_mac.h"
|
||||
#include <dlfcn.h>
|
||||
#include <openair2/LAYER2/MAC/mac.h>
|
||||
|
||||
|
||||
#include "T.h"
|
||||
|
||||
|
||||
@@ -3900,7 +3900,6 @@ void nr_ue_send_sdu(module_id_t module_idP,
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
for (i = 0; i < 32; i++) {
|
||||
@@ -3908,7 +3907,6 @@ void nr_ue_send_sdu(module_id_t module_idP,
|
||||
}
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
*/
|
||||
|
||||
// Processing MAC PDU
|
||||
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
|
||||
@@ -4563,6 +4561,7 @@ void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||
//#endif
|
||||
|
||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
|
||||
switch(rx_lcid){
|
||||
// MAC CE
|
||||
|
||||
|
||||
@@ -444,8 +444,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot);
|
||||
}
|
||||
|
||||
|
||||
if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
|
||||
|
||||
|
||||
// This schedules MIB
|
||||
schedule_nr_mib(module_idP, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]);
|
||||
|
||||
@@ -466,24 +468,30 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
if (get_softmodem_params()->phy_test == 0) {
|
||||
nr_schedule_RA(module_idP, frame, slot);
|
||||
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
|
||||
|
||||
}
|
||||
|
||||
// This schedules the DCI for Uplink and subsequently PUSCH
|
||||
|
||||
// The decision about whether to schedule is done for each UE independently
|
||||
// inside
|
||||
if (UE_info->active[UE_id] && slot < 10) {
|
||||
|
||||
int tda = 1; // time domain assignment hardcoded for now
|
||||
schedule_fapi_ul_pdu(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, tda, ulsch_in_slot_bitmap);
|
||||
nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot);
|
||||
}
|
||||
|
||||
|
||||
if (UE_info->active[UE_id]
|
||||
&& (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd))
|
||||
&& slot < 10) {
|
||||
|
||||
ue_sched_ctl->current_harq_pid = slot % num_slots_per_tdd;
|
||||
nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd);
|
||||
}
|
||||
|
||||
|
||||
if (UE_info->active[UE_id])
|
||||
nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot);
|
||||
|
||||
|
||||
@@ -438,9 +438,11 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pr_found) {
|
||||
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
|
||||
module_idP, preamble_index);
|
||||
|
||||
return; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc
|
||||
}
|
||||
// This should be handled differently when we use the initialBWP for RA
|
||||
|
||||
@@ -202,8 +202,12 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP,
|
||||
}
|
||||
}
|
||||
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) {
|
||||
|
||||
void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
|
||||
//----------------------------------------
|
||||
}
|
||||
|
||||
void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) {
|
||||
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||
for (int rb = 0; rb < 20; rb++)
|
||||
vrb_map[rbStart + rb] = 1;
|
||||
|
||||
@@ -1830,6 +1830,7 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti)
|
||||
|
||||
/* UE found, remove it */
|
||||
UE_id = i;
|
||||
|
||||
UE_info->num_UEs--;
|
||||
UE_info->active[UE_id] = FALSE;
|
||||
UE_info->rnti[UE_id] = 0;
|
||||
|
||||
@@ -214,12 +214,8 @@ void nr_process_mac_pdu(
|
||||
int UE_id = find_nr_UE_id(module_idP, rnti);
|
||||
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||
log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
if(IS_SOFTMODEM_NOS1){
|
||||
mac_rlc_data_ind(module_idP,
|
||||
@@ -355,6 +351,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||
|
||||
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
||||
for (int i = 0; i < sdu_lenP ; i++) {
|
||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||
@@ -362,6 +359,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
printf("%02x ",(unsigned char)sduP[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
#endif
|
||||
|
||||
if (sduP != NULL){
|
||||
@@ -420,4 +418,5 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "NR_TAG.h"
|
||||
|
||||
#include <openair3/UICC/usim_interface.h>
|
||||
|
||||
|
||||
/* Defs */
|
||||
#define MAX_NUM_BWP 2
|
||||
#define MAX_NUM_CORESET 2
|
||||
@@ -386,7 +389,11 @@ typedef struct {
|
||||
} NR_UE_sched_ctrl_t;
|
||||
|
||||
typedef struct {
|
||||
boolean_t fiveG_connected;
|
||||
uicc_t *uicc;
|
||||
} NRUEcontext_t;
|
||||
|
||||
typedef struct {
|
||||
int lc_bytes_tx[64];
|
||||
int lc_bytes_rx[64];
|
||||
int dlsch_rounds[8];
|
||||
@@ -399,6 +406,7 @@ typedef struct {
|
||||
} NR_mac_stats_t;
|
||||
|
||||
|
||||
|
||||
/*! \brief UNR_E_list_t is a "list" of users within UE_info_t. Especial useful in
|
||||
* the scheduler and to keep "classes" of users. */
|
||||
typedef struct {
|
||||
@@ -406,6 +414,7 @@ typedef struct {
|
||||
int next[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_list_t;
|
||||
|
||||
|
||||
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
|
||||
#define MAX_CSI_REPORTCONFIG 48
|
||||
typedef struct {
|
||||
@@ -416,6 +425,7 @@ typedef struct {
|
||||
NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB];
|
||||
NR_UE_list_t list;
|
||||
int num_UEs;
|
||||
|
||||
bool active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||
|
||||
@@ -1025,7 +1025,7 @@ pdcp_data_ind(
|
||||
pushNotifiedFIFO(&pdcp_sdu_list, new_sdu_p);
|
||||
|
||||
/* Print octets of incoming data in hexadecimal form */
|
||||
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
|
||||
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
|
||||
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
|
||||
sdu_buffer_sizeP - payload_offset);
|
||||
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
|
||||
|
||||
@@ -150,9 +150,9 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
||||
nas_nlh_tx->nlmsg_len = sizeToWrite;
|
||||
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
|
||||
} // PDCP_USE_NETLINK
|
||||
|
||||
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
|
||||
|
||||
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
|
||||
|
||||
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
|
||||
log_dump(PDCP, pdcpData, min(sizeToWrite,30) , LOG_DUMP_CHAR,
|
||||
"Printing first bytes of PDCP SDU before removing it from the list: \n");
|
||||
@@ -196,6 +196,7 @@ int pdcp_fifo_flush_mbms_sdus(const protocol_ctxt_t *const ctxt_pP) {
|
||||
//} // PDCP_USE_NETLINK
|
||||
|
||||
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
||||
|
||||
//AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s)\n", errno, strerror(errno));
|
||||
delNotifiedFIFO_elt (sdu_p);
|
||||
pdcp_nb_sdu_sent ++;
|
||||
|
||||
@@ -143,7 +143,7 @@ void (*rlc_rrc_data_conf)(
|
||||
const protocol_ctxt_t *const ctxtP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
const rlc_tx_status_t statusP);
|
||||
const rlc_tx_status_t statusP) __attribute__ ((aligned(32)));
|
||||
|
||||
typedef void (rrc_data_ind_cb_t)(
|
||||
const protocol_ctxt_t *const ctxtP,
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include "nr_pdcp_ue_manager.h"
|
||||
#include "NR_RadioBearerConfig.h"
|
||||
#include "NR_RLC-BearerConfig.h"
|
||||
@@ -43,6 +46,7 @@ static uint64_t pdcp_optmask;
|
||||
/* rlc_data_req queue - begin */
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
/* NR PDCP and RLC both use "big locks". In some cases a thread may do
|
||||
@@ -92,6 +96,7 @@ static void *rlc_data_req_thread(void *_)
|
||||
{
|
||||
int i;
|
||||
|
||||
pthread_setname_np(pthread_self(), "RLC queue");
|
||||
while (1) {
|
||||
if (pthread_mutex_lock(&q.m) != 0) abort();
|
||||
while (q.length == 0)
|
||||
@@ -203,6 +208,7 @@ static void *enb_tun_read_thread(void *_)
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int rb_id = 1;
|
||||
pthread_setname_np( pthread_self(),"enb_tun_read");
|
||||
|
||||
while (1) {
|
||||
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
||||
@@ -247,7 +253,7 @@ static void *ue_tun_read_thread(void *_)
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int rb_id = 1;
|
||||
|
||||
pthread_setname_np( pthread_self(),"ue_tun_read");
|
||||
while (1) {
|
||||
len = read(nas_sock_fd[0], &rx_buf, NL_MAX_PAYLOAD);
|
||||
if (len == -1) {
|
||||
|
||||
@@ -88,6 +88,12 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
}
|
||||
|
||||
/* TODO BCCH SIB1 SIBs */
|
||||
if ((Srb_id & RAB_OFFSET ) == BCCH) {
|
||||
memcpy(&buffer_pP[0],
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS);
|
||||
|
||||
}
|
||||
|
||||
/* CCCH */
|
||||
if( (Srb_id & RAB_OFFSET ) == CCCH) {
|
||||
@@ -114,4 +120,4 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,6 +200,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) {
|
||||
mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits
|
||||
|
||||
mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15;
|
||||
/*
|
||||
* The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables
|
||||
* the reverse allocation is in nr_ue_decode_mib()
|
||||
*/
|
||||
mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero;
|
||||
mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero;
|
||||
AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n");
|
||||
@@ -265,10 +269,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
gNB_RrcConfigurationReq *configuration
|
||||
) {
|
||||
asn_enc_rval_t enc_rval;
|
||||
NR_BCCH_DL_SCH_Message_t *sib1_message ;
|
||||
struct NR_SIB1 *sib1 ;
|
||||
int i;
|
||||
struct NR_PLMN_IdentityInfo nr_plmn_info;
|
||||
|
||||
// TODO : Add support for more than one PLMN
|
||||
//int num_plmn = configuration->num_plmn;
|
||||
@@ -276,31 +276,29 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
struct NR_PLMN_Identity nr_plmn[num_plmn];
|
||||
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
|
||||
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
|
||||
memset(nr_plmn,0,sizeof(nr_plmn));
|
||||
memset(nr_mcc_digit,0,sizeof(nr_mcc_digit));
|
||||
memset(nr_mnc_digit,0,sizeof(nr_mnc_digit));
|
||||
|
||||
// struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet;
|
||||
sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||
memset(sib1_message,0,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||
NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t));
|
||||
carrier->siblock1 = sib1_message;
|
||||
sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1;
|
||||
sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
||||
memset(sib1_message->message.choice.c1,0,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1));
|
||||
sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
|
||||
sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1));
|
||||
sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||
memset(sib1,0,sizeof(struct NR_SIB1));
|
||||
|
||||
struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1;
|
||||
sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo));
|
||||
memset(sib1->cellSelectionInfo,0,sizeof(struct NR_SIB1__cellSelectionInfo));
|
||||
sib1->cellSelectionInfo->q_RxLevMin = -50;
|
||||
memset(&nr_plmn_info.plmn_IdentityList,0,sizeof(struct NR_PLMN_IdentityInfo__plmn_IdentityList));
|
||||
asn_set_empty(&nr_plmn_info.plmn_IdentityList.list);
|
||||
memset(&nr_plmn_info,0,sizeof(struct NR_PLMN_IdentityInfo));
|
||||
memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity));
|
||||
|
||||
for (i = 0; i < num_plmn; ++i) {
|
||||
struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo));
|
||||
asn_set_empty(&nr_plmn_info->plmn_IdentityList.list);
|
||||
for (int i = 0; i < num_plmn; ++i) {
|
||||
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
|
||||
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
|
||||
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
|
||||
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
|
||||
memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC));
|
||||
asn_set_empty(&nr_plmn[i].mcc->list);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
|
||||
@@ -308,26 +306,23 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
|
||||
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
|
||||
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
|
||||
memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t));
|
||||
nr_plmn[i].mnc.list.size=0;
|
||||
nr_plmn[i].mnc.list.count=0;
|
||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn_info.plmn_IdentityList.list, &nr_plmn[i]);
|
||||
ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]);
|
||||
}//end plmn loop
|
||||
|
||||
nr_plmn_info.cellIdentity.buf = MALLOC(8);
|
||||
memset(nr_plmn_info.cellIdentity.buf,0,8);
|
||||
nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
|
||||
nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
|
||||
nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
|
||||
nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
|
||||
nr_plmn_info.cellIdentity.size= 4;
|
||||
nr_plmn_info.cellIdentity.bits_unused= 4;
|
||||
nr_plmn_info.cellReservedForOperatorUse = 0;
|
||||
memset(&sib1->cellAccessRelatedInfo,0,sizeof(NR_CellAccessRelatedInfo_t));
|
||||
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, &nr_plmn_info);
|
||||
nr_plmn_info->cellIdentity.buf = CALLOC(1,8);
|
||||
nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
|
||||
nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
|
||||
nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
|
||||
nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
|
||||
nr_plmn_info->cellIdentity.size= 4;
|
||||
nr_plmn_info->cellIdentity.bits_unused= 4;
|
||||
nr_plmn_info->cellReservedForOperatorUse = 0;
|
||||
ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info);
|
||||
#if 0
|
||||
sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo));
|
||||
memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo));
|
||||
@@ -340,11 +335,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
|
||||
ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet);
|
||||
#endif
|
||||
//encode SIB1 to data
|
||||
carrier->SIB1=(uint8_t *) malloc16(128);
|
||||
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message,
|
||||
NULL,
|
||||
(void *)sib1_message,
|
||||
carrier->SIB1,
|
||||
100);
|
||||
128);
|
||||
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
|
||||
enc_rval.failed_type->name, enc_rval.encoded);
|
||||
|
||||
@@ -578,3 +574,8 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
|
||||
spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
|
||||
}
|
||||
|
||||
|
||||
int do_DLInformationTransfer_NR (void * p) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* Author and copyright: Laurent Thomas, open-cells.com
|
||||
*
|
||||
* 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 <openair2/RRC/LTE/MESSAGES/asn1_msg.h>
|
||||
#include <openair2/RRC/NR/nr_rrc_proto.h>
|
||||
|
||||
void rrc_gNB_process_NGAP_DOWNLINK_NAS (void ) {
|
||||
do_DLInformationTransfer(0,NULL,0,0,NULL);
|
||||
// send it as DL data
|
||||
/*
|
||||
rrc_data_req (
|
||||
&ctxt,
|
||||
srb_id,
|
||||
(*rrc_eNB_mui)++,
|
||||
SDU_CONFIRM_NO,
|
||||
length,
|
||||
buffer,
|
||||
PDCP_TRANSMISSION_MODE_CONTROL);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void rrc_gNB_send_NGAP_NAS_FIRST_REQ(void ) {
|
||||
// We are noCore only now
|
||||
// create message that should come from 5GC
|
||||
|
||||
// send it dow
|
||||
rrc_gNB_process_NGAP_DOWNLINK_NAS();
|
||||
}
|
||||
|
||||
void nr_rrc_rx_tx() {
|
||||
// check timers
|
||||
|
||||
// check if UEs are lost, to remove them from upper layers
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
@@ -93,7 +93,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
|
||||
|
||||
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
|
||||
|
||||
|
||||
void nr_rrc_rx_tx(void);
|
||||
|
||||
/**\brief RRC eNB task.
|
||||
\param void *args_p Pointer on arguments to start the task. */
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
|
||||
#include "x2ap_eNB.h"
|
||||
#include <openair2/X2AP/x2ap_eNB.h>
|
||||
|
||||
//#define XER_PRINT
|
||||
|
||||
@@ -179,10 +179,11 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
|
||||
///---------------------------------------------------------------------------------------------------------------///
|
||||
///---------------------------------------------------------------------------------------------------------------///
|
||||
|
||||
static void init_NR_SI(gNB_RRC_INST *rrc) {
|
||||
static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) {
|
||||
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
|
||||
rrc->carrier.MIB = (uint8_t *) malloc16(4);
|
||||
rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0);
|
||||
rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration);
|
||||
LOG_I(NR_RRC,"Done init_NR_SI\n");
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
@@ -272,7 +273,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
|
||||
rrc->carrier.pucch_TargetSNRx10 = configuration->pucch_TargetSNRx10;
|
||||
/// System Information INIT
|
||||
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt));
|
||||
init_NR_SI(rrc);
|
||||
init_NR_SI(rrc, configuration);
|
||||
rrc_init_nr_global_param();
|
||||
openair_nr_rrc_on(&ctxt);
|
||||
return 0;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define MAC_LTE_DLT 147
|
||||
#define DLT_IPV4 228
|
||||
/********************************************************/
|
||||
/* Definitions and descriptions come from:
|
||||
http://wiki.wireshark.org/Development/LibpcapFileFormat */
|
||||
@@ -29,20 +30,4 @@ typedef struct pcaprec_hdr_s {
|
||||
unsigned int orig_len; /* actual length of packet */
|
||||
} pcaprec_hdr_t;
|
||||
|
||||
/* Context information for every MAC PDU that will be logged */
|
||||
typedef struct MAC_Context_Info_t {
|
||||
unsigned short radioType;
|
||||
unsigned char direction;
|
||||
unsigned char rntiType;
|
||||
unsigned short rnti;
|
||||
unsigned short ueid;
|
||||
unsigned char isRetx;
|
||||
unsigned char crcStatusOK;
|
||||
|
||||
unsigned short sysFrameNumber;
|
||||
unsigned short subFrameNumber;
|
||||
|
||||
unsigned int subframesSinceCaptureStart;
|
||||
} MAC_Context_Info_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef guint8 gboolean;
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define OPT_PARAMS_DESC { \
|
||||
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
|
||||
{"type" , CONFIG_HLP_TYPEMON, 0, strptr:(char**)&in_type, defstrval:"none", TYPE_STRING, 0}, \
|
||||
{"ip" , CONFIG_HLP_L2MONIP, 0, strptr:(char**)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
|
||||
{"path" , CONFIG_HLP_L2MONPATH, 0, strptr:(char**)&in_path,defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
|
||||
}
|
||||
|
||||
+108
-107
@@ -90,6 +90,7 @@ what about the implementation
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "opt.h"
|
||||
#include "common/utils/system.h"
|
||||
@@ -99,8 +100,6 @@ int opt_enabled=0;
|
||||
//static unsigned char g_PDUBuffer[1600];
|
||||
//static unsigned int g_PDUOffset;
|
||||
|
||||
static char in_ip[128]={0};
|
||||
static char in_path[128]={0};
|
||||
FILE *file_fd = NULL;
|
||||
pcap_hdr_t file_header = {
|
||||
0xa1b2c3d4, /* magic number */
|
||||
@@ -108,10 +107,14 @@ pcap_hdr_t file_header = {
|
||||
0, /* timezone */
|
||||
0, /* sigfigs - apparently all tools do this */
|
||||
65535, /* snaplen - this should be long enough */
|
||||
MAC_LTE_DLT /* Data Link Type (DLT). Set as unused value 147 for now */
|
||||
DLT_IPV4
|
||||
//MAC_LTE_DLT /* Data Link Type (DLT). Set as unused value 147 for now */
|
||||
};
|
||||
|
||||
trace_mode_t opt_type = OPT_NONE;
|
||||
static char *in_type=NULL;
|
||||
static char *in_path=NULL;
|
||||
static char *in_ip=NULL;
|
||||
static unsigned int subframesSinceCaptureStart;
|
||||
|
||||
static int g_socksd = -1;/* UDP socket used for sending frames */
|
||||
@@ -131,8 +134,80 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
guint8 oob_event, guint8 oob_event_value,
|
||||
uint8_t *pdu_buffer, unsigned int pdu_buffer_size);
|
||||
|
||||
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||
const unsigned char *PDU, unsigned int length);
|
||||
unsigned short checksum(unsigned short *ptr, int length) {
|
||||
int sum = 0;
|
||||
u_short answer = 0;
|
||||
unsigned short *w = ptr;
|
||||
int nleft = length;
|
||||
|
||||
while(nleft > 1) {
|
||||
sum += *w++;
|
||||
nleft -= 2;
|
||||
}
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xFFFF);
|
||||
sum += (sum >> 16);
|
||||
answer = ~sum;
|
||||
return(answer);
|
||||
}
|
||||
|
||||
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
||||
static int MAC_LTE_PCAP_WritePDU(const uint8_t *PDU,
|
||||
unsigned int length) {
|
||||
pcaprec_hdr_t packet_header;
|
||||
// IPv4 header
|
||||
typedef struct ip_hdr {
|
||||
unsigned char ip_verlen; // 4-bit IPv4 version 4-bit header length (in 32-bit words)
|
||||
unsigned char ip_tos; // IP type of service
|
||||
unsigned short ip_totallength; // Total length
|
||||
unsigned short ip_id; // Unique identifier
|
||||
unsigned short ip_offset; // Fragment offset field
|
||||
unsigned char ip_ttl; // Time to live
|
||||
unsigned char ip_protocol; // Protocol(TCP,UDP etc)
|
||||
unsigned short ip_checksum; // IP checksum
|
||||
unsigned int ip_srcaddr; // Source address
|
||||
unsigned int ip_destaddr; // Source address
|
||||
} IPV4_HDR;
|
||||
// Define the UDP header
|
||||
typedef struct udp_hdr {
|
||||
unsigned short src_portno; // Source port no.
|
||||
unsigned short dst_portno; // Dest. port no.
|
||||
unsigned short udp_length; // Udp packet length
|
||||
unsigned short udp_checksum; // Udp checksum (optional)
|
||||
} UDP_HDR;
|
||||
IPV4_HDR IPheader= {0};
|
||||
IPheader.ip_verlen = (4 << 4) | (sizeof(IPV4_HDR) / sizeof(uint32_t));
|
||||
IPheader.ip_totallength = htons(sizeof(IPV4_HDR) + sizeof(UDP_HDR) + length);
|
||||
IPheader.ip_ttl = 8; // Time-to-live is eight
|
||||
IPheader.ip_protocol = IPPROTO_UDP;
|
||||
IPheader.ip_srcaddr = inet_addr(in_ip);
|
||||
IPheader.ip_destaddr = inet_addr(in_ip);
|
||||
IPheader.ip_checksum = checksum((unsigned short *)&IPheader, sizeof(IPV4_HDR));
|
||||
// Initialize the UDP header
|
||||
UDP_HDR UDPheader;
|
||||
UDPheader.src_portno = htons( PACKET_MAC_LTE_DEFAULT_UDP_PORT);
|
||||
UDPheader.dst_portno = htons( PACKET_MAC_LTE_DEFAULT_UDP_PORT);
|
||||
UDPheader.udp_length = htons(sizeof(UDP_HDR) + length);
|
||||
UDPheader.udp_checksum = 0;
|
||||
/****************************************************************/
|
||||
/* PCAP Header */
|
||||
/* TODO: Timestamp might want to be relative to a more sensible
|
||||
base time... */
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
packet_header.ts_sec = tv.tv_sec;
|
||||
packet_header.ts_usec = tv.tv_usec;
|
||||
packet_header.incl_len =sizeof(IPV4_HDR) + sizeof(UDP_HDR) + length;
|
||||
packet_header.orig_len =sizeof(IPV4_HDR) + sizeof(UDP_HDR) + length;
|
||||
/***************************************************************/
|
||||
/* Now write everything to the file */
|
||||
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, file_fd);
|
||||
fwrite(&IPheader, sizeof(IPV4_HDR), 1, file_fd);
|
||||
fwrite(&UDPheader, sizeof(UDP_HDR), 1, file_fd);
|
||||
fwrite(PDU, 1, length, file_fd);
|
||||
fflush(file_fd);
|
||||
return length;
|
||||
}
|
||||
|
||||
static void *opt_listener_thread(void *arg) {
|
||||
ssize_t ret;
|
||||
@@ -198,7 +273,6 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) {
|
||||
}
|
||||
|
||||
threadCreate(&opt_listener.thread, opt_listener_thread, NULL, "flexran", -1, OAI_PRIORITY_RT_LOW);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -321,67 +395,20 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
|
||||
frameOffset += pdu_buffer_size;
|
||||
}
|
||||
|
||||
/* Send out the data over the UDP socket */
|
||||
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
|
||||
(const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
|
||||
if ( opt_type == OPT_WIRESHARK )
|
||||
/* Send out the data over the UDP socket */
|
||||
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
|
||||
(const struct sockaddr *)&g_serv_addr, sizeof(g_serv_addr));
|
||||
else
|
||||
bytesSent = MAC_LTE_PCAP_WritePDU(frameBuffer, frameOffset);
|
||||
|
||||
if (bytesSent != frameOffset) {
|
||||
LOG_W(OPT, "sendto() failed (not a thread-safe func)- expected %d bytes, got %ld (errno=%d)\n",
|
||||
LOG_W(OPT, "trace_pdu expected %d bytes, got %ld (errno=%d)\n",
|
||||
frameOffset, bytesSent, errno);
|
||||
//exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
|
||||
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
|
||||
const uint8_t *PDU,
|
||||
unsigned int length)
|
||||
{
|
||||
pcaprec_hdr_t packet_header;
|
||||
uint8_t context_header[256];
|
||||
int offset = 0;
|
||||
unsigned short tmp16;
|
||||
/*****************************************************************/
|
||||
/* Context information (same as written by UDP heuristic clients */
|
||||
context_header[offset++] = context->radioType;
|
||||
context_header[offset++] = context->direction;
|
||||
context_header[offset++] = context->rntiType;
|
||||
/* RNTI */
|
||||
context_header[offset++] = MAC_LTE_RNTI_TAG;
|
||||
tmp16 = htons(context->rnti);
|
||||
memcpy(context_header+offset, &tmp16, 2);
|
||||
offset += 2;
|
||||
/* UEId */
|
||||
context_header[offset++] = MAC_LTE_UEID_TAG;
|
||||
tmp16 = htons(context->ueid);
|
||||
memcpy(context_header+offset, &tmp16, 2);
|
||||
offset += 2;
|
||||
/* Subframe number */
|
||||
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
|
||||
tmp16 = htons(context->subFrameNumber);
|
||||
memcpy(context_header+offset, &tmp16, 2);
|
||||
offset += 2;
|
||||
/* CRC Status */
|
||||
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
|
||||
context_header[offset++] = context->crcStatusOK;
|
||||
/* Data tag immediately preceding PDU */
|
||||
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
|
||||
/****************************************************************/
|
||||
/* PCAP Header */
|
||||
/* TODO: Timestamp might want to be relative to a more sensible
|
||||
base time... */
|
||||
packet_header.ts_sec = context->subframesSinceCaptureStart / 1000;
|
||||
packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
|
||||
packet_header.incl_len = offset + length;
|
||||
packet_header.orig_len = offset + length;
|
||||
/***************************************************************/
|
||||
/* Now write everything to the file */
|
||||
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, file_fd);
|
||||
fwrite(context_header, 1, offset, file_fd);
|
||||
fwrite(PDU, 1, length, file_fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include <common/ran_context.h>
|
||||
extern RAN_CONTEXT_t RC;
|
||||
#include <openair1/PHY/phy_extern_ue.h>
|
||||
@@ -389,7 +416,6 @@ extern RAN_CONTEXT_t RC;
|
||||
void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
|
||||
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
|
||||
int oob_event_value) {
|
||||
MAC_Context_Info_t pdu_context;
|
||||
int radioType=FDD_RADIO;
|
||||
LOG_D(OPT,"sending packet to wireshark: direction=%s, size: %d, ueid: %d, rnti: %x, frame/sf: %d.%d\n",
|
||||
direction?"DL":"UL", pdu_buffer_size, ueid, rnti, sysFrameNumber,subFrameNumber);
|
||||
@@ -405,53 +431,41 @@ void trace_pdu_implementation(int direction, uint8_t *pdu_buffer, unsigned int p
|
||||
|
||||
switch (opt_type) {
|
||||
case OPT_WIRESHARK :
|
||||
if (g_socksd == -1) {
|
||||
if (g_socksd == -1)
|
||||
return;
|
||||
}
|
||||
|
||||
SendFrame( radioType,
|
||||
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
||||
rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
|
||||
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
||||
oob_event,oob_event_value,
|
||||
pdu_buffer, pdu_buffer_size);
|
||||
break;
|
||||
|
||||
case OPT_PCAP:
|
||||
if (file_fd == NULL) {
|
||||
if (file_fd == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
pdu_context.radioType = radioType;
|
||||
pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
|
||||
: DIRECTION_UPLINK;
|
||||
pdu_context.rntiType = rntiType;
|
||||
pdu_context.rnti = rnti;
|
||||
pdu_context.ueid = ueid;
|
||||
pdu_context.isRetx = 0;
|
||||
pdu_context.crcStatusOK =1;
|
||||
pdu_context.sysFrameNumber = sysFrameNumber;
|
||||
pdu_context.subFrameNumber = subFrameNumber;
|
||||
pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++;
|
||||
MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size);
|
||||
break;
|
||||
|
||||
case OPT_TSHARK:
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
SendFrame( radioType,
|
||||
(direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
|
||||
rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
|
||||
1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
|
||||
oob_event,oob_event_value,
|
||||
pdu_buffer, pdu_buffer_size);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int init_opt(void)
|
||||
{
|
||||
char *in_type=NULL;
|
||||
int init_opt(void) {
|
||||
in_type=malloc(200);
|
||||
in_ip=malloc(200);
|
||||
in_path=malloc(200);
|
||||
paramdef_t opt_params[] = OPT_PARAMS_DESC ;
|
||||
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
|
||||
uint16_t in_port=0;
|
||||
config_set_checkfunctions(opt_params, opt_checkParams,
|
||||
sizeof(opt_params)/sizeof(paramdef_t));
|
||||
config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||
|
||||
subframesSinceCaptureStart = 0;
|
||||
int tmptype = config_get_processedint( &(opt_params[OPTTYPE_IDX]));
|
||||
|
||||
@@ -462,25 +476,21 @@ int init_opt(void)
|
||||
} else if (tmptype == OPT_PCAP && strlen(in_path) > 0) {
|
||||
opt_type = OPT_PCAP;
|
||||
opt_enabled=1;
|
||||
LOG_I(OPT,"Enabling OPT for PCAP with the following file %s \n",in_path);
|
||||
} else if (tmptype == OPT_WIRESHARK && strlen(in_ip) > 0) {
|
||||
opt_enabled=1;
|
||||
opt_type = OPT_WIRESHARK;
|
||||
LOG_I(OPT,"Enabling OPT for wireshark for local interface %s\n",in_ip);
|
||||
} else {
|
||||
LOG_E(OPT,"Invalid OPT configuration\n");
|
||||
config_printhelp(opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
|
||||
}
|
||||
|
||||
in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
|
||||
|
||||
// trace_mode
|
||||
switch (opt_type) {
|
||||
case OPT_WIRESHARK:
|
||||
|
||||
LOG_I(OPT,"mode Wireshark: ip %s port %d\n", in_ip, PACKET_MAC_LTE_DEFAULT_UDP_PORT);
|
||||
/* Create local server socket only if using localhost address */
|
||||
if (strcmp(in_ip, "127.0.0.1") == 0) {
|
||||
opt_create_listener_socket(in_ip, in_port);
|
||||
if (strncmp(in_ip, "127.0.0.1", 4) == 0) {
|
||||
opt_create_listener_socket(in_ip, PACKET_MAC_LTE_DEFAULT_UDP_PORT);
|
||||
}
|
||||
|
||||
g_socksd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
@@ -493,11 +503,12 @@ int init_opt(void)
|
||||
|
||||
/* Get remote IP address from the function argument */
|
||||
g_serv_addr.sin_family = AF_INET;
|
||||
g_serv_addr.sin_port = htons(in_port);
|
||||
g_serv_addr.sin_port = htons(PACKET_MAC_LTE_DEFAULT_UDP_PORT);
|
||||
g_serv_addr.sin_addr.s_addr = inet_addr(in_ip);
|
||||
break;
|
||||
|
||||
case OPT_PCAP:
|
||||
LOG_I(OPT,"mode PCAB : path is %s \n",in_path);
|
||||
file_fd = fopen(in_path, "w");
|
||||
|
||||
if (file_fd == NULL) {
|
||||
@@ -516,19 +527,9 @@ int init_opt(void)
|
||||
|
||||
default:
|
||||
opt_type = OPT_NONE;
|
||||
LOG_W(OPT, "supported Option\n");
|
||||
LOG_E(OPT,"Unsupported or unknown mode %d \n", opt_type);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( opt_type == OPT_WIRESHARK )
|
||||
LOG_E(OPT,"mode Wireshark: ip %s port %d\n", in_ip, in_port);
|
||||
else if (opt_type == OPT_PCAP)
|
||||
LOG_E(OPT,"mode PCAB : path is %s \n",in_path);
|
||||
else
|
||||
LOG_E(OPT,"Unsupported or unknown mode %d \n", opt_type);
|
||||
|
||||
// mac_info = (mac_info*)malloc16(sizeof(mac_lte_info));
|
||||
// memset(mac_info, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user