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 ==================================================================================
25 #cgo LDFLAGS: -le2ap_wrapper -le2ap
30 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
31 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper"
32 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer"
35 var packerif e2ap.E2APPackerIf = e2ap_wrapper.NewAsn1E2Packer()
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
43 func (c *E2ap) UnpackSubscriptionRequest(payload []byte) (*e2ap.E2APSubscriptionRequest, error) {
44 e2SubReq := packerif.NewPackerSubscriptionRequest()
45 packedData := &packer.PackedData{}
46 packedData.Buf = payload
47 err := e2SubReq.UnPack(packedData)
51 err, subReq := e2SubReq.Get()
58 func (c *E2ap) PackSubscriptionRequest(req *e2ap.E2APSubscriptionRequest) (*packer.PackedData, error) {
59 e2SubReq := packerif.NewPackerSubscriptionRequest()
60 err := e2SubReq.Set(req)
64 err, packedData := e2SubReq.Pack(nil)
68 return packedData, nil
71 //-----------------------------------------------------------------------------
73 //-----------------------------------------------------------------------------
74 func (c *E2ap) UnpackSubscriptionResponse(payload []byte) (*e2ap.E2APSubscriptionResponse, error) {
75 e2SubResp := packerif.NewPackerSubscriptionResponse()
76 packedData := &packer.PackedData{}
77 packedData.Buf = payload
78 err := e2SubResp.UnPack(packedData)
82 err, subResp := e2SubResp.Get()
89 func (c *E2ap) PackSubscriptionResponse(req *e2ap.E2APSubscriptionResponse) (*packer.PackedData, error) {
90 e2SubResp := packerif.NewPackerSubscriptionResponse()
91 err := e2SubResp.Set(req)
95 err, packedData := e2SubResp.Pack(nil)
99 return packedData, nil
102 //-----------------------------------------------------------------------------
104 //-----------------------------------------------------------------------------
105 func (c *E2ap) UnpackSubscriptionFailure(payload []byte) (*e2ap.E2APSubscriptionFailure, error) {
106 e2SubFail := packerif.NewPackerSubscriptionFailure()
107 packedData := &packer.PackedData{}
108 packedData.Buf = payload
109 err := e2SubFail.UnPack(packedData)
113 err, subFail := e2SubFail.Get()
120 func (c *E2ap) PackSubscriptionFailure(req *e2ap.E2APSubscriptionFailure) (*packer.PackedData, error) {
121 e2SubFail := packerif.NewPackerSubscriptionFailure()
122 err := e2SubFail.Set(req)
126 err, packedData := e2SubFail.Pack(nil)
130 return packedData, nil
133 //-----------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------
136 func (c *E2ap) UnpackSubscriptionDeleteRequest(payload []byte) (*e2ap.E2APSubscriptionDeleteRequest, error) {
137 e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest()
138 packedData := &packer.PackedData{}
139 packedData.Buf = payload
140 err := e2SubDelReq.UnPack(packedData)
144 err, subDelReq := e2SubDelReq.Get()
148 return subDelReq, nil
151 func (c *E2ap) PackSubscriptionDeleteRequest(req *e2ap.E2APSubscriptionDeleteRequest) (*packer.PackedData, error) {
152 e2SubDelReq := packerif.NewPackerSubscriptionDeleteRequest()
153 err := e2SubDelReq.Set(req)
157 err, packedData := e2SubDelReq.Pack(nil)
161 return packedData, nil
164 //-----------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------
167 func (c *E2ap) UnpackSubscriptionDeleteResponse(payload []byte) (*e2ap.E2APSubscriptionDeleteResponse, error) {
168 e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse()
169 packedData := &packer.PackedData{}
170 packedData.Buf = payload
171 err := e2SubDelResp.UnPack(packedData)
175 err, subDelResp := e2SubDelResp.Get()
179 return subDelResp, nil
182 func (c *E2ap) PackSubscriptionDeleteResponse(req *e2ap.E2APSubscriptionDeleteResponse) (*packer.PackedData, error) {
183 e2SubDelResp := packerif.NewPackerSubscriptionDeleteResponse()
184 err := e2SubDelResp.Set(req)
188 err, packedData := e2SubDelResp.Pack(nil)
192 return packedData, nil
195 //-----------------------------------------------------------------------------
197 //-----------------------------------------------------------------------------
198 func (c *E2ap) UnpackSubscriptionDeleteFailure(payload []byte) (*e2ap.E2APSubscriptionDeleteFailure, error) {
199 e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure()
200 packedData := &packer.PackedData{}
201 packedData.Buf = payload
202 err := e2SubDelFail.UnPack(packedData)
206 err, subDelFail := e2SubDelFail.Get()
210 return subDelFail, nil
213 func (c *E2ap) PackSubscriptionDeleteFailure(req *e2ap.E2APSubscriptionDeleteFailure) (*packer.PackedData, error) {
214 e2SubDelFail := packerif.NewPackerSubscriptionDeleteFailure()
215 err := e2SubDelFail.Set(req)
219 err, packedData := e2SubDelFail.Pack(nil)
223 return packedData, nil