X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2ap%2Fpkg%2Fe2ap_wrapper%2Fpacker_e2ap.go;h=7069f8607f9a975fa845b2346f78854c2b673c11;hb=14f827331f7ae565d33cdf23c82f7794d3fc2d0d;hp=b01baebbd0bb2f28412245a299eda9bd13b9829c;hpb=47942b4fd845472cd4f669bdcc5320be71f1570c;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..7069f86 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 }