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 ==================================================================================
23 #include <e2sm/wrapper.h>
24 #cgo LDFLAGS: -le2smwrapper -lm
25 #cgo CFLAGS: -I/usr/local/include/e2sm
31 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
38 func (c *E2sm) SetRicControlHeader(buffer []byte, ueIDbuf []byte, ricControlStyleType int64, ricControlActionID int64) (newBuffer []byte, err error) {
39 cptr := unsafe.Pointer(&buffer[0])
40 cptr_ueIDbuf := unsafe.Pointer(&ueIDbuf[0])
41 size := C.e2sm_encode_ric_control_header(cptr, C.size_t(len(buffer)), cptr_ueIDbuf, C.size_t(len(ueIDbuf)),
42 C.long(ricControlStyleType), C.long(ricControlActionID))
45 return make([]byte, 0), errors.New("e2sm wrapper is unable to set EventTriggerDefinition due to wrong or invalid input")
47 newBuffer = C.GoBytes(cptr, (C.int(size)+7)/8)
48 xapp.Logger.Info("E2sm SetRicControlHeader is success")
52 func (c *E2sm) SetRicControlMessage(buffer []byte, targetPrimaryCell int64, targetCell int64, nrCGIOrECGI int64, nrOrEUtraCell int64, ranParameterValue []byte) (newBuffer []byte, err error) {
53 cptr := unsafe.Pointer(&buffer[0])
54 cptrRanParameterValue := unsafe.Pointer(&ranParameterValue[0])
56 size := C.e2sm_encode_ric_control_message(cptr, C.size_t(len(buffer)), C.long(targetPrimaryCell),
57 C.long(targetCell), C.long(nrOrEUtraCell), C.long(nrCGIOrECGI), cptrRanParameterValue, C.size_t(len(ranParameterValue)))
59 return make([]byte, 0), errors.New("e2sm wrapper is unable to set RicControlMessage due to wrong or invalid input")
61 newBuffer = C.GoBytes(cptr, (C.int(size)+7)/8) //TOCHECK: if C.int(size) is returning bits not bytes to get correct size of the buffer.
62 xapp.Logger.Info("E2sm SetRicControlMessage is success")