X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2FrcE2AP.go;h=e30512584f630de4ccef6d74d86002f16253eecf;hb=a829dab71827b00d48740684a122cbaa2f56ba6f;hp=456b6d03c7830cc32b9a12755dd24b3ac85dcc32;hpb=727cefb2889f78571bfc655359e03bf20227381c;p=ric-app%2Frc.git diff --git a/control/rcE2AP.go b/control/rcE2AP.go index 456b6d0..e305125 100644 --- a/control/rcE2AP.go +++ b/control/rcE2AP.go @@ -1,22 +1,3 @@ -/* -================================================================================== - Copyright (c) 2019 AT&T Intellectual Property. - Copyright (c) 2019 Nokia - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - 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. -================================================================================== -*/ - package control /* @@ -59,3 +40,24 @@ func (c *E2ap) SetRicControlRequestPayload(payload []byte, ricRequestorID uint16 return } + +func (c *E2ap) GetControlAckMsg(payload []byte) (decodedMsg *ControlAckMsg, err error) { + cptr := unsafe.Pointer(&payload[0]) + decodedMsg = &ControlAckMsg{} + decodedCMsg := C.e2ap_decode_ric_control_acknowledge_message(cptr, C.size_t(len(payload))) + if decodedCMsg == nil { + return decodedMsg, errors.New("e2ap wrapper is unable to decode indication message due to wrong or invalid payload") + } + defer C.e2ap_free_decoded_ric_control_ack(decodedCMsg) + + decodedMsg.RequestID = int32(decodedCMsg.requestorID) + decodedMsg.InstanceId = int32(decodedCMsg.instanceID) + decodedMsg.FuncID = int32(decodedCMsg.ranfunctionID) + callproc := unsafe.Pointer(decodedCMsg.callProcessID) + decodedMsg.CallProcessID = C.GoBytes(callproc, C.int(decodedCMsg.callProcessIDSize)) + decodedMsg.CallProcessIDLength = int32(decodedCMsg.callProcessIDSize) + controlOutcome := unsafe.Pointer(decodedCMsg.ricControlOutCome) + decodedMsg.ControlOutcome = C.GoBytes(controlOutcome, C.int(decodedCMsg.ricControlOutComeSize)) + decodedMsg.ControlOutcomeLength = int32(decodedCMsg.ricControlOutComeSize) + return +}