Remove legacy 4G kernel modules

I don't know about any user of the kernel modules. It is effectively
legacy code we carry around, for no good reason. Remove it for the
moment. If we ever need it, we can revert.
This commit is contained in:
Robert Schmidt
2024-08-01 18:22:46 +02:00
parent 8f549a5433
commit 6b21dea1ee
56 changed files with 4 additions and 12781 deletions
-3
View File
@@ -13,9 +13,6 @@ cd cmake_targets
#Execution instuctions (Currently running eNB (VNF) and UE side (PNF) on the same machine using the loopback interface)
cd cmake_targets/tools
# Loading nasmesh
source init_nas_nos1
# Add a new loopback interface address
sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
-157
View File
@@ -1,157 +0,0 @@
include $(OPENAIR_DIR)/common/utils/Makefile.inc
TOP_DIR = $(OPENAIR1_DIR)
OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3_TOP = $(OPENAIR3_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS += -m32 -DPHYSIM -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1
CFLAGS += -DEMIT_ASN_DEBUG=1
ifndef OPENAIR2
OPENAIR2=1
endif
# activate OCG and libxml only under linux
ifeq ($(linux),1)
CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
CFLAGS += -DLINUX
endif
ifndef rrc_cellular
rrc_cellular = 0
rrc_cellular_eNB = 0
rrc_cellular_UE = 0
else
ifeq ($(eNB_flag),1)
rrc_cellular_eNB=1
endif
ifeq ($(UE_flag),1)
rrc_cellular_UE=1
endif
endif
ifdef DEBUG_PHY
CFLAGS += -DDEBUG_PHY
endif
#CFLAGS += -DPDCP_USE_NETLINK -DLINUX
#NAS_FLAG=1
#require kernel patch for oai driver to enable address autoconfiguration (IPv6 only)
ifdef ADDCONF
CFLAGS+=-DADDRCONF
endif
ifdef TRAFFIC_TM5
CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 -DFULL_BUFFER=1
endif
include $(OPENAIR1_DIR)/PHY/Makefile.inc
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
include $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/Makefile.inc
include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
include $(OPENAIR2_DIR)/UTIL/Makefile.inc
ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
#L2_OBJS =
#EXTRA_CFLAGS =
export IS_REL10=$(shell if [ -f .lock-rel10 ] ; then echo "1" ; else echo "0" ; fi)
export IS_REL8=$(shell if [ -f .lock-rel8 ] ; then echo "1" ; else echo "0" ; fi)
ifdef Rel10
CFLAGS += -DRel10
ifeq ($(IS_REL10), 0)
$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR_TARGETS)/TEST/PACKET_TRACER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS) ; touch .lock-rel10 ; rm .lock-rel8 ;)
endif
else # default is rel 8
ifeq ($(IS_REL8), 0)
$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR_TARGETS)/TEST/PACKET_TRACER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS); rm -f *.o ; rm -f oaisim ; touch .lock-rel8 ; rm .lock-rel10 ; )
endif
endif
export IS_REL10=$(shell if [ -f .lock-rel10 ] ; then echo "1" ; else echo "0" ; fi)
export IS_REL8=$(shell if [ -f .lock-rel8 ] ; then echo "1" ; else echo "0" ; fi)
PT_OBJS = pt.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o
SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o
OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(SCHED_OBJS) $(L2_OBJS) $(TOOLS_OBJS) $(STATS_OBJS) $(ASN1_MSG_OBJS1) $(NAS_OBJS) $(INT_OBJS) $(UTIL_OBJ)
OBJ += $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o
all: pt
printvars:
@echo LINUX variable is $(linux)
@echo rrc_cellular variable is $(rrc_cellular)
@echo EXTRA_CFLAGS = $(EXTRA_CFLAGS)
@echo OAI NETLINK FLAG is $(NAS_FLAG)
@echo SSE3 proc is $(SSE3PROC)
@echo IS_REL_8 is $(IS_REL_8)
@echo IS_REL_10 is $(IS_REL_10)
$(OBJ): %.o : %.c
@echo Compiling $<
$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) -I$(ASN1_MSG_INC) -o $@ $<
pt: $(OBJ) pt.c
@echo "Compiling pt.c ..."
@$(CC) pt.c -I$(TOP_DIR) $(L2_incl) $(UTIL_incl) -I$(ASN1_MSG_INC) -o pt $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) -lm -lblas -lpthread -lxml2 -lX11 -lXpm -lrt -lforms -llapack_atlas
ifeq ($(rrc_cellular_eNB),1)
mv oaisim oaisim_eNB
endif
ifeq ($(rrc_cellular_UE),1)
mv oaisim oaisim_UE
endif
nasmesh_fix:
(cd $(OPENAIR2_DIR) && make nasmesh_netlink_address_fix.ko)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
nasmesh_nl:
(cd $(OPENAIR2_DIR) && make nasmesh_netlink.ko)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
rb_tool:
(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make)
nasmesh_install:
(sudo rmmod nasmesh)
(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
clean:
rm -f oaisim
rm -f $(OBJ)
rm -f *.o
rm -f *.exe*
cleanl1:
rm -f oaisim
rm -f $(PHY_OBJS) $(SCHED_OBJS)
rm -f *.o
rm -f *.exe
cleanl2:
rm -f $(L2_OBJS)
cleanasn1:
rm -f $(ASN1_MSG_OBJS1)
rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
print:
@echo $(CFLAGS)
@echo $(EXTRA_CFLAGS)
@echo $(OBJ)
showcflags:
@echo $(CFLAGS)
-35
View File
@@ -1,35 +0,0 @@
This utility allows you to inject packets into the Openair4G stack (UE for the moment) or generate packets
from different parts of the stack.
To compile:
make pt
To get help
./pt --help
Some pregenerated messages (RRC and MAC) can be found in the PACKET_TRACER/messages directory. Here are some
usage examples:
To generate RRC messages (e.g. SIBx)
./pt --eNB_RRC --RRCSIB2_3
./pt --eNB_RRC --RRCConnectionReconfiguration
./pt --UE_RRC --RRCConnectionRequest
To inject packets into the OpenAir4G stack (This works for UE receiver only for now, with control-plane messasges)
./pt --eNB_MAC -I messages/Msg4.txt
./pt -I messages/rrcconnectionsetup.txt -J messages/rrcconnectionreconfiguration.txt --eNB_RRC --RRCConnectionReconfiguration
./pt -I messages/rrcconnectionsetup.txt --eNB_RRC --RRCConnectionSetup
To be done:
- user-plane tests, in particular out-of-order segments to (MAC->RLC)
@@ -1 +0,0 @@
1C5AF0FA9E3966
@@ -1 +0,0 @@
21591FA00404200602013D2C3FAC50083A101700300007888000080102900E08484A0202020000000000605A0AA1A3BB4B932B632B9B982808A0A0A322805FB007888000080891A2B3C353E0FA897844866E926E0D80100021F756A900
@@ -1 +0,0 @@
3F0060129B26E0D9E1C952C860C0827030
@@ -1 +0,0 @@
5040040300010000001C1650902080850000
@@ -1 +0,0 @@
00000C60FD6C8160C002A00200141000029AA55696D0C72944C1C000
@@ -1 +0,0 @@
00800f5995648000020a580020000804012f395796dec00a111fe807c1
@@ -1 +0,0 @@
010101eb32ac900000414b00040001008025e72af2dbd800115542023fd00f83020c000802200000
@@ -1 +0,0 @@
00043020384000
-734
View File
@@ -1,734 +0,0 @@
/*
* 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 <string.h>
#include <math.h>
#include <execinfo.h>
#include <signal.h>
#include <unistd.h>
#include <getopt.h>
//#include "SIMULATION/TOOLS/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/vars.h"
#include "MAC_INTERFACE/vars.h"
#include "SCHED/defs.h"
#include "SCHED/vars.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/vars.h"
#include "RRC/LTE/vars.h"
#include "PHY_INTERFACE/vars.h"
#include "UTIL/LOG/log.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_vars.h"
char binary_table[16][5] = {{"0000\0"},{"0001\0"},{"0010\0"},{"0011\0"},{"0100\0"},{"0101\0"},{"0110\0"},{"0111\0"},{"1000\0"},{"1001\0"},{"1010\0"},{"1011\0"},{"1100\0"},{"1101\0"},{"1110\0"},{"1111\0"}};
typedef enum {
RRCConnectionRequest=0,
RRCConnectionSetup,
RRCConnectionSetupComplete,
RRCConnectionReconfiguration,
RRCConnectionReconfigurationComplete,
RRCSIB1,
RRCSIB2_3
} RRC_MESSAGES_t;
typedef enum {
eNB_RRC=0,
eNB_S1U,
eNB_PDCP,
eNB_RLC_UM,
eNB_RLC_AM,
eNB_RLC_TM,
eNB_MAC,
UE_RRC,
UE_S1U,
UE_PDCP,
UE_RLC_UM,
UE_RLC_AM,
UE_RLC_TM,
eNB_SI
} SDUsource_t;
typedef struct {
int verbose;
int RRCmessage;
int lcid;
int rbid;
int SDUsize;
int TBsize;
SDUsource_t SDUsource;
char input1_file[128];
char input2_file[128];
char output_file[128];
unsigned char input1_sdu[1024];
unsigned char input2_sdu[1024];
int input1_sdu_flag;
unsigned short input1_sdu_len;
int input2_sdu_flag;
unsigned short input2_sdu_len;
int frame;
int input_sib;
int input_eNB_MAC;
} args_t;
int input_text(char *file,char *sdu)
{
FILE *fd;
int i,b_ind=0;
char c,c0,c1;
unsigned char byte;
fd = fopen(file,"r");
while (!feof(fd)) {
c0 = fgetc(fd);
if (!feof(fd))
c1 = fgetc(fd);
else
return(-1);
byte = 0;
for (i=0,c=c0; i<2; i++,c=c1)
switch(c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
byte += (c-'0')<<(4*(1-i));
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
byte += (10+c-'A')<<(4*(1-i));
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
byte += (10+c-'a')<<(4*(1-i));
break;
case '\n':
case '\0':
return(b_ind);
break;
default:
printf("Unknown hex character %c in file\n",c);
return(-1);
break;
}
sdu[b_ind]=byte;
printf("byte %d: %x (%s%s)\n",b_ind,byte,binary_table[byte>>4],binary_table[byte&0xf]);
b_ind++;
}
if (fd)
fclose(fd);
return(b_ind);
}
int parse_args(int argc, char** argv, args_t* args)
{
int c;
int k;
const struct option long_options[] = {
{"lcid", required_argument, NULL, 256},
{"rbid", required_argument, NULL, 257},
{"TBsize", required_argument, NULL, 258},
{"SDUsize", required_argument, NULL, 259},
{"eNB_RRC", no_argument, NULL, 260},
{"eNB_S1U", no_argument, NULL, 261},
{"eNB_PDCP", no_argument, NULL, 262},
{"eNB_RLC_UM", no_argument, NULL, 263},
{"eNB_RLC_AM", no_argument, NULL, 264},
{"eNB_RLC_TM", no_argument, NULL, 265},
{"eNB_MAC" , no_argument, NULL, 266},
{"UE_RRC", no_argument, NULL, 267},
{"UE_S1U", no_argument, NULL, 268},
{"UE_PDCP", no_argument, NULL, 269},
{"UE_RLC_UM", no_argument, NULL, 270},
{"UE_RLC_AM", no_argument, NULL, 271},
{"UE_RLC_TM", no_argument, NULL, 272},
{"RRCConnectionRequest", no_argument, NULL, 273},
{"RRCConnectionSetup", no_argument, NULL, 274},
{"RRCConnectionSetupComplete", no_argument, NULL, 275},
{"RRCConnectionReconfiguration", no_argument, NULL, 276},
{"RRCConnectionReconfigurationComplete", no_argument, NULL, 277},
{"RRCSIB1", no_argument, NULL, 278},
{"RRCSIB2_3", no_argument, NULL, 279},
{NULL, 0, NULL, 0}
};
args->frame = 0;
while((c = getopt_long(argc, argv, "ho:I:J:v", long_options, NULL)) != -1) {
switch(c) {
case 'h':
return 1;
case 'o':
strcpy(args->output_file,optarg);
break;
case 'f':
args->frame = atoi(optarg);
break;
case 'I':
strcpy(args->input1_file,optarg);
args->input1_sdu_len = input_text(args->input1_file,args->input1_sdu);
printf("Got sdu1 of length %u bytes\n",args->input1_sdu_len);
args->input1_sdu_flag=1;
break;
case 'J':
strcpy(args->input2_file,optarg);
args->input2_sdu_len = input_text(args->input2_file,args->input2_sdu);
printf("Got sdu2 of length %u bytes\n",args->input2_sdu_len);
args->input2_sdu_flag=1;
break;
case 'v':
args->verbose++;
break;
case 256: // lchan
args->lcid = atoi(optarg);
break;
case 257: //
args->rbid = atoi(optarg);
break;
case 258:
args->TBsize = atoi(optarg);
break;
case 259:
args->SDUsize = atoi(optarg);
break;
case 260: //eNB_RRC
case 261: //eNB_S1U
case 262: //eNB_PDCP
case 263: //eNB_RLC_UM
case 264: //eNB_RLC_AM
case 265: //eNB_RLC_TM
case 266: //eNB_MAC
case 267: //UE_RRC
case 268: //UE_S1U
case 269: //UE_PDCP
case 270: //UE_RLC_UM
case 271: //UE_RLC_AM
case 272: //UE_RLC_TM
args->SDUsource = c-260;
break;
case 273: //RRCConnectionRequest
case 274: //RRCConnectionSetup
case 275: //RRCConnectionSetupComplete
case 276: //RRCConnectionReconfiguration
case 277: //RRCConnectionReconfigurationComplete
case 278: //RRCSIB1
case 279: //RRCSIB2_3
args->RRCmessage = c-273;
break;
default:
return 1;
}
}
return 0;
}
void print_usage(const char* prog)
{
printf("Usage: %s [options]\n", prog);
printf("\n");
printf(" General options:\n");
printf(" -h : print usage\n");
printf(" -v : increase verbosity level [0]\n");
printf(" -o : output .dat file (binary packet data)\n");
printf(" -i : input .dat file (binary packet data)\n");
printf(" -I : input .txt file (ASCII packet data)\n");
printf("\n");
printf(" Packet options:\n");
printf(" --eNB_RRC : set source of packet to eNB_RRC\n");
printf(" --eNB_S1U : set source of packet to eNB_S1U (e.g. IP)\n");
printf(" --eNB_PDCP : set source of packet to eNB_PDCP\n");
printf(" --eNB_RLC_UM : set source of packet to eNB_RLC_UM\n");
printf(" --eNB_RLC_AM : set source of packet to eNB_RLC_AM\n");
printf(" --eNB_RLC_TM : set source of packet to eNB_RLC_TM\n");
printf(" --eNB_MAC : set source of packet to eNB_MAC\n");
printf(" --UE_RRC : set source of packet to UE_RRC\n");
printf(" --UE_S1U : set source of packet to UE_S1U (e.g. IP)\n");
printf(" --UE_PDCP : set source of packet to UE_PDCP\n");
printf(" --UE_RLC_UM : set source of packet to UE_RLC_UM\n");
printf(" --UE_RLC_AM : set source of packet to UE RLC_AM\n");
printf(" --UE_RLC_TM : set source of packet to UE RLC_TM\n");
printf(" --lchan : set logical channel id\n");
printf(" --rbid : set radio bearer id\n");
printf(" --TBsize : set Transport Block Size at MAC layer\n");
printf(" --SDUsize : set the SDU size used by the originating entity (except RRC)\n");
printf(" --RRCConnectionSetup : set the SDU to be an RRCConnectionSetup\n");
printf(" --RRCConnectionSetupComplete : set the SDU to be an RRCConnectionSetupComplete\n");
printf(" --RRCConnectionRequest : set the SDU to be an RRCConnectionRequest\n");
printf(" --RRCConnectionReconfiguration : set the SDU to be an RRCConnectionReconfiguration\n");
printf(" --RRCConnectionReconfigurationComplete : set the SDU to be an RRCConnectionReconfigurationComplete\n");
printf(" --RRCSIB1 : set the SDU to be an RRCSIB1\n");
printf(" --RRCSIB2_3 : set the SDU to be an RRCSIB2_3\n");
}
u8 attach_ue0(char *sdu)
{
u8 Size;
u16 Size16;
u8 lcid=0;
UE_rrc_inst[0].Info[0].State = RRC_SI_RECEIVED;
rrc_ue_generate_RRCConnectionRequest(0,131,0);
Size = mac_rrc_data_req(0,
131,
CCCH,1,
&sdu[sizeof(SCH_SUBHEADER_FIXED)],0,
0);
Size16 = (u16)Size;
generate_ulsch_header((u8 *)sdu, // mac header
1, // num sdus
0, // short padding
&Size16, // sdu length
&lcid, // sdu lcid
NULL, // power headroom
NULL, // crnti
NULL, // truncated bsr
NULL, // short bsr
NULL,
0); // post padding
return(Size+sizeof(SCH_SUBHEADER_FIXED));
}
// This retrieves the RRCConnectionSetup RRC SDU
u8 attach_ue1(char *sdu)
{
// simulate reception of CCCH at eNB(RRCConnectionRequest)
mac_rrc_lite_data_ind(0,131,0,UE_rrc_inst[0].Srb0[0].Tx_buffer.Payload,
UE_rrc_inst[0].Srb0[0].Tx_buffer.payload_size,1,0);
return(mac_rrc_data_req(0,
132,
0,1,
sdu,
1,
0));
}
// This retrieves the RRCConnectionSetupComplete RRC SDU
u16 attach_ue2(char *dcch_sdu_eNB, char dcch_sdu_eNB_len, char *dcch_sdu)
{
mac_rlc_status_resp_t rlc_status;
u16 sdu_len;
printf("************* attach_ue2 (CCCH payload %d)\n",
eNB_rrc_inst[0].Srb0.Tx_buffer.payload_size);
// simulate reception of CCCH at UE (RRCConnectionSetup)
mac_rrc_lite_data_ind(0,132,0,dcch_sdu_eNB,dcch_sdu_eNB_len,0,0);
// simulate transmission of RRCConnectionSetupComplete
rlc_status = mac_rlc_status_ind(1,134,0,
DCCH,
100);
sdu_len = mac_rlc_data_req(1,133,
DCCH,
dcch_sdu);
return(sdu_len);
}
// This retrieves the RRCConnectionReconfiguration RRC SDU
u16 attach_ue3(char *dcch_sdu_ue, char dcch_sdu_ue_len, char *dcch_sdu_eNB)
{
mac_rlc_status_resp_t rlc_status;
u16 sdu_len;
// simulation reception of RRCConnectionSetupComplete
mac_rlc_data_ind(0,134,1,
DCCH,
dcch_sdu_ue,
dcch_sdu_ue_len,
1,
NULL);
/// ... and generation of RRCConnectionReconfiguration
/// First RLC-AM Control SDU (ACK)
rlc_status = mac_rlc_status_ind(0,135,1,
DCCH,
100);
sdu_len = mac_rlc_data_req(0,135,
DCCH,
dcch_sdu_eNB);
mac_rlc_data_ind(1,135,1,
DCCH,
dcch_sdu_eNB,
sdu_len,
1,
NULL);
// now RRC message
rlc_status = mac_rlc_status_ind(0,136,1,
DCCH,
100);
sdu_len = mac_rlc_data_req(0,136,
DCCH,
dcch_sdu_eNB);
return(sdu_len);
}
// This retrieves the RRCConnectionReconfigurationComplete RRC SDU
u16 attach_ue4(char *dcch_sdu_eNB, char dcch_sdu_eNB_len, char *dcch_sdu_ue)
{
mac_rlc_status_resp_t rlc_status;
u16 sdu_len;
// simulation UE reception of RRCConnectionReconfiguration ....
mac_rlc_data_ind(1,135,0,
DCCH,
dcch_sdu_eNB,
dcch_sdu_eNB_len,
1,
NULL);
// ... and generation of RRCConnectionReconfigurationComplete
rlc_status = mac_rlc_status_ind(1,135,0,
DCCH,
100);
sdu_len = mac_rlc_data_req(1,135,
DCCH,
dcch_sdu_ue);
rlc_status = mac_rlc_status_ind(1,136,0,
DCCH,
100);
sdu_len = mac_rlc_data_req(1,136,
DCCH,
dcch_sdu_ue);
return(sdu_len);
}
//u8 NB_INST=2;
const int NB_UE_INST = 1;
int main (int argc, char **argv)
{
args_t args;
LTE_DL_FRAME_PARMS frame_parms0;
LTE_DL_FRAME_PARMS *frame_parms=&frame_parms;
char sdu0[16],sdu1[64],sdu2[1024],sdu3[1024],sdu4[1024];
unsigned short sdu_len0,sdu_len1,sdu_len2,sdu_len3,sdu_len4;
char ulsch_buffer[1024],dlsch_buffer[1024];
u8 lcid;
u8 payload_offset;
int i,comp;
logInit();
// Parse arguments
if(parse_args(argc, argv, &args) > 0) {
print_usage(argv[0]);
exit(1);
}
set_taus_seed(0);
logInit();
set_glog(LOG_TRACE, 1);
for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++)
set_comp_log(comp,
LOG_TRACE,
LOG_NONE,
1);
/*
set_log(OMG, LOG_INFO, 20);
set_log(EMU, LOG_INFO, 10);
set_log(MAC, LOG_TRACE, 1);
set_log(RLC, LOG_TRACE, 1);
set_log(PHY, LOG_DEBUG, 1);
set_log(PDCP, LOG_TRACE, 1);
set_log(RRC, LOG_TRACE, 1);
*/
mac_xface = (MAC_xface *)malloc(sizeof(MAC_xface));
init_lte_vars (&frame_parms, 0, 1, 0, 0, 25, 0, 0, 1, 1);
l2_init(frame_parms);
// Generate eNB SI
if (args.input_sib == 0) {
openair_rrc_lite_eNB_init(0);
} else {
printf("Got SI from files (%d,%d,%d)\n",
args.input_sib,args.input1_sdu_flag,args.input2_sdu_flag);
}
openair_rrc_on(0,0);
openair_rrc_lite_ue_init(0,0);
switch (args.SDUsource) {
case eNB_RRC:
if (args.RRCmessage == RRCSIB1) {
if (args.input1_sdu_flag == 1) {
for (i=0; i<args.input1_sdu_len; i++)
printf("%02x",args.input1_sdu[i]);
printf("\n");
ue_decode_si(0,142,0,args.input1_sdu,args.input1_sdu_len);
} else {
printf("\n\nSIB1\n\n");
for (i=0; i<eNB_rrc_inst[0].sizeof_SIB1; i++)
printf("%02x",eNB_rrc_inst[0].SIB1[i]);
printf("\n");
}
} else if (args.RRCmessage == RRCSIB2_3) {
if (args.input1_sdu_flag == 1) {
for (i=0; i<args.input2_sdu_len; i++)
printf("%02x",args.input2_sdu[i]);
printf("\n");
ue_decode_si(0,149,0,args.input1_sdu,args.input1_sdu_len);
} else {
printf("\n\nSIB2_3\n\n");
for (i=0; i<eNB_rrc_inst[0].sizeof_SIB23; i++)
printf("%02x",eNB_rrc_inst[0].SIB23[i]);
printf("\n");
}
} else if ((args.input1_sdu_flag == 1)&&
((args.RRCmessage == RRCConnectionSetup) ||
(args.RRCmessage == RRCConnectionReconfiguration))) {
sdu_len0 = attach_ue0(sdu0);
ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0);
if (args.RRCmessage == RRCConnectionReconfiguration)
ue_send_sdu(0,144,args.input2_sdu,args.input2_sdu_len,0);
} else {
switch (args.RRCmessage) {
case RRCConnectionSetup:
printf("Doing eNB RRCConnectionSetup\n");
sdu_len0 = attach_ue0(sdu0);
sdu_len1 = attach_ue1(sdu1);
lcid = 0;
payload_offset = generate_dlsch_header(dlsch_buffer,
1, //num_sdus
&sdu_len1, //
&lcid, // sdu_lcid
255, // no drx
0, // no timing advance
sdu0, // contention res id
0,0);
memcpy(&dlsch_buffer[payload_offset],sdu1,sdu_len1);
printf("\nRRCConnectionSetup (DLSCH input / MAC output)\n\n");
for (i=0; i<sdu_len1+payload_offset; i++)
printf("%02x ",(unsigned char)sdu1[i]);
printf("\n");
break;
case RRCConnectionReconfiguration:
printf("Doing eNB RRCConnectionReconfiguration\n");
sdu_len0 = attach_ue0(sdu0);
sdu_len1 = attach_ue1(sdu1);
sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);
sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3);
lcid=1;
payload_offset = generate_dlsch_header(dlsch_buffer,
// offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0],
1, //num_sdus
&sdu_len3, //
&lcid,
255, // no drx
1, // timing advance
NULL, // contention res idk
0,0);
memcpy(&dlsch_buffer[payload_offset],sdu3,sdu_len3);
printf("\nRRCConnectionReconfiguration (DLSCH input / MAC output)\n\n");
for (i=0; i<sdu_len3+payload_offset; i++)
printf("%02x ",(unsigned char)dlsch_buffer[i]);
printf("\n");
break;
default:
printf("Unknown eNB_RRC SDU (%d), exiting\n",args.RRCmessage);
break;
}
break;
}
break;
case eNB_MAC:
sdu_len0 = attach_ue0(sdu0);
ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0);
break;
case UE_RRC:
switch (args.RRCmessage) {
case RRCConnectionRequest:
sdu_len0 = attach_ue0(sdu0);
printf("\n\nRRCConnectionRequest\n\n");
for (i=0; i<sdu_len0; i++)
printf("%02x ",(unsigned char)sdu0[i]);
printf("\n");
break;
case RRCConnectionSetupComplete:
sdu_len0=attach_ue0(sdu0);
sdu_len1 = attach_ue1(sdu1);
sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);
lcid=1;
printf("Got sdu of length %d\n",sdu_len2);
payload_offset = generate_ulsch_header((u8*)ulsch_buffer, // mac header
1, // num sdus
0, // short pading
&sdu_len2, // sdu length
&lcid, // sdu lcid
NULL, // power headroom
NULL, // crnti
NULL, // truncated bsr
NULL, // short bsr
NULL, // long_bsr
0);
printf("Got MAC header of length %d\n",payload_offset);
memcpy(&ulsch_buffer[payload_offset],sdu2,sdu_len2);
printf("\n\nRRCConnectionSetupComplete (ULSCH input / MAC output)\n\n");
for (i=0; i<sdu_len2+payload_offset; i++)
printf("%02x ",(unsigned char)ulsch_buffer[i]);
printf("\n");
break;
case RRCConnectionReconfigurationComplete:
sdu_len0=attach_ue0(sdu0);
sdu_len1=attach_ue1(sdu1);
sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);
sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3);
sdu_len4 = attach_ue4(sdu3,sdu_len3,sdu4);
lcid=1;
printf("Got sdu of length %d\n",sdu_len4);
payload_offset = generate_ulsch_header((u8*)ulsch_buffer, // mac header
1, // num sdus
0, // short pading
&sdu_len4, // sdu length
&lcid, // sdu lcid
NULL, // power headroom
NULL, // crnti
NULL, // truncated bsr
NULL, // short bsr
NULL, // long_bsr
0);
printf("Got MAC header of length %d\n",payload_offset);
memcpy(&ulsch_buffer[payload_offset],sdu4,sdu_len4);
printf("\n\nRRCConnectionReconfigurationComplete (ULSCH input / MAC output)\n\n");
for (i=0; i<sdu_len4+payload_offset; i++)
printf("%02x ",(unsigned char)ulsch_buffer[i]);
printf("\n");
break;
default:
printf("Unknown UE_RRC SDU (%d), exiting\n",args.RRCmessage);
break;
}
break;
}
free(mac_xface);
return(0);
}