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.PlmnIdentityIf) error {
180 buf := new(bytes.Buffer)
183 plmnId.entry.contentLength = (C.uint8_t)(len(data))
184 for i := 0; i < len(data); i++ {
185 plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(data[i])
190 func (plmnId *e2apEntryPlmnIdentity) get(id conv.PlmnIdentityIf) error {
191 conlen := (int)(plmnId.entry.contentLength)
192 bcdBuf := make([]uint8, conlen)
193 for i := 0; i < conlen; i++ {
194 bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i])
196 reader := bytes.NewReader(bcdBuf)
197 id.DecodeFrom(reader)
201 //-----------------------------------------------------------------------------
203 //-----------------------------------------------------------------------------
204 type e2apEntryGlobalEnbId struct {
205 entry *C.GlobalNodeID_t
208 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
210 case e2ap.E2AP_ENBIDMacroPBits20:
212 case e2ap.E2AP_ENBIDHomeBits28:
214 case e2ap.E2AP_ENBIDShortMacroits18:
216 case e2ap.E2AP_ENBIDlongMacroBits21:
219 return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
222 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
223 if err := enbId.checkbits(id.NodeId.Bits); err != nil {
226 enbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
227 enbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
228 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
231 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
232 if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
235 id.NodeId.Bits = (uint8)(enbId.entry.nodeID.bits)
236 id.NodeId.Id = (uint32)(enbId.entry.nodeID.nodeID)
237 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
240 //-----------------------------------------------------------------------------
242 //-----------------------------------------------------------------------------
243 type e2apEntryGlobalGnbId struct {
244 entry *C.GlobalNodeID_t
247 func (gnbId *e2apEntryGlobalGnbId) checkbits(bits uint8) error {
248 if bits < 22 || bits > 32 {
249 return fmt.Errorf("GlobalGnbId: given bits %d not match allowed: 22-32", bits)
254 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
255 if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
258 gnbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
259 gnbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
260 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
263 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
264 if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
267 id.NodeId.Bits = (uint8)(gnbId.entry.nodeID.bits)
268 id.NodeId.Id = (uint32)(gnbId.entry.nodeID.nodeID)
269 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
272 //-----------------------------------------------------------------------------
274 //-----------------------------------------------------------------------------
275 type e2apEntryInterfaceId struct {
276 entry *C.InterfaceID_t
279 func (indId *e2apEntryInterfaceId) set(id *e2ap.InterfaceId) error {
280 if id.GlobalEnbId.Present {
281 indId.entry.globalENBIDPresent = true
282 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).set(&id.GlobalEnbId); err != nil {
287 if id.GlobalGnbId.Present {
288 indId.entry.globalGNBIDPresent = true
289 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
296 func (indId *e2apEntryInterfaceId) get(id *e2ap.InterfaceId) error {
297 if indId.entry.globalENBIDPresent == true {
298 id.GlobalEnbId.Present = true
299 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).get(&id.GlobalEnbId); err != nil {
304 if indId.entry.globalGNBIDPresent == true {
305 id.GlobalGnbId.Present = true
306 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
313 //-----------------------------------------------------------------------------
315 //-----------------------------------------------------------------------------
316 type e2apEntryEventTrigger struct {
317 entry *C.RICEventTriggerDefinition_t
320 func (evtTrig *e2apEntryEventTrigger) set(id *e2ap.EventTriggerDefinition) error {
321 evtTrig.entry.interfaceDirection = (C.uint8_t)(id.InterfaceDirection)
322 evtTrig.entry.interfaceMessageType.procedureCode = (C.uint8_t)(id.ProcedureCode)
323 evtTrig.entry.interfaceMessageType.typeOfMessage = (C.uint8_t)(id.TypeOfMessage)
324 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).set(&id.InterfaceId)
327 func (evtTrig *e2apEntryEventTrigger) get(id *e2ap.EventTriggerDefinition) error {
328 id.InterfaceDirection = (uint32)(evtTrig.entry.interfaceDirection)
329 id.ProcedureCode = (uint32)(evtTrig.entry.interfaceMessageType.procedureCode)
330 id.TypeOfMessage = (uint64)(evtTrig.entry.interfaceMessageType.typeOfMessage)
331 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).get(&id.InterfaceId)
334 //-----------------------------------------------------------------------------
336 //-----------------------------------------------------------------------------
337 type e2apEntryAdmittedList struct {
338 entry *C.RICActionAdmittedList_t
341 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
343 if len(data.Items) > 16 {
344 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
347 item.entry.contentLength = 0
348 for i := 0; i < len(data.Items); i++ {
349 item.entry.ricActionID[item.entry.contentLength] = (C.ulong)(data.Items[i].ActionId)
350 item.entry.contentLength++
355 func (item *e2apEntryAdmittedList) get(data *e2ap.ActionAdmittedList) error {
356 conlen := (int)(item.entry.contentLength)
357 data.Items = make([]e2ap.ActionAdmittedItem, conlen)
358 for i := 0; i < conlen; i++ {
359 data.Items[i].ActionId = (uint64)(item.entry.ricActionID[i])
364 //-----------------------------------------------------------------------------
366 //-----------------------------------------------------------------------------
367 type e2apEntryNotAdmittedList struct {
368 entry *C.RICActionNotAdmittedList_t
371 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
373 if len(data.Items) > 16 {
374 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
377 item.entry.contentLength = 0
378 for i := 0; i < len(data.Items); i++ {
379 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId)
380 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content)
381 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal)
382 item.entry.contentLength++
388 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
389 conlen := (int)(item.entry.contentLength)
390 data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
391 for i := 0; i < conlen; i++ {
392 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
393 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content)
394 data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause)
399 //-----------------------------------------------------------------------------
401 //-----------------------------------------------------------------------------
402 type e2apEntryCriticalityDiagnostic struct {
403 entry *C.CriticalityDiagnostics__t
406 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
408 item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
409 item.entry.procedureCode = (C.uchar)(data.ProcCode)
411 item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
412 item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
414 item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
415 item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
417 item.entry.criticalityDiagnosticsIELength = 0
418 item.entry.iEsCriticalityDiagnosticsPresent = false
419 for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
420 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
421 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
422 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
423 item.entry.criticalityDiagnosticsIELength++
424 item.entry.iEsCriticalityDiagnosticsPresent = true
429 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
431 data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
432 data.ProcCode = (uint64)(item.entry.procedureCode)
434 data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
435 data.TrigMsg = (uint64)(item.entry.triggeringMessage)
437 data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
438 data.ProcCrit = (uint8)(item.entry.procedureCriticality)
440 if item.entry.iEsCriticalityDiagnosticsPresent == true {
441 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
442 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
443 for i := 0; i < conlen; i++ {
444 data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
445 data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
446 data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
453 //-----------------------------------------------------------------------------
455 //-----------------------------------------------------------------------------
456 type e2apEntryCallProcessId struct {
457 entry *C.RICCallProcessID_t
460 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
461 callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
465 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
466 data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
471 //-----------------------------------------------------------------------------
473 //-----------------------------------------------------------------------------
475 type e2apMessagePacker struct {
476 expectedInfo C.E2MessageInfo_t
477 pduMsgInfo C.E2MessageInfo_t
478 pdu *C.e2ap_pdu_ptr_t
484 func (e2apMsg *e2apMessagePacker) init(minfo C.E2MessageInfo_t) {
485 e2apMsg.expectedInfo = minfo
486 e2apMsg.lb = make([]byte, cLogBufferMaxSize)
488 e2apMsg.p = C.malloc(C.size_t(cMsgBufferMaxSize))
489 e2apMsg.plen = C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
492 func (e2apMsg *e2apMessagePacker) fini() {
498 func (e2apMsg *e2apMessagePacker) lbString() string {
499 return "logbuffer(" + string(e2apMsg.lb[:strings.Index(string(e2apMsg.lb[:]), "\000")]) + ")"
502 func (e2apMsg *e2apMessagePacker) packeddata() *e2ap.PackedData {
503 return &e2ap.PackedData{C.GoBytes(e2apMsg.p, C.int(e2apMsg.plen))}
506 func (e2apMsg *e2apMessagePacker) checkerr(errorNro C.uint64_t) error {
507 if errorNro != C.e2err_OK {
508 return fmt.Errorf("e2err(%s) %s", C.GoString(C.getE2ErrorString(errorNro)), e2apMsg.lbString())
513 func (e2apMsg *e2apMessagePacker) unpacktopdu(data *e2ap.PackedData) error {
514 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)
515 if e2apMsg.pduMsgInfo.messageType != e2apMsg.expectedInfo.messageType || e2apMsg.pduMsgInfo.messageId != e2apMsg.expectedInfo.messageId {
516 return fmt.Errorf("unpack e2ap %s %s", e2apMsg.lbString(), e2apMsg.String())
521 func (e2apMsg *e2apMessagePacker) messageInfoPdu() *e2ap.MessageInfo {
522 return cMessageInfoToMessageInfo(&e2apMsg.pduMsgInfo)
525 func (e2apMsg *e2apMessagePacker) messageInfoExpected() *e2ap.MessageInfo {
526 return cMessageInfoToMessageInfo(&e2apMsg.expectedInfo)
529 func (e2apMsg *e2apMessagePacker) String() string {
531 pduInfo := e2apMsg.messageInfoPdu()
533 ret += "pduinfo(" + pduInfo.String() + ")"
535 ret += "pduinfo(N/A)"
537 expInfo := e2apMsg.messageInfoExpected()
539 ret += " expinfo(" + expInfo.String() + ")"
541 ret += " expinfo(N/A)"
546 //-----------------------------------------------------------------------------
548 //-----------------------------------------------------------------------------
550 type e2apMsgPackerSubscriptionRequest struct {
552 msgC *C.RICSubscriptionRequest_t
553 msgG *e2ap.E2APSubscriptionRequest
556 func (e2apMsg *e2apMsgPackerSubscriptionRequest) init() {
557 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2InitiatingMessage, C.cRICSubscriptionRequest})
558 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
559 e2apMsg.msgG = &e2ap.E2APSubscriptionRequest{}
560 C.initSubsRequest(e2apMsg.msgC)
563 func (e2apMsg *e2apMsgPackerSubscriptionRequest) Pack(data *e2ap.E2APSubscriptionRequest) (error, *e2ap.PackedData) {
569 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
570 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
573 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).set(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
576 if len(e2apMsg.msgG.ActionSetups) > 16 {
577 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(e2apMsg.msgG.ActionSetups), 16), nil
579 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 0
580 for i := 0; i < len(e2apMsg.msgG.ActionSetups); i++ {
581 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength]}
582 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength += 1
583 if err := item.set(&e2apMsg.msgG.ActionSetups[i]); err != nil {
588 errorNro := C.packRICSubscriptionRequest(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
589 if err := e2apMsg.checkerr(errorNro); err != nil {
592 return nil, e2apMsg.packeddata()
595 func (e2apMsg *e2apMsgPackerSubscriptionRequest) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionRequest) {
600 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
601 return err, e2apMsg.msgG
603 errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
604 if err := e2apMsg.checkerr(errorNro); err != nil {
605 return err, e2apMsg.msgG
608 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
609 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
610 return err, e2apMsg.msgG
612 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).get(&e2apMsg.msgG.EventTriggerDefinition); err != nil {
613 return err, e2apMsg.msgG
615 conlen := (int)(e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
616 e2apMsg.msgG.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
617 for i := 0; i < conlen; i++ {
618 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
619 if err := item.get(&e2apMsg.msgG.ActionSetups[i]); err != nil {
620 return err, e2apMsg.msgG
623 return nil, e2apMsg.msgG
627 func (e2apMsg *e2apMsgPackerSubscriptionRequest) String() string {
629 fmt.Fprintln(&b, "ricSubscriptionRequest.")
630 fmt.Fprintln(&b, " ricRequestID.")
631 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
632 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
633 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
634 fmt.Fprintln(&b, " ricSubscription.")
635 fmt.Fprintln(&b, " ricEventTriggerDefinition.")
636 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.octetString.contentLength)
637 fmt.Fprintln(&b, " interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent)
638 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent {
639 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength)
640 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
641 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
642 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
643 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits)
644 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID)
646 fmt.Fprintln(&b, " interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent)
647 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent {
648 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.contentLength)
649 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
650 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
651 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
652 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.bits)
653 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.nodeID)
655 fmt.Fprintln(&b, " interfaceDirection= ", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceDirection)
656 fmt.Fprintln(&b, " interfaceMessageType.procedureCode =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode)
657 fmt.Fprintln(&b, " interfaceMessageType.typeOfMessage =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage)
658 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.")
659 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
662 for (C.uchar)(index) < e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength {
663 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
664 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
666 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
667 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent {
668 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinition.styleID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID)
669 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID)
672 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
673 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
674 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
675 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait)
682 //-----------------------------------------------------------------------------
684 //-----------------------------------------------------------------------------
685 type e2apMsgPackerSubscriptionResponse struct {
687 msgC *C.RICSubscriptionResponse_t
688 msgG *e2ap.E2APSubscriptionResponse
691 func (e2apMsg *e2apMsgPackerSubscriptionResponse) init() {
692 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2SuccessfulOutcome, C.cRICSubscriptionResponse})
693 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
694 e2apMsg.msgG = &e2ap.E2APSubscriptionResponse{}
695 C.initSubsResponse(e2apMsg.msgC)
698 func (e2apMsg *e2apMsgPackerSubscriptionResponse) Pack(data *e2ap.E2APSubscriptionResponse) (error, *e2ap.PackedData) {
703 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
704 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
707 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).set(&e2apMsg.msgG.ActionAdmittedList); err != nil {
710 e2apMsg.msgC.ricActionNotAdmittedListPresent = false
711 if len(e2apMsg.msgG.ActionNotAdmittedList.Items) > 0 {
712 e2apMsg.msgC.ricActionNotAdmittedListPresent = true
713 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
718 errorNro := C.packRICSubscriptionResponse(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
719 if err := e2apMsg.checkerr(errorNro); err != nil {
722 return nil, e2apMsg.packeddata()
725 func (e2apMsg *e2apMsgPackerSubscriptionResponse) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionResponse) {
730 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
731 return err, e2apMsg.msgG
733 errorNro := C.getRICSubscriptionResponseData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
734 if err := e2apMsg.checkerr(errorNro); err != nil {
735 return err, e2apMsg.msgG
738 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
739 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
740 return err, e2apMsg.msgG
742 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).get(&e2apMsg.msgG.ActionAdmittedList); err != nil {
743 return err, e2apMsg.msgG
745 if e2apMsg.msgC.ricActionNotAdmittedListPresent == true {
746 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
747 return err, e2apMsg.msgG
750 return nil, e2apMsg.msgG
753 func (e2apMsg *e2apMsgPackerSubscriptionResponse) String() string {
755 fmt.Fprintln(&b, "ricSubscriptionResponse.")
756 fmt.Fprintln(&b, " ricRequestID.")
757 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
758 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
759 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
760 fmt.Fprintln(&b, " ricActionAdmittedList.")
761 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionAdmittedList.contentLength)
764 for (C.uchar)(index) < e2apMsg.msgC.ricActionAdmittedList.contentLength {
765 fmt.Fprintln(&b, " ricActionAdmittedList.ricActionID[index] =", e2apMsg.msgC.ricActionAdmittedList.ricActionID[index])
768 if e2apMsg.msgC.ricActionNotAdmittedListPresent {
769 fmt.Fprintln(&b, " ricActionNotAdmittedListPresent =", e2apMsg.msgC.ricActionNotAdmittedListPresent)
770 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
771 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
773 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
774 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
775 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
776 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
783 //-----------------------------------------------------------------------------
785 //-----------------------------------------------------------------------------
786 type e2apMsgPackerSubscriptionFailure struct {
788 msgC *C.RICSubscriptionFailure_t
789 msgG *e2ap.E2APSubscriptionFailure
792 func (e2apMsg *e2apMsgPackerSubscriptionFailure) init() {
793 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2UnsuccessfulOutcome, C.cRICSubscriptionFailure})
794 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
795 e2apMsg.msgG = &e2ap.E2APSubscriptionFailure{}
796 C.initSubsFailure(e2apMsg.msgC)
799 func (e2apMsg *e2apMsgPackerSubscriptionFailure) Pack(data *e2ap.E2APSubscriptionFailure) (error, *e2ap.PackedData) {
804 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
805 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
808 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
811 e2apMsg.msgC.criticalityDiagnosticsPresent = false
812 if e2apMsg.msgG.CriticalityDiagnostics.Present {
813 e2apMsg.msgC.criticalityDiagnosticsPresent = true
814 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
819 errorNro := C.packRICSubscriptionFailure(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
820 if err := e2apMsg.checkerr(errorNro); err != nil {
823 return nil, e2apMsg.packeddata()
826 func (e2apMsg *e2apMsgPackerSubscriptionFailure) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionFailure) {
830 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
831 return err, e2apMsg.msgG
833 errorNro := C.getRICSubscriptionFailureData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
834 if err := e2apMsg.checkerr(errorNro); err != nil {
835 return err, e2apMsg.msgG
838 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
839 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
840 return err, e2apMsg.msgG
842 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&e2apMsg.msgG.ActionNotAdmittedList); err != nil {
843 return err, e2apMsg.msgG
845 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
846 e2apMsg.msgG.CriticalityDiagnostics.Present = true
847 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
848 return err, e2apMsg.msgG
851 return nil, e2apMsg.msgG
854 func (e2apMsg *e2apMsgPackerSubscriptionFailure) String() string {
856 fmt.Fprintln(&b, "ricSubscriptionFailure.")
857 fmt.Fprintln(&b, " ricRequestID.")
858 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
859 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
860 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
861 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
862 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
865 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
866 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
867 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
868 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
872 if e2apMsg.msgC.criticalityDiagnosticsPresent {
873 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
874 fmt.Fprintln(&b, " criticalityDiagnostics.")
875 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
876 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
877 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
878 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
879 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
880 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
881 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
882 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
885 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
886 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
887 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
888 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
896 //-----------------------------------------------------------------------------
898 //-----------------------------------------------------------------------------
899 type e2apMsgPackerSubscriptionDeleteRequest struct {
901 msgC *C.RICSubscriptionDeleteRequest_t
902 msgG *e2ap.E2APSubscriptionDeleteRequest
905 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) init() {
906 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2InitiatingMessage, C.cRICSubscriptionDeleteRequest})
907 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
908 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteRequest{}
909 C.initSubsDeleteRequest(e2apMsg.msgC)
912 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) Pack(data *e2ap.E2APSubscriptionDeleteRequest) (error, *e2ap.PackedData) {
917 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
918 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
922 errorNro := C.packRICSubscriptionDeleteRequest(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
923 if err := e2apMsg.checkerr(errorNro); err != nil {
926 return nil, e2apMsg.packeddata()
929 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteRequest) {
933 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
934 return err, e2apMsg.msgG
936 errorNro := C.getRICSubscriptionDeleteRequestData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
937 if err := e2apMsg.checkerr(errorNro); err != nil {
938 return err, e2apMsg.msgG
941 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
942 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
943 return err, e2apMsg.msgG
945 return nil, e2apMsg.msgG
949 func (e2apMsg *e2apMsgPackerSubscriptionDeleteRequest) String() string {
951 fmt.Fprintln(&b, "ricSubscriptionDeleteRequest.")
952 fmt.Fprintln(&b, " ricRequestID.")
953 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
954 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
955 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
959 //-----------------------------------------------------------------------------
961 //-----------------------------------------------------------------------------
962 type e2apMsgPackerSubscriptionDeleteResponse struct {
964 msgC *C.RICSubscriptionDeleteResponse_t
965 msgG *e2ap.E2APSubscriptionDeleteResponse
968 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) init() {
969 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2SuccessfulOutcome, C.cRICsubscriptionDeleteResponse})
970 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
971 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteResponse{}
972 C.initSubsDeleteResponse(e2apMsg.msgC)
975 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) Pack(data *e2ap.E2APSubscriptionDeleteResponse) (error, *e2ap.PackedData) {
980 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
981 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
985 errorNro := C.packRICSubscriptionDeleteResponse(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
986 if err := e2apMsg.checkerr(errorNro); err != nil {
989 return nil, e2apMsg.packeddata()
992 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteResponse) {
996 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
997 return err, e2apMsg.msgG
999 errorNro := C.getRICSubscriptionDeleteResponseData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
1000 if err := e2apMsg.checkerr(errorNro); err != nil {
1001 return err, e2apMsg.msgG
1004 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1005 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
1006 return err, e2apMsg.msgG
1008 return nil, e2apMsg.msgG
1011 func (e2apMsg *e2apMsgPackerSubscriptionDeleteResponse) String() string {
1013 fmt.Fprintln(&b, "ricSubscriptionDeleteResponse.")
1014 fmt.Fprintln(&b, " ricRequestID.")
1015 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1016 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1017 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1021 //-----------------------------------------------------------------------------
1023 //-----------------------------------------------------------------------------
1024 type e2apMsgPackerSubscriptionDeleteFailure struct {
1026 msgC *C.RICSubscriptionDeleteFailure_t
1027 msgG *e2ap.E2APSubscriptionDeleteFailure
1030 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) init() {
1031 e2apMsg.e2apMessagePacker.init(C.E2MessageInfo_t{C.cE2UnsuccessfulOutcome, C.cRICsubscriptionDeleteFailure})
1032 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1033 e2apMsg.msgG = &e2ap.E2APSubscriptionDeleteFailure{}
1034 C.initSubsDeleteFailure(e2apMsg.msgC)
1037 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) Pack(data *e2ap.E2APSubscriptionDeleteFailure) (error, *e2ap.PackedData) {
1039 defer e2apMsg.fini()
1042 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(e2apMsg.msgG.FunctionId)
1043 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&e2apMsg.msgG.RequestId); err != nil {
1046 e2apMsg.msgC.ricCause.content = (C.uchar)(e2apMsg.msgG.Cause.Content)
1047 e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.CauseVal)
1048 e2apMsg.msgC.criticalityDiagnosticsPresent = false
1049 if e2apMsg.msgG.CriticalityDiagnostics.Present {
1050 e2apMsg.msgC.criticalityDiagnosticsPresent = true
1051 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
1056 errorNro := C.packRICSubscriptionDeleteFailure(&e2apMsg.plen, (*C.uchar)(e2apMsg.p), (*C.char)(unsafe.Pointer(&e2apMsg.lb[0])), e2apMsg.msgC)
1057 if err := e2apMsg.checkerr(errorNro); err != nil {
1060 return nil, e2apMsg.packeddata()
1063 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) UnPack(msg *e2ap.PackedData) (error, *e2ap.E2APSubscriptionDeleteFailure) {
1065 defer e2apMsg.fini()
1067 if err := e2apMsg.e2apMessagePacker.unpacktopdu(msg); err != nil {
1068 return err, e2apMsg.msgG
1070 errorNro := C.getRICSubscriptionDeleteFailureData(e2apMsg.e2apMessagePacker.pdu, e2apMsg.msgC)
1071 if err := e2apMsg.checkerr(errorNro); err != nil {
1072 return err, e2apMsg.msgG
1075 e2apMsg.msgG.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1076 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&e2apMsg.msgG.RequestId); err != nil {
1077 return err, e2apMsg.msgG
1079 e2apMsg.msgG.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content)
1080 e2apMsg.msgG.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause)
1081 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
1082 e2apMsg.msgG.CriticalityDiagnostics.Present = true
1083 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {
1084 return err, e2apMsg.msgG
1087 return nil, e2apMsg.msgG
1090 func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) String() string {
1092 fmt.Fprintln(&b, "ricSubscriptionDeleteFailure.")
1093 fmt.Fprintln(&b, " ricRequestID.")
1094 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1095 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1096 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1098 if e2apMsg.msgC.criticalityDiagnosticsPresent {
1099 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
1100 fmt.Fprintln(&b, " criticalityDiagnostics.")
1101 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
1102 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
1103 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
1104 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
1105 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
1106 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
1107 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
1108 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
1111 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
1112 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
1113 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
1114 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
1122 //-----------------------------------------------------------------------------
1123 // Public E2AP packer creators
1124 //-----------------------------------------------------------------------------
1126 type cppasn1E2APPacker struct{}
1128 func (*cppasn1E2APPacker) NewPackerSubscriptionRequest() e2ap.E2APMsgPackerSubscriptionRequestIf {
1129 return &e2apMsgPackerSubscriptionRequest{}
1132 func (*cppasn1E2APPacker) NewPackerSubscriptionResponse() e2ap.E2APMsgPackerSubscriptionResponseIf {
1133 return &e2apMsgPackerSubscriptionResponse{}
1136 func (*cppasn1E2APPacker) NewPackerSubscriptionFailure() e2ap.E2APMsgPackerSubscriptionFailureIf {
1137 return &e2apMsgPackerSubscriptionFailure{}
1140 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteRequest() e2ap.E2APMsgPackerSubscriptionDeleteRequestIf {
1141 return &e2apMsgPackerSubscriptionDeleteRequest{}
1144 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteResponse() e2ap.E2APMsgPackerSubscriptionDeleteResponseIf {
1145 return &e2apMsgPackerSubscriptionDeleteResponse{}
1148 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPackerSubscriptionDeleteFailureIf {
1149 return &e2apMsgPackerSubscriptionDeleteFailure{}
1152 func NewAsn1E2Packer() e2ap.E2APPackerIf {
1153 return &cppasn1E2APPacker{}