2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
22 // #cgo LDFLAGS: -le2ap_wrapper -le2ap -lstdc++
23 // #include <stdlib.h>
24 // #include <c_types.h>
25 // #include <E2AP_if.h>
26 // #include <strings.h>
28 // void initSubsRequest(RICSubscriptionRequest_t *data){
29 // bzero(data,sizeof(RICSubscriptionRequest_t));
31 // void initSubsResponse(RICSubscriptionResponse_t *data){
32 // bzero(data,sizeof(RICSubscriptionResponse_t));
34 // void initSubsFailure(RICSubscriptionFailure_t *data){
35 // bzero(data,sizeof(RICSubscriptionFailure_t));
37 // void initSubsDeleteRequest(RICSubscriptionDeleteRequest_t *data){
38 // bzero(data,sizeof(RICSubscriptionDeleteRequest_t));
40 // void initSubsDeleteResponse(RICSubscriptionDeleteResponse_t *data){
41 // bzero(data,sizeof(RICSubscriptionDeleteResponse_t));
43 // void initSubsDeleteFailure(RICSubscriptionDeleteFailure_t *data){
44 // bzero(data,sizeof(RICSubscriptionDeleteFailure_t));
52 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/conv"
53 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
54 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer"
58 const cMsgBufferMaxSize = 40960
59 const cMsgBufferExtra = 512
61 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
64 type e2apEntryRequestID struct {
65 entry *C.RICRequestID_t
68 func (e2Item *e2apEntryRequestID) set(id *e2ap.RequestId) error {
69 e2Item.entry.ricRequestorID = (C.uint32_t)(id.Id)
70 e2Item.entry.ricRequestSequenceNumber = (C.uint32_t)(id.Seq)
74 func (e2Item *e2apEntryRequestID) get(id *e2ap.RequestId) error {
75 id.Id = (uint32)(e2Item.entry.ricRequestorID)
76 id.Seq = (uint32)(e2Item.entry.ricRequestSequenceNumber)
80 //-----------------------------------------------------------------------------
82 //-----------------------------------------------------------------------------
83 type e2apEntryActionToBeSetupItem struct {
84 entry *C.RICActionToBeSetupItem_t
87 func (e2Item *e2apEntryActionToBeSetupItem) set(id *e2ap.ActionToBeSetupItem) error {
89 e2Item.entry.ricActionID = (C.ulong)(id.ActionId)
90 e2Item.entry.ricActionType = (C.uint64_t)(id.ActionType)
92 if id.ActionDefinition.Present {
93 e2Item.entry.ricActionDefinitionPresent = true
94 e2Item.entry.ricActionDefinition.styleID = (C.uint64_t)(id.ActionDefinition.StyleId)
95 e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID = (C.uint32_t)(id.ActionDefinition.ParamId)
96 //e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue = id.ActionDefinition.ParamValue
99 if id.SubsequentAction.Present {
100 e2Item.entry.ricSubsequentActionPresent = true
101 e2Item.entry.ricSubsequentAction.ricSubsequentActionType = (C.uint64_t)(id.SubsequentAction.Type)
102 e2Item.entry.ricSubsequentAction.ricTimeToWait = (C.uint64_t)(id.SubsequentAction.TimetoWait)
107 func (e2Item *e2apEntryActionToBeSetupItem) get(id *e2ap.ActionToBeSetupItem) error {
109 id.ActionId = (uint64)(e2Item.entry.ricActionID)
110 id.ActionType = (uint64)(e2Item.entry.ricActionType)
112 if e2Item.entry.ricActionDefinitionPresent {
113 id.ActionDefinition.Present = true
114 id.ActionDefinition.StyleId = (uint64)(e2Item.entry.ricActionDefinition.styleID)
115 id.ActionDefinition.ParamId = (uint32)(e2Item.entry.ricActionDefinition.sequenceOfActionParameters.parameterID)
116 //id.ActionDefinition.ParamValue=e2Item.entry.ricActionDefinition.sequenceOfActionParameters.ParameterValue
119 if e2Item.entry.ricSubsequentActionPresent {
120 id.SubsequentAction.Present = true
121 id.SubsequentAction.Type = (uint64)(e2Item.entry.ricSubsequentAction.ricSubsequentActionType)
122 id.SubsequentAction.TimetoWait = (uint64)(e2Item.entry.ricSubsequentAction.ricTimeToWait)
127 //-----------------------------------------------------------------------------
129 //-----------------------------------------------------------------------------
130 type e2apEntryPlmnIdentity struct {
131 entry *C.PLMNIdentity_t
134 func (plmnId *e2apEntryPlmnIdentity) set(id *conv.PlmnIdentity) error {
136 plmnId.entry.contentLength = (C.uint8_t)(len(id.Val))
137 for i := 0; i < len(id.Val); i++ {
138 plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(id.Val[i])
143 func (plmnId *e2apEntryPlmnIdentity) get(id *conv.PlmnIdentity) error {
144 conlen := (int)(plmnId.entry.contentLength)
145 bcdBuf := make([]uint8, conlen)
146 for i := 0; i < conlen; i++ {
147 bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i])
153 //-----------------------------------------------------------------------------
155 //-----------------------------------------------------------------------------
156 type e2apEntryGlobalEnbId struct {
157 entry *C.GlobalNodeID_t
160 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
162 case e2ap.E2AP_ENBIDMacroPBits20:
164 case e2ap.E2AP_ENBIDHomeBits28:
166 case e2ap.E2AP_ENBIDShortMacroits18:
168 case e2ap.E2AP_ENBIDlongMacroBits21:
171 return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
174 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
175 if err := enbId.checkbits(id.NodeId.Bits); err != nil {
178 enbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
179 enbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
180 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
183 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
184 if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
187 id.NodeId.Bits = (uint8)(enbId.entry.nodeID.bits)
188 id.NodeId.Id = (uint32)(enbId.entry.nodeID.nodeID)
189 return (&e2apEntryPlmnIdentity{entry: &enbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
192 //-----------------------------------------------------------------------------
194 //-----------------------------------------------------------------------------
195 type e2apEntryGlobalGnbId struct {
196 entry *C.GlobalNodeID_t
199 func (gnbId *e2apEntryGlobalGnbId) checkbits(bits uint8) error {
200 if bits < 22 || bits > 32 {
201 return fmt.Errorf("GlobalGnbId: given bits %d not match allowed: 22-32", bits)
206 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
207 if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
210 gnbId.entry.nodeID.bits = (C.uchar)(id.NodeId.Bits)
211 gnbId.entry.nodeID.nodeID = (C.uint32_t)(id.NodeId.Id)
212 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).set(&id.PlmnIdentity)
215 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
216 if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
219 id.NodeId.Bits = (uint8)(gnbId.entry.nodeID.bits)
220 id.NodeId.Id = (uint32)(gnbId.entry.nodeID.nodeID)
221 return (&e2apEntryPlmnIdentity{entry: &gnbId.entry.pLMNIdentity}).get(&id.PlmnIdentity)
224 //-----------------------------------------------------------------------------
226 //-----------------------------------------------------------------------------
227 type e2apEntryInterfaceId struct {
228 entry *C.InterfaceID_t
231 func (indId *e2apEntryInterfaceId) set(id *e2ap.InterfaceId) error {
232 if id.GlobalEnbId.Present {
233 indId.entry.globalENBIDPresent = true
234 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).set(&id.GlobalEnbId); err != nil {
239 if id.GlobalGnbId.Present {
240 indId.entry.globalGNBIDPresent = true
241 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
248 func (indId *e2apEntryInterfaceId) get(id *e2ap.InterfaceId) error {
249 if indId.entry.globalENBIDPresent == true {
250 id.GlobalEnbId.Present = true
251 if err := (&e2apEntryGlobalEnbId{entry: &indId.entry.globalENBID}).get(&id.GlobalEnbId); err != nil {
256 if indId.entry.globalGNBIDPresent == true {
257 id.GlobalGnbId.Present = true
258 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
265 //-----------------------------------------------------------------------------
267 //-----------------------------------------------------------------------------
268 type e2apEntryEventTrigger struct {
269 entry *C.RICEventTriggerDefinition_t
272 func (evtTrig *e2apEntryEventTrigger) set(id *e2ap.EventTriggerDefinition) error {
273 evtTrig.entry.interfaceDirection = (C.uint8_t)(id.InterfaceDirection)
274 evtTrig.entry.interfaceMessageType.procedureCode = (C.uint8_t)(id.ProcedureCode)
275 evtTrig.entry.interfaceMessageType.typeOfMessage = (C.uint8_t)(id.TypeOfMessage)
276 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).set(&id.InterfaceId)
279 func (evtTrig *e2apEntryEventTrigger) get(id *e2ap.EventTriggerDefinition) error {
280 id.InterfaceDirection = (uint32)(evtTrig.entry.interfaceDirection)
281 id.ProcedureCode = (uint32)(evtTrig.entry.interfaceMessageType.procedureCode)
282 id.TypeOfMessage = (uint64)(evtTrig.entry.interfaceMessageType.typeOfMessage)
283 return (&e2apEntryInterfaceId{entry: &evtTrig.entry.interfaceID}).get(&id.InterfaceId)
286 //-----------------------------------------------------------------------------
288 //-----------------------------------------------------------------------------
289 type e2apEntryAdmittedList struct {
290 entry *C.RICActionAdmittedList_t
293 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
295 if len(data.Items) > 16 {
296 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
299 item.entry.contentLength = 0
300 for i := 0; i < len(data.Items); i++ {
301 item.entry.ricActionID[item.entry.contentLength] = (C.ulong)(data.Items[i].ActionId)
302 item.entry.contentLength++
307 func (item *e2apEntryAdmittedList) get(data *e2ap.ActionAdmittedList) error {
308 conlen := (int)(item.entry.contentLength)
309 data.Items = make([]e2ap.ActionAdmittedItem, conlen)
310 for i := 0; i < conlen; i++ {
311 data.Items[i].ActionId = (uint64)(item.entry.ricActionID[i])
316 //-----------------------------------------------------------------------------
318 //-----------------------------------------------------------------------------
319 type e2apEntryNotAdmittedList struct {
320 entry *C.RICActionNotAdmittedList_t
323 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
325 if len(data.Items) > 16 {
326 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
329 item.entry.contentLength = 0
330 for i := 0; i < len(data.Items); i++ {
331 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId)
332 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content)
333 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal)
334 item.entry.contentLength++
340 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
341 conlen := (int)(item.entry.contentLength)
342 data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
343 for i := 0; i < conlen; i++ {
344 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
345 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content)
346 data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause)
351 //-----------------------------------------------------------------------------
353 //-----------------------------------------------------------------------------
354 type e2apEntryCriticalityDiagnostic struct {
355 entry *C.CriticalityDiagnostics__t
358 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
360 item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
361 item.entry.procedureCode = (C.uchar)(data.ProcCode)
363 item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
364 item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
366 item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
367 item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
369 item.entry.criticalityDiagnosticsIELength = 0
370 item.entry.iEsCriticalityDiagnosticsPresent = false
371 for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
372 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
373 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
374 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
375 item.entry.criticalityDiagnosticsIELength++
376 item.entry.iEsCriticalityDiagnosticsPresent = true
381 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
383 data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
384 data.ProcCode = (uint64)(item.entry.procedureCode)
386 data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
387 data.TrigMsg = (uint64)(item.entry.triggeringMessage)
389 data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
390 data.ProcCrit = (uint8)(item.entry.procedureCriticality)
392 if item.entry.iEsCriticalityDiagnosticsPresent == true {
393 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
394 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
395 for i := 0; i < conlen; i++ {
396 data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
397 data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
398 data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
405 //-----------------------------------------------------------------------------
407 //-----------------------------------------------------------------------------
408 type e2apEntryCallProcessId struct {
409 entry *C.RICCallProcessID_t
412 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
413 callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
417 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
418 data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
423 //-----------------------------------------------------------------------------
425 //-----------------------------------------------------------------------------
427 type e2apMessage struct {
428 pdu *C.e2ap_pdu_ptr_t
429 messageInfo C.E2MessageInfo_t
432 func (e2apMsg *e2apMessage) PduUnPack(logBuf []byte, data *packer.PackedData) error {
433 e2apMsg.pdu = C.unpackE2AP_pdu((C.size_t)(len(data.Buf)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), &e2apMsg.messageInfo)
437 func (e2apMsg *e2apMessage) MessageInfo() *packer.MessageInfo {
439 msgInfo := &packer.MessageInfo{}
441 switch e2apMsg.messageInfo.messageType {
442 case C.cE2InitiatingMessage:
443 msgInfo.MsgType = e2ap.E2AP_InitiatingMessage
444 switch e2apMsg.messageInfo.messageId {
445 case C.cRICSubscriptionRequest:
446 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionRequest
448 case C.cRICSubscriptionDeleteRequest:
449 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteRequest
452 case C.cE2SuccessfulOutcome:
453 msgInfo.MsgType = e2ap.E2AP_SuccessfulOutcome
454 switch e2apMsg.messageInfo.messageId {
455 case C.cRICSubscriptionResponse:
456 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionResponse
458 case C.cRICsubscriptionDeleteResponse:
459 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteResponse
462 case C.cE2UnsuccessfulOutcome:
463 msgInfo.MsgType = e2ap.E2AP_UnsuccessfulOutcome
464 switch e2apMsg.messageInfo.messageId {
465 case C.cRICSubscriptionFailure:
466 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionFailure
468 case C.cRICsubscriptionDeleteFailure:
469 msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteFailure
477 func (e2apMsg *e2apMessage) String() string {
478 msgInfo := e2apMsg.MessageInfo()
482 return msgInfo.String()
485 //-----------------------------------------------------------------------------
487 //-----------------------------------------------------------------------------
489 type e2apMsgSubscriptionRequest struct {
491 msgC *C.RICSubscriptionRequest_t
494 func (e2apMsg *e2apMsgSubscriptionRequest) PduPack(logBuf []byte) (error, *packer.PackedData) {
495 p := C.malloc(C.size_t(cMsgBufferMaxSize))
497 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
498 errorNro := C.packRICSubscriptionRequest(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
499 if errorNro != C.e2err_OK {
500 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
502 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
505 func (e2apMsg *e2apMsgSubscriptionRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
506 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
507 C.initSubsRequest(e2apMsg.msgC)
508 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
509 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionRequest {
510 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
512 errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
513 if errorNro != C.e2err_OK {
514 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
519 func (e2apMsg *e2apMsgSubscriptionRequest) Pack(data *e2ap.E2APSubscriptionRequest) (error, *packer.PackedData) {
521 e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
522 C.initSubsRequest(e2apMsg.msgC)
523 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
524 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
527 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).set(&data.EventTriggerDefinition); err != nil {
530 if len(data.ActionSetups) > 16 {
531 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(data.ActionSetups), 16), nil
533 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 0
534 for i := 0; i < len(data.ActionSetups); i++ {
535 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength]}
536 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength += 1
537 if err := item.set(&data.ActionSetups[i]); err != nil {
542 return packer.PduPackerPack(e2apMsg)
545 func (e2apMsg *e2apMsgSubscriptionRequest) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionRequest) {
546 data := &e2ap.E2APSubscriptionRequest{}
547 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
550 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
551 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
554 if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).get(&data.EventTriggerDefinition); err != nil {
557 conlen := (int)(e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
558 data.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
559 for i := 0; i < conlen; i++ {
560 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
561 if err := item.get(&data.ActionSetups[i]); err != nil {
569 func (e2apMsg *e2apMsgSubscriptionRequest) String() string {
571 fmt.Fprintln(&b, "ricSubscriptionRequest.")
572 fmt.Fprintln(&b, " ricRequestID.")
573 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
574 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
575 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
576 fmt.Fprintln(&b, " ricSubscription.")
577 fmt.Fprintln(&b, " ricEventTriggerDefinition.")
578 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.octetString.contentLength)
579 fmt.Fprintln(&b, " interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent)
580 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent {
581 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength)
582 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
583 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
584 fmt.Fprintln(&b, " interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
585 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits)
586 fmt.Fprintln(&b, " interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID)
588 fmt.Fprintln(&b, " interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent)
589 if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent {
590 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.contentLength)
591 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
592 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
593 fmt.Fprintln(&b, " interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
594 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.bits)
595 fmt.Fprintln(&b, " interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.nodeID)
597 fmt.Fprintln(&b, " interfaceDirection= ", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceDirection)
598 fmt.Fprintln(&b, " interfaceMessageType.procedureCode =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode)
599 fmt.Fprintln(&b, " interfaceMessageType.typeOfMessage =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage)
600 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.")
601 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
604 for (C.uchar)(index) < e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength {
605 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
606 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
608 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
609 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent {
610 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricActionDefinition.styleID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID)
611 fmt.Fprintln(&b, " ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID)
614 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
615 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
616 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
617 fmt.Fprintln(&b, " ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait)
624 //-----------------------------------------------------------------------------
626 //-----------------------------------------------------------------------------
627 type e2apMsgSubscriptionResponse struct {
629 msgC *C.RICSubscriptionResponse_t
632 func (e2apMsg *e2apMsgSubscriptionResponse) PduPack(logBuf []byte) (error, *packer.PackedData) {
633 p := C.malloc(C.size_t(cMsgBufferMaxSize))
635 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
636 errorNro := C.packRICSubscriptionResponse(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
637 if errorNro != C.e2err_OK {
638 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
640 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
643 func (e2apMsg *e2apMsgSubscriptionResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
644 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
645 C.initSubsResponse(e2apMsg.msgC)
647 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
648 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionResponse {
649 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
651 errorNro := C.getRICSubscriptionResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
652 if errorNro != C.e2err_OK {
653 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
658 func (e2apMsg *e2apMsgSubscriptionResponse) Pack(data *e2ap.E2APSubscriptionResponse) (error, *packer.PackedData) {
659 e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
660 C.initSubsResponse(e2apMsg.msgC)
661 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
662 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
665 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).set(&data.ActionAdmittedList); err != nil {
668 e2apMsg.msgC.ricActionNotAdmittedListPresent = false
669 if len(data.ActionNotAdmittedList.Items) > 0 {
670 e2apMsg.msgC.ricActionNotAdmittedListPresent = true
671 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
675 return packer.PduPackerPack(e2apMsg)
678 func (e2apMsg *e2apMsgSubscriptionResponse) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionResponse) {
679 data := &e2ap.E2APSubscriptionResponse{}
681 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
685 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
686 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
689 if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).get(&data.ActionAdmittedList); err != nil {
692 if e2apMsg.msgC.ricActionNotAdmittedListPresent == true {
693 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
700 func (e2apMsg *e2apMsgSubscriptionResponse) String() string {
702 fmt.Fprintln(&b, "ricSubscriptionResponse.")
703 fmt.Fprintln(&b, " ricRequestID.")
704 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
705 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
706 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
707 fmt.Fprintln(&b, " ricActionAdmittedList.")
708 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionAdmittedList.contentLength)
711 for (C.uchar)(index) < e2apMsg.msgC.ricActionAdmittedList.contentLength {
712 fmt.Fprintln(&b, " ricActionAdmittedList.ricActionID[index] =", e2apMsg.msgC.ricActionAdmittedList.ricActionID[index])
715 if e2apMsg.msgC.ricActionNotAdmittedListPresent {
716 fmt.Fprintln(&b, " ricActionNotAdmittedListPresent =", e2apMsg.msgC.ricActionNotAdmittedListPresent)
717 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
718 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
720 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
721 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
722 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
723 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
730 //-----------------------------------------------------------------------------
732 //-----------------------------------------------------------------------------
733 type e2apMsgSubscriptionFailure struct {
735 msgC *C.RICSubscriptionFailure_t
738 func (e2apMsg *e2apMsgSubscriptionFailure) PduPack(logBuf []byte) (error, *packer.PackedData) {
739 p := C.malloc(C.size_t(cMsgBufferMaxSize))
741 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
742 errorNro := C.packRICSubscriptionFailure(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
743 if errorNro != C.e2err_OK {
744 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
746 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
749 func (e2apMsg *e2apMsgSubscriptionFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
750 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
751 C.initSubsFailure(e2apMsg.msgC)
752 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
753 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionFailure {
754 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
756 errorNro := C.getRICSubscriptionFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
757 if errorNro != C.e2err_OK {
758 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
764 func (e2apMsg *e2apMsgSubscriptionFailure) Pack(data *e2ap.E2APSubscriptionFailure) (error, *packer.PackedData) {
765 e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
766 C.initSubsFailure(e2apMsg.msgC)
767 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
768 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
771 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
774 e2apMsg.msgC.criticalityDiagnosticsPresent = false
775 if data.CriticalityDiagnostics.Present {
776 e2apMsg.msgC.criticalityDiagnosticsPresent = true
777 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
781 return packer.PduPackerPack(e2apMsg)
784 func (e2apMsg *e2apMsgSubscriptionFailure) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionFailure) {
785 data := &e2ap.E2APSubscriptionFailure{}
786 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
789 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
790 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
793 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
796 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
797 data.CriticalityDiagnostics.Present = true
798 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
805 func (e2apMsg *e2apMsgSubscriptionFailure) String() string {
807 fmt.Fprintln(&b, "ricSubscriptionFailure.")
808 fmt.Fprintln(&b, " ricRequestID.")
809 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
810 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
811 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
812 fmt.Fprintln(&b, " ricActionNotAdmittedList.")
813 fmt.Fprintln(&b, " contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
816 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
817 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
818 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
819 fmt.Fprintln(&b, " RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
823 if e2apMsg.msgC.criticalityDiagnosticsPresent {
824 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
825 fmt.Fprintln(&b, " criticalityDiagnostics.")
826 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
827 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
828 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
829 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
830 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
831 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
832 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
833 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
836 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
837 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
838 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
839 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
847 //-----------------------------------------------------------------------------
849 //-----------------------------------------------------------------------------
850 type e2apMsgSubscriptionDeleteRequest struct {
852 msgC *C.RICSubscriptionDeleteRequest_t
855 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduPack(logBuf []byte) (error, *packer.PackedData) {
856 p := C.malloc(C.size_t(cMsgBufferMaxSize))
858 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
859 errorNro := C.packRICSubscriptionDeleteRequest(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
860 if errorNro != C.e2err_OK {
861 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
863 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
866 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
867 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
868 C.initSubsDeleteRequest(e2apMsg.msgC)
869 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
870 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionDeleteRequest {
871 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
873 errorNro := C.getRICSubscriptionDeleteRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
874 if errorNro != C.e2err_OK {
875 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
880 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Pack(data *e2ap.E2APSubscriptionDeleteRequest) (error, *packer.PackedData) {
881 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
882 C.initSubsDeleteRequest(e2apMsg.msgC)
883 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
884 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
887 return packer.PduPackerPack(e2apMsg)
890 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Pack21(data *e2ap.E2APSubscriptionDeleteRequest) (error, *packer.PackedData) {
891 e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
892 C.initSubsDeleteRequest(e2apMsg.msgC)
893 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
894 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
900 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Pack22(data *e2ap.E2APSubscriptionDeleteRequest) (error, *packer.PackedData) {
901 return packer.PduPackerPack(e2apMsg)
904 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionDeleteRequest) {
905 data := &e2ap.E2APSubscriptionDeleteRequest{}
906 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
909 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
910 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
917 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) String() string {
919 fmt.Fprintln(&b, "ricSubscriptionDeleteRequest.")
920 fmt.Fprintln(&b, " ricRequestID.")
921 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
922 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
923 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
927 //-----------------------------------------------------------------------------
929 //-----------------------------------------------------------------------------
930 type e2apMsgSubscriptionDeleteResponse struct {
932 msgC *C.RICSubscriptionDeleteResponse_t
935 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduPack(logBuf []byte) (error, *packer.PackedData) {
936 p := C.malloc(C.size_t(cMsgBufferMaxSize))
938 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
939 errorNro := C.packRICSubscriptionDeleteResponse(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
940 if errorNro != C.e2err_OK {
941 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
943 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
946 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
947 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
948 C.initSubsDeleteResponse(e2apMsg.msgC)
949 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
950 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteResponse {
951 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
953 errorNro := C.getRICSubscriptionDeleteResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
954 if errorNro != C.e2err_OK {
955 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
960 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Pack(data *e2ap.E2APSubscriptionDeleteResponse) (error, *packer.PackedData) {
961 e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
962 C.initSubsDeleteResponse(e2apMsg.msgC)
963 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
964 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
967 return packer.PduPackerPack(e2apMsg)
970 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionDeleteResponse) {
971 data := &e2ap.E2APSubscriptionDeleteResponse{}
972 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
975 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
976 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
982 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) String() string {
984 fmt.Fprintln(&b, "ricSubscriptionDeleteResponse.")
985 fmt.Fprintln(&b, " ricRequestID.")
986 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
987 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
988 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
992 //-----------------------------------------------------------------------------
994 //-----------------------------------------------------------------------------
995 type e2apMsgSubscriptionDeleteFailure struct {
997 msgC *C.RICSubscriptionDeleteFailure_t
1000 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduPack(logBuf []byte) (error, *packer.PackedData) {
1001 p := C.malloc(C.size_t(cMsgBufferMaxSize))
1003 plen := C.size_t(cMsgBufferMaxSize) - cMsgBufferExtra
1004 errorNro := C.packRICSubscriptionDeleteFailure(&plen, (*C.uchar)(p), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1005 if errorNro != C.e2err_OK {
1006 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro))), nil
1008 return nil, &packer.PackedData{C.GoBytes(p, C.int(plen))}
1011 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1012 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1013 C.initSubsDeleteFailure(e2apMsg.msgC)
1014 e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1015 if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteFailure {
1016 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1018 errorNro := C.getRICSubscriptionDeleteFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1019 if errorNro != C.e2err_OK {
1020 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1026 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Pack(data *e2ap.E2APSubscriptionDeleteFailure) (error, *packer.PackedData) {
1027 e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1028 C.initSubsDeleteFailure(e2apMsg.msgC)
1029 e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1030 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1033 e2apMsg.msgC.ricCause.content = (C.uchar)(data.Cause.Content)
1034 e2apMsg.msgC.ricCause.cause = (C.uchar)(data.Cause.CauseVal)
1035 e2apMsg.msgC.criticalityDiagnosticsPresent = false
1036 if data.CriticalityDiagnostics.Present {
1037 e2apMsg.msgC.criticalityDiagnosticsPresent = true
1038 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
1043 return packer.PduPackerPack(e2apMsg)
1046 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) UnPack(msg *packer.PackedData) (error, *e2ap.E2APSubscriptionDeleteFailure) {
1047 data := &e2ap.E2APSubscriptionDeleteFailure{}
1048 if err := packer.PduPackerUnPack(e2apMsg, msg); err != nil {
1051 data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1052 if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1055 data.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content)
1056 data.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause)
1057 if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
1058 data.CriticalityDiagnostics.Present = true
1059 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
1066 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) String() string {
1068 fmt.Fprintln(&b, "ricSubscriptionDeleteFailure.")
1069 fmt.Fprintln(&b, " ricRequestID.")
1070 fmt.Fprintln(&b, " ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1071 fmt.Fprintln(&b, " ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1072 fmt.Fprintln(&b, " ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1074 if e2apMsg.msgC.criticalityDiagnosticsPresent {
1075 fmt.Fprintln(&b, " criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
1076 fmt.Fprintln(&b, " criticalityDiagnostics.")
1077 fmt.Fprintln(&b, " procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
1078 fmt.Fprintln(&b, " procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
1079 fmt.Fprintln(&b, " triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
1080 fmt.Fprintln(&b, " triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
1081 fmt.Fprintln(&b, " procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
1082 fmt.Fprintln(&b, " procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
1083 fmt.Fprintln(&b, " iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
1084 fmt.Fprintln(&b, " criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
1087 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
1088 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
1089 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
1090 fmt.Fprintln(&b, " criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
1098 //-----------------------------------------------------------------------------
1099 // Public E2AP packer creators
1100 //-----------------------------------------------------------------------------
1102 type cppasn1E2APPacker struct{}
1104 func (*cppasn1E2APPacker) NewPackerSubscriptionRequest() e2ap.E2APMsgPackerSubscriptionRequestIf {
1105 return &e2apMsgSubscriptionRequest{}
1108 func (*cppasn1E2APPacker) NewPackerSubscriptionResponse() e2ap.E2APMsgPackerSubscriptionResponseIf {
1109 return &e2apMsgSubscriptionResponse{}
1112 func (*cppasn1E2APPacker) NewPackerSubscriptionFailure() e2ap.E2APMsgPackerSubscriptionFailureIf {
1113 return &e2apMsgSubscriptionFailure{}
1116 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteRequest() e2ap.E2APMsgPackerSubscriptionDeleteRequestIf {
1117 return &e2apMsgSubscriptionDeleteRequest{}
1120 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteResponse() e2ap.E2APMsgPackerSubscriptionDeleteResponseIf {
1121 return &e2apMsgSubscriptionDeleteResponse{}
1124 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPackerSubscriptionDeleteFailureIf {
1125 return &e2apMsgSubscriptionDeleteFailure{}
1128 func NewAsn1E2Packer() e2ap.E2APPackerIf {
1129 return &cppasn1E2APPacker{}