kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | package control |
| 21 | |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 22 | /* |
| 23 | #include <wrapper.h> |
| 24 | |
| 25 | #cgo LDFLAGS: -lwrapper |
| 26 | */ |
| 27 | import "C" |
| 28 | |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 29 | import ( |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 30 | "unsafe" |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 31 | "fmt" |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 32 | ) |
| 33 | |
| 34 | type E2ap struct { |
| 35 | } |
| 36 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 37 | /* RICsubscriptionRequest */ |
| 38 | |
| 39 | // Used by e2t test stub |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 40 | func (c *E2ap) GetSubscriptionRequestSequenceNumber(payload []byte) (subId uint16, err error) { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 41 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 44 | return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 45 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 46 | subId = uint16(cret) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 47 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 48 | } |
| 49 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 50 | // Used by submgr, rco test stub |
| 51 | func (c *E2ap) SetSubscriptionRequestSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 52 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 55 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 56 | } |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 57 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 58 | } |
| 59 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 60 | // Used by submgr, rco test stub |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 61 | func (c *E2ap) GetSubscriptionResponseSequenceNumber(payload []byte) (subId uint16, err error) { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 62 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 65 | return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 66 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 67 | subId = uint16(cret) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 68 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 69 | } |
| 70 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 71 | // Used by e2t test stub |
| 72 | func (c *E2ap) SetSubscriptionResponseSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 73 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 76 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 77 | } |
Peter Szilagyi | fbc56f9 | 2019-07-23 19:29:46 +0000 | [diff] [blame] | 78 | return |
kalnagy | 4511475 | 2019-06-18 14:40:39 +0200 | [diff] [blame] | 79 | } |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 80 | |
| 81 | /* RICsubscriptionDeleteRequest */ |
| 82 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 83 | // Used by submgr, e2t test stub |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 84 | func (c *E2ap) GetSubscriptionDeleteRequestSequenceNumber(payload []byte) (subId uint16, err error) { |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 85 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 88 | return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 89 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 90 | subId = uint16(cret) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 91 | return |
| 92 | } |
| 93 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 94 | // Used by rco test stub |
| 95 | func (c *E2ap) SetSubscriptionDeleteRequestSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 96 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 99 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Request Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 100 | } |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 101 | return |
| 102 | } |
| 103 | |
| 104 | /* RICsubscriptionDeleteResponse */ |
| 105 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 106 | // Used by submgr, rco test stub |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 107 | func (c *E2ap) GetSubscriptionDeleteResponseSequenceNumber(payload []byte) (subId uint16, err error) { |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 108 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 111 | return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 112 | } |
kalnagy | 1455c85 | 2019-10-21 13:06:23 +0200 | [diff] [blame] | 113 | subId = uint16(cret) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 114 | return |
| 115 | } |
| 116 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 117 | // Used by e2t test stub |
| 118 | func (c *E2ap) SetSubscriptionDeleteResponseSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 119 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 122 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Response Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 123 | } |
kalnagy | 93cc3e2 | 2019-09-19 11:29:29 +0200 | [diff] [blame] | 124 | return |
| 125 | } |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 126 | |
| 127 | /* RICsubscriptionRequestFailure */ |
| 128 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 129 | // Used by submgr |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 130 | func (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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 134 | return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",cret) |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 135 | } |
| 136 | subId = uint16(cret) |
| 137 | return |
| 138 | } |
| 139 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 140 | // Used by submgr |
| 141 | func (c *E2ap) SetSubscriptionFailureSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 142 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 145 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 146 | } |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 147 | return |
| 148 | } |
| 149 | |
| 150 | /* RICsubscriptionDeleteFailure */ |
| 151 | |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 152 | // Used by submgr |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 153 | func (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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 157 | 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 Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 158 | } |
| 159 | subId = uint16(cret) |
| 160 | return |
| 161 | } |
Anssi Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 162 | // Used by submgr |
| 163 | func (c *E2ap) SetSubscriptionDeleteFailureSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) { |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 164 | 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 Mannila | 0a9f260 | 2019-12-09 15:26:44 +0200 | [diff] [blame] | 167 | return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Failure Sequence Number due to wrong or invalid payload. ErrorCode: %v",size) |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 168 | } |
Anssi Mannila | 2e99e2f | 2019-12-05 13:57:06 +0200 | [diff] [blame] | 169 | return |
| 170 | } |