Commit 447c4706 authored by Francesco Mani's avatar Francesco Mani

Merge branch 'NR_RRCConfiguration' of...

Merge branch 'NR_RRCConfiguration' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_RRCConfiguration
parents b904161f ad1a102f
......@@ -8510,7 +8510,7 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP,
unsigned char buffer[8192];
int size;
ue_context = (rrc_eNB_ue_context_t *) get_first_ue_context(RC.rrc[enb_mod_idP]);
ue_context = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], m->rnti);
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
0,
......@@ -8893,9 +8893,6 @@ rrc_enb_task(
{
rrc_enb_init();
void rrc_endc_hack_init(void);
rrc_endc_hack_init();
itti_mark_task_ready(TASK_RRC_ENB);
LOG_I(RRC,"Entering main loop of RRC message task\n");
......
......@@ -241,163 +241,3 @@ printf("\n");
return (enc_rval.encoded + 7) / 8;
}
volatile int go_nr;
struct rrc_eNB_ue_context_s *
get_first_ue_context(eNB_RRC_INST *rrc_instance_pP)
{
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) {
return ue_context_p;
}
return NULL;
}
void rrc_go_nr(void)
{
protocol_ctxt_t ctxt;
rrc_eNB_ue_context_t *ue_context;
unsigned char buffer[8192];
int size;
go_nr = 0;
ue_context = get_first_ue_context(RC.rrc[0]);
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
0,
ENB_FLAG_YES,
ue_context->ue_context.rnti,
0, 0);
size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, NULL, NULL);
rrc_data_req(&ctxt,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
static void new_thread(void *(*f)(void *), void *data) {
pthread_t t;
pthread_attr_t att;
if (pthread_attr_init(&att)) {
fprintf(stderr, "pthread_attr_init err\n");
exit(1);
}
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
fprintf(stderr, "pthread_attr_setdetachstate err\n");
exit(1);
}
if (pthread_attr_setstacksize(&att, 10000000)) {
fprintf(stderr, "pthread_attr_setstacksize err\n");
exit(1);
}
if (pthread_create(&t, &att, f, data)) {
fprintf(stderr, "pthread_create err\n");
exit(1);
}
if (pthread_attr_destroy(&att)) {
fprintf(stderr, "pthread_attr_destroy err\n");
exit(1);
}
}
static int create_listen_socket(char *addr, int port) {
struct sockaddr_in a;
int s;
int v;
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) {
perror("socket");
exit(1);
}
v = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int))) {
perror("setsockopt");
exit(1);
}
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
perror("bind");
exit(1);
}
if (listen(s, 5)) {
perror("listen");
exit(1);
}
return s;
}
static int socket_accept(int s) {
struct sockaddr_in a;
socklen_t alen;
alen = sizeof(a);
return accept(s, (struct sockaddr *)&a, &alen);
}
static int fullread(int fd, void *_buf, int count) {
char *buf = _buf;
int ret = 0;
int l;
while (count) {
l = read(fd, buf, count);
if (l <= 0) return -1;
count -= l;
buf += l;
ret += l;
}
return ret;
}
void *nr_hack(void *_)
{
int s = create_listen_socket("0.0.0.0", 9001);
int t;
over:
t = socket_accept(s);
while (1) {
char c;
if (fullread(t, &c, 1) != 1) {
close(t);
goto over;
}
if (c != '\n') continue;
printf("setting go_nr to 1\n");
go_nr = 1;
}
return 0;
}
void rrc_endc_hack_init(void)
{
new_thread(nr_hack, NULL);
}
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