Fixes to SI message struct item in CU messages

* num_SI is the size of the list of gNB-CU System Information messages
* the new struct member is an array, sized after the maximum nb
  of SIB types, which contains the SI container, the container length
  and the SIB type
This commit is contained in:
Guido Casati
2024-09-25 15:38:41 +02:00
parent 4b5ea6dcf8
commit da6b1a4be4
3 changed files with 53 additions and 36 deletions
+27 -17
View File
@@ -322,14 +322,22 @@ int CU_send_F1_SETUP_RESPONSE(sctp_assoc_t assoc_id, f1ap_setup_resp_t *f1ap_set
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
for (int sIBtype=2; sIBtype<21; sIBtype++) {
if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = sIBtype;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype],
f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
for (int n = 0; n < f1ap_setup_resp->cells_to_activate[i].num_SI; n++) {
if (f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container != NULL) {
if (f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type > 6
&& f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type != 9) {
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container,
f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container_length);
LOG_D(F1AP,
"f1ap_setup_resp->cells_to_activate[%d].SI_msg[%d].SI_container_length = %d \n",
i,
n,
f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container_length);
}
}
}
}
}
@@ -875,16 +883,18 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(sctp_assoc_t assoc_id, f1ap_gnb_cu_confi
//printf("\n");
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
for (int sIBtype=2; sIBtype<21; sIBtype++) {
if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
for (int j = 0; j < sizeofArray(f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_msg); j++) {
f1ap_sib_msg_t *SI_msg = &f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_msg[j];
if (SI_msg->SI_container != NULL) {
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = sIBtype;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype],
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
sib_item->sIBtype = SI_msg->SI_type;
AssertFatal(sib_item->sIBtype < 6 || sib_item->sIBtype == 9, "Illegal SI type %ld\n", sib_item->sIBtype);
OCTET_STRING_fromBuf(&sib_item->sIBmessage, (const char *)SI_msg->SI_container, SI_msg->SI_container_length);
LOG_D(F1AP,
"f1ap_gnb_cu_configuration_update->SI_container_length[%d][sIBtype %ld] = %d \n",
i,
sib_item->sIBtype,
SI_msg->SI_container_length);
}
}
}
+14 -15
View File
@@ -525,15 +525,15 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint
resp.cells_to_activate[i].plmn.mnc,
resp.cells_to_activate[i].nr_cellid,
resp.cells_to_activate[i].num_SI);
for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
size_t size = sib_item->sIBmessage.size;
resp.cells_to_activate[i].SI_container_length[si] = size;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size);
resp.cells_to_activate[i].SI_container[si] = malloc(resp.cells_to_activate[i].SI_container_length[si]);
memcpy(resp.cells_to_activate[i].SI_container[si], sib_item->sIBmessage.buf, size);
resp.cells_to_activate[i].SI_type[si]=sib_item->sIBtype;
for (int s = 0; s < resp.cells_to_activate[i].num_SI; s++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[s];
f1ap_sib_msg_t *SI_msg = &resp.cells_to_activate[i].SI_msg[s];
SI_msg->SI_container = calloc(sib_item->sIBmessage.size, sizeof(uint8_t));
AssertFatal(SI_msg->SI_container != NULL, "out of memory\n");
memcpy(SI_msg->SI_container, sib_item->sIBmessage.buf, sib_item->sIBmessage.size);
SI_msg->SI_container_length = sib_item->sIBmessage.size;
SI_msg->SI_type = sib_item->sIBtype;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, sib_item->sIBmessage.size);
}
break;
@@ -816,13 +816,12 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t asso
for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
size_t size = sib_item->sIBmessage.size;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si] = size;
f1ap_sib_msg_t *SI_msg = &F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].SI_msg[si];
SI_msg->SI_container_length = size;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size);
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si]);
memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si],
(void *)sib_item->sIBmessage.buf,
size);
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype;
SI_msg->SI_container = malloc(SI_msg->SI_container_length);
memcpy((void *)SI_msg->SI_container, (void *)sib_item->sIBmessage.buf, size);
SI_msg->SI_type = sib_item->sIBtype;
}
break;