X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=ric-plt%2Fresource-status-manager.git;a=blobdiff_plain;f=RSM%2Fe2pdus%2Fresource_status_request.go;fp=RSM%2Fe2pdus%2Fresource_status_request.go;h=d0da36cacb4f68d8d5f5f3c02daabee8cdc1b3f4;hp=490e62ec048a24c5dac302991c68d83eaf99e298;hb=60652d98d51ee23c1eaca2e8bc2bf19c74c57658;hpb=b8d3ff3abf409da49ecab244cd6d2c2124dbce7c diff --git a/RSM/e2pdus/resource_status_request.go b/RSM/e2pdus/resource_status_request.go index 490e62e..d0da36c 100644 --- a/RSM/e2pdus/resource_status_request.go +++ b/RSM/e2pdus/resource_status_request.go @@ -23,6 +23,7 @@ package e2pdus // #cgo CFLAGS: -I../3rdparty/asn1codec/inc/ -I../3rdparty/asn1codec/e2ap_engine/ // #cgo LDFLAGS: -L ../3rdparty/asn1codec/lib/ -L../3rdparty/asn1codec/e2ap_engine/ -le2ap_codec -lasncodec +// #include // #include // #include import "C" @@ -41,7 +42,7 @@ const ( type Measurement_ID int64 type ResourceStatusRequestData struct { - CellID string // PLMNIdentifier:eUTRANCellIdentifier + CellIdList []string // PLMNIdentifier:eUTRANCellIdentifier MeasurementID Measurement_ID MeasurementID2 Measurement_ID PartialSuccessAllowed bool @@ -63,18 +64,34 @@ func BuildPackedResourceStatusRequest(registrationRequest enums.Registration_Req packedBufSize := C.ulong(len(packedBuf)) pduAsString := "" - var pLMNIdentifier, eUTRANCellIdentifier string + pLMNIdentities := make([]*C.uchar, len(request.CellIdList)) + eUTRANCellIdentifiers := make([]*C.uchar, len(request.CellIdList)) - if _, err := fmt.Sscanf(request.CellID, "%x:%x", &pLMNIdentifier, &eUTRANCellIdentifier); err != nil { - return nil, "", fmt.Errorf("BuildPackedResourceStatusRequest() - unexpected CellID value [%s] (want: \":\"), err: %s", request.CellID, err) + for i, cellID := range request.CellIdList { + var pLMNIdentity, eUTRANCellIdentifier []byte + if _, err := fmt.Sscanf(cellID, "%x:%x", &pLMNIdentity, &eUTRANCellIdentifier); err != nil { + return nil, "", fmt.Errorf("BuildPackedResourceStatusRequest() - unexpected CellID value [%s]@%d (want: \":\"), err: %s", cellID, i, err) + } + pLMNIdentities[i], eUTRANCellIdentifiers[i] = (*C.uchar)(C.CBytes(pLMNIdentity)), (*C.uchar)(C.CBytes(eUTRANCellIdentifier)) } + defer func() { + for _, cPtr := range pLMNIdentities { + C.free(unsafe.Pointer(cPtr)) + + } + for _, cPtr := range eUTRANCellIdentifiers { + C.free(unsafe.Pointer(cPtr)) + } + + }() + /* - 9.2.0 General - When specifying information elements which are to be represented by bit strings, if not otherwise specifically stated in the semantics description of the concerned IE or elsewhere, the following principle applies with regards to the ordering of bits: - - The first bit (leftmost bit) contains the most significant bit (MSB); - - The last bit (rightmost bit) contains the least significant bit (LSB); - - When importing bit strings from other specifications, the first bit of the bit string contains the first bit of the concerned information. + 9.2.0 General + When specifying information elements which are to be represented by bit strings, if not otherwise specifically stated in the semantics description of the concerned IE or elsewhere, the following principle applies with regards to the ordering of bits: + - The first bit (leftmost bit) contains the most significant bit (MSB); + - The last bit (rightmost bit) contains the least significant bit (LSB); + - When importing bit strings from other specifications, the first bit of the bit string contains the first bit of the concerned information. */ /*reportCharacteristics: @@ -118,8 +135,9 @@ func BuildPackedResourceStatusRequest(registrationRequest enums.Registration_Req reportCharacteristics := uint32(prbPeriodic<<7 | tnlLoadIndPeriodic<<6 | hwLoadIndPeriodic<<5 | compositeAvailablCapacityPeriodic<<4 | absStatusPeriodic<<3 | rsrpMeasurementPeriodic<<2 | csiPeriodic<<1) if !C.build_pack_resource_status_request( - (*C.uchar)(unsafe.Pointer(&[]byte(pLMNIdentifier)[0])), - (*C.uchar)(unsafe.Pointer(&[]byte(eUTRANCellIdentifier)[0])), + (**C.uchar)(unsafe.Pointer(&pLMNIdentities[0])), + (**C.uchar)(unsafe.Pointer(&eUTRANCellIdentifiers[0])), + C.ulong(len(request.CellIdList)), C.Measurement_ID_t(request.MeasurementID), C.Measurement_ID_t(request.MeasurementID2), C.Registration_Request_t(registrationRequest),