X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2ap%2Fpkg%2Fe2ap_wrapper%2Fpacker_e2ap.go;h=46836f6a0c1535e3b03e90bebb9071736267f601;hb=87b89ee5f7466f6f645a44388e8a7fa097a93d19;hp=b01baebbd0bb2f28412245a299eda9bd13b9829c;hpb=a9bf76cb8dec6e52e7699edf1631c214647f8beb;p=ric-plt%2Fsubmgr.git diff --git a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go index b01baeb..46836f6 100644 --- a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go +++ b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go @@ -175,22 +175,26 @@ type e2apEntryPlmnIdentity struct { entry *C.PLMNIdentity_t } -func (plmnId *e2apEntryPlmnIdentity) set(id *conv.PlmnIdentity) error { +func (plmnId *e2apEntryPlmnIdentity) set(id conv.PlmnIdentityIf) error { - plmnId.entry.contentLength = (C.uint8_t)(len(id.Val)) - for i := 0; i < len(id.Val); i++ { - plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(id.Val[i]) + buf := new(bytes.Buffer) + id.EncodeTo(buf) + data := buf.Bytes() + plmnId.entry.contentLength = (C.uint8_t)(len(data)) + for i := 0; i < len(data); i++ { + plmnId.entry.pLMNIdentityVal[i] = (C.uint8_t)(data[i]) } return nil } -func (plmnId *e2apEntryPlmnIdentity) get(id *conv.PlmnIdentity) error { +func (plmnId *e2apEntryPlmnIdentity) get(id conv.PlmnIdentityIf) error { conlen := (int)(plmnId.entry.contentLength) bcdBuf := make([]uint8, conlen) for i := 0; i < conlen; i++ { bcdBuf[i] = (uint8)(plmnId.entry.pLMNIdentityVal[i]) } - id.BcdPut(bcdBuf) + reader := bytes.NewReader(bcdBuf) + id.DecodeFrom(reader) return nil } @@ -374,7 +378,7 @@ func (item *e2apEntryNotAdmittedList) set(data *e2ap.ActionNotAdmittedList) erro for i := 0; i < len(data.Items); i++ { item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricActionID = (C.ulong)(data.Items[i].ActionId) item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.content = (C.uchar)(data.Items[i].Cause.Content) - item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.CauseVal) + item.entry.RICActionNotAdmittedItem[item.entry.contentLength].ricCause.cause = (C.uchar)(data.Items[i].Cause.Value) item.entry.contentLength++ } @@ -387,7 +391,7 @@ func (item *e2apEntryNotAdmittedList) get(data *e2ap.ActionNotAdmittedList) erro for i := 0; i < conlen; i++ { data.Items[i].ActionId = (uint64)(item.entry.RICActionNotAdmittedItem[i].ricActionID) data.Items[i].Cause.Content = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.content) - data.Items[i].Cause.CauseVal = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause) + data.Items[i].Cause.Value = (uint8)(item.entry.RICActionNotAdmittedItem[i].ricCause.cause) } return nil } @@ -1040,7 +1044,7 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) Pack(data *e2ap.E2APSubsc return err, nil } e2apMsg.msgC.ricCause.content = (C.uchar)(e2apMsg.msgG.Cause.Content) - e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.CauseVal) + e2apMsg.msgC.ricCause.cause = (C.uchar)(e2apMsg.msgG.Cause.Value) e2apMsg.msgC.criticalityDiagnosticsPresent = false if e2apMsg.msgG.CriticalityDiagnostics.Present { e2apMsg.msgC.criticalityDiagnosticsPresent = true @@ -1073,7 +1077,7 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) UnPack(msg *e2ap.PackedDa return err, e2apMsg.msgG } e2apMsg.msgG.Cause.Content = (uint8)(e2apMsg.msgC.ricCause.content) - e2apMsg.msgG.Cause.CauseVal = (uint8)(e2apMsg.msgC.ricCause.cause) + e2apMsg.msgG.Cause.Value = (uint8)(e2apMsg.msgC.ricCause.cause) if e2apMsg.msgC.criticalityDiagnosticsPresent == true { e2apMsg.msgG.CriticalityDiagnostics.Present = true if err := (&e2apEntryCriticalityDiagnostic{entry: &e2apMsg.msgC.criticalityDiagnostics}).get(&e2apMsg.msgG.CriticalityDiagnostics); err != nil {