X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=RSM%2Fe2pdus%2Fresource_status_request.go;h=d0da36cacb4f68d8d5f5f3c02daabee8cdc1b3f4;hb=60652d98d51ee23c1eaca2e8bc2bf19c74c57658;hp=ebff854e7200817327ef8d4ebb1f57ce4d646015;hpb=7b80668df78103cebafdfb7caa0070dc92ed3779;p=ric-plt%2Fresource-status-manager.git diff --git a/RSM/e2pdus/resource_status_request.go b/RSM/e2pdus/resource_status_request.go index ebff854..d0da36c 100644 --- a/RSM/e2pdus/resource_status_request.go +++ b/RSM/e2pdus/resource_status_request.go @@ -1,5 +1,4 @@ -/******************************************************************************* - * +/* * Copyright (c) 2019 AT&T Intellectual Property. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,12 +12,18 @@ * 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. - * - *******************************************************************************/ + */ + +/* + * This source code is part of the near-RT RIC (RAN Intelligent Controller) + * platform project (RICP). + */ + package e2pdus -// #cgo CFLAGS: -I../asn1codec/inc/ -I../asn1codec/e2ap_engine/ -// #cgo LDFLAGS: -L ../asn1codec/lib/ -L../asn1codec/e2ap_engine/ -le2ap_codec -lasncodec +// #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" @@ -37,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 @@ -59,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: @@ -114,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),