diff --git a/executables/agent_if/ie/kpm_data_ie.h b/executables/agent_if/ie/kpm_data_ie.h index aff1c823f36ebcbec21c908c90a8c48052e88f0c..746368c072d6c85c50c6e948e1f49d8abc2e17f0 100644 --- a/executables/agent_if/ie/kpm_data_ie.h +++ b/executables/agent_if/ie/kpm_data_ie.h @@ -55,45 +55,34 @@ extern "C" { /* * SEC 0: General data types that make the mapping between ASN data types and RIC ones */ -typedef byte_array_t adapter_OCTET_STRING_t; -typedef adapter_OCTET_STRING_t adapter_PrintableString_t; -typedef adapter_OCTET_STRING_t adapter_TimeStamp_t; // IETF RFC 5905 , NTP spec, 4 bytes long - -/******************************************************* - * SEC 1. RIC Event Trigger Definition as per $8.2.1.1 - *******************************************************/ -typedef struct kpm_event_trigger_t { - unsigned long ms; // reporting period in milliseconds -} kpm_event_trigger_t; - -/******************************************************* - * SEC 2. RIC Action Definition as per $8.2.1.2 - *******************************************************/ - -typedef byte_array_t adapter_MeasurementTypeName_t; -typedef long adapter_MeasurementTypeID_t; -typedef byte_array_t adapter_PLMNIdentity_t; // 3 bytes size -typedef uint64_t adapter_NRCellIdentity_t; // 36 bits size +typedef byte_array_t adapter_OCTET_STRING_t; +typedef adapter_OCTET_STRING_t adapter_PrintableString_t; +typedef uint32_t adapter_TimeStamp_t; // IETF RFC 5905 , NTP spec, 4 bytes long + +typedef adapter_PrintableString_t adapter_MeasurementTypeName_t; +typedef long adapter_MeasurementTypeID_t; +typedef byte_array_t adapter_PLMNIdentity_t; // 3 bytes size +typedef uint64_t adapter_NRCellIdentity_t; // 36 bits size -typedef long adapter_QCI_t; -typedef byte_array_t adapter_SST_t;// size = 1 byte -typedef byte_array_t adapter_SD_t; // size = 3 byte +typedef long adapter_QCI_t; +typedef byte_array_t adapter_SST_t;// size = 1 byte +typedef byte_array_t adapter_SD_t; // size = 3 byte typedef struct S_NSSAI { adapter_SST_t sST; adapter_SD_t *sD; /* OPTIONAL */ } adapter_S_NSSAI_t; -typedef long adapter_FiveQI_t; // values: 0..255 -typedef long adapter_QosFlowIdentifier_t; - +typedef long adapter_FiveQI_t; // values: 0..255 +typedef long adapter_QosFlowIdentifier_t; +typedef uint64_t adapter_EUTRACellIdentity_t; // 28 bit size /* - * Structure 'adapter_LabelInfoList_t' defines the values of the subcounters that are applicable to an associated measurement type + * Structure 'adapter_LabelInfoItem_t_t' defines the values of the subcounters that are applicable to an associated measurement type * identified by measName or measID. All the fields are indicated as optional. If value is != NULL, it means presence of the optional * field. */ -typedef struct adapter_LabelInfoList_t { +typedef struct adapter_LabelInfoItem_t { long *noLabel; /* OPTIONAL: looks like this is an enumeration datatype that accepts only true (0) */ adapter_PLMNIdentity_t *plmnID; /* OPTIONAL */ adapter_S_NSSAI_t *sliceID; /* OPTIONAL */ @@ -115,18 +104,29 @@ typedef struct adapter_LabelInfoList_t { long *min; /* OPTIONAL */ long *max; /* OPTIONAL */ long *avg; /* OPTIONAL */ -} adapter_LabelInfoList_t; +} adapter_LabelInfoItem_t; + +void free_label_info(adapter_LabelInfoItem_t *l); +void cp_label_info(adapter_LabelInfoItem_t *dst, adapter_LabelInfoItem_t const *src); typedef struct MeasInfo_t { enum {MeasurementType_NAME = 1, MeasurementType_ID=2} measType; adapter_MeasurementTypeName_t measName; adapter_MeasurementTypeID_t measID; - adapter_LabelInfoList_t *labelInfo; // list implemented as array having a maximum of 'maxnoofLabelInfo' items + adapter_LabelInfoItem_t *labelInfo; // list implemented as array having a maximum of 'maxnoofLabelInfo' items size_t labelInfo_len;// length of the array labelInfo } MeasInfo_t; -typedef uint64_t adapter_EUTRACellIdentity_t; // 28 bit size +/******************************************************* + * SEC 1. RIC Event Trigger Definition as per $8.2.1.1 + *******************************************************/ +typedef struct kpm_event_trigger_t { + unsigned long ms; // reporting period in milliseconds +} kpm_event_trigger_t; +/******************************************************* + * SEC 2. RIC Action Definition as per $8.2.1.2 + *******************************************************/ typedef struct kpm_action_def_t { /* @@ -166,7 +166,6 @@ typedef struct kpm_action_def_t } kpm_action_def_t; void free_kpm_action_def(kpm_action_def_t* src); -void free_kpm_label_info(adapter_LabelInfoList_t *l); /************************************************ * SEC 3. RIC Indication Header as per $8.2.1.3.1 ************************************************/ diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c324793fd0026037e2ebf453b770af2982c16122..18656aa8013ac8062f3d621dca3f51081d6af669 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -941,17 +941,8 @@ void read_kpm_sm(kpm_ind_data_t* data) // Fill KPM indication header kpm_ind_hdr_t* hdr = &data->hdr; - hdr->collectStartTime.len = 4; - hdr->collectStartTime.buf = calloc(1, 4); - assert(hdr->collectStartTime.buf != NULL && "memory exhausted"); - int64_t t = time_now_us(); - uint32_t t_truncated = t / 1000000; -#if BYTE_ORDER == LITTLE_ENDIAN - t_truncated = __bswap_32 (t_truncated); -#endif - - memcpy(hdr->collectStartTime.buf, &t_truncated, 4); + hdr->collectStartTime = t / 1000000; // needs to be truncated to 32 bits to arrive to a resolution of seconds hdr->fileFormatversion = NULL; hdr->senderName = NULL; hdr->senderType = NULL; @@ -1060,10 +1051,12 @@ void read_kpm_sm(kpm_ind_data_t* data) // TODO: assign labelInfo_len according to the action definition (?) info->labelInfo_len = 1; - info->labelInfo = calloc(info->labelInfo_len, sizeof(adapter_LabelInfoList_t)); - adapter_LabelInfoList_t* label = &info->labelInfo[0]; + info->labelInfo = calloc(info->labelInfo_len, sizeof(adapter_LabelInfoItem_t)); + assert(info->labelInfo != NULL && "memory exhausted"); + adapter_LabelInfoItem_t* label = &info->labelInfo[0]; label->noLabel = calloc(1, sizeof(long)); - *(label->noLabel) = 1; + assert(label->noLabel != NULL && "memory exhausted"); + *(label->noLabel) = 0; } } else { for (size_t i = 0; i < msg->MeasData_len; i++) {