X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fe2ap.go;h=b21eb3f2cc9fe392a59010616ea4141c38595905;hb=7348625b9ef03d41dd5a0ca0f6c508376259717e;hp=f0b33812316854a4696f796647232be618dbf3c7;hpb=01a4c49324392003717106267c56126275b9058b;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/e2ap.go b/pkg/control/e2ap.go index f0b3381..b21eb3f 100644 --- a/pkg/control/e2ap.go +++ b/pkg/control/e2ap.go @@ -20,8 +20,6 @@ package control /* -#include - #cgo LDFLAGS: -le2ap_wrapper -le2ap */ import "C" @@ -31,7 +29,6 @@ import ( "fmt" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" - "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) @@ -45,16 +42,14 @@ type E2ap struct { //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionRequest(payload []byte) (*e2ap.E2APSubscriptionRequest, error) { e2SubReq := packerif.NewPackerSubscriptionRequest() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subReq := e2SubReq.UnPack(packedData) + err, subReq := e2SubReq.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subReq, nil } -func (c *E2ap) PackSubscriptionRequest(req *e2ap.E2APSubscriptionRequest) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionRequest(req *e2ap.E2APSubscriptionRequest) (int, *e2ap.PackedData, error) { e2SubReq := packerif.NewPackerSubscriptionRequest() err, packedData := e2SubReq.Pack(req) if err != nil { @@ -68,16 +63,14 @@ func (c *E2ap) PackSubscriptionRequest(req *e2ap.E2APSubscriptionRequest) (int, //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionResponse(payload []byte) (*e2ap.E2APSubscriptionResponse, error) { e2SubResp := packerif.NewPackerSubscriptionResponse() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subResp := e2SubResp.UnPack(packedData) + err, subResp := e2SubResp.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subResp, nil } -func (c *E2ap) PackSubscriptionResponse(req *e2ap.E2APSubscriptionResponse) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionResponse(req *e2ap.E2APSubscriptionResponse) (int, *e2ap.PackedData, error) { e2SubResp := packerif.NewPackerSubscriptionResponse() err, packedData := e2SubResp.Pack(req) if err != nil { @@ -91,16 +84,14 @@ func (c *E2ap) PackSubscriptionResponse(req *e2ap.E2APSubscriptionResponse) (int //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionFailure(payload []byte) (*e2ap.E2APSubscriptionFailure, error) { e2SubFail := packerif.NewPackerSubscriptionFailure() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subFail := e2SubFail.UnPack(packedData) + err, subFail := e2SubFail.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subFail, nil } -func (c *E2ap) PackSubscriptionFailure(req *e2ap.E2APSubscriptionFailure) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionFailure(req *e2ap.E2APSubscriptionFailure) (int, *e2ap.PackedData, error) { e2SubFail := packerif.NewPackerSubscriptionFailure() err, packedData := e2SubFail.Pack(req) if err != nil { @@ -114,16 +105,14 @@ func (c *E2ap) PackSubscriptionFailure(req *e2ap.E2APSubscriptionFailure) (int, //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionDeleteRequest(payload []byte) (*e2ap.E2APSubscriptionDeleteRequest, error) { e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subDelReq := e2SubDelReq.UnPack(packedData) + err, subDelReq := e2SubDelReq.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subDelReq, nil } -func (c *E2ap) PackSubscriptionDeleteRequest(req *e2ap.E2APSubscriptionDeleteRequest) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionDeleteRequest(req *e2ap.E2APSubscriptionDeleteRequest) (int, *e2ap.PackedData, error) { e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest() err, packedData := e2SubDelReq.Pack(req) if err != nil { @@ -137,16 +126,14 @@ func (c *E2ap) PackSubscriptionDeleteRequest(req *e2ap.E2APSubscriptionDeleteReq //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionDeleteResponse(payload []byte) (*e2ap.E2APSubscriptionDeleteResponse, error) { e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subDelResp := e2SubDelResp.UnPack(packedData) + err, subDelResp := e2SubDelResp.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subDelResp, nil } -func (c *E2ap) PackSubscriptionDeleteResponse(req *e2ap.E2APSubscriptionDeleteResponse) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionDeleteResponse(req *e2ap.E2APSubscriptionDeleteResponse) (int, *e2ap.PackedData, error) { e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse() err, packedData := e2SubDelResp.Pack(req) if err != nil { @@ -160,16 +147,14 @@ func (c *E2ap) PackSubscriptionDeleteResponse(req *e2ap.E2APSubscriptionDeleteRe //----------------------------------------------------------------------------- func (c *E2ap) UnpackSubscriptionDeleteFailure(payload []byte) (*e2ap.E2APSubscriptionDeleteFailure, error) { e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure() - packedData := &packer.PackedData{} - packedData.Buf = payload - err, subDelFail := e2SubDelFail.UnPack(packedData) + err, subDelFail := e2SubDelFail.UnPack(&e2ap.PackedData{payload}) if err != nil { return nil, fmt.Errorf("%s buf[%s]", err.Error(), hex.EncodeToString(payload)) } return subDelFail, nil } -func (c *E2ap) PackSubscriptionDeleteFailure(req *e2ap.E2APSubscriptionDeleteFailure) (int, *packer.PackedData, error) { +func (c *E2ap) PackSubscriptionDeleteFailure(req *e2ap.E2APSubscriptionDeleteFailure) (int, *e2ap.PackedData, error) { e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure() err, packedData := e2SubDelFail.Pack(req) if err != nil {