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
105 //-----------------------------------------------------------------------------
107 //-----------------------------------------------------------------------------
108 type e2apEntryRequestID struct {
109 entry *C.RICRequestID_t
112 func (e2Item *e2apEntryRequestID) set(id *e2ap.RequestId) error {
113 e2Item.entry.ricRequestorID = (C.uint32_t)(id.Id)
114 e2Item.entry.ricRequestSequenceNumber = (C.uint32_t)(id.Seq)
118 func (e2Item *e2apEntryRequestID) get(id *e2ap.RequestId) error {
119 id.Id = (uint32)(e2Item.entry.ricRequestorID)
120 id.Seq = (uint32)(e2Item.entry.ricRequestSequenceNumber)
124 //-----------------------------------------------------------------------------
126 //-----------------------------------------------------------------------------
127 type e2apEntryActionToBeSetupItem struct {
128 entry *C.RICActionToBeSetupItem_t
131 func (e2Item *e2apEntryActionToBeSetupItem) set(id *e2ap.ActionToBeSetupItem) error {
133 e2Item.entry.ricActionID = (C.ulong)(id.ActionId)
134 e2Item.entry.ricActionType = (C.uint64_t)(id.ActionType)
136 if id.ActionDefinition.Present {
137 e2Item.entry.ricActionDefinitionPresent = true
138 e2Item.entry.ricActionDefinition.styleID = (C.uint64_t)(id.ActionDefinition.StyleId)
139 e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID = (C.uint32_t)(id.ActionDefinition.ParamId)
140 //e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue = id.ActionDefinition.ParamValue
143 if id.SubsequentAction.Present {
144 e2Item.entry.ricSubsequentActionPresent = true
145 e2Item.entry.ricSubsequentAction.ricSubsequentActionType = (C.uint64_t)(id.SubsequentAction.Type)
146 e2Item.entry.ricSubsequentAction.ricTimeToWait = (C.uint64_t)(id.SubsequentAction.TimetoWait)
151 func (e2Item *e2apEntryActionToBeSetupItem) get(id *e2ap.ActionToBeSetupItem) error {
153 id.ActionId = (uint64)(e2Item.entry.ricActionID)
154 id.ActionType = (uint64)(e2Item.entry.ricActionType)
156 if e2Item.entry.ricActionDefinitionPresent {
157 id.ActionDefinition.Present = true
158 id.ActionDefinition.StyleId = (uint64)(e2Item.entry.ricActionDefinition.styleID)
159 id.ActionDefinition.ParamId = (uint32)(e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID)
160 //id.ActionDefinition.ParamValue=e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue
163 if e2Item.entry.ricSubsequentActionPresent {
164 id.SubsequentAction.Present = true
165 id.SubsequentAction.Type = (uint64)(e2Item.entry.ricSubsequentAction.ricSubsequentActionType)
166 id.SubsequentAction.TimetoWait = (uint64)(e2Item.entry.ricSubsequentAction.ricTimeToWait)
171 //-----------------------------------------------------------------------------
173 //-----------------------------------------------------------------------------
174 type e2apEntryPlmnIdentity struct {
175 entry *C.PLMNIdentity_t
178 func (plmnId *e2apEntryPlmnIdentity) set(id *conv.PlmnIdentity) error {
180 plmnId.entry.contentLength = (C.uint8_t)(len(id.Val))
181 for i := 0; i < len(id.Val); i++ {
182 plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(id.Val[i])
187 func (plmnId *e2apEntryPlmnIdentity) get(id *conv.PlmnIdentity) error {
188 conlen := (int)(plmnId.entry.contentLength)
189 bcdBuf := make([]uint8, conlen)
190 for i := 0; i < conlen; i++ {
191 bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i])
197 //-----------------------------------------------------------------------------
199 //-----------------------------------------------------------------------------
200 type e2apEntryGlobalEnbId struct {
201 entry *C.GlobalNodeID_t
204 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
206 case e2ap.E2AP_ENBIDMacroPBits20:
208 case e2ap.E2AP_ENBIDHomeBits28:
210 case e2ap.E2AP_ENBIDShortMacroits18:
212 case e2ap.E2AP_ENBIDlongMacroBits21:
215 return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
218 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
219 if err := enbId.checkbits(id.NodeId.Bits); err != nil {
222 enbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
223 enbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
224 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
227 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
228 if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
231 id.NodeId.Bits = (uint8)(enbId.entry.nodeID.bits)
232 id.NodeId.Id = (uint32)(enbId.entry.nodeID.nodeID)
233 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
236 //-----------------------------------------------------------------------------
238 //-----------------------------------------------------------------------------
239 type e2apEntryGlobalGnbId struct {
240 entry *C.GlobalNodeID_t
243 func (gnbId *e2apEntryGlobalGnbId) checkbits(bits uint8) error {
244 if bits < 22 || bits > 32 {
245 return fmt.Errorf("GlobalGnbId: given bits %d not match allowed: 22-32", bits)
250 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
251 if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
254 gnbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
255 gnbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
256 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
259 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
260 if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
263 id.NodeId.Bits = (uint8)(gnbId.entry.nodeID.bits)
264 id.NodeId.Id = (uint32)(gnbId.entry.nodeID.nodeID)
265 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
268 //-----------------------------------------------------------------------------
270 //-----------------------------------------------------------------------------
271 type e2apEntryInterfaceId struct {
272 entry *C.InterfaceID_t
275 func (indId *e2apEntryInterfaceId) set(id *e2ap.InterfaceId) error {
276 if id.GlobalEnbId.Present {
277 indId.entry.globalENBIDPresent = true
278 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).set(&id.GlobalEnbId); err != nil {
283 if id.GlobalGnbId.Present {
284 indId.entry.globalGNBIDPresent = true
285 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
292 func (indId *e2apEntryInterfaceId) get(id *e2ap.InterfaceId) error {
293 if indId.entry.globalENBIDPresent == true {
294 id.GlobalEnbId.Present = true
295 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).get(&id.GlobalEnbId); err != nil {
300 if indId.entry.globalGNBIDPresent == true {
301 id.GlobalGnbId.Present = true
302 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
309 //-----------------------------------------------------------------------------
311 //-----------------------------------------------------------------------------
312 type e2apEntryEventTrigger struct {
313 entry *C.RICEventTriggerDefinition_t
316 func (evtTrig *e2apEntryEventTrigger) set(id *e2ap.EventTriggerDefinition) error {
317 evtTrig.entry.interfaceDirection = (C.uint8_t)(id.InterfaceDirection)
318 evtTrig.entry.interfaceMessageType.procedureCode = (C.uint8_t)(id.ProcedureCode)
319 evtTrig.entry.interfaceMessageType.typeOfMessage = (C.uint8_t)(id.TypeOfMessage)
320 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).set(&id.InterfaceId)
323 func (evtTrig *e2apEntryEventTrigger) get(id *e2ap.EventTriggerDefinition) error {
324 id.InterfaceDirection = (uint32)(evtTrig.entry.interfaceDirection)
325 id.ProcedureCode = (uint32)(evtTrig.entry.interfaceMessageType.procedureCode)
326 id.TypeOfMessage = (uint64)(evtTrig.entry.interfaceMessageType.typeOfMessage)
327 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).get(&id.InterfaceId)
330 //-----------------------------------------------------------------------------
332 //-----------------------------------------------------------------------------
333 type e2apEntryAdmittedList struct {
334 entry *C.RICActionAdmittedList_t
337 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
339 if len(data.Items) > 16 {
340 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
343 item.entry.contentLength = 0
344 for i := 0; i < len(data.Items); i++ {
345 item.entry.ricActionID[item.entry.contentLength] = (C.ulong)(data.Items[i].ActionId)
346 item.entry.contentLength++
351 func (item *e2apEntryAdmittedList) get(data *e2ap.ActionAdmittedList) error {
352 conlen := (int)(item.entry.contentLength)
353 data.Items = make([]e2ap.ActionAdmittedItem, conlen)
354 for i := 0; i < conlen; i++ {
355 data.Items[i].ActionId = (uint64)(item.entry.ricActionID[i])
360 //-----------------------------------------------------------------------------
362 //-----------------------------------------------------------------------------
363 type e2apEntryNotAdmittedList struct {
364 entry *C.RICActionNotAdmittedList_t
367 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
369 if len(data.Items) > 16 {
370 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
373 item.entry.contentLength = 0
374 for i := 0; i < len(data.Items); i++ {
375 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId)
376 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content)
377 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal)
378 item.entry.contentLength++
384 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
385 conlen := (int)(item.entry.contentLength)
386 data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
387 for i := 0; i < conlen; i++ {
388 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
389 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content)
390 data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause)
395 //-----------------------------------------------------------------------------
397 //-----------------------------------------------------------------------------
398 type e2apEntryCriticalityDiagnostic struct {
399 entry *C.CriticalityDiagnostics__t
402 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
404 item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
405 item.entry.procedureCode = (C.uchar)(data.ProcCode)
407 item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
408 item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
410 item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
411 item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
413 item.entry.criticalityDiagnosticsIELength = 0
414 item.entry.iEsCriticalityDiagnosticsPresent = false
415 for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
416 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
417 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
418 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
419 item.entry.criticalityDiagnosticsIELength++
420 item.entry.iEsCriticalityDiagnosticsPresent = true
425 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
427 data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
428 data.ProcCode = (uint64)(item.entry.procedureCode)
430 data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
431 data.TrigMsg = (uint64)(item.entry.triggeringMessage)
433 data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
434 data.ProcCrit = (uint8)(item.entry.procedureCriticality)
436 if item.entry.iEsCriticalityDiagnosticsPresent == true {
437 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
438 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
439 for i := 0; i < conlen; i++ {
440 data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
441 data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
442 data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
449 //-----------------------------------------------------------------------------
451 //-----------------------------------------------------------------------------
452 type e2apEntryCallProcessId struct {
453 entry *C.RICCallProcessID_t
456 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
457 callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
461 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
462 data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
467 //-----------------------------------------------------------------------------
469 //-----------------------------------------------------------------------------
471 type e2apMessagePacker struct {
472 expectedInfo C.E2MessageInfo_t
473 pduMsgInfo C.E2MessageInfo_t
474 pdu *C.e2ap_pdu_ptr_t
480 func (e2apMsg *e2apMessagePacker) init(minfo C.E2MessageInfo_t) {
481 e2apMsg.expectedInfo = minfo
482 e2apMsg.lb = make([]byte, cLogBufferMaxSize)
484 e2apMsg.p = C.malloc(C.size_t(cMsgBufferMaxSize))
485 e2apMsg.plen = C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
488 func (e2apMsg *e2apMessagePacker) fini() {
494 func (e2apMsg *e2apMessagePacker) lbString() string {
495 return "logbuffer(" + string(e2apMsg.lb[:strings.Index(string(e2apMsg.lb[:]), "\000")]) + ")"
498 func (e2apMsg *e2apMessagePacker) packeddata() *e2ap.PackedData {
499 return &e2ap.PackedData{C.GoBytes(e2apMsg.p, C.int(e2apMsg.plen))}
502 func (e2apMsg *e2apMessagePacker) checkerr(errorNro C.uint64_t) error {
503 if errorNro != C.e2err_OK {
504 return fmt.Errorf("e2err(%s) %s", C.GoString(C.getE2ErrorString(errorNro)), e2apMsg.lbString())
509 func (e2apMsg *e2apMessagePacker) unpacktopdu(data *e2ap.PackedData) error {
510 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)
511 if e2apMsg.pduMsgInfo.messageType != e2apMsg.expectedInfo.messageType || e2apMsg.pduMsgInfo.messageId != e2apMsg.expectedInfo.messageId {
512 return fmt.Errorf("unpack e2ap %s %s", e2apMsg.lbString(), e2apMsg.String())
517 func (e2apMsg *e2apMessagePacker) messageInfoPdu() *e2ap.MessageInfo {
518 return cMessageInfoToMessageInfo(&e2apMsg.pduMsgInfo)
521 func (e2apMsg *e2apMessagePacker) messageInfoExpected() *e2ap.MessageInfo {
522 return cMessageInfoToMessageInfo(&e2apMsg.expectedInfo)
525 func (e2apMsg *e2apMessagePacker) String() string {
527 pduInfo := e2apMsg.messageInfoPdu()
529 ret += "pduinfo(" + pduInfo.String() + ")"
531 ret += "pduinfo(N/A)"
533 expInfo := e2apMsg.messageInfoExpected()
535 ret += " expinfo(" + expInfo.String() + ")"
537 ret += " expinfo(N/A)"
542 //-----------------------------------------------------------------------------
544 //-----------------------------------------------------------------------------
546 type e2apMsgPackerSubscriptionRequest struct {
548 msgC *C.RICSubscriptionRequest_t
549 msgG *e2ap.E2APSubscriptionRequest
552 func (e2apMsg *e2apMsgPackerSubscriptionRequest) init() {
553 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2InitiatingMessage, C.cRICSubscriptionRequest})
554 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
555 e2apMsg.msgG = &e2ap.E2APSubscriptionRequest{}
556 C.initSubsRequest(e2apMsg.msgC)
559 func (e2apMsg *e2apMsgPackerSubscriptionRequest) Pack(data *e2ap.E2APSubscriptionRequest) (error, *e2ap.PackedData) {
565 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
566 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
569 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).set(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
572 if len(e2apMsg.msgG.ActionSetups) > 16 {
573 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(e2apMsg.msgG.ActionSetups), 16), nil
575 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 0
576 for i := 0; i < len(e2apMsg.msgG.ActionSetups); i++ {
577 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength]}
578 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength += 1
579 if err := item.set(&e2apMsg.msgG.ActionSetups[i]); err != nil {
584 errorNro := C.packRICSubscriptionRequest(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
585 if err := e2apMsg.checkerr(errorNro); err != nil {
588 return nil, e2apMsg.packeddata()
591 func (e2apMsg *e2apMsgPackerSubscriptionRequest) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionRequest) {
596 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
597 return err, e2apMsg.msgG
599 errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
600 if err := e2apMsg.checkerr(errorNro); err != nil {
601 return err, e2apMsg.msgG
604 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
605 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
606 return err, e2apMsg.msgG
608 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).get(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
609 return err, e2apMsg.msgG
611 conlen := (int)(e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
612 e2apMsg.msgG.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
613 for i := 0; i < conlen; i++ {
614 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
615 if err := item.get(&e2apMsg.msgG.ActionSetups[i]); err != nil {
616 return err, e2apMsg.msgG
619 return nil, e2apMsg.msgG
623 func (e2apMsg *e2apMsgPackerSubscriptionRequest) String() string {
625 fmt.Fprintln(&b, "ricSubscriptionRequest.")
626 fmt.Fprintln(&b, " ricRequestID.")
627 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
628 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
629 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
630 fmt.Fprintln(&b, " ricSubscription.")
631 fmt.Fprintln(&b, " ricEventTriggerDefinition.")
632 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.octetString.contentLength)
633 fmt.Fprintln(&b, " interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent)
634 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent {
635 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength)
636 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
637 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
638 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
639 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits)
640 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID)
642 fmt.Fprintln(&b, " interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent)
643 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent {
644 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.contentLength)
645 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
646 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
647 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
648 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.bits)
649 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.nodeID)
651 fmt.Fprintln(&b, " interfaceDirection= ", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceDirection)
652 fmt.Fprintln(&b, " interfaceMessageType.procedureCode =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode)
653 fmt.Fprintln(&b, " interfaceMessageType.typeOfMessage =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage)
654 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.")
655 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
658 for (C.uchar)(index) < e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength {
659 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
660 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
662 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
663 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent {
664 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinition.styleID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID)
665 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID)
668 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
669 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
670 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
671 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscription.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, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
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].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
772 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
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, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
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].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
864 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
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, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
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, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
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.ricCause.content = (C.uchar)(e2apMsg.msgG.Cause.Content)
1043 e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.CauseVal)
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.ricCause.content)
1076 e2apMsg.msgG.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause)
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, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
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{}