blob: 8f9f7c939deb809887dedf46e2de9a356c1551c4 [file] [log] [blame]
kalnagy45114752019-06-18 14:40:39 +02001/*
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
20package control
21
Peter Szilagyifbc56f92019-07-23 19:29:46 +000022/*
23#include <wrapper.h>
24
25#cgo LDFLAGS: -lwrapper
26*/
27import "C"
28
kalnagy45114752019-06-18 14:40:39 +020029import (
Peter Szilagyifbc56f92019-07-23 19:29:46 +000030 "unsafe"
Anssi Mannila0a9f2602019-12-09 15:26:44 +020031 "fmt"
kalnagy45114752019-06-18 14:40:39 +020032)
33
34type E2ap struct {
35}
36
Anssi Mannila0a9f2602019-12-09 15:26:44 +020037/* RICsubscriptionRequest */
38
39// Used by e2t test stub
kalnagy1455c852019-10-21 13:06:23 +020040func (c *E2ap) GetSubscriptionRequestSequenceNumber(payload []byte) (subId uint16, err error) {
Peter Szilagyifbc56f92019-07-23 19:29:46 +000041 cptr := unsafe.Pointer(&payload[0])
42 cret := C.e2ap_get_ric_subscription_request_sequence_number(cptr, C.size_t(len(payload)))
43 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020044 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000045 }
kalnagy1455c852019-10-21 13:06:23 +020046 subId = uint16(cret)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000047 return
kalnagy45114752019-06-18 14:40:39 +020048}
49
Anssi Mannila0a9f2602019-12-09 15:26:44 +020050// Used by submgr, rco test stub
51func (c *E2ap) SetSubscriptionRequestSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
Peter Szilagyifbc56f92019-07-23 19:29:46 +000052 cptr := unsafe.Pointer(&payload[0])
53 size := C.e2ap_set_ric_subscription_request_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
54 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020055 return fmt.Errorf("e2ap wrapper is unable to set Subscription Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000056 }
Peter Szilagyifbc56f92019-07-23 19:29:46 +000057 return
kalnagy45114752019-06-18 14:40:39 +020058}
59
Anssi Mannila0a9f2602019-12-09 15:26:44 +020060// Used by submgr, rco test stub
kalnagy1455c852019-10-21 13:06:23 +020061func (c *E2ap) GetSubscriptionResponseSequenceNumber(payload []byte) (subId uint16, err error) {
Peter Szilagyifbc56f92019-07-23 19:29:46 +000062 cptr := unsafe.Pointer(&payload[0])
63 cret := C.e2ap_get_ric_subscription_response_sequence_number(cptr, C.size_t(len(payload)))
64 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020065 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000066 }
kalnagy1455c852019-10-21 13:06:23 +020067 subId = uint16(cret)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000068 return
kalnagy45114752019-06-18 14:40:39 +020069}
70
Anssi Mannila0a9f2602019-12-09 15:26:44 +020071// Used by e2t test stub
72func (c *E2ap) SetSubscriptionResponseSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
Peter Szilagyifbc56f92019-07-23 19:29:46 +000073 cptr := unsafe.Pointer(&payload[0])
74 size := C.e2ap_set_ric_subscription_response_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
75 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020076 return fmt.Errorf("e2ap wrapper is unable to set Subscription Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
Peter Szilagyifbc56f92019-07-23 19:29:46 +000077 }
Peter Szilagyifbc56f92019-07-23 19:29:46 +000078 return
kalnagy45114752019-06-18 14:40:39 +020079}
kalnagy93cc3e22019-09-19 11:29:29 +020080
81/* RICsubscriptionDeleteRequest */
82
Anssi Mannila0a9f2602019-12-09 15:26:44 +020083// Used by submgr, e2t test stub
kalnagy1455c852019-10-21 13:06:23 +020084func (c *E2ap) GetSubscriptionDeleteRequestSequenceNumber(payload []byte) (subId uint16, err error) {
kalnagy93cc3e22019-09-19 11:29:29 +020085 cptr := unsafe.Pointer(&payload[0])
86 cret := C.e2ap_get_ric_subscription_delete_request_sequence_number(cptr, C.size_t(len(payload)))
87 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020088 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
kalnagy93cc3e22019-09-19 11:29:29 +020089 }
kalnagy1455c852019-10-21 13:06:23 +020090 subId = uint16(cret)
kalnagy93cc3e22019-09-19 11:29:29 +020091 return
92}
93
Anssi Mannila0a9f2602019-12-09 15:26:44 +020094// Used by rco test stub
95func (c *E2ap) SetSubscriptionDeleteRequestSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
kalnagy93cc3e22019-09-19 11:29:29 +020096 cptr := unsafe.Pointer(&payload[0])
97 size := C.e2ap_set_ric_subscription_delete_request_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
98 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +020099 return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
kalnagy93cc3e22019-09-19 11:29:29 +0200100 }
kalnagy93cc3e22019-09-19 11:29:29 +0200101 return
102}
103
104/* RICsubscriptionDeleteResponse */
105
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200106// Used by submgr, rco test stub
kalnagy1455c852019-10-21 13:06:23 +0200107func (c *E2ap) GetSubscriptionDeleteResponseSequenceNumber(payload []byte) (subId uint16, err error) {
kalnagy93cc3e22019-09-19 11:29:29 +0200108 cptr := unsafe.Pointer(&payload[0])
109 cret := C.e2ap_get_ric_subscription_delete_response_sequence_number(cptr, C.size_t(len(payload)))
110 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200111 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
kalnagy93cc3e22019-09-19 11:29:29 +0200112 }
kalnagy1455c852019-10-21 13:06:23 +0200113 subId = uint16(cret)
kalnagy93cc3e22019-09-19 11:29:29 +0200114 return
115}
116
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200117// Used by e2t test stub
118func (c *E2ap) SetSubscriptionDeleteResponseSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
kalnagy93cc3e22019-09-19 11:29:29 +0200119 cptr := unsafe.Pointer(&payload[0])
120 size := C.e2ap_set_ric_subscription_delete_response_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
121 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200122 return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
kalnagy93cc3e22019-09-19 11:29:29 +0200123 }
kalnagy93cc3e22019-09-19 11:29:29 +0200124 return
125}
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200126
127/* RICsubscriptionRequestFailure */
128
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200129// Used by submgr
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200130func (c *E2ap) GetSubscriptionFailureSequenceNumber(payload []byte) (subId uint16, err error) {
131 cptr := unsafe.Pointer(&payload[0])
132 cret := C.e2ap_get_ric_subscription_failure_sequence_number(cptr, C.size_t(len(payload)))
133 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200134 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200135 }
136 subId = uint16(cret)
137 return
138}
139
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200140// Used by submgr
141func (c *E2ap) SetSubscriptionFailureSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200142 cptr := unsafe.Pointer(&payload[0])
143 size := C.e2ap_set_ric_subscription_failure_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
144 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200145 return fmt.Errorf("e2ap wrapper is unable to set Subscription Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200146 }
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200147 return
148}
149
150/* RICsubscriptionDeleteFailure */
151
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200152// Used by submgr
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200153func (c *E2ap) GetSubscriptionDeleteFailureSequenceNumber(payload []byte) (subId uint16, err error) {
154 cptr := unsafe.Pointer(&payload[0])
155 cret := C.e2ap_get_ric_subscription_delete_failure_sequence_number(cptr, C.size_t(len(payload)))
156 if cret < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200157 return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret)
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200158 }
159 subId = uint16(cret)
160 return
161}
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200162// Used by submgr
163func (c *E2ap) SetSubscriptionDeleteFailureSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200164 cptr := unsafe.Pointer(&payload[0])
165 size := C.e2ap_set_ric_subscription_delete_failure_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
166 if size < 0 {
Anssi Mannila0a9f2602019-12-09 15:26:44 +0200167 return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",size)
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200168 }
Anssi Mannila2e99e2f2019-12-05 13:57:06 +0200169 return
170}