container tag updated
[ric-app/rc.git] / control / rcE2AP.go
index 456b6d0..e305125 100644 (file)
@@ -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
+}