X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2FrcE2AP.go;h=e30512584f630de4ccef6d74d86002f16253eecf;hb=refs%2Fchanges%2F67%2F8467%2F1;hp=ee3db21d40e759b440e72b7203029bdadce8b504;hpb=301648c2a948e736d7922293108d6980bd9bf429;p=ric-app%2Frc.git diff --git a/control/rcE2AP.go b/control/rcE2AP.go index ee3db21..e305125 100644 --- a/control/rcE2AP.go +++ b/control/rcE2AP.go @@ -40,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 +}