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 ==================================================================================
22 // #cgo LDFLAGS: -le2ap_wrapper -le2ap -lstdc++
23 // #include <stdlib.h>
24 // #include <c_types.h>
25 // #include <E2AP_if.h>
26 // #include <strings.h>
28 // void initSubsRequest(RICSubscriptionRequest_t *data){
29 // bzero(data,sizeof(RICSubscriptionRequest_t));
31 // void initSubsResponse(RICSubscriptionResponse_t *data){
32 // bzero(data,sizeof(RICSubscriptionResponse_t));
34 // void initSubsFailure(RICSubscriptionFailure_t *data){
35 // bzero(data,sizeof(RICSubscriptionFailure_t));
37 // void initSubsDeleteRequest(RICSubscriptionDeleteRequest_t *data){
38 // bzero(data,sizeof(RICSubscriptionDeleteRequest_t));
40 // void initSubsDeleteResponse(RICSubscriptionDeleteResponse_t *data){
41 // bzero(data,sizeof(RICSubscriptionDeleteResponse_t));
43 // void initSubsDeleteFailure(RICSubscriptionDeleteFailure_t *data){
44 // bzero(data,sizeof(RICSubscriptionDeleteFailure_t));
52 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/conv"
53 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
54 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer"
58 //-----------------------------------------------------------------------------
60 //-----------------------------------------------------------------------------
61 type e2apEntryRequestID struct {
62 entry *C.RICRequestID_t
65 func (e2Item *e2apEntryRequestID) set(id *e2ap.RequestId) error {
66 e2Item.entry.ricRequestorID = (C.uint32_t)(id.Id)
67 e2Item.entry.ricRequestSequenceNumber = (C.uint32_t)(id.Seq)
71 func (e2Item *e2apEntryRequestID) get(id *e2ap.RequestId) error {
72 id.Id = (uint32)(e2Item.entry.ricRequestorID)
73 id.Seq = (uint32)(e2Item.entry.ricRequestSequenceNumber)
77 //-----------------------------------------------------------------------------
79 //-----------------------------------------------------------------------------
80 type e2apEntryActionToBeSetupItem struct {
81 entry *C.RICActionToBeSetupItem_t
84 func (e2Item *e2apEntryActionToBeSetupItem) set(id *e2ap.ActionToBeSetupItem) error {
86 e2Item.entry.ricActionID = (C.ulong)(id.ActionId)
87 e2Item.entry.ricActionType = (C.uint64_t)(id.ActionType)
89 if id.ActionDefinition.Present {
90 e2Item.entry.ricActionDefinitionPresent = true
91 e2Item.entry.ricActionDefinition.styleID = (C.uint64_t)(id.ActionDefinition.StyleId)
92 e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID = (C.uint32_t)(id.ActionDefinition.ParamId)
93 //e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue = id.ActionDefinition.ParamValue
96 if id.SubsequentAction.Present {
97 e2Item.entry.ricSubsequentActionPresent = true
98 e2Item.entry.ricSubsequentAction.ricSubsequentActionType = (C.uint64_t)(id.SubsequentAction.Type)
99 e2Item.entry.ricSubsequentAction.ricTimeToWait = (C.uint64_t)(id.SubsequentAction.TimetoWait)
104 func (e2Item *e2apEntryActionToBeSetupItem) get(id *e2ap.ActionToBeSetupItem) error {
106 id.ActionId = (uint64)(e2Item.entry.ricActionID)
107 id.ActionType = (uint64)(e2Item.entry.ricActionType)
109 if e2Item.entry.ricActionDefinitionPresent {
110 id.ActionDefinition.Present = true
111 id.ActionDefinition.StyleId = (uint64)(e2Item.entry.ricActionDefinition.styleID)
112 id.ActionDefinition.ParamId = (uint32)(e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID)
113 //id.ActionDefinition.ParamValue=e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue
116 if e2Item.entry.ricSubsequentActionPresent {
117 id.SubsequentAction.Present = true
118 id.SubsequentAction.Type = (uint64)(e2Item.entry.ricSubsequentAction.ricSubsequentActionType)
119 id.SubsequentAction.TimetoWait = (uint64)(e2Item.entry.ricSubsequentAction.ricTimeToWait)
124 //-----------------------------------------------------------------------------
126 //-----------------------------------------------------------------------------
127 type e2apEntryPlmnIdentity struct {
128 entry *C.PLMNIdentity_t
131 func (plmnId *e2apEntryPlmnIdentity) set(id *conv.PlmnIdentity) error {
133 plmnId.entry.contentLength = (C.uint8_t)(len(id.Val))
134 for i := 0; i < len(id.Val); i++ {
135 plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(id.Val[i])
140 func (plmnId *e2apEntryPlmnIdentity) get(id *conv.PlmnIdentity) error {
141 conlen := (int)(plmnId.entry.contentLength)
142 bcdBuf := make([]uint8, conlen)
143 for i := 0; i < conlen; i++ {
144 bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i])
150 //-----------------------------------------------------------------------------
152 //-----------------------------------------------------------------------------
153 type e2apEntryGlobalEnbId struct {
154 entry *C.GlobalNodeID_t
157 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
159 case e2ap.E2AP_ENBIDMacroPBits20:
161 case e2ap.E2AP_ENBIDHomeBits28:
163 case e2ap.E2AP_ENBIDShortMacroits18:
165 case e2ap.E2AP_ENBIDlongMacroBits21:
168 return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
171 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
172 if err := enbId.checkbits(id.NodeId.Bits); err != nil {
175 enbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
176 enbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
177 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
180 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
181 if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
184 id.NodeId.Bits = (uint8)(enbId.entry.nodeID.bits)
185 id.NodeId.Id = (uint32)(enbId.entry.nodeID.nodeID)
186 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
189 //-----------------------------------------------------------------------------
191 //-----------------------------------------------------------------------------
192 type e2apEntryGlobalGnbId struct {
193 entry *C.GlobalNodeID_t
196 func (gnbId *e2apEntryGlobalGnbId) checkbits(bits uint8) error {
197 if bits < 22 || bits > 32 {
198 return fmt.Errorf("GlobalGnbId: given bits %d not match allowed: 22-32", bits)
203 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
204 if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
207 gnbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
208 gnbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
209 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
212 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
213 if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
216 id.NodeId.Bits = (uint8)(gnbId.entry.nodeID.bits)
217 id.NodeId.Id = (uint32)(gnbId.entry.nodeID.nodeID)
218 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
221 //-----------------------------------------------------------------------------
223 //-----------------------------------------------------------------------------
224 type e2apEntryInterfaceId struct {
225 entry *C.InterfaceID_t
228 func (indId *e2apEntryInterfaceId) set(id *e2ap.InterfaceId) error {
229 if id.GlobalEnbId.Present {
230 indId.entry.globalENBIDPresent = true
231 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).set(&id.GlobalEnbId); err != nil {
236 if id.GlobalGnbId.Present {
237 indId.entry.globalGNBIDPresent = true
238 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
245 func (indId *e2apEntryInterfaceId) get(id *e2ap.InterfaceId) error {
246 if indId.entry.globalENBIDPresent == true {
247 id.GlobalEnbId.Present = true
248 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).get(&id.GlobalEnbId); err != nil {
253 if indId.entry.globalGNBIDPresent == true {
254 id.GlobalGnbId.Present = true
255 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
262 //-----------------------------------------------------------------------------
264 //-----------------------------------------------------------------------------
265 type e2apEntryEventTrigger struct {
266 entry *C.RICEventTriggerDefinition_t
269 func (evtTrig *e2apEntryEventTrigger) set(id *e2ap.EventTriggerDefinition) error {
270 evtTrig.entry.interfaceDirection = (C.uint8_t)(id.InterfaceDirection)
271 evtTrig.entry.interfaceMessageType.procedureCode = (C.uint8_t)(id.ProcedureCode)
272 evtTrig.entry.interfaceMessageType.typeOfMessage = (C.uint8_t)(id.TypeOfMessage)
273 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).set(&id.InterfaceId)
276 func (evtTrig *e2apEntryEventTrigger) get(id *e2ap.EventTriggerDefinition) error {
277 id.InterfaceDirection = (uint32)(evtTrig.entry.interfaceDirection)
278 id.ProcedureCode = (uint32)(evtTrig.entry.interfaceMessageType.procedureCode)
279 id.TypeOfMessage = (uint64)(evtTrig.entry.interfaceMessageType.typeOfMessage)
280 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).get(&id.InterfaceId)
283 //-----------------------------------------------------------------------------
285 //-----------------------------------------------------------------------------
286 type e2apEntryAdmittedList struct {
287 entry *C.RICActionAdmittedList_t
290 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
292 if len(data.Items) > 16 {
293 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
296 item.entry.contentLength = 0
297 for i := 0; i < len(data.Items); i++ {
298 item.entry.ricActionID[item.entry.contentLength] = (C.ulong)(data.Items[i].ActionId)
299 item.entry.contentLength++
304 func (item *e2apEntryAdmittedList) get(data *e2ap.ActionAdmittedList) error {
305 conlen := (int)(item.entry.contentLength)
306 data.Items = make([]e2ap.ActionAdmittedItem, conlen)
307 for i := 0; i < conlen; i++ {
308 data.Items[i].ActionId = (uint64)(item.entry.ricActionID[i])
313 //-----------------------------------------------------------------------------
315 //-----------------------------------------------------------------------------
316 type e2apEntryNotAdmittedList struct {
317 entry *C.RICActionNotAdmittedList_t
320 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
322 if len(data.Items) > 16 {
323 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
326 item.entry.contentLength = 0
327 for i := 0; i < len(data.Items); i++ {
328 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId)
329 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content)
330 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal)
331 item.entry.contentLength++
337 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
338 conlen := (int)(item.entry.contentLength)
339 data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
340 for i := 0; i < conlen; i++ {
341 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
342 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content)
343 data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause)
348 //-----------------------------------------------------------------------------
350 //-----------------------------------------------------------------------------
351 type e2apEntryCriticalityDiagnostic struct {
352 entry *C.CriticalityDiagnostics__t
355 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
357 item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
358 item.entry.procedureCode = (C.uchar)(data.ProcCode)
360 item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
361 item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
363 item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
364 item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
366 item.entry.criticalityDiagnosticsIELength = 0
367 item.entry.iEsCriticalityDiagnosticsPresent = false
368 for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
369 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
370 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
371 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
372 item.entry.criticalityDiagnosticsIELength++
373 item.entry.iEsCriticalityDiagnosticsPresent = true
378 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
380 data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
381 data.ProcCode = (uint64)(item.entry.procedureCode)
383 data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
384 data.TrigMsg = (uint64)(item.entry.triggeringMessage)
386 data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
387 data.ProcCrit = (uint8)(item.entry.procedureCriticality)
389 if item.entry.iEsCriticalityDiagnosticsPresent == true {
390 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
391 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
392 for i := 0; i < conlen; i++ {
393 data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
394 data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
395 data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
402 //-----------------------------------------------------------------------------
404 //-----------------------------------------------------------------------------
405 type e2apEntryCallProcessId struct {
406 entry *C.RICCallProcessID_t
409 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
410 callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
414 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
415 data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
420 //-----------------------------------------------------------------------------
422 //-----------------------------------------------------------------------------
424 type e2apMessage struct {
425 pdu *C.e2ap_pdu_ptr_t
426 messageInfo C.E2MessageInfo_t
429 func (e2apMsg *e2apMessage) PduUnPack(logBuf []byte, data *packer.PackedData) error {
430 e2apMsg.pdu = C.unpackE2AP_pdu((C.size_t)(len(data.Buf)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), &e2apMsg.messageInfo)
434 func (e2apMsg *e2apMessage) MessageInfo() *packer.MessageInfo {
436 msgInfo := &packer.MessageInfo{}
438 switch e2apMsg.messageInfo.messageType {
439 case C.cE2InitiatingMessage:
440 msgInfo.MsgType = e2ap.E2AP_InitiatingMessage
441 switch e2apMsg.messageInfo.messageId {
442 case C.cRICSubscriptionRequest:
443 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionRequest
445 case C.cRICSubscriptionDeleteRequest:
446 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteRequest
449 case C.cE2SuccessfulOutcome:
450 msgInfo.MsgType = e2ap.E2AP_SuccessfulOutcome
451 switch e2apMsg.messageInfo.messageId {
452 case C.cRICSubscriptionResponse:
453 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionResponse
455 case C.cRICsubscriptionDeleteResponse:
456 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteResponse
459 case C.cE2UnsuccessfulOutcome:
460 msgInfo.MsgType = e2ap.E2AP_UnsuccessfulOutcome
461 switch e2apMsg.messageInfo.messageId {
462 case C.cRICSubscriptionFailure:
463 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionFailure
465 case C.cRICsubscriptionDeleteFailure:
466 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteFailure
474 func (e2apMsg *e2apMessage) UnPack(msg *packer.PackedData) *packer.MessageInfo {
475 err := packer.PduPackerUnPack(e2apMsg, msg)
479 return e2apMsg.MessageInfo()
482 func (e2apMsg *e2apMessage) String() string {
483 msgInfo := e2apMsg.MessageInfo()
487 return msgInfo.String()
490 //-----------------------------------------------------------------------------
492 //-----------------------------------------------------------------------------
494 type e2apMsgSubscriptionRequest struct {
496 msgC *C.RICSubscriptionRequest_t
499 func (e2apMsg *e2apMsgSubscriptionRequest) Set(data *e2ap.E2APSubscriptionRequest) error {
501 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
502 C.initSubsRequest(e2apMsg.msgC)
504 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
506 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
509 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).set(&data.EventTriggerDefinition); err != nil {
513 if len(data.ActionSetups) > 16 {
514 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(data.ActionSetups), 16)
517 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 0
518 for i := 0; i < len(data.ActionSetups); i++ {
519 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength]}
520 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength += 1
521 if err := item.set(&data.ActionSetups[i]); err != nil {
528 func (e2apMsg *e2apMsgSubscriptionRequest) Get() (error, *e2ap.E2APSubscriptionRequest) {
530 data := &e2ap.E2APSubscriptionRequest{}
532 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
534 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
537 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).get(&data.EventTriggerDefinition); err != nil {
541 conlen := (int)(e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
542 data.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
543 for i := 0; i < conlen; i++ {
544 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
545 if err := item.get(&data.ActionSetups[i]); err != nil {
553 func (e2apMsg *e2apMsgSubscriptionRequest) PduPack(logBuf []byte, data *packer.PackedData) error {
557 evtTrig := e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}
558 if err := evtTrig.pack(); err != nil {
562 var buflen uint32 = (uint32)(len(data.Buf))
563 errorNro := C.packRICSubscriptionRequest((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
564 if errorNro != C.e2err_OK {
565 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
567 data.Buf = data.Buf[0:buflen]
572 func (e2apMsg *e2apMsgSubscriptionRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
574 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
575 C.initSubsRequest(e2apMsg.msgC)
577 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
578 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionRequest {
579 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
581 errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
582 if errorNro != C.e2err_OK {
583 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
588 evtTrig := e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}
589 if err := evtTrig.unpack(); err != nil {
596 func (e2apMsg *e2apMsgSubscriptionRequest) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
597 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
600 func (e2apMsg *e2apMsgSubscriptionRequest) UnPack(msg *packer.PackedData) error {
601 return packer.PduPackerUnPack(e2apMsg, msg)
604 func (e2apMsg *e2apMsgSubscriptionRequest) String() string {
606 fmt.Fprintln(&b, "ricSubscriptionRequest.")
607 fmt.Fprintln(&b, " ricRequestID.")
608 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
609 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
610 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
611 fmt.Fprintln(&b, " ricSubscription.")
612 fmt.Fprintln(&b, " ricEventTriggerDefinition.")
613 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.octetString.contentLength)
614 fmt.Fprintln(&b, " interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent)
615 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent {
616 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength)
617 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
618 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
619 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
620 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits)
621 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID)
623 fmt.Fprintln(&b, " interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent)
624 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent {
625 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.contentLength)
626 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
627 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
628 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
629 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.bits)
630 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.nodeID)
632 fmt.Fprintln(&b, " interfaceDirection= ", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceDirection)
633 fmt.Fprintln(&b, " interfaceMessageType.procedureCode =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode)
634 fmt.Fprintln(&b, " interfaceMessageType.typeOfMessage =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage)
635 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.")
636 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
639 for (C.uchar)(index) < e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength {
640 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
641 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
643 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
644 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent {
645 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinition.styleID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID)
646 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID)
649 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
650 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
651 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
652 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait)
659 //-----------------------------------------------------------------------------
661 //-----------------------------------------------------------------------------
662 type e2apMsgSubscriptionResponse struct {
664 msgC *C.RICSubscriptionResponse_t
667 func (e2apMsg *e2apMsgSubscriptionResponse) Set(data *e2ap.E2APSubscriptionResponse) error {
669 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
670 C.initSubsResponse(e2apMsg.msgC)
672 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
674 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
678 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).set(&data.ActionAdmittedList); err != nil {
682 e2apMsg.msgC.ricActionNotAdmittedListPresent = false
683 if len(data.ActionNotAdmittedList.Items) > 0 {
684 e2apMsg.msgC.ricActionNotAdmittedListPresent = true
685 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
692 func (e2apMsg *e2apMsgSubscriptionResponse) Get() (error, *e2ap.E2APSubscriptionResponse) {
694 data := &e2ap.E2APSubscriptionResponse{}
696 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
698 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
702 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).get(&data.ActionAdmittedList); err != nil {
706 if e2apMsg.msgC.ricActionNotAdmittedListPresent == true {
707 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
715 func (e2apMsg *e2apMsgSubscriptionResponse) PduPack(logBuf []byte, data *packer.PackedData) error {
716 var buflen uint32 = (uint32)(len(data.Buf))
717 errorNro := C.packRICSubscriptionResponse((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
718 if errorNro != C.e2err_OK {
719 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
721 data.Buf = data.Buf[0:buflen]
725 func (e2apMsg *e2apMsgSubscriptionResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
726 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
727 C.initSubsResponse(e2apMsg.msgC)
729 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
730 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionResponse {
731 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
733 errorNro := C.getRICSubscriptionResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
734 if errorNro != C.e2err_OK {
735 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
740 func (e2apMsg *e2apMsgSubscriptionResponse) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
741 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
744 func (e2apMsg *e2apMsgSubscriptionResponse) UnPack(msg *packer.PackedData) error {
745 return packer.PduPackerUnPack(e2apMsg, msg)
748 func (e2apMsg *e2apMsgSubscriptionResponse) String() string {
750 fmt.Fprintln(&b, "ricSubscriptionResponse.")
751 fmt.Fprintln(&b, " ricRequestID.")
752 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
753 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
754 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
755 fmt.Fprintln(&b, " ricActionAdmittedList.")
756 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionAdmittedList.contentLength)
759 for (C.uchar)(index) < e2apMsg.msgC.ricActionAdmittedList.contentLength {
760 fmt.Fprintln(&b, " ricActionAdmittedList.ricActionID[index] =", e2apMsg.msgC.ricActionAdmittedList.ricActionID[index])
763 if e2apMsg.msgC.ricActionNotAdmittedListPresent {
764 fmt.Fprintln(&b, " ricActionNotAdmittedListPresent =", e2apMsg.msgC.ricActionNotAdmittedListPresent)
765 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
766 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
768 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
769 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
770 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
771 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
778 //-----------------------------------------------------------------------------
780 //-----------------------------------------------------------------------------
781 type e2apMsgSubscriptionFailure struct {
783 msgC *C.RICSubscriptionFailure_t
786 func (e2apMsg *e2apMsgSubscriptionFailure) Set(data *e2ap.E2APSubscriptionFailure) error {
788 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
789 C.initSubsFailure(e2apMsg.msgC)
791 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
793 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
797 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
801 e2apMsg.msgC.criticalityDiagnosticsPresent = false
802 if data.CriticalityDiagnostics.Present {
803 e2apMsg.msgC.criticalityDiagnosticsPresent = true
804 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
812 func (e2apMsg *e2apMsgSubscriptionFailure) Get() (error, *e2ap.E2APSubscriptionFailure) {
814 data := &e2ap.E2APSubscriptionFailure{}
816 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
818 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
822 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
826 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
827 data.CriticalityDiagnostics.Present = true
828 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
836 func (e2apMsg *e2apMsgSubscriptionFailure) PduPack(logBuf []byte, data *packer.PackedData) error {
837 var buflen uint32 = (uint32)(len(data.Buf))
838 errorNro := C.packRICSubscriptionFailure((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
839 if errorNro != C.e2err_OK {
840 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
842 data.Buf = data.Buf[0:buflen]
846 func (e2apMsg *e2apMsgSubscriptionFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
848 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
849 C.initSubsFailure(e2apMsg.msgC)
851 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
852 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionFailure {
853 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
855 errorNro := C.getRICSubscriptionFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
856 if errorNro != C.e2err_OK {
857 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
863 func (e2apMsg *e2apMsgSubscriptionFailure) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
864 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
867 func (e2apMsg *e2apMsgSubscriptionFailure) UnPack(msg *packer.PackedData) error {
868 return packer.PduPackerUnPack(e2apMsg, msg)
871 func (e2apMsg *e2apMsgSubscriptionFailure) String() string {
873 fmt.Fprintln(&b, "ricSubscriptionFailure.")
874 fmt.Fprintln(&b, " ricRequestID.")
875 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
876 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
877 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
878 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
879 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
882 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
883 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
884 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
885 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
889 if e2apMsg.msgC.criticalityDiagnosticsPresent {
890 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
891 fmt.Fprintln(&b, " criticalityDiagnostics.")
892 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
893 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
894 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
895 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
896 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
897 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
898 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
899 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
902 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
903 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
904 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
905 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
913 //-----------------------------------------------------------------------------
915 //-----------------------------------------------------------------------------
916 type e2apMsgSubscriptionDeleteRequest struct {
918 msgC *C.RICSubscriptionDeleteRequest_t
921 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Set(data *e2ap.E2APSubscriptionDeleteRequest) error {
923 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
924 C.initSubsDeleteRequest(e2apMsg.msgC)
926 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
928 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
934 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Get() (error, *e2ap.E2APSubscriptionDeleteRequest) {
936 data := &e2ap.E2APSubscriptionDeleteRequest{}
938 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
940 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
947 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduPack(logBuf []byte, data *packer.PackedData) error {
948 var buflen uint32 = (uint32)(len(data.Buf))
949 errorNro := C.packRICSubscriptionDeleteRequest((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
950 if errorNro != C.e2err_OK {
951 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
953 data.Buf = data.Buf[0:buflen]
958 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
960 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
961 C.initSubsDeleteRequest(e2apMsg.msgC)
963 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
964 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionDeleteRequest {
965 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
967 errorNro := C.getRICSubscriptionDeleteRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
968 if errorNro != C.e2err_OK {
969 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
974 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
975 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
978 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) UnPack(msg *packer.PackedData) error {
979 return packer.PduPackerUnPack(e2apMsg, msg)
982 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) String() string {
984 fmt.Fprintln(&b, "ricSubscriptionDeleteRequest.")
985 fmt.Fprintln(&b, " ricRequestID.")
986 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
987 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
988 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
992 //-----------------------------------------------------------------------------
994 //-----------------------------------------------------------------------------
995 type e2apMsgSubscriptionDeleteResponse struct {
997 msgC *C.RICSubscriptionDeleteResponse_t
1000 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Set(data *e2ap.E2APSubscriptionDeleteResponse) error {
1002 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
1003 C.initSubsDeleteResponse(e2apMsg.msgC)
1005 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1007 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1013 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Get() (error, *e2ap.E2APSubscriptionDeleteResponse) {
1015 data := &e2ap.E2APSubscriptionDeleteResponse{}
1017 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1019 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1025 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduPack(logBuf []byte, data *packer.PackedData) error {
1026 var buflen uint32 = (uint32)(len(data.Buf))
1027 errorNro := C.packRICSubscriptionDeleteResponse((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1028 if errorNro != C.e2err_OK {
1029 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1031 data.Buf = data.Buf[0:buflen]
1035 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1036 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
1037 C.initSubsDeleteResponse(e2apMsg.msgC)
1039 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1040 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteResponse {
1041 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1043 errorNro := C.getRICSubscriptionDeleteResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1044 if errorNro != C.e2err_OK {
1045 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1050 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1051 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1054 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) UnPack(msg *packer.PackedData) error {
1055 return packer.PduPackerUnPack(e2apMsg, msg)
1058 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) String() string {
1060 fmt.Fprintln(&b, "ricSubscriptionDeleteResponse.")
1061 fmt.Fprintln(&b, " ricRequestID.")
1062 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1063 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1064 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1068 //-----------------------------------------------------------------------------
1070 //-----------------------------------------------------------------------------
1071 type e2apMsgSubscriptionDeleteFailure struct {
1073 msgC *C.RICSubscriptionDeleteFailure_t
1076 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Set(data *e2ap.E2APSubscriptionDeleteFailure) error {
1078 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1079 C.initSubsDeleteFailure(e2apMsg.msgC)
1081 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1083 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1087 e2apMsg.msgC.ricCause.content = (C.uchar)(data.Cause.Content)
1088 e2apMsg.msgC.ricCause.cause = (C.uchar)(data.Cause.CauseVal)
1090 e2apMsg.msgC.criticalityDiagnosticsPresent = false
1091 if data.CriticalityDiagnostics.Present {
1092 e2apMsg.msgC.criticalityDiagnosticsPresent = true
1093 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
1100 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Get() (error, *e2ap.E2APSubscriptionDeleteFailure) {
1102 data := &e2ap.E2APSubscriptionDeleteFailure{}
1104 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1106 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1110 data.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content)
1111 data.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause)
1113 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
1114 data.CriticalityDiagnostics.Present = true
1115 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
1122 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduPack(logBuf []byte, data *packer.PackedData) error {
1123 var buflen uint32 = (uint32)(len(data.Buf))
1124 errorNro := C.packRICSubscriptionDeleteFailure((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1125 if errorNro != C.e2err_OK {
1126 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1128 data.Buf = data.Buf[0:buflen]
1132 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1134 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1135 C.initSubsDeleteFailure(e2apMsg.msgC)
1137 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1138 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteFailure {
1139 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1141 errorNro := C.getRICSubscriptionDeleteFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1142 if errorNro != C.e2err_OK {
1143 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1149 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1150 return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1153 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) UnPack(msg *packer.PackedData) error {
1154 return packer.PduPackerUnPack(e2apMsg, msg)
1157 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) String() string {
1159 fmt.Fprintln(&b, "ricSubscriptionDeleteFailure.")
1160 fmt.Fprintln(&b, " ricRequestID.")
1161 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1162 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1163 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1165 if e2apMsg.msgC.criticalityDiagnosticsPresent {
1166 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
1167 fmt.Fprintln(&b, " criticalityDiagnostics.")
1168 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
1169 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
1170 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
1171 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
1172 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
1173 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
1174 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
1175 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
1178 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
1179 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
1180 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
1181 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
1189 //-----------------------------------------------------------------------------
1190 // Public E2AP packer creators
1191 //-----------------------------------------------------------------------------
1193 type cppasn1E2APPacker struct{}
1195 func (*cppasn1E2APPacker) NewPackerSubscriptionRequest() e2ap.E2APMsgPackerSubscriptionRequestIf {
1196 return &e2apMsgSubscriptionRequest{}
1199 func (*cppasn1E2APPacker) NewPackerSubscriptionResponse() e2ap.E2APMsgPackerSubscriptionResponseIf {
1200 return &e2apMsgSubscriptionResponse{}
1203 func (*cppasn1E2APPacker) NewPackerSubscriptionFailure() e2ap.E2APMsgPackerSubscriptionFailureIf {
1204 return &e2apMsgSubscriptionFailure{}
1207 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteRequest() e2ap.E2APMsgPackerSubscriptionDeleteRequestIf {
1208 return &e2apMsgSubscriptionDeleteRequest{}
1211 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteResponse() e2ap.E2APMsgPackerSubscriptionDeleteResponseIf {
1212 return &e2apMsgSubscriptionDeleteResponse{}
1215 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPackerSubscriptionDeleteFailureIf {
1216 return &e2apMsgSubscriptionDeleteFailure{}
1219 func (*cppasn1E2APPacker) MessageInfo(msg *packer.PackedData) *packer.MessageInfo {
1220 e2apMsg := &e2apMessage{}
1221 return e2apMsg.UnPack(msg)
1224 func NewAsn1E2Packer() e2ap.E2APPackerIf {
1225 return &cppasn1E2APPacker{}