RICPLT-2910
[ric-plt/submgr.git] / e2ap / pkg / e2ap_wrapper / packer_e2ap.go
1 /*
2 ==================================================================================
3   Copyright (c) 2019 AT&T Intellectual Property.
4   Copyright (c) 2019 Nokia
5
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
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
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 ==================================================================================
18 */
19
20 package e2ap_wrapper
21
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>
27 //
28 // void initSubsRequest(RICSubscriptionRequest_t *data){
29 //   bzero(data,sizeof(RICSubscriptionRequest_t));
30 // }
31 // void initSubsResponse(RICSubscriptionResponse_t *data){
32 //   bzero(data,sizeof(RICSubscriptionResponse_t));
33 // }
34 // void initSubsFailure(RICSubscriptionFailure_t *data){
35 //   bzero(data,sizeof(RICSubscriptionFailure_t));
36 // }
37 // void initSubsDeleteRequest(RICSubscriptionDeleteRequest_t *data){
38 //   bzero(data,sizeof(RICSubscriptionDeleteRequest_t));
39 // }
40 // void initSubsDeleteResponse(RICSubscriptionDeleteResponse_t *data){
41 //   bzero(data,sizeof(RICSubscriptionDeleteResponse_t));
42 // }
43 // void initSubsDeleteFailure(RICSubscriptionDeleteFailure_t *data){
44 //   bzero(data,sizeof(RICSubscriptionDeleteFailure_t));
45 // }
46 // void initIndication(RICIndication_t *data){
47 //   bzero(data,sizeof(RICIndication_t));
48 // }
49 //
50 import "C"
51
52 import (
53         "bytes"
54         "fmt"
55         "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/conv"
56         "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
57         "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer"
58         "unsafe"
59 )
60
61 //-----------------------------------------------------------------------------
62 //
63 //-----------------------------------------------------------------------------
64 type e2apEntryRequestID struct {
65         entry *C.RICRequestID_t
66 }
67
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)
71         return nil
72 }
73
74 func (e2Item *e2apEntryRequestID) get(id *e2ap.RequestId) error {
75         id.Id = (uint32)(e2Item.entry.ricRequestorID)
76         id.Seq = (uint32)(e2Item.entry.ricRequestSequenceNumber)
77         return nil
78 }
79
80 //-----------------------------------------------------------------------------
81 //
82 //-----------------------------------------------------------------------------
83 type e2apEntryActionToBeSetupItem struct {
84         entry *C.RICActionToBeSetupItem_t
85 }
86
87 func (e2Item *e2apEntryActionToBeSetupItem) set(id *e2ap.ActionToBeSetupItem) error {
88
89         e2Item.entry.ricActionID = (C.ulong)(id.ActionId)
90         e2Item.entry.ricActionType = (C.uint64_t)(id.ActionType)
91
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
97         }
98
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)
103         }
104         return nil
105 }
106
107 func (e2Item *e2apEntryActionToBeSetupItem) get(id *e2ap.ActionToBeSetupItem) error {
108
109         id.ActionId = (uint64)(e2Item.entry.ricActionID)
110         id.ActionType = (uint64)(e2Item.entry.ricActionType)
111
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
117         }
118
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)
123         }
124         return nil
125 }
126
127 //-----------------------------------------------------------------------------
128 //
129 //-----------------------------------------------------------------------------
130 type e2apEntryPlmnIdentity struct {
131         entry *C.PLMNIdentity_t
132 }
133
134 func (plmnId *e2apEntryPlmnIdentity) set(id *conv.PlmnIdentity) error {
135
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])
139         }
140         return nil
141 }
142
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])
148         }
149         id.BcdPut(bcdBuf)
150         return nil
151 }
152
153 //-----------------------------------------------------------------------------
154 //
155 //-----------------------------------------------------------------------------
156 type e2apEntryGlobalEnbId struct {
157         entry *C.GlobalNodeID_t
158 }
159
160 func (enbId *e2apEntryGlobalEnbId) checkbits(bits uint8) error {
161         switch bits {
162         case e2ap.E2AP_ENBIDMacroPBits20:
163                 return nil
164         case e2ap.E2AP_ENBIDHomeBits28:
165                 return nil
166         case e2ap.E2AP_ENBIDShortMacroits18:
167                 return nil
168         case e2ap.E2AP_ENBIDlongMacroBits21:
169                 return nil
170         }
171         return fmt.Errorf("GlobalEnbId: given bits %d not match allowed: 20,28,18,21", bits)
172 }
173
174 func (enbId *e2apEntryGlobalEnbId) set(id *e2ap.GlobalNodeId) error {
175         if err := enbId.checkbits(id.NodeId.Bits); err != nil {
176                 return err
177         }
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)
181 }
182
183 func (enbId *e2apEntryGlobalEnbId) get(id *e2ap.GlobalNodeId) error {
184         if err := enbId.checkbits((uint8)(enbId.entry.nodeID.bits)); err != nil {
185                 return err
186         }
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)
190 }
191
192 //-----------------------------------------------------------------------------
193 //
194 //-----------------------------------------------------------------------------
195 type e2apEntryGlobalGnbId struct {
196         entry *C.GlobalNodeID_t
197 }
198
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)
202         }
203         return nil
204 }
205
206 func (gnbId *e2apEntryGlobalGnbId) set(id *e2ap.GlobalNodeId) error {
207         if err := gnbId.checkbits(id.NodeId.Bits); err != nil {
208                 return err
209         }
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)
213 }
214
215 func (gnbId *e2apEntryGlobalGnbId) get(id *e2ap.GlobalNodeId) error {
216         if err := gnbId.checkbits((uint8)(gnbId.entry.nodeID.bits)); err != nil {
217                 return err
218         }
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)
222 }
223
224 //-----------------------------------------------------------------------------
225 //
226 //-----------------------------------------------------------------------------
227 type e2apEntryInterfaceId struct {
228         entry *C.InterfaceID_t
229 }
230
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 {
235                         return err
236                 }
237         }
238
239         if id.GlobalGnbId.Present {
240                 indId.entry.globalGNBIDPresent = true
241                 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).set(&id.GlobalGnbId); err != nil {
242                         return err
243                 }
244         }
245         return nil
246 }
247
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 {
252                         return err
253                 }
254         }
255
256         if indId.entry.globalGNBIDPresent == true {
257                 id.GlobalGnbId.Present = true
258                 if err := (&e2apEntryGlobalGnbId{entry: &indId.entry.globalGNBID}).get(&id.GlobalGnbId); err != nil {
259                         return err
260                 }
261         }
262         return nil
263 }
264
265 //-----------------------------------------------------------------------------
266 //
267 //-----------------------------------------------------------------------------
268 type e2apEntryEventTrigger struct {
269         entry *C.RICEventTriggerDefinition_t
270 }
271
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)
277 }
278
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)
284 }
285
286 //-----------------------------------------------------------------------------
287 //
288 //-----------------------------------------------------------------------------
289 type e2apEntryAdmittedList struct {
290         entry *C.RICActionAdmittedList_t
291 }
292
293 func (item *e2apEntryAdmittedList) set(data *e2ap.ActionAdmittedList) error {
294
295         if len(data.Items) > 16 {
296                 return fmt.Errorf("ActionAdmittedList: too long %d while allowed %d", len(data.Items), 16)
297         }
298
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++
303         }
304         return nil
305 }
306
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])
312         }
313         return nil
314 }
315
316 //-----------------------------------------------------------------------------
317 //
318 //-----------------------------------------------------------------------------
319 type e2apEntryNotAdmittedList struct {
320         entry *C.RICActionNotAdmittedList_t
321 }
322
323 func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) error {
324
325         if len(data.Items) > 16 {
326                 return fmt.Errorf("e2apEntryNotAdmittedList: too long %d while allowed %d", len(data.Items), 16)
327         }
328
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) // C.cRICCauseRadioNetwork
333                 item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal)
334                 item.entry.contentLength++
335         }
336         return nil
337 }
338
339 func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) error {
340         conlen := (int)(item.entry.contentLength)
341         data.Items = make([]e2ap.ActionNotAdmittedItem, conlen)
342         for i := 0; i < conlen; i++ {
343                 data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID)
344                 data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content)
345                 data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause)
346         }
347         return nil
348 }
349
350 //-----------------------------------------------------------------------------
351 //
352 //-----------------------------------------------------------------------------
353 type e2apEntryCriticalityDiagnostic struct {
354         entry *C.CriticalityDiagnostics__t
355 }
356
357 func (item *e2apEntryCriticalityDiagnostic) set(data *e2ap.CriticalityDiagnostics) error {
358
359         item.entry.procedureCodePresent = (C.bool)(data.ProcCodePresent)
360         item.entry.procedureCode = (C.uchar)(data.ProcCode)
361
362         item.entry.triggeringMessagePresent = (C.bool)(data.TrigMsgPresent)
363         item.entry.triggeringMessage = (C.uchar)(data.TrigMsg)
364
365         item.entry.procedureCriticalityPresent = (C.bool)(data.ProcCritPresent)
366         item.entry.procedureCriticality = (C.uchar)(data.ProcCrit)
367
368         item.entry.criticalityDiagnosticsIELength = 0
369         item.entry.iEsCriticalityDiagnosticsPresent = false
370         for i := 0; i < len(data.CriticalityDiagnosticsIEList.Items); i++ {
371                 item.entry.criticalityDiagnosticsIEListItem[i].iECriticality = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].IeCriticality)
372                 item.entry.criticalityDiagnosticsIEListItem[i].iE_ID = (C.uint32_t)(data.CriticalityDiagnosticsIEList.Items[i].IeID)
373                 item.entry.criticalityDiagnosticsIEListItem[i].typeOfError = (C.uint8_t)(data.CriticalityDiagnosticsIEList.Items[i].TypeOfError)
374                 item.entry.criticalityDiagnosticsIELength++
375                 item.entry.iEsCriticalityDiagnosticsPresent = true
376         }
377         return nil
378 }
379
380 func (item *e2apEntryCriticalityDiagnostic) get(data *e2ap.CriticalityDiagnostics) error {
381
382         data.ProcCodePresent = (bool)(item.entry.procedureCodePresent)
383         data.ProcCode = (uint64)(item.entry.procedureCode)
384
385         data.TrigMsgPresent = (bool)(item.entry.triggeringMessagePresent)
386         data.TrigMsg = (uint64)(item.entry.triggeringMessage)
387
388         data.ProcCritPresent = (bool)(item.entry.procedureCriticalityPresent)
389         data.ProcCrit = (uint8)(item.entry.procedureCriticality)
390
391         if item.entry.iEsCriticalityDiagnosticsPresent == true {
392                 conlen := (int)(item.entry.criticalityDiagnosticsIELength)
393                 data.CriticalityDiagnosticsIEList.Items = make([]e2ap.CriticalityDiagnosticsIEListItem, conlen)
394                 for i := 0; i < conlen; i++ {
395                         data.CriticalityDiagnosticsIEList.Items[i].IeCriticality = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].iECriticality)
396                         data.CriticalityDiagnosticsIEList.Items[i].IeID = (uint32)(item.entry.criticalityDiagnosticsIEListItem[i].iE_ID)
397                         data.CriticalityDiagnosticsIEList.Items[i].TypeOfError = (uint8)(item.entry.criticalityDiagnosticsIEListItem[i].typeOfError)
398                 }
399         }
400         return nil
401 }
402
403 //-----------------------------------------------------------------------------
404 //
405 //-----------------------------------------------------------------------------
406 type e2apEntryIndicationHeader struct {
407         entry *C.RICIndicationHeader_t
408 }
409
410 func (indHdr *e2apEntryIndicationHeader) set(data *e2ap.IndicationHeader) error {
411         indHdr.entry.interfaceDirection = (C.uint8_t)(data.InterfaceDirection)
412         return (&e2apEntryInterfaceId{entry: &indHdr.entry.interfaceID}).set(&data.InterfaceId)
413 }
414
415 func (indHdr *e2apEntryIndicationHeader) get(data *e2ap.IndicationHeader) error {
416         data.InterfaceDirection = (uint32)(indHdr.entry.interfaceDirection)
417         return (&e2apEntryInterfaceId{entry: &indHdr.entry.interfaceID}).get(&data.InterfaceId)
418 }
419
420 //-----------------------------------------------------------------------------
421 //
422 //-----------------------------------------------------------------------------
423 type e2apEntryIndicationMessage struct {
424         entry *C.RICIndicationMessage_t
425 }
426
427 func (indMsg *e2apEntryIndicationMessage) set(data *e2ap.IndicationMessage) error {
428         if len(data.InterfaceMessage.Buf) > 1024 {
429                 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(data.InterfaceMessage.Buf), 1024)
430         }
431         indMsg.entry.interfaceMessage.contentLength = (C.uint64_t)(len(data.InterfaceMessage.Buf))
432         for i := 0; i < len(data.InterfaceMessage.Buf); i++ {
433                 indMsg.entry.interfaceMessage.data[i] = (C.uint8_t)(data.InterfaceMessage.Buf[i])
434         }
435         return nil
436 }
437
438 func (indMsg *e2apEntryIndicationMessage) get(data *e2ap.IndicationMessage) error {
439         conlen := (int)(indMsg.entry.interfaceMessage.contentLength)
440         if conlen > 0 {
441                 data.InterfaceMessage.Buf = make([]byte, conlen)
442                 for i := 0; i < conlen; i++ {
443                         data.InterfaceMessage.Buf[i] = (uint8)(indMsg.entry.interfaceMessage.data[i])
444                 }
445         }
446         return nil
447 }
448
449 /*
450 //-----------------------------------------------------------------------------
451 //
452 //-----------------------------------------------------------------------------
453 type e2apEntryCallProcessId struct {
454         entry *C.RICCallProcessID_t
455 }
456
457 func (callProcId *e2apEntryCallProcessId) set(data *e2ap.CallProcessId) error {
458         callProcId.entry.ricCallProcessIDVal = (C.uint64_t)(data.CallProcessIDVal)
459         return nil
460 }
461
462 func (callProcId *e2apEntryCallProcessId) get(data *e2ap.CallProcessId) error {
463         data.CallProcessIDVal = (uint32)(callProcId.entry.ricCallProcessIDVal)
464         return nil
465 }
466 */
467
468 //-----------------------------------------------------------------------------
469 //
470 //-----------------------------------------------------------------------------
471
472 type e2apMessage struct {
473         pdu         *C.e2ap_pdu_ptr_t
474         messageInfo C.E2MessageInfo_t
475 }
476
477 func (e2apMsg *e2apMessage) PduUnPack(logBuf []byte, data *packer.PackedData) error {
478         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)
479         return nil
480 }
481
482 func (e2apMsg *e2apMessage) MessageInfo() *packer.MessageInfo {
483
484         msgInfo := &packer.MessageInfo{}
485
486         switch e2apMsg.messageInfo.messageType {
487         case C.cE2InitiatingMessage:
488                 msgInfo.MsgType = e2ap.E2AP_InitiatingMessage
489                 switch e2apMsg.messageInfo.messageId {
490                 case C.cRICSubscriptionRequest:
491                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionRequest
492                         return msgInfo
493                 case C.cRICSubscriptionDeleteRequest:
494                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteRequest
495                         return msgInfo
496                 case C.cRICIndication:
497                         msgInfo.MsgId = e2ap.E2AP_RICIndication
498                         return msgInfo
499                 }
500         case C.cE2SuccessfulOutcome:
501                 msgInfo.MsgType = e2ap.E2AP_SuccessfulOutcome
502                 switch e2apMsg.messageInfo.messageId {
503                 case C.cRICSubscriptionResponse:
504                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionResponse
505                         return msgInfo
506                 case C.cRICsubscriptionDeleteResponse:
507                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteResponse
508                         return msgInfo
509                 }
510         case C.cE2UnsuccessfulOutcome:
511                 msgInfo.MsgType = e2ap.E2AP_UnsuccessfulOutcome
512                 switch e2apMsg.messageInfo.messageId {
513                 case C.cRICSubscriptionFailure:
514                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionFailure
515                         return msgInfo
516                 case C.cRICsubscriptionDeleteFailure:
517                         msgInfo.MsgId = e2ap.E2AP_RICSubscriptionDeleteFailure
518                         return msgInfo
519                 }
520
521         }
522         return nil
523 }
524
525 func (e2apMsg *e2apMessage) UnPack(msg *packer.PackedData) *packer.MessageInfo {
526         err := packer.PduPackerUnPack(e2apMsg, msg)
527         if err != nil {
528                 return nil
529         }
530         return e2apMsg.MessageInfo()
531 }
532
533 func (e2apMsg *e2apMessage) String() string {
534         msgInfo := e2apMsg.MessageInfo()
535         if msgInfo == nil {
536                 return "N/A"
537         }
538         return msgInfo.String()
539 }
540
541 //-----------------------------------------------------------------------------
542 //
543 //-----------------------------------------------------------------------------
544
545 type e2apMsgSubscriptionRequest struct {
546         e2apMessage
547         msgC *C.RICSubscriptionRequest_t
548 }
549
550 func (e2apMsg *e2apMsgSubscriptionRequest) Set(data *e2ap.E2APSubscriptionRequest) error {
551
552         e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
553         C.initSubsRequest(e2apMsg.msgC)
554
555         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
556
557         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
558                 return err
559         }
560         if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).set(&data.EventTriggerDefinition); err != nil {
561                 return err
562         }
563
564         if len(data.ActionSetups) > 16 {
565                 return fmt.Errorf("IndicationMessage.InterfaceMessage: too long %d while allowed %d", len(data.ActionSetups), 16)
566         }
567
568         e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength = 0
569         for i := 0; i < len(data.ActionSetups); i++ {
570                 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength]}
571                 e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength += 1
572                 if err := item.set(&data.ActionSetups[i]); err != nil {
573                         return err
574                 }
575         }
576         return nil
577 }
578
579 func (e2apMsg *e2apMsgSubscriptionRequest) Get() (error, *e2ap.E2APSubscriptionRequest) {
580
581         data := &e2ap.E2APSubscriptionRequest{}
582
583         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
584
585         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
586                 return err, data
587         }
588         if err := (&e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}).get(&data.EventTriggerDefinition); err != nil {
589                 return err, data
590         }
591
592         conlen := (int)(e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
593         data.ActionSetups = make([]e2ap.ActionToBeSetupItem, conlen)
594         for i := 0; i < conlen; i++ {
595                 item := &e2apEntryActionToBeSetupItem{entry: &e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[i]}
596                 if err := item.get(&data.ActionSetups[i]); err != nil {
597                         return err, data
598                 }
599         }
600         return nil, data
601
602 }
603
604 func (e2apMsg *e2apMsgSubscriptionRequest) PduPack(logBuf []byte, data *packer.PackedData) error {
605         /*
606            Not needed anymore
607
608                 evtTrig := e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}
609                 if err := evtTrig.pack(); err != nil {
610                         return err
611                 }
612         */
613         var buflen uint32 = (uint32)(len(data.Buf))
614         errorNro := C.packRICSubscriptionRequest((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
615         if errorNro != C.e2err_OK {
616                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
617         }
618         data.Buf = data.Buf[0:buflen]
619         return nil
620
621 }
622
623 func (e2apMsg *e2apMsgSubscriptionRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
624
625         e2apMsg.msgC = &C.RICSubscriptionRequest_t{}
626         C.initSubsRequest(e2apMsg.msgC)
627
628         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
629         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionRequest {
630                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
631         }
632         errorNro := C.getRICSubscriptionRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
633         if errorNro != C.e2err_OK {
634                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
635         }
636         /*
637            Not needed anymore
638
639                 evtTrig := e2apEntryEventTrigger{entry: &e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition}
640                 if err := evtTrig.unpack(); err != nil {
641                         return err
642                 }
643         */
644         return nil
645 }
646
647 func (e2apMsg *e2apMsgSubscriptionRequest) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
648         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
649 }
650
651 func (e2apMsg *e2apMsgSubscriptionRequest) UnPack(msg *packer.PackedData) error {
652         return packer.PduPackerUnPack(e2apMsg, msg)
653 }
654
655 func (e2apMsg *e2apMsgSubscriptionRequest) String() string {
656         var b bytes.Buffer
657         fmt.Fprintln(&b, "ricSubscriptionRequest.")
658         fmt.Fprintln(&b, "  ricRequestID.")
659         fmt.Fprintln(&b, "     ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
660         fmt.Fprintln(&b, "     ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
661         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
662         fmt.Fprintln(&b, "  ricSubscription.")
663         fmt.Fprintln(&b, "    ricEventTriggerDefinition.")
664         fmt.Fprintln(&b, "      contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.octetString.contentLength)
665         fmt.Fprintln(&b, "      interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent)
666         if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBIDPresent {
667                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.contentLength)
668                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
669                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
670                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
671                 fmt.Fprintln(&b, "      interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.bits)
672                 fmt.Fprintln(&b, "      interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalENBID.nodeID.nodeID)
673         }
674         fmt.Fprintln(&b, "      interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent)
675         if e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBIDPresent {
676                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.contentLength)
677                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
678                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
679                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
680                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.bits)
681                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceID.globalGNBID.nodeID.nodeID)
682         }
683         fmt.Fprintln(&b, "      interfaceDirection= ", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceDirection)
684         fmt.Fprintln(&b, "      interfaceMessageType.procedureCode =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.procedureCode)
685         fmt.Fprintln(&b, "      interfaceMessageType.typeOfMessage =", e2apMsg.msgC.ricSubscription.ricEventTriggerDefinition.interfaceMessageType.typeOfMessage)
686         fmt.Fprintln(&b, "    ricActionToBeSetupItemIEs.")
687         fmt.Fprintln(&b, "      contentLength =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength)
688         var index uint8
689         index = 0
690         for (C.uchar)(index) < e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.contentLength {
691                 fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricActionID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionID)
692                 fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionType)
693
694                 fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricActionDefinitionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent)
695                 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinitionPresent {
696                         fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricActionDefinition.styleID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.styleID)
697                         fmt.Fprintln(&b, "      ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricActionDefinition.sequenceOfActionParameters.parameterID)
698                 }
699
700                 fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricSubsequentActionPresent =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent)
701                 if e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentActionPresent {
702                         fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricSubsequentActionType)
703                         fmt.Fprintln(&b, "      ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait =", e2apMsg.msgC.ricSubscription.ricActionToBeSetupItemIEs.ricActionToBeSetupItem[index].ricSubsequentAction.ricTimeToWait)
704                 }
705                 index++
706         }
707         return b.String()
708 }
709
710 //-----------------------------------------------------------------------------
711 //
712 //-----------------------------------------------------------------------------
713 type e2apMsgSubscriptionResponse struct {
714         e2apMessage
715         msgC *C.RICSubscriptionResponse_t
716 }
717
718 func (e2apMsg *e2apMsgSubscriptionResponse) Set(data *e2ap.E2APSubscriptionResponse) error {
719
720         e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
721         C.initSubsResponse(e2apMsg.msgC)
722
723         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
724
725         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
726                 return err
727         }
728
729         if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).set(&data.ActionAdmittedList); err != nil {
730                 return err
731         }
732
733         e2apMsg.msgC.ricActionNotAdmittedListPresent = false
734         if len(data.ActionNotAdmittedList.Items) > 0 {
735                 e2apMsg.msgC.ricActionNotAdmittedListPresent = true
736                 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
737                         return err
738                 }
739         }
740         return nil
741 }
742
743 func (e2apMsg *e2apMsgSubscriptionResponse) Get() (error, *e2ap.E2APSubscriptionResponse) {
744
745         data := &e2ap.E2APSubscriptionResponse{}
746
747         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
748
749         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
750                 return err, data
751         }
752
753         if err := (&e2apEntryAdmittedList{entry: &e2apMsg.msgC.ricActionAdmittedList}).get(&data.ActionAdmittedList); err != nil {
754                 return err, data
755         }
756
757         if e2apMsg.msgC.ricActionNotAdmittedListPresent == true {
758                 if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
759                         return err, data
760                 }
761         }
762         return nil, data
763
764 }
765
766 func (e2apMsg *e2apMsgSubscriptionResponse) PduPack(logBuf []byte, data *packer.PackedData) error {
767         var buflen uint32 = (uint32)(len(data.Buf))
768         errorNro := C.packRICSubscriptionResponse((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
769         if errorNro != C.e2err_OK {
770                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
771         }
772         data.Buf = data.Buf[0:buflen]
773         return nil
774 }
775
776 func (e2apMsg *e2apMsgSubscriptionResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
777         e2apMsg.msgC = &C.RICSubscriptionResponse_t{}
778         C.initSubsResponse(e2apMsg.msgC)
779
780         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
781         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionResponse {
782                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
783         }
784         errorNro := C.getRICSubscriptionResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
785         if errorNro != C.e2err_OK {
786                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
787         }
788         return nil
789 }
790
791 func (e2apMsg *e2apMsgSubscriptionResponse) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
792         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
793 }
794
795 func (e2apMsg *e2apMsgSubscriptionResponse) UnPack(msg *packer.PackedData) error {
796         return packer.PduPackerUnPack(e2apMsg, msg)
797 }
798
799 func (e2apMsg *e2apMsgSubscriptionResponse) String() string {
800         var b bytes.Buffer
801         fmt.Fprintln(&b, "ricSubscriptionResponse.")
802         fmt.Fprintln(&b, "  ricRequestID.")
803         fmt.Fprintln(&b, "    ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
804         fmt.Fprintln(&b, "    ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
805         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
806         fmt.Fprintln(&b, "  ricActionAdmittedList.")
807         fmt.Fprintln(&b, "    contentLength =", e2apMsg.msgC.ricActionAdmittedList.contentLength)
808         var index uint8
809         index = 0
810         for (C.uchar)(index) < e2apMsg.msgC.ricActionAdmittedList.contentLength {
811                 fmt.Fprintln(&b, "    ricActionAdmittedList.ricActionID[index] =", e2apMsg.msgC.ricActionAdmittedList.ricActionID[index])
812                 index++
813         }
814         if e2apMsg.msgC.ricActionNotAdmittedListPresent {
815                 fmt.Fprintln(&b, "  ricActionNotAdmittedListPresent =", e2apMsg.msgC.ricActionNotAdmittedListPresent)
816                 fmt.Fprintln(&b, "    ricActionNotAdmittedList.")
817                 fmt.Fprintln(&b, "    contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
818                 index = 0
819                 for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
820                         fmt.Fprintln(&b, "      RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
821                         fmt.Fprintln(&b, "      RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
822                         fmt.Fprintln(&b, "      RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
823                         index++
824                 }
825         }
826         return b.String()
827 }
828
829 //-----------------------------------------------------------------------------
830 //
831 //-----------------------------------------------------------------------------
832 type e2apMsgSubscriptionFailure struct {
833         e2apMessage
834         msgC *C.RICSubscriptionFailure_t
835 }
836
837 func (e2apMsg *e2apMsgSubscriptionFailure) Set(data *e2ap.E2APSubscriptionFailure) error {
838
839         e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
840         C.initSubsFailure(e2apMsg.msgC)
841
842         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
843
844         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
845                 return err
846         }
847
848         if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).set(&data.ActionNotAdmittedList); err != nil {
849                 return err
850         }
851
852         e2apMsg.msgC.criticalityDiagnosticsPresent = false
853         if data.CriticalityDiagnostics.Present {
854                 e2apMsg.msgC.criticalityDiagnosticsPresent = true
855                 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
856                         return err
857                 }
858         }
859
860         return nil
861 }
862
863 func (e2apMsg *e2apMsgSubscriptionFailure) Get() (error, *e2ap.E2APSubscriptionFailure) {
864
865         data := &e2ap.E2APSubscriptionFailure{}
866
867         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
868
869         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
870                 return err, data
871         }
872
873         if err := (&e2apEntryNotAdmittedList{entry: &e2apMsg.msgC.ricActionNotAdmittedList}).get(&data.ActionNotAdmittedList); err != nil {
874                 return err, data
875         }
876
877         if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
878                 data.CriticalityDiagnostics.Present = true
879                 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
880                         return err, data
881                 }
882         }
883
884         return nil, data
885 }
886
887 func (e2apMsg *e2apMsgSubscriptionFailure) PduPack(logBuf []byte, data *packer.PackedData) error {
888         var buflen uint32 = (uint32)(len(data.Buf))
889         errorNro := C.packRICSubscriptionFailure((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
890         if errorNro != C.e2err_OK {
891                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
892         }
893         data.Buf = data.Buf[0:buflen]
894         return nil
895 }
896
897 func (e2apMsg *e2apMsgSubscriptionFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
898
899         e2apMsg.msgC = &C.RICSubscriptionFailure_t{}
900         C.initSubsFailure(e2apMsg.msgC)
901
902         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
903         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionFailure {
904                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
905         }
906         errorNro := C.getRICSubscriptionFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
907         if errorNro != C.e2err_OK {
908                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
909         }
910         return nil
911
912 }
913
914 func (e2apMsg *e2apMsgSubscriptionFailure) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
915         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
916 }
917
918 func (e2apMsg *e2apMsgSubscriptionFailure) UnPack(msg *packer.PackedData) error {
919         return packer.PduPackerUnPack(e2apMsg, msg)
920 }
921
922 func (e2apMsg *e2apMsgSubscriptionFailure) String() string {
923         var b bytes.Buffer
924         fmt.Fprintln(&b, "ricSubscriptionFailure.")
925         fmt.Fprintln(&b, "  ricRequestID.")
926         fmt.Fprintln(&b, "    ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
927         fmt.Fprintln(&b, "    ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
928         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
929         fmt.Fprintln(&b, "  ricActionNotAdmittedList.")
930         fmt.Fprintln(&b, "    contentLength =", e2apMsg.msgC.ricActionNotAdmittedList.contentLength)
931         var index uint8
932         index = 0
933         for (C.uchar)(index) < e2apMsg.msgC.ricActionNotAdmittedList.contentLength {
934                 fmt.Fprintln(&b, "    RICActionNotAdmittedItem[index].ricActionID =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricActionID)
935                 fmt.Fprintln(&b, "    RICActionNotAdmittedItem[index].ricCause.content =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.content)
936                 fmt.Fprintln(&b, "    RICActionNotAdmittedItem[index].ricCause.cause =", e2apMsg.msgC.ricActionNotAdmittedList.RICActionNotAdmittedItem[index].ricCause.cause)
937                 index++
938         }
939         /* NOT SUPPORTED
940         if e2apMsg.msgC.criticalityDiagnosticsPresent {
941                 fmt.Fprintln(&b, "  criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
942                 fmt.Fprintln(&b, "    criticalityDiagnostics.")
943                 fmt.Fprintln(&b, "    procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
944                 fmt.Fprintln(&b, "      procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
945                 fmt.Fprintln(&b, "    triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
946                 fmt.Fprintln(&b, "      triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
947                 fmt.Fprintln(&b, "    procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
948                 fmt.Fprintln(&b, "      procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
949                 fmt.Fprintln(&b, "    iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
950                 fmt.Fprintln(&b, "      criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
951                 var index2 uint16
952                 index2 = 0
953                 for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
954                         fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
955                         fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
956                         fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
957                         index2++
958                 }
959         }
960         */
961         return b.String()
962 }
963
964 //-----------------------------------------------------------------------------
965 //
966 //-----------------------------------------------------------------------------
967 type e2apMsgSubscriptionDeleteRequest struct {
968         e2apMessage
969         msgC *C.RICSubscriptionDeleteRequest_t
970 }
971
972 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Set(data *e2ap.E2APSubscriptionDeleteRequest) error {
973
974         e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
975         C.initSubsDeleteRequest(e2apMsg.msgC)
976
977         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
978
979         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
980                 return err
981         }
982         return nil
983 }
984
985 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Get() (error, *e2ap.E2APSubscriptionDeleteRequest) {
986
987         data := &e2ap.E2APSubscriptionDeleteRequest{}
988
989         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
990
991         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
992                 return err, data
993         }
994
995         return nil, data
996 }
997
998 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduPack(logBuf []byte, data *packer.PackedData) error {
999         var buflen uint32 = (uint32)(len(data.Buf))
1000         errorNro := C.packRICSubscriptionDeleteRequest((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1001         if errorNro != C.e2err_OK {
1002                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1003         }
1004         data.Buf = data.Buf[0:buflen]
1005         return nil
1006
1007 }
1008
1009 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1010
1011         e2apMsg.msgC = &C.RICSubscriptionDeleteRequest_t{}
1012         C.initSubsDeleteRequest(e2apMsg.msgC)
1013
1014         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1015         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICSubscriptionDeleteRequest {
1016                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1017         }
1018         errorNro := C.getRICSubscriptionDeleteRequestData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1019         if errorNro != C.e2err_OK {
1020                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1021         }
1022         return nil
1023 }
1024
1025 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1026         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1027 }
1028
1029 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) UnPack(msg *packer.PackedData) error {
1030         return packer.PduPackerUnPack(e2apMsg, msg)
1031 }
1032
1033 func (e2apMsg *e2apMsgSubscriptionDeleteRequest) String() string {
1034         var b bytes.Buffer
1035         fmt.Fprintln(&b, "ricSubscriptionDeleteRequest.")
1036         fmt.Fprintln(&b, "  ricRequestID.")
1037         fmt.Fprintln(&b, "     ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1038         fmt.Fprintln(&b, "     ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1039         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1040         return b.String()
1041 }
1042
1043 //-----------------------------------------------------------------------------
1044 //
1045 //-----------------------------------------------------------------------------
1046 type e2apMsgSubscriptionDeleteResponse struct {
1047         e2apMessage
1048         msgC *C.RICSubscriptionDeleteResponse_t
1049 }
1050
1051 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Set(data *e2ap.E2APSubscriptionDeleteResponse) error {
1052
1053         e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
1054         C.initSubsDeleteResponse(e2apMsg.msgC)
1055
1056         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1057
1058         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1059                 return err
1060         }
1061         return nil
1062 }
1063
1064 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Get() (error, *e2ap.E2APSubscriptionDeleteResponse) {
1065
1066         data := &e2ap.E2APSubscriptionDeleteResponse{}
1067
1068         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1069
1070         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1071                 return err, data
1072         }
1073
1074         return nil, data
1075 }
1076 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduPack(logBuf []byte, data *packer.PackedData) error {
1077         var buflen uint32 = (uint32)(len(data.Buf))
1078         errorNro := C.packRICSubscriptionDeleteResponse((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1079         if errorNro != C.e2err_OK {
1080                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1081         }
1082         data.Buf = data.Buf[0:buflen]
1083         return nil
1084 }
1085
1086 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1087         e2apMsg.msgC = &C.RICSubscriptionDeleteResponse_t{}
1088         C.initSubsDeleteResponse(e2apMsg.msgC)
1089
1090         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1091         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2SuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteResponse {
1092                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1093         }
1094         errorNro := C.getRICSubscriptionDeleteResponseData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1095         if errorNro != C.e2err_OK {
1096                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1097         }
1098         return nil
1099 }
1100
1101 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1102         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1103 }
1104
1105 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) UnPack(msg *packer.PackedData) error {
1106         return packer.PduPackerUnPack(e2apMsg, msg)
1107 }
1108
1109 func (e2apMsg *e2apMsgSubscriptionDeleteResponse) String() string {
1110         var b bytes.Buffer
1111         fmt.Fprintln(&b, "ricSubscriptionDeleteResponse.")
1112         fmt.Fprintln(&b, "  ricRequestID.")
1113         fmt.Fprintln(&b, "    ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1114         fmt.Fprintln(&b, "    ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1115         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1116         return b.String()
1117 }
1118
1119 //-----------------------------------------------------------------------------
1120 //
1121 //-----------------------------------------------------------------------------
1122 type e2apMsgSubscriptionDeleteFailure struct {
1123         e2apMessage
1124         msgC *C.RICSubscriptionDeleteFailure_t
1125 }
1126
1127 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Set(data *e2ap.E2APSubscriptionDeleteFailure) error {
1128
1129         e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1130         C.initSubsDeleteFailure(e2apMsg.msgC)
1131
1132         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1133
1134         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1135                 return err
1136         }
1137
1138         e2apMsg.msgC.ricCause.content = (C.uchar)(data.Cause.Content)
1139         e2apMsg.msgC.ricCause.cause = (C.uchar)(data.Cause.CauseVal)
1140
1141         e2apMsg.msgC.criticalityDiagnosticsPresent = false
1142         if data.CriticalityDiagnostics.Present {
1143                 e2apMsg.msgC.criticalityDiagnosticsPresent = true
1144                 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).set(&data.CriticalityDiagnostics); err != nil {
1145                         return err
1146                 }
1147         }
1148         return nil
1149 }
1150
1151 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Get() (error, *e2ap.E2APSubscriptionDeleteFailure) {
1152
1153         data := &e2ap.E2APSubscriptionDeleteFailure{}
1154
1155         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1156
1157         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1158                 return err, data
1159         }
1160
1161         data.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content)
1162         data.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause)
1163
1164         if e2apMsg.msgC.criticalityDiagnosticsPresent == true {
1165                 data.CriticalityDiagnostics.Present = true
1166                 if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&data.CriticalityDiagnostics); err != nil {
1167                         return err, data
1168                 }
1169         }
1170         return nil, data
1171 }
1172
1173 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduPack(logBuf []byte, data *packer.PackedData) error {
1174         var buflen uint32 = (uint32)(len(data.Buf))
1175         errorNro := C.packRICSubscriptionDeleteFailure((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1176         if errorNro != C.e2err_OK {
1177                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1178         }
1179         data.Buf = data.Buf[0:buflen]
1180         return nil
1181 }
1182
1183 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1184
1185         e2apMsg.msgC = &C.RICSubscriptionDeleteFailure_t{}
1186         C.initSubsDeleteFailure(e2apMsg.msgC)
1187
1188         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1189         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2UnsuccessfulOutcome || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICsubscriptionDeleteFailure {
1190                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1191         }
1192         errorNro := C.getRICSubscriptionDeleteFailureData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1193         if errorNro != C.e2err_OK {
1194                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1195         }
1196         return nil
1197
1198 }
1199
1200 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1201         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1202 }
1203
1204 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) UnPack(msg *packer.PackedData) error {
1205         return packer.PduPackerUnPack(e2apMsg, msg)
1206 }
1207
1208 func (e2apMsg *e2apMsgSubscriptionDeleteFailure) String() string {
1209         var b bytes.Buffer
1210         fmt.Fprintln(&b, "ricSubscriptionDeleteFailure.")
1211         fmt.Fprintln(&b, "  ricRequestID.")
1212         fmt.Fprintln(&b, "    ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1213         fmt.Fprintln(&b, "    ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1214         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1215         /*      NOT SUPPORTED
1216                 if e2apMsg.msgC.criticalityDiagnosticsPresent {
1217                         fmt.Fprintln(&b, "  criticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnosticsPresent)
1218                         fmt.Fprintln(&b, "    criticalityDiagnostics.")
1219                         fmt.Fprintln(&b, "    procedureCodePresent =", e2apMsg.msgC.criticalityDiagnostics.procedureCodePresent)
1220                         fmt.Fprintln(&b, "      procedureCode =", e2apMsg.msgC.criticalityDiagnostics.procedureCode)
1221                         fmt.Fprintln(&b, "    triggeringMessagePresent =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessagePresent)
1222                         fmt.Fprintln(&b, "      triggeringMessage =", e2apMsg.msgC.criticalityDiagnostics.triggeringMessage)
1223                         fmt.Fprintln(&b, "    procedureCriticalityPresent=", e2apMsg.msgC.criticalityDiagnostics.procedureCriticalityPresent)
1224                         fmt.Fprintln(&b, "      procedureCriticality =", e2apMsg.msgC.criticalityDiagnostics.procedureCriticality)
1225                         fmt.Fprintln(&b, "    iEsCriticalityDiagnosticsPresent =", e2apMsg.msgC.criticalityDiagnostics.iEsCriticalityDiagnosticsPresent)
1226                         fmt.Fprintln(&b, "      criticalityDiagnosticsIELength =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength)
1227                         var index2 uint16
1228                         index2 = 0
1229                         for (C.ushort)(index2) < e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIELength {
1230                                 fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].iECriticality =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iECriticality)
1231                                 fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].iE_ID =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].iE_ID)
1232                                 fmt.Fprintln(&b, "      criticalityDiagnosticsIEListItem[index2].typeOfError =", e2apMsg.msgC.criticalityDiagnostics.criticalityDiagnosticsIEListItem[index2].typeOfError)
1233                                 index2++
1234                         }
1235                 }
1236         */
1237         return b.String()
1238 }
1239
1240 //-----------------------------------------------------------------------------
1241 //
1242 //-----------------------------------------------------------------------------
1243 type e2apMsgIndication struct {
1244         e2apMessage
1245         msgC *C.RICIndication_t
1246 }
1247
1248 func (e2apMsg *e2apMsgIndication) Set(data *e2ap.E2APIndication) error {
1249
1250         e2apMsg.msgC = &C.RICIndication_t{}
1251         C.initIndication(e2apMsg.msgC)
1252
1253         e2apMsg.msgC.ranFunctionID = (C.uint16_t)(data.FunctionId)
1254         e2apMsg.msgC.ricIndicationSN = (C.int32_t)(data.IndicationSn)
1255         e2apMsg.msgC.ricIndicationType = (C.uint64_t)(data.IndicationType)
1256
1257         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).set(&data.RequestId); err != nil {
1258                 return err
1259         }
1260         if err := (&e2apEntryIndicationHeader{entry: &e2apMsg.msgC.ricIndicationHeader}).set(&data.IndicationHeader); err != nil {
1261                 return err
1262         }
1263         if err := (&e2apEntryIndicationMessage{entry: &e2apMsg.msgC.ricIndicationMessage}).set(&data.IndicationMessage); err != nil {
1264                 return err
1265         }
1266         /*      NOT SUPPORTED
1267                 if err := (&e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}).set(&data.CallProcessId); err != nil {
1268                         return err
1269                 }
1270         */
1271         return nil
1272 }
1273
1274 func (e2apMsg *e2apMsgIndication) Get() (error, *e2ap.E2APIndication) {
1275
1276         data := &e2ap.E2APIndication{}
1277
1278         data.FunctionId = (e2ap.FunctionId)(e2apMsg.msgC.ranFunctionID)
1279         data.IndicationSn = (int32)(e2apMsg.msgC.ricIndicationSN)
1280         data.IndicationType = (uint64)(e2apMsg.msgC.ricIndicationType)
1281
1282         if err := (&e2apEntryRequestID{entry: &e2apMsg.msgC.ricRequestID}).get(&data.RequestId); err != nil {
1283                 return err, data
1284         }
1285         if err := (&e2apEntryIndicationHeader{entry: &e2apMsg.msgC.ricIndicationHeader}).get(&data.IndicationHeader); err != nil {
1286                 return err, data
1287         }
1288         if err := (&e2apEntryIndicationMessage{entry: &e2apMsg.msgC.ricIndicationMessage}).get(&data.IndicationMessage); err != nil {
1289                 return err, data
1290         }
1291         /*      NOT SUPPORTED
1292                 if err := (&e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}).get(&data.CallProcessId); err != nil {
1293                         return err,data
1294                 }
1295         */
1296         return nil, data
1297 }
1298
1299 func (e2apMsg *e2apMsgIndication) PduPack(logBuf []byte, data *packer.PackedData) error {
1300
1301         /*      NOT SUPPORTED
1302                 callProcId := e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}
1303                 if err := callProcId.pack(); err != nil {
1304                         return err
1305                 }
1306         */
1307         var buflen uint32 = (uint32)(len(data.Buf))
1308         errorNro := C.packRICIndication((*C.size_t)(unsafe.Pointer(&buflen)), (*C.uchar)(unsafe.Pointer(&data.Buf[0])), (*C.char)(unsafe.Pointer(&logBuf[0])), e2apMsg.msgC)
1309         if errorNro != C.e2err_OK {
1310                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1311         }
1312         data.Buf = data.Buf[0:buflen]
1313         return nil
1314 }
1315
1316 func (e2apMsg *e2apMsgIndication) PduUnPack(logBuf []byte, data *packer.PackedData) error {
1317
1318         e2apMsg.msgC = &C.RICIndication_t{}
1319         C.initIndication(e2apMsg.msgC)
1320
1321         e2apMsg.e2apMessage.PduUnPack(logBuf, data)
1322         if e2apMsg.e2apMessage.messageInfo.messageType != C.cE2InitiatingMessage || e2apMsg.e2apMessage.messageInfo.messageId != C.cRICIndication {
1323                 return fmt.Errorf("unpackE2AP_pdu failed -> %s", e2apMsg.e2apMessage.String())
1324         }
1325         errorNro := C.getRICIndicationData(e2apMsg.e2apMessage.pdu, e2apMsg.msgC)
1326         if errorNro != C.e2err_OK {
1327                 return fmt.Errorf("%s", C.GoString(C.getE2ErrorString(errorNro)))
1328         }
1329
1330         /*      NOT SUPPORTED
1331                 callProcId := e2apEntryCallProcessId{entry: &e2apMsg.msgC.ricCallProcessID}
1332                 if err := callProcId.unpack(); err != nil {
1333                         return err
1334                 }
1335         */
1336         return nil
1337 }
1338
1339 func (e2apMsg *e2apMsgIndication) Pack(trg *packer.PackedData) (error, *packer.PackedData) {
1340         return packer.PduPackerPackAllocTrg(e2apMsg, trg)
1341 }
1342
1343 func (e2apMsg *e2apMsgIndication) UnPack(msg *packer.PackedData) error {
1344         return packer.PduPackerUnPack(e2apMsg, msg)
1345 }
1346
1347 func (e2apMsg *e2apMsgIndication) String() string {
1348         var b bytes.Buffer
1349         fmt.Fprintln(&b, "ricIndication.")
1350         fmt.Fprintln(&b, "  ricRequestID.")
1351         fmt.Fprintln(&b, "    ricRequestorID =", e2apMsg.msgC.ricRequestID.ricRequestorID)
1352         fmt.Fprintln(&b, "    ricRequestSequenceNumber =", e2apMsg.msgC.ricRequestID.ricRequestSequenceNumber)
1353         fmt.Fprintln(&b, "  ranFunctionID =", e2apMsg.msgC.ranFunctionID)
1354
1355         fmt.Fprintln(&b, "  ricActionID =", e2apMsg.msgC.ricActionID)
1356         fmt.Fprintln(&b, "  ricIndicationSN =", e2apMsg.msgC.ricIndicationSN)
1357         fmt.Fprintln(&b, "  ricIndicationType =", e2apMsg.msgC.ricIndicationType)
1358         fmt.Fprintln(&b, "  ricIndication.ricIndicationHeader.")
1359         fmt.Fprintln(&b, "    interfaceID.globalENBIDPresent =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBIDPresent)
1360         if e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBIDPresent {
1361                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.contentLength)
1362                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[0])
1363                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[1])
1364                 fmt.Fprintln(&b, "      interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.pLMNIdentity.pLMNIdentityVal[2])
1365                 fmt.Fprintln(&b, "      interfaceID.globalENBID.nodeID.bits =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.nodeID.bits)
1366                 fmt.Fprintln(&b, "      interfaceID.globalENBID.nodeID.nodeID =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalENBID.nodeID.nodeID)
1367         }
1368         fmt.Fprintln(&b, "      interfaceID.globalGNBIDPresent =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBIDPresent)
1369         if e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBIDPresent {
1370                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.contentLength =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.contentLength)
1371                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[0])
1372                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[1])
1373                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2] =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.pLMNIdentity.pLMNIdentityVal[2])
1374                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.nodeID.bits =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.nodeID.bits)
1375                 fmt.Fprintln(&b, "      interfaceID.globalGNBID.nodeID.nodeID =", e2apMsg.msgC.ricIndicationHeader.interfaceID.globalGNBID.nodeID.nodeID)
1376         }
1377         fmt.Fprintln(&b, "  ricIndication.ricIndicationMessage.interfaceMessage.contentLength =", e2apMsg.msgC.ricIndicationMessage.interfaceMessage.contentLength)
1378         fmt.Fprintln(&b, "  ricIndication.ricIndicationMessage.interfaceMessage.data =", e2apMsg.msgC.ricIndicationMessage.interfaceMessage.data[:e2apMsg.msgC.ricIndicationMessage.interfaceMessage.contentLength])
1379         //      fmt.Fprintln(&b,"  ricIndication.ricCallProcessID.ricCallProcessIDVal =", e2apMsg.msgC.ricCallProcessID.ricCallProcessIDVal)
1380         return b.String()
1381 }
1382
1383 //-----------------------------------------------------------------------------
1384 // Public E2AP packer creators
1385 //-----------------------------------------------------------------------------
1386
1387 type cppasn1E2APPacker struct{}
1388
1389 func (*cppasn1E2APPacker) NewPackerSubscriptionRequest() e2ap.E2APMsgPackerSubscriptionRequestIf {
1390         return &e2apMsgSubscriptionRequest{}
1391 }
1392
1393 func (*cppasn1E2APPacker) NewPackerSubscriptionResponse() e2ap.E2APMsgPackerSubscriptionResponseIf {
1394         return &e2apMsgSubscriptionResponse{}
1395 }
1396
1397 func (*cppasn1E2APPacker) NewPackerSubscriptionFailure() e2ap.E2APMsgPackerSubscriptionFailureIf {
1398         return &e2apMsgSubscriptionFailure{}
1399 }
1400
1401 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteRequest() e2ap.E2APMsgPackerSubscriptionDeleteRequestIf {
1402         return &e2apMsgSubscriptionDeleteRequest{}
1403 }
1404
1405 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteResponse() e2ap.E2APMsgPackerSubscriptionDeleteResponseIf {
1406         return &e2apMsgSubscriptionDeleteResponse{}
1407 }
1408
1409 func (*cppasn1E2APPacker) NewPackerSubscriptionDeleteFailure() e2ap.E2APMsgPackerSubscriptionDeleteFailureIf {
1410         return &e2apMsgSubscriptionDeleteFailure{}
1411 }
1412
1413 func (*cppasn1E2APPacker) NewPackerIndication() e2ap.E2APMsgPackerIndicationIf {
1414         return &e2apMsgIndication{}
1415 }
1416
1417 func (*cppasn1E2APPacker) MessageInfo(msg *packer.PackedData) *packer.MessageInfo {
1418         e2apMsg := &e2apMessage{}
1419         return e2apMsg.UnPack(msg)
1420 }
1421
1422 func NewAsn1E2Packer() e2ap.E2APPackerIf {
1423         return &cppasn1E2APPacker{}
1424 }