X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2FrcE2AP.go;h=c2beae3c1dc80a67144b95879e8f166382d47d85;hb=90fe232d4ef733461b703bfaf5f8b56319f83339;hp=e30512584f630de4ccef6d74d86002f16253eecf;hpb=6218ae594c4e2c23156c839a009aa25d4a004503;p=ric-app%2Frc.git diff --git a/control/rcE2AP.go b/control/rcE2AP.go index e305125..c2beae3 100644 --- a/control/rcE2AP.go +++ b/control/rcE2AP.go @@ -61,3 +61,26 @@ func (c *E2ap) GetControlAckMsg(payload []byte) (decodedMsg *ControlAckMsg, err decodedMsg.ControlOutcomeLength = int32(decodedCMsg.ricControlOutComeSize) return } + +func (c *E2ap) GetControlFailureMsg(payload []byte) (decodedMsg *ControlFailureMsg, err error) { + cptr := unsafe.Pointer(&payload[0]) + decodedMsg = &ControlFailureMsg{} + decodedCMsg := C.e2ap_decode_ric_control_failure_message(cptr, C.size_t(len(payload))) + if decodedCMsg == nil { + return decodedMsg, errors.New("e2ap wrapper is unable to decode control failure message due to wrong or invalid payload") + } + defer C.e2ap_free_decoded_ric_control_failure(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) + decodedMsg.CauseType = int32(decodedCMsg.causeType) + decodedMsg.CauseValue = int64(decodedCMsg.causeValue) + controlOutcome := unsafe.Pointer(decodedCMsg.ricControlOutCome) + decodedMsg.ControlOutcome = C.GoBytes(controlOutcome, C.int(decodedCMsg.ricControlOutComeSize)) + decodedMsg.ControlOutcomeLength = int32(decodedCMsg.ricControlOutComeSize) + return +}