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"
58 const cLogBufferMaxSize = 40960
59 const cMsgBufferMaxSize = 40960
60 const cMsgBufferExtra = 512
62 //-----------------------------------------------------------------------------
64 //-----------------------------------------------------------------------------
65 func cMessageInfoToMessageInfo(minfo *C.E2MessageInfo_t) *e2ap.MessageInfo {
67 msgInfo := &e2ap.MessageInfo{}
69 switch minfo.messageType {
70 case C.cE2InitiatingMessage:
71 msgInfo.MsgType = e2ap.E2AP_InitiatingMessage
72 switch minfo.messageId {
73 case C.cRICSubscriptionRequest:
74 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionRequest
76 case C.cRICSubscriptionDeleteRequest:
77 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteRequest
80 case C.cE2SuccessfulOutcome:
81 msgInfo.MsgType = e2ap.E2AP_SuccessfulOutcome
82 switch minfo.messageId {
83 case C.cRICSubscriptionResponse:
84 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionResponse
86 case C.cRICsubscriptionDeleteResponse:
87 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteResponse
90 case C.cE2UnsuccessfulOutcome:
91 msgInfo.MsgType = e2ap.E2AP_UnsuccessfulOutcome
92 switch minfo.messageId {
93 case C.cRICSubscriptionFailure:
94 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionFailure
96 case C.cRICsubscriptionDeleteFailure:
97 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteFailure
104 //-----------------------------------------------------------------------------
106 //-----------------------------------------------------------------------------
107 type e2apEntryRequestID struct {
108 entry *C.RICRequestID_t
111 func (e2Item *e2apEntryRequestID) set(id *e2ap.RequestId) error {
112 e2Item.entry.ricRequestorID = (C.uint32_t)(id.Id)
113 e2Item.entry.ricInstanceID = (C.uint32_t)(id.InstanceId)
117 func (e2Item *e2apEntryRequestID) get(id *e2ap.RequestId) error {
118 id.Id = (uint32)(e2Item.entry.ricRequestorID)
119 id.InstanceId = (uint32)(e2Item.entry.ricInstanceID)
123 //-----------------------------------------------------------------------------
125 //-----------------------------------------------------------------------------
126 type e2apEntryActionToBeSetupItem struct {
127 entry *C.RICActionToBeSetupItem_t
130 func (e2Item *e2apEntryActionToBeSetupItem) set(id *e2ap.ActionToBeSetupItem) error {
132 e2Item.entry.ricActionID = (C.ulong)(id.ActionId)
133 e2Item.entry.ricActionType = (C.uint64_t)(id.ActionType)
134 if id.RicActionDefinitionPresent {
135 e2Item.entry.ricActionDefinitionPresent = true
136 if err := (&e2apEntryActionDefinitionChoice{entry: &e2Item.entry.ricActionDefinitionChoice}).set(&id.ActionDefinitionChoice); err != nil {
140 if id.SubsequentAction.Present {
141 e2Item.entry.ricSubsequentActionPresent = true
142 e2Item.entry.ricSubsequentAction.ricSubsequentActionType = (C.uint64_t)(id.SubsequentAction.Type)
143 e2Item.entry.ricSubsequentAction.ricTimeToWait = (C.uint64_t)(id.SubsequentAction.TimetoWait)
148 func (e2Item *e2apEntryActionToBeSetupItem) get(id *e2ap.ActionToBeSetupItem) error {
150 id.ActionId = (uint64)(e2Item.entry.ricActionID)
151 id.ActionType = (uint64)(e2Item.entry.ricActionType)
152 if e2Item.entry.ricActionDefinitionPresent {
153 id.RicActionDefinitionPresent = true
154 if err := (&e2apEntryActionDefinitionChoice{entry: &e2Item.entry.ricActionDefinitionChoice}).get(&id.ActionDefinitionChoice); err != nil {
158 if e2Item.entry.ricSubsequentActionPresent {
159 id.SubsequentAction.Present = true
160 id.SubsequentAction.Type = (uint64)(e2Item.entry.ricSubsequentAction.ricSubsequentActionType)
161 id.SubsequentAction.TimetoWait = (uint64)(e2Item.entry.ricSubsequentAction.ricTimeToWait)
166 //-----------------------------------------------------------------------------
168 //-----------------------------------------------------------------------------
169 type e2apEntryActionDefinitionChoice struct {
170 entry *C.RICActionDefinitionChoice_t
173 func (e2Item *e2apEntryActionDefinitionChoice) set(id *e2ap.ActionDefinitionChoice) error {
174 if id.Data.Length > 0 {
175 e2Item.entry.octetString.contentLength = C.size_t(id.Data.Length)
176 C.memcpy(unsafe.Pointer(&e2Item.entry.octetString.data[0]), unsafe.Pointer(&id.Data.Data[0]), C.size_t(e2Item.entry.octetString.contentLength))
181 func (e2Item *e2apEntryActionDefinitionChoice) get(id *e2ap.ActionDefinitionChoice) error {
182 id.Data.Length = (uint64)(e2Item.entry.octetString.contentLength)
183 if id.Data.Length > 0 {
184 id.Data.Data = make([]uint8, id.Data.Length)
185 C.memcpy(unsafe.Pointer(&id.Data.Data[0]), unsafe.Pointer(&e2Item.entry.octetString.data[0]), C.size_t(e2Item.entry.octetString.contentLength))
190 //-----------------------------------------------------------------------------
192 //-----------------------------------------------------------------------------
193 type e2apEntryPlmnIdentity struct {
194 entry *C.PLMNIdentity_t
197 func (plmnId *e2apEntryPlmnIdentity) set(id conv.PlmnIdentityIf) error {
199 buf := new(bytes.Buffer)
202 plmnId.entry.contentLength = (C.uint8_t)(len(data))
203 for i := 0; i < len(data); i++ {
204 plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(data[i])
209 func (plmnId *e2apEntryPlmnIdentity) get(id conv.PlmnIdentityIf) error {
210 conlen := (int)(plmnId.entry.contentLength)
211 bcdBuf := make([]uint8, conlen)
212 for i := 0; i < conlen; i++ {
213 bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i])
215 reader := bytes.NewReader(bcdBuf)
216 id.DecodeFrom(reader)
220 //-----------------------------------------------------------------------------
222 //-----------------------------------------------------------------------------
223 type e2apEntryGlobalEnbId struct {
224 entry *C.GlobalNodeID_t
227 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
229 case e2ap.E2AP_ENBIDMacroPBits20:
231 case e2ap.E2AP_ENBIDHomeBits28:
233 case e2ap.E2AP_ENBIDShortMacroits18:
235 case e2ap.E2AP_ENBIDlongMacroBits21:
238 return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
241 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
242 if err := enbId.checkbits(id.NodeId.Bits); err != nil {
245 enbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
246 enbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
247 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
250 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
251 if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
254 id.NodeId.Bits = (uint8)(enbId.entry.nodeID.bits)
255 id.NodeId.Id = (uint32)(enbId.entry.nodeID.nodeID)
256 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
259 //-----------------------------------------------------------------------------
261 //-----------------------------------------------------------------------------
262 type e2apEntryGlobalGnbId struct {
263 entry *C.GlobalNodeID_t
266 func (gnbId *e2apEntryGlobalGnbId) checkbits(bits uint8) error {
267 if bits < 22 || bits > 32 {
268 return fmt.Errorf("GlobalGnbId: given bits %d not match allowed: 22-32", bits)
273 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
274 if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
277 gnbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
278 gnbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
279 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
282 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
283 if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
286 id.NodeId.Bits = (uint8)(gnbId.entry.nodeID.bits)
287 id.NodeId.Id = (uint32)(gnbId.entry.nodeID.nodeID)
288 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
291 //-----------------------------------------------------------------------------
293 //-----------------------------------------------------------------------------
294 type e2apEntryInterfaceId struct {
295 entry *C.InterfaceID_t
298 func (indId *e2apEntryInterfaceId) set(id *e2ap.InterfaceId) error {
299 if id.GlobalEnbId.Present {
300 indId.entry.globalENBIDPresent = true
301 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).set(&id.GlobalEnbId); err != nil {
306 if id.GlobalGnbId.Present {
307 indId.entry.globalGNBIDPresent = true
308 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
315 func (indId *e2apEntryInterfaceId) get(id *e2ap.InterfaceId) error {
316 if indId.entry.globalENBIDPresent == true {
317 id.GlobalEnbId.Present = true
318 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).get(&id.GlobalEnbId); err != nil {
323 if indId.entry.globalGNBIDPresent == true {
324 id.GlobalGnbId.Present = true
325 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
332 //-----------------------------------------------------------------------------
334 //-----------------------------------------------------------------------------
335 type e2apEntryEventTrigger struct {
336 entry *C.RICEventTriggerDefinition_t
339 func (evtTrig *e2apEntryEventTrigger) set(id *e2ap.EventTriggerDefinition) error {
341 if id.Data.Length > 0 {
342 evtTrig.entry.octetString.contentLength = C.size_t(id.Data.Length)
343 C.memcpy(unsafe.Pointer(&evtTrig.entry.octetString.data[0]), unsafe.Pointer(&id.Data.Data[0]), C.size_t(evtTrig.entry.octetString.contentLength))
348 func (evtTrig *e2apEntryEventTrigger) get(id *e2ap.EventTriggerDefinition) error {
350 id.Data.Length = (uint64)(evtTrig.entry.octetString.contentLength)
351 if id.Data.Length > 0 {
352 id.Data.Data = make([]uint8, id.Data.Length)
353 C.memcpy(unsafe.Pointer(&id.Data.Data[0]), unsafe.Pointer(&evtTrig.entry.octetString.data[0]), C.size_t(evtTrig.entry.octetString.contentLength))
358 //-----------------------------------------------------------------------------
360 //-----------------------------------------------------------------------------
361 type e2apEntryAdmittedList struct {
362 entry *C.RICActionAdmittedList_t
365 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
367 if len(data.Items) > 16 {
368 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
371 item.entry.contentLength = 0
372 for i := 0; i < len(data.Items); i++ {
373 item.entry.ricActionID[item.entry.contentLength] = (C.ulong)(data.Items[i].ActionId)
374 item.entry.contentLength++
379 func (item *e2apEntryAdmittedList) get(data *e2ap.ActionAdmittedList) error {
380 conlen := (int)(item.entry.contentLength)
381 data.Items = make([]e2ap.ActionAdmittedItem, conlen)
382 for i := 0; i < conlen; i++ {
383 data.Items[i].ActionId = (uint64)(item.entry.ricActionID[i])
388 //-----------------------------------------------------------------------------
390 //-----------------------------------------------------------------------------
391 type e2apEntryNotAdmittedList struct {
392 entry *C.RICActionNotAdmittedList_t
395 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
397 if len(data.Items) > 16 {
398 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
401 item.entry.contentLength = 0
402 for i := 0; i < len(data.Items); i++ {
403 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId)
404 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].cause.content = (C.uchar)(data.Items[i].Cause.Content)
405 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].cause.causeVal = (C.uchar)(data.Items[i].Cause.Value)
406 item.entry.contentLength++
412 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
413 conlen := (int)(item.entry.contentLength)
414 data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
415 for i := 0; i < conlen; i++ {
416 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
417 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].cause.content)
418 data.Items[i].Cause.Value = (uint8)(item.entry.RICActionNotAdmittedItem[i].cause.causeVal)
423 //-----------------------------------------------------------------------------
425 //-----------------------------------------------------------------------------
426 type e2apEntryCriticalityDiagnostic struct {
427 entry *C.CriticalityDiagnostics__t
430 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
432 item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
433 item.entry.procedureCode = (C.uchar)(data.ProcCode)
435 item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
436 item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
438 item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
439 item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
441 item.entry.criticalityDiagnosticsIELength = 0
442 item.entry.iEsCriticalityDiagnosticsPresent = false
443 for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
444 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
445 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
446 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
447 item.entry.criticalityDiagnosticsIELength++
448 item.entry.iEsCriticalityDiagnosticsPresent = true
453 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
455 data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
456 data.ProcCode = (uint64)(item.entry.procedureCode)
458 data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
459 data.TrigMsg = (uint64)(item.entry.triggeringMessage)
461 data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
462 data.ProcCrit = (uint8)(item.entry.procedureCriticality)
464 if item.entry.iEsCriticalityDiagnosticsPresent == true {
465 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
466 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
467 for i := 0; i < conlen; i++ {
468 data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
469 data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
470 data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
477 //-----------------------------------------------------------------------------
479 //-----------------------------------------------------------------------------
480 type e2apEntryCallProcessId struct {
481 entry *C.RICCallProcessID_t
484 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
485 callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
489 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
490 data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
495 //-----------------------------------------------------------------------------
497 //-----------------------------------------------------------------------------
499 type e2apMessagePacker struct {
500 expectedInfo C.E2MessageInfo_t
501 pduMsgInfo C.E2MessageInfo_t
502 pdu *C.e2ap_pdu_ptr_t
508 func (e2apMsg *e2apMessagePacker) init(minfo C.E2MessageInfo_t) {
509 e2apMsg.expectedInfo = minfo
510 e2apMsg.lb = make([]byte, cLogBufferMaxSize)
512 e2apMsg.p = C.malloc(C.size_t(cMsgBufferMaxSize))
513 e2apMsg.plen = C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
516 func (e2apMsg *e2apMessagePacker) fini() {
522 func (e2apMsg *e2apMessagePacker) lbString() string {
523 return "logbuffer(" + string(e2apMsg.lb[:strings.Index(string(e2apMsg.lb[:]), "\000")]) + ")"
526 func (e2apMsg *e2apMessagePacker) packeddata() *e2ap.PackedData {
527 return &e2ap.PackedData{C.GoBytes(e2apMsg.p, C.int(e2apMsg.plen))}
530 func (e2apMsg *e2apMessagePacker) checkerr(errorNro C.uint64_t) error {
531 if errorNro != C.e2err_OK {
532 return fmt.Errorf("e2err(%s) %s", C.GoString(C.getE2ErrorString(errorNro)), e2apMsg.lbString())
537 func (e2apMsg *e2apMessagePacker) unpacktopdu(data *e2ap.PackedData) error {
538 e2apMsg.pdu = C.unpackE2AP_pdu((C.size_t)(len(data.Buf)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), &e2apMsg.pduMsgInfo)
539 if e2apMsg.pduMsgInfo.messageType != e2apMsg.expectedInfo.messageType || e2apMsg.pduMsgInfo.messageId != e2apMsg.expectedInfo.messageId {
540 return fmt.Errorf("unpack e2ap %s %s", e2apMsg.lbString(), e2apMsg.String())
545 func (e2apMsg *e2apMessagePacker) messageInfoPdu() *e2ap.MessageInfo {
546 return cMessageInfoToMessageInfo(&e2apMsg.pduMsgInfo)
549 func (e2apMsg *e2apMessagePacker) messageInfoExpected() *e2ap.MessageInfo {
550 return cMessageInfoToMessageInfo(&e2apMsg.expectedInfo)
553 func (e2apMsg *e2apMessagePacker) String() string {
555 pduInfo := e2apMsg.messageInfoPdu()
557 ret += "pduinfo(" + pduInfo.String() + ")"
559 ret += "pduinfo(N/A)"
561 expInfo := e2apMsg.messageInfoExpected()
563 ret += " expinfo(" + expInfo.String() + ")"
565 ret += " expinfo(N/A)"
570 //-----------------------------------------------------------------------------
572 //-----------------------------------------------------------------------------
574 type e2apMsgPackerSubscriptionRequest struct {
576 msgC *C.RICSubscriptionRequest_t
577 msgG *e2ap.E2APSubscriptionRequest
580 func (e2apMsg *e2apMsgPackerSubscriptionRequest) init() {
581 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2InitiatingMessage, C.cRICSubscriptionRequest})
582 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
583 e2apMsg.msgG = &e2ap.E2APSubscriptionRequest{}
584 C.initSubsRequest(e2apMsg.msgC)
587 func (e2apMsg *e2apMsgPackerSubscriptionRequest) Pack(data *e2ap.E2APSubscriptionRequest) (error, *e2ap.PackedData) {
594 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
595 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
598 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscriptionDetails.ricEventTriggerDefinition}).set(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
601 if len(e2apMsg.msgG.ActionSetups) > 16 {
602 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(e2apMsg.msgG.ActionSetups), 16), nil
604 e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength = 0
605 for i := 0; i < len(e2apMsg.msgG.ActionSetups); i++ {
606 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength]}
607 e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength += 1
608 if err := item.set(&e2apMsg.msgG.ActionSetups[i]); err != nil {
612 errorNro := C.packRICSubscriptionRequest(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
613 if err := e2apMsg.checkerr(errorNro); err != nil {
616 return nil, e2apMsg.packeddata()
619 func (e2apMsg *e2apMsgPackerSubscriptionRequest) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionRequest) {
624 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
625 return err, e2apMsg.msgG
628 errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
629 if err := e2apMsg.checkerr(errorNro); err != nil {
630 return err, e2apMsg.msgG
633 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
634 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
635 return err, e2apMsg.msgG
637 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscriptionDetails.ricEventTriggerDefinition}).get(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
638 return err, e2apMsg.msgG
640 conlen := (int)(e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength)
641 e2apMsg.msgG.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
642 for i := 0; i < conlen; i++ {
643 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
644 if err := item.get(&e2apMsg.msgG.ActionSetups[i]); err != nil {
645 return err, e2apMsg.msgG
648 return nil, e2apMsg.msgG
652 func (e2apMsg *e2apMsgPackerSubscriptionRequest) String() string {
654 fmt.Fprintln(&b, "ricSubscriptionRequest.")
655 fmt.Fprintln(&b, " ricRequestID.")
656 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
657 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
658 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
659 fmt.Fprintln(&b, " ricSubscriptionDetails.")
660 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.")
661 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength)
664 for (C.uchar)(index) < e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.contentLength {
665 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
666 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
667 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
668 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
669 if e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
670 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
671 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscriptionDetails.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait)
678 //-----------------------------------------------------------------------------
680 //-----------------------------------------------------------------------------
681 type e2apMsgPackerSubscriptionResponse struct {
683 msgC *C.RICSubscriptionResponse_t
684 msgG *e2ap.E2APSubscriptionResponse
687 func (e2apMsg *e2apMsgPackerSubscriptionResponse) init() {
688 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2SuccessfulOutcome, C.cRICSubscriptionResponse})
689 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
690 e2apMsg.msgG = &e2ap.E2APSubscriptionResponse{}
691 C.initSubsResponse(e2apMsg.msgC)
694 func (e2apMsg *e2apMsgPackerSubscriptionResponse) Pack(data *e2ap.E2APSubscriptionResponse) (error, *e2ap.PackedData) {
699 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
700 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
703 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).set(&e2apMsg.msgG.ActionAdmittedList); err != nil {
706 e2apMsg.msgC.ricActionNotAdmittedListPresent = false
707 if len(e2apMsg.msgG.ActionNotAdmittedList.Items) > 0 {
708 e2apMsg.msgC.ricActionNotAdmittedListPresent = true
709 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
714 errorNro := C.packRICSubscriptionResponse(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
715 if err := e2apMsg.checkerr(errorNro); err != nil {
718 return nil, e2apMsg.packeddata()
721 func (e2apMsg *e2apMsgPackerSubscriptionResponse) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionResponse) {
726 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
727 return err, e2apMsg.msgG
729 errorNro := C.getRICSubscriptionResponseData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
730 if err := e2apMsg.checkerr(errorNro); err != nil {
731 return err, e2apMsg.msgG
734 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
735 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
736 return err, e2apMsg.msgG
738 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).get(&e2apMsg.msgG.ActionAdmittedList); err != nil {
739 return err, e2apMsg.msgG
741 if e2apMsg.msgC.ricActionNotAdmittedListPresent == true {
742 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
743 return err, e2apMsg.msgG
746 return nil, e2apMsg.msgG
749 func (e2apMsg *e2apMsgPackerSubscriptionResponse) String() string {
751 fmt.Fprintln(&b, "ricSubscriptionResponse.")
752 fmt.Fprintln(&b, " ricRequestID.")
753 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
754 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
755 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
756 fmt.Fprintln(&b, " ricActionAdmittedList.")
757 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionAdmittedList.contentLength)
760 for (C.uchar)(index) < e2apMsg.msgC.ricActionAdmittedList.contentLength {
761 fmt.Fprintln(&b, " ricActionAdmittedList.ricActionID[index] =", e2apMsg.msgC.ricActionAdmittedList.ricActionID[index])
764 if e2apMsg.msgC.ricActionNotAdmittedListPresent {
765 fmt.Fprintln(&b, " ricActionNotAdmittedListPresent =", e2apMsg.msgC.ricActionNotAdmittedListPresent)
766 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
767 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
769 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
770 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
771 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].cause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content)
772 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].cause.causeVal =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal)
779 //-----------------------------------------------------------------------------
781 //-----------------------------------------------------------------------------
782 type e2apMsgPackerSubscriptionFailure struct {
784 msgC *C.RICSubscriptionFailure_t
785 msgG *e2ap.E2APSubscriptionFailure
788 func (e2apMsg *e2apMsgPackerSubscriptionFailure) init() {
789 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2UnsuccessfulOutcome, C.cRICSubscriptionFailure})
790 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
791 e2apMsg.msgG = &e2ap.E2APSubscriptionFailure{}
792 C.initSubsFailure(e2apMsg.msgC)
795 func (e2apMsg *e2apMsgPackerSubscriptionFailure) Pack(data *e2ap.E2APSubscriptionFailure) (error, *e2ap.PackedData) {
800 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
801 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
804 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
807 e2apMsg.msgC.criticalityDiagnosticsPresent = false
808 if e2apMsg.msgG.CriticalityDiagnostics.Present {
809 e2apMsg.msgC.criticalityDiagnosticsPresent = true
810 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
815 errorNro := C.packRICSubscriptionFailure(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
816 if err := e2apMsg.checkerr(errorNro); err != nil {
819 return nil, e2apMsg.packeddata()
822 func (e2apMsg *e2apMsgPackerSubscriptionFailure) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionFailure) {
826 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
827 return err, e2apMsg.msgG
829 errorNro := C.getRICSubscriptionFailureData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
830 if err := e2apMsg.checkerr(errorNro); err != nil {
831 return err, e2apMsg.msgG
834 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
835 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
836 return err, e2apMsg.msgG
838 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
839 return err, e2apMsg.msgG
841 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
842 e2apMsg.msgG.CriticalityDiagnostics.Present = true
843 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
844 return err, e2apMsg.msgG
847 return nil, e2apMsg.msgG
850 func (e2apMsg *e2apMsgPackerSubscriptionFailure) String() string {
852 fmt.Fprintln(&b, "ricSubscriptionFailure.")
853 fmt.Fprintln(&b, " ricRequestID.")
854 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
855 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
856 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
857 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
858 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
861 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
862 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
863 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].cause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.content)
864 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].cause.causeVal =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].cause.causeVal)
868 if e2apMsg.msgC.criticalityDiagnosticsPresent {
869 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
870 fmt.Fprintln(&b, " criticalityDiagnostics.")
871 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
872 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
873 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
874 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
875 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
876 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
877 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
878 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
881 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
882 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
883 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
884 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
892 //-----------------------------------------------------------------------------
894 //-----------------------------------------------------------------------------
895 type e2apMsgPackerSubscriptionDeleteRequest struct {
897 msgC *C.RICSubscriptionDeleteRequest_t
898 msgG *e2ap.E2APSubscriptionDeleteRequest
901 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) init() {
902 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2InitiatingMessage, C.cRICSubscriptionDeleteRequest})
903 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
904 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteRequest{}
905 C.initSubsDeleteRequest(e2apMsg.msgC)
908 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) Pack(data *e2ap.E2APSubscriptionDeleteRequest) (error, *e2ap.PackedData) {
913 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
914 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
918 errorNro := C.packRICSubscriptionDeleteRequest(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
919 if err := e2apMsg.checkerr(errorNro); err != nil {
922 return nil, e2apMsg.packeddata()
925 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteRequest) {
929 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
930 return err, e2apMsg.msgG
932 errorNro := C.getRICSubscriptionDeleteRequestData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
933 if err := e2apMsg.checkerr(errorNro); err != nil {
934 return err, e2apMsg.msgG
937 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
938 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
939 return err, e2apMsg.msgG
941 return nil, e2apMsg.msgG
945 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) String() string {
947 fmt.Fprintln(&b, "ricSubscriptionDeleteRequest.")
948 fmt.Fprintln(&b, " ricRequestID.")
949 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
950 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
951 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
955 //-----------------------------------------------------------------------------
957 //-----------------------------------------------------------------------------
958 type e2apMsgPackerSubscriptionDeleteResponse struct {
960 msgC *C.RICSubscriptionDeleteResponse_t
961 msgG *e2ap.E2APSubscriptionDeleteResponse
964 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) init() {
965 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2SuccessfulOutcome, C.cRICsubscriptionDeleteResponse})
966 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
967 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteResponse{}
968 C.initSubsDeleteResponse(e2apMsg.msgC)
971 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) Pack(data *e2ap.E2APSubscriptionDeleteResponse) (error, *e2ap.PackedData) {
976 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
977 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
981 errorNro := C.packRICSubscriptionDeleteResponse(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
982 if err := e2apMsg.checkerr(errorNro); err != nil {
985 return nil, e2apMsg.packeddata()
988 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteResponse) {
992 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
993 return err, e2apMsg.msgG
995 errorNro := C.getRICSubscriptionDeleteResponseData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
996 if err := e2apMsg.checkerr(errorNro); err != nil {
997 return err, e2apMsg.msgG
1000 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1001 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
1002 return err, e2apMsg.msgG
1004 return nil, e2apMsg.msgG
1007 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) String() string {
1009 fmt.Fprintln(&b, "ricSubscriptionDeleteResponse.")
1010 fmt.Fprintln(&b, " ricRequestID.")
1011 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1012 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
1013 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1017 //-----------------------------------------------------------------------------
1019 //-----------------------------------------------------------------------------
1020 type e2apMsgPackerSubscriptionDeleteFailure struct {
1022 msgC *C.RICSubscriptionDeleteFailure_t
1023 msgG *e2ap.E2APSubscriptionDeleteFailure
1026 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) init() {
1027 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2UnsuccessfulOutcome, C.cRICsubscriptionDeleteFailure})
1028 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1029 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteFailure{}
1030 C.initSubsDeleteFailure(e2apMsg.msgC)
1033 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) Pack(data *e2ap.E2APSubscriptionDeleteFailure) (error, *e2ap.PackedData) {
1035 defer e2apMsg.fini()
1038 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
1039 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
1042 e2apMsg.msgC.cause.content = (C.uchar)(e2apMsg.msgG.Cause.Content)
1043 e2apMsg.msgC.cause.causeVal = (C.uchar)(e2apMsg.msgG.Cause.Value)
1044 e2apMsg.msgC.criticalityDiagnosticsPresent = false
1045 if e2apMsg.msgG.CriticalityDiagnostics.Present {
1046 e2apMsg.msgC.criticalityDiagnosticsPresent = true
1047 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
1052 errorNro := C.packRICSubscriptionDeleteFailure(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
1053 if err := e2apMsg.checkerr(errorNro); err != nil {
1056 return nil, e2apMsg.packeddata()
1059 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteFailure) {
1061 defer e2apMsg.fini()
1063 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
1064 return err, e2apMsg.msgG
1066 errorNro := C.getRICSubscriptionDeleteFailureData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
1067 if err := e2apMsg.checkerr(errorNro); err != nil {
1068 return err, e2apMsg.msgG
1071 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1072 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
1073 return err, e2apMsg.msgG
1075 e2apMsg.msgG.Cause.Content = (uint8)(e2apMsg.msgC.cause.content)
1076 e2apMsg.msgG.Cause.Value = (uint8)(e2apMsg.msgC.cause.causeVal)
1077 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
1078 e2apMsg.msgG.CriticalityDiagnostics.Present = true
1079 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
1080 return err, e2apMsg.msgG
1083 return nil, e2apMsg.msgG
1086 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) String() string {
1088 fmt.Fprintln(&b, "ricSubscriptionDeleteFailure.")
1089 fmt.Fprintln(&b, " ricRequestID.")
1090 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1091 fmt.Fprintln(&b, " ricInstanceID =", e2apMsg.msgC.ricRequestID.ricInstanceID)
1092 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1094 if e2apMsg.msgC.criticalityDiagnosticsPresent {
1095 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
1096 fmt.Fprintln(&b, " criticalityDiagnostics.")
1097 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
1098 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
1099 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
1100 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
1101 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
1102 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
1103 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
1104 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
1107 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
1108 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
1109 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
1110 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
1118 //-----------------------------------------------------------------------------
1119 // Public E2AP packer creators
1120 //-----------------------------------------------------------------------------
1122 type cppasn1E2APPacker struct{}
1124 func (*cppasn1E2APPacker) NewPackerSubscriptionRequest() e2ap.E2APMsgPackerSubscriptionRequestIf {
1125 return &e2apMsgPackerSubscriptionRequest{}
1128 func (*cppasn1E2APPacker) NewPackerSubscriptionResponse() e2ap.E2APMsgPackerSubscriptionResponseIf {
1129 return &e2apMsgPackerSubscriptionResponse{}
1132 func (*cppasn1E2APPacker) NewPackerSubscriptionFailure() e2ap.E2APMsgPackerSubscriptionFailureIf {
1133 return &e2apMsgPackerSubscriptionFailure{}
1136 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteRequest() e2ap.E2APMsgPackerSubscriptionDeleteRequestIf {
1137 return &e2apMsgPackerSubscriptionDeleteRequest{}
1140 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteResponse() e2ap.E2APMsgPackerSubscriptionDeleteResponseIf {
1141 return &e2apMsgPackerSubscriptionDeleteResponse{}
1144 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPackerSubscriptionDeleteFailureIf {
1145 return &e2apMsgPackerSubscriptionDeleteFailure{}
1148 func NewAsn1E2Packer() e2ap.E2APPackerIf {
1149 return &cppasn1E2APPacker{}