2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
24 #include <e2ap/wrapper.h>
25 #cgo LDFLAGS: -le2apwrapper
26 #cgo CFLAGS: -I/usr/local/include/e2ap
32 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
39 func (c *E2ap) SetRicControlRequestPayload(payload []byte, ricRequestorID uint16, ricRequestSequenceNumber uint16, ranFunctionID uint16,
40 ricControlHdr []byte, ricControlMsg []byte) (newPayload []byte, err error) {
42 cptr := unsafe.Pointer(&payload[0])
43 cptr_ricControlHdr := unsafe.Pointer(&ricControlHdr[0])
44 cptr_ricControlMsg := unsafe.Pointer(&ricControlMsg[0])
46 xapp.Logger.Debug("\n")
47 xapp.Logger.Debug("ricControlHdr\n", ricControlHdr)
48 xapp.Logger.Debug("\n")
49 xapp.Logger.Debug("ricControlMsg\n", ricControlMsg)
50 xapp.Logger.Debug("\n")
52 size := C.e2ap_encode_ric_control_request_message(cptr, C.size_t(len(payload)), C.long(ricRequestorID), C.long(ricRequestSequenceNumber),
53 C.long(ranFunctionID), cptr_ricControlHdr, C.size_t(len(ricControlHdr)), cptr_ricControlMsg, C.size_t(len(ricControlMsg)))
55 return make([]byte, 0), errors.New("e2ap wrapper is unable to set Subscription Request Payload due to wrong or invalid payload")
57 newPayload = C.GoBytes(cptr, (C.int(size)+7)/8)
58 xapp.Logger.Info("SetRicControlHeader is success")