blob: 5872b000ae7ad9ffb637477d7da46a072c34b19b [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* GPRS-NS Emulation in TTCN-3
Harald Welte013d65a2020-09-13 14:41:31 +02002 * (C) 2018-2020 Harald Welte <laforge@gnumonks.org>
Harald Welte34b5a952019-05-27 11:54:11 +02003 * contributions by sysmocom - s.f.m.c. GmbH
4 * All rights reserved.
5 *
6 * Released under the terms of GNU General Public License, Version 2 or
7 * (at your option) any later version.
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
Harald Welte6fff3642017-07-22 21:36:13 +020012module NS_Emulation {
13 import from NS_Types all;
14 import from BSSGP_Types all;
Harald Welte867243a2020-09-13 18:32:32 +020015 import from Osmocom_Types all;
Harald Weltee0abc472018-02-05 09:13:31 +010016 import from Osmocom_Gb_Types all;
Harald Welte013d65a2020-09-13 14:41:31 +020017 import from NS_Provider_IPL4 all;
Harald Welte867243a2020-09-13 18:32:32 +020018#ifdef NS_EMULATION_FR
19 import from NS_Provider_FR all;
20#endif
Harald Welte6fff3642017-07-22 21:36:13 +020021 import from IPL4asp_Types all;
22
23 type record NsUnitdataRequest {
24 BssgpBvci bvci,
25 Nsei nsei,
Harald Welte6e594f22017-07-23 16:19:35 +020026 octetstring sdu optional,
Harald Weltee0abc472018-02-05 09:13:31 +010027 PDU_BSSGP bssgp optional
Harald Welte6e594f22017-07-23 16:19:35 +020028 }
29
30 template NsUnitdataRequest t_NsUdReq(template Nsei nsei, template BssgpBvci bvci, template octetstring sdu,
Harald Weltee0abc472018-02-05 09:13:31 +010031 template PDU_BSSGP bssgp) := {
Harald Welte6e594f22017-07-23 16:19:35 +020032 bvci := bvci,
33 nsei := nsei,
34 sdu := sdu,
35 bssgp := bssgp
Harald Welte6fff3642017-07-22 21:36:13 +020036 }
37
38 type record NsUnitdataIndication {
39 BssgpBvci bvci,
40 Nsei nsei,
Harald Welte6e594f22017-07-23 16:19:35 +020041 octetstring sdu optional,
Harald Weltee0abc472018-02-05 09:13:31 +010042 PDU_BSSGP bssgp optional
Harald Welte6e594f22017-07-23 16:19:35 +020043 }
44
45 template NsUnitdataIndication t_NsUdInd(Nsei nsei, BssgpBvci bvci, octetstring sdu) := {
46 bvci := bvci,
47 nsei := nsei,
48 sdu := sdu,
Harald Weltee0abc472018-02-05 09:13:31 +010049 bssgp := dec_PDU_BSSGP(sdu)
Harald Welte6e594f22017-07-23 16:19:35 +020050 }
51
52 type record NsStatusIndication {
53 Nsei nsei,
54 Nsvci nsvci,
55 NseState old_state,
56 NseState new_state
57 }
58
59 template NsStatusIndication t_NsStsInd(Nsei nsei, Nsvci nsvci, NseState old_state, NseState state) := {
60 nsei := nsei,
61 nsvci := nsvci,
62 old_state := old_state,
63 new_state := state
Harald Welte6fff3642017-07-22 21:36:13 +020064 }
65
66 type enumerated NseState {
Harald Welte6e594f22017-07-23 16:19:35 +020067 NSE_S_DEAD_BLOCKED,
68 NSE_S_WAIT_RESET,
69 NSE_S_ALIVE_BLOCKED,
70 NSE_S_ALIVE_UNBLOCKED
71 }
Harald Welte6fff3642017-07-22 21:36:13 +020072
73 /* port from our (internal) point of view */
74 type port NS_SP_PT message {
75 in NsUnitdataRequest;
76 out NsUnitdataIndication,
Harald Welte013d65a2020-09-13 14:41:31 +020077 NsStatusIndication;
Harald Welte6fff3642017-07-22 21:36:13 +020078 } with { extension "internal" };
79
80 /* port from the user point of view */
81 type port NS_PT message {
82 in ASP_Event,
Harald Welte6e594f22017-07-23 16:19:35 +020083 NsStatusIndication,
Harald Welte6fff3642017-07-22 21:36:13 +020084 NsUnitdataIndication;
85 out NsUnitdataRequest;
86 } with { extension "internal" };
87
Alexander Couzens2c12b242018-07-31 00:30:11 +020088 function NSStart(NSConfiguration init_config) runs on NS_CT {
89 config := init_config;
Harald Welte6fff3642017-07-22 21:36:13 +020090 f_init();
91 f_ScanEvents();
92 }
93
94 private function f_init() runs on NS_CT {
Harald Welte6e594f22017-07-23 16:19:35 +020095 var Result res;
Harald Welte013d65a2020-09-13 14:41:31 +020096
Harald Welte867243a2020-09-13 18:32:32 +020097 if (ischosen(config.provider.ip)) {
98 /* Connect the UDP socket */
99 vc_NSP_IP := NS_Provider_IPL4_CT.create;
100 connect(self:NSCP, vc_NSP_IP:NSE);
101 vc_NSP_IP.start(NS_Provider_IPL4.main(config));
102#ifdef NS_EMULATION_FR
103 } else if (ischosen(config.provider.fr)) {
104 vc_NSP_FR := NS_Provider_FR_CT.create;
105 connect(self:NSCP, vc_NSP_FR:NSE);
106 vc_NSP_FR.start(NS_Provider_FR.main(config));
107#endif
108 }
Harald Welte013d65a2020-09-13 14:41:31 +0200109
Harald Welte6e594f22017-07-23 16:19:35 +0200110 f_change_state(NSE_S_DEAD_BLOCKED);
111 /* Send the first NS-ALIVE to test the connection */
Harald Weltee81d84e2018-07-05 03:17:00 +0200112 if (not config.role_sgsn) {
113 f_sendReset();
114 }
Harald Welte6fff3642017-07-22 21:36:13 +0200115 }
116
Harald Welte013d65a2020-09-13 14:41:31 +0200117 type component NS_Provider_CT {
118 /* upper port, facing to NS_Emulation:NSCP */
119 port NS_PROVIDER_PT NSE;
120 /* lower layer ports (UDP/IP, Frame Relay) are added in derived components */
121 };
122
Harald Weltebd612cd2020-09-14 09:42:28 +0200123 type enumerated NS_Provider_LinkStatus {
124 NS_PROV_LINK_STATUS_UP,
125 NS_PROV_LINK_STATUS_DOWN
126 };
127 type union NS_Provider_Evt {
128 NS_Provider_LinkStatus link_status
129 };
130
Harald Welte013d65a2020-09-13 14:41:31 +0200131 /* port between NS_Provider and NS_CT */
132 type port NS_PROVIDER_PT message {
Harald Weltebd612cd2020-09-14 09:42:28 +0200133 inout PDU_NS, NS_Provider_Evt;
Harald Welte013d65a2020-09-13 14:41:31 +0200134 } with { extension "internal" };
135
Harald Welte6fff3642017-07-22 21:36:13 +0200136 type component NS_CT {
137 /* UDP port towards the bottom (IUT) */
Harald Welte013d65a2020-09-13 14:41:31 +0200138 port NS_PROVIDER_PT NSCP;
139 var NS_Provider_IPL4_CT vc_NSP_IP;
Harald Welte867243a2020-09-13 18:32:32 +0200140#ifdef NS_EMULATION_FR
141 var NS_Provider_FR_CT vc_NSP_FR;
142#endif
Harald Welte013d65a2020-09-13 14:41:31 +0200143
Harald Welte6fff3642017-07-22 21:36:13 +0200144 /* NS-User SAP towards the user */
145 port NS_SP_PT NS_SP;
146
Alexander Couzens2c12b242018-07-31 00:30:11 +0200147 var NSConfiguration config;
148
Harald Welte6e594f22017-07-23 16:19:35 +0200149 var NseState g_state := NSE_S_DEAD_BLOCKED;
Harald Welte6e594f22017-07-23 16:19:35 +0200150
151 timer Tns_alive := 3.0;
152 timer Tns_test := 10.0;
153 timer Tns_block := 10.0;
Harald Welte6fff3642017-07-22 21:36:13 +0200154 }
155
Harald Welte5e8573e2020-09-13 15:32:56 +0200156 type record NSConfigurationIP {
Alexander Couzense0f7c542020-09-13 17:25:18 +0200157 AddressFamily address_family,
Alexander Couzens2c12b242018-07-31 00:30:11 +0200158 PortNumber local_udp_port,
159 charstring local_ip,
160 PortNumber remote_udp_port,
Harald Welte5e8573e2020-09-13 15:32:56 +0200161 charstring remote_ip
162 };
Harald Welte867243a2020-09-13 18:32:32 +0200163 type record NSConfigurationFR {
164 charstring netdev, /* HDLC net-device for AF_PACKET socket */
165 integer dlci
166 };
Harald Welte5e8573e2020-09-13 15:32:56 +0200167 type union NSConfigurationP {
Harald Welte867243a2020-09-13 18:32:32 +0200168 NSConfigurationIP ip,
169 NSConfigurationFR fr
Harald Welte5e8573e2020-09-13 15:32:56 +0200170 };
171 type record NSConfiguration {
172 NSConfigurationP provider,
Alexander Couzens2c12b242018-07-31 00:30:11 +0200173 Nsvci nsvci,
Harald Welte5e514fa2018-07-05 00:01:45 +0200174 Nsvci nsei,
175 boolean role_sgsn,
176 boolean handle_sns
Alexander Couzens2c12b242018-07-31 00:30:11 +0200177 }
Harald Welte6fff3642017-07-22 21:36:13 +0200178
Harald Welte6e594f22017-07-23 16:19:35 +0200179 private function f_change_state(NseState new_state) runs on NS_CT {
180 var NseState old_state := g_state;
181 g_state := new_state;
182 log("NS State Transition: ", old_state, " -> ", new_state);
Alexander Couzens2c12b242018-07-31 00:30:11 +0200183 NS_SP.send(t_NsStsInd(config.nsei, config.nsvci, old_state, new_state));
Harald Welte6fff3642017-07-22 21:36:13 +0200184 }
185
Harald Welte6e594f22017-07-23 16:19:35 +0200186 private function f_sendReset() runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200187 NSCP.send(ts_NS_RESET(NS_CAUSE_OM_INTERVENTION, config.nsvci, config.nsei));
Harald Welte6e594f22017-07-23 16:19:35 +0200188 g_state := NSE_S_WAIT_RESET;
Harald Welte6fff3642017-07-22 21:36:13 +0200189 }
190
Harald Welte6e594f22017-07-23 16:19:35 +0200191 private function f_sendAlive() runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200192 NSCP.send(t_NS_ALIVE);
Harald Welte6e594f22017-07-23 16:19:35 +0200193 Tns_alive.start;
194 }
195
196 private function f_sendUnblock() runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200197 NSCP.send(t_NS_UNBLOCK);
Harald Welte6e594f22017-07-23 16:19:35 +0200198 Tns_block.start;
199 }
200
201 private function f_sendBlock(NsCause cause) runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200202 NSCP.send(ts_NS_BLOCK(cause, config.nsvci));
Harald Welte6e594f22017-07-23 16:19:35 +0200203 Tns_block.start;
204 }
205
206 altstep as_allstate() runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200207 var PDU_NS rf;
Harald Welte6e594f22017-07-23 16:19:35 +0200208 var ASP_Event evt;
209
210 /* transition to DEAD if t_alive times out */
Harald Welte9a7c5122020-09-14 11:35:57 +0200211 [] Tns_alive.timeout {
212 log("Tns-alive expired: changing to DEAD_BLOCKED + starting Tns-test");
Harald Welte6e594f22017-07-23 16:19:35 +0200213 f_change_state(NSE_S_DEAD_BLOCKED);
214 Tns_test.start;
Harald Welte6fff3642017-07-22 21:36:13 +0200215 }
Harald Welte6fff3642017-07-22 21:36:13 +0200216
Harald Welte9a7c5122020-09-14 11:35:57 +0200217 [] Tns_test.timeout {
Harald Welte6e594f22017-07-23 16:19:35 +0200218 log("Tns-test expired: sending NS-ALIVE");
219 f_sendAlive();
Harald Welte6fff3642017-07-22 21:36:13 +0200220 }
Harald Welte6fff3642017-07-22 21:36:13 +0200221
Harald Weltebd612cd2020-09-14 09:42:28 +0200222 [] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
223 log("Provider Link came up: sending NS-ALIVE");
224 f_sendAlive();
225 Tns_test.start;
226 }
227
Harald Welte6e594f22017-07-23 16:19:35 +0200228 /* Stop t_alive when receiving ALIVE-ACK */
Harald Welte9a7c5122020-09-14 11:35:57 +0200229 [Tns_alive.running] NSCP.receive(t_NS_ALIVE_ACK) {
Harald Welte6e594f22017-07-23 16:19:35 +0200230 log("NS-ALIVE-ACK received: stopping Tns-alive; starting Tns-test");
231 Tns_alive.stop;
232 Tns_test.start;
233 }
Harald Welte6fff3642017-07-22 21:36:13 +0200234
Harald Welte6e594f22017-07-23 16:19:35 +0200235 /* respond to NS-ALIVE with NS-ALIVE-ACK */
Harald Welte013d65a2020-09-13 14:41:31 +0200236 [] NSCP.receive(t_NS_ALIVE) {
237 NSCP.send(t_NS_ALIVE_ACK);
Harald Welte6e594f22017-07-23 16:19:35 +0200238 }
239
240 /* Respond to BLOCK for wrong NSVCI */
Harald Welte013d65a2020-09-13 14:41:31 +0200241 [] NSCP.receive(tr_NS_BLOCK(?, ?)) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200242 log("Rx NS-BLOCK for unknown NSVCI");
243 /* FIXME */
244 }
245
246 /* Respond to RESET with correct NSEI/NSVCI */
Harald Welte013d65a2020-09-13 14:41:31 +0200247 [] NSCP.receive(tr_NS_RESET(?, config.nsvci, config.nsei)) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200248 f_change_state(NSE_S_ALIVE_BLOCKED);
Harald Welte013d65a2020-09-13 14:41:31 +0200249 NSCP.send(ts_NS_RESET_ACK(config.nsvci, config.nsei));
Harald Welte6e594f22017-07-23 16:19:35 +0200250 }
251
252 /* Respond to RESET with wrong NSEI/NSVCI */
Harald Welte013d65a2020-09-13 14:41:31 +0200253 [] NSCP.receive(tr_NS_RESET(?, ?, ?)) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200254 log("Rx NS-RESET for unknown NSEI/NSVCI");
255 /* FIXME */
256 }
257
Harald Welte5e8573e2020-09-13 15:32:56 +0200258 [config.role_sgsn and config.handle_sns and ischosen(config.provider.ip)] as_sns_sgsn();
Harald Welte5e514fa2018-07-05 00:01:45 +0200259
Harald Welte6e594f22017-07-23 16:19:35 +0200260 /* default case of handling unknown PDUs */
Harald Welte013d65a2020-09-13 14:41:31 +0200261 [] NSCP.receive(PDU_NS: ?) -> value rf {
262 log("Rx Unexpected NS PDU ", rf," in state ", g_state);
263 NSCP.send(ts_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf));
Harald Welte6e594f22017-07-23 16:19:35 +0200264 }
Harald Welte6fff3642017-07-22 21:36:13 +0200265 }
266
Harald Welte5e514fa2018-07-05 00:01:45 +0200267 /* simple IP Sub-Network Service responder for the SGSN side. This is not a full implementation
268 * of the protocol, merely sufficient to make the PCU/BSS side happy to proceed */
269 altstep as_sns_sgsn() runs on NS_CT {
Harald Welte013d65a2020-09-13 14:41:31 +0200270 var PDU_NS rf;
271 [] NSCP.receive(tr_SNS_SIZE(config.nsei)) -> value rf {
Harald Welte5e514fa2018-07-05 00:01:45 +0200272 /* blindly acknowledge whatever the PCU sends */
Harald Welte013d65a2020-09-13 14:41:31 +0200273 NSCP.send(ts_SNS_SIZE_ACK(config.nsei, omit));
Harald Welte5e514fa2018-07-05 00:01:45 +0200274 }
Harald Welte013d65a2020-09-13 14:41:31 +0200275 [] NSCP.receive(tr_SNS_SIZE(?)) {
Harald Welte5e514fa2018-07-05 00:01:45 +0200276 setverdict(fail, "SNS-SIZE from unexpected NSEI");
277 self.stop;
278 }
Harald Welte013d65a2020-09-13 14:41:31 +0200279 [] NSCP.receive(tr_SNS_CONFIG(config.nsei, true,
Harald Welte5e8573e2020-09-13 15:32:56 +0200280 {tr_SNS_IPv4(config.provider.ip.remote_ip,
281 config.provider.ip.remote_udp_port)})) -> value rf {
Harald Welte5e514fa2018-07-05 00:01:45 +0200282 /* blindly acknowledge whatever the PCU sends */
Harald Welte013d65a2020-09-13 14:41:31 +0200283 NSCP.send(ts_SNS_CONFIG_ACK(config.nsei, omit));
Harald Welte5e514fa2018-07-05 00:01:45 +0200284 /* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
Harald Welte5e8573e2020-09-13 15:32:56 +0200285 var IP4_Elements v4 := { valueof(ts_SNS_IPv4(config.provider.ip.local_ip, config.provider.ip.local_udp_port)) };
Harald Welte013d65a2020-09-13 14:41:31 +0200286 NSCP.send(ts_SNS_CONFIG(config.nsei, true, v4));
Harald Welte5e514fa2018-07-05 00:01:45 +0200287 alt {
Harald Welte013d65a2020-09-13 14:41:31 +0200288 [] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, omit)) {
Harald Welte5e514fa2018-07-05 00:01:45 +0200289 /* success */
290 }
Harald Welte013d65a2020-09-13 14:41:31 +0200291 [] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, ?)) {
Harald Welte5e514fa2018-07-05 00:01:45 +0200292 setverdict(fail, "Unexpected SNS-CONFIG-NACK");
293 self.stop;
294 }
295 }
296 }
Harald Welte013d65a2020-09-13 14:41:31 +0200297 [] NSCP.receive(tr_SNS_CONFIG(config.nsei, false, ?)) { /* ignore */}
298 [] NSCP.receive(tr_SNS_CONFIG(config.nsei, true, ?)) {
Harald Welte5e514fa2018-07-05 00:01:45 +0200299 setverdict(fail, "Unexpected SNS-CONFIG content");
300 self.stop;
301 }
Harald Welte013d65a2020-09-13 14:41:31 +0200302 [] NSCP.receive(tr_SNS_CONFIG(?, ?, ?)) {
Harald Welte5e514fa2018-07-05 00:01:45 +0200303 setverdict(fail, "SNS-CONFIG from unexpected NSEI");
304 self.stop;
305 }
306 }
307
Harald Welte6fff3642017-07-22 21:36:13 +0200308 private function f_ScanEvents() runs on NS_CT {
309 var NsUnitdataRequest ud_req;
Harald Welte013d65a2020-09-13 14:41:31 +0200310 var PDU_NS rf;
Harald Welte6e594f22017-07-23 16:19:35 +0200311 var default d;
312
313 d := activate(as_allstate());
Harald Welte6fff3642017-07-22 21:36:13 +0200314
315 while (true) {
Harald Welte6e594f22017-07-23 16:19:35 +0200316 if (g_state == NSE_S_DEAD_BLOCKED) {
Harald Welte6fff3642017-07-22 21:36:13 +0200317 alt {
Harald Welte6e594f22017-07-23 16:19:35 +0200318 [false] any timer.timeout {}
Harald Welte6fff3642017-07-22 21:36:13 +0200319 }
Harald Welte6e594f22017-07-23 16:19:35 +0200320 } else if (g_state == NSE_S_WAIT_RESET) {
Harald Welte6fff3642017-07-22 21:36:13 +0200321 alt {
Harald Welte013d65a2020-09-13 14:41:31 +0200322 [] NSCP.receive(tr_NS_RESET_ACK(config.nsvci, config.nsei)) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200323 f_change_state(NSE_S_ALIVE_BLOCKED);
324 f_sendAlive();
325 f_sendUnblock();
Harald Welte6fff3642017-07-22 21:36:13 +0200326 }
Harald Welte6fff3642017-07-22 21:36:13 +0200327 }
Harald Welte6e594f22017-07-23 16:19:35 +0200328 } else if (g_state == NSE_S_ALIVE_BLOCKED) {
Harald Welte6fff3642017-07-22 21:36:13 +0200329 alt {
Harald Welte6e594f22017-07-23 16:19:35 +0200330 /* bogus block, just respond with ACK */
Harald Welte013d65a2020-09-13 14:41:31 +0200331 [] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
332 NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
Harald Welte6e594f22017-07-23 16:19:35 +0200333 }
334 /* Respond to UNBLOCK with UNBLOCK-ACK + change state */
Harald Welte013d65a2020-09-13 14:41:31 +0200335 [] NSCP.receive(t_NS_UNBLOCK) -> value rf {
336 NSCP.send(t_NS_UNBLOCK_ACK);
Harald Welte6e594f22017-07-23 16:19:35 +0200337 Tns_block.stop;
338 f_change_state(NSE_S_ALIVE_UNBLOCKED);
339 }
Harald Welte013d65a2020-09-13 14:41:31 +0200340 [] NSCP.receive(t_NS_UNBLOCK_ACK) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200341 Tns_block.stop;
342 f_change_state(NSE_S_ALIVE_UNBLOCKED);
343 }
344 [] Tns_block.timeout {
345 /* repeat unblock transmission */
346 f_sendUnblock();
347 }
348 }
349 } else if (g_state == NSE_S_ALIVE_UNBLOCKED) {
350 alt {
351 /* bogus unblock, just respond with ACK */
Harald Welte013d65a2020-09-13 14:41:31 +0200352 [] NSCP.receive(t_NS_UNBLOCK) -> value rf {
353 NSCP.send(t_NS_UNBLOCK_ACK);
Harald Welte6e594f22017-07-23 16:19:35 +0200354 }
355 /* Respond to BLOCK with BLOCK-ACK + change state */
Harald Welte013d65a2020-09-13 14:41:31 +0200356 [] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
357 NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
Harald Welte6e594f22017-07-23 16:19:35 +0200358 Tns_block.stop;
359 f_change_state(NSE_S_ALIVE_BLOCKED);
360 }
Harald Welte013d65a2020-09-13 14:41:31 +0200361 [] NSCP.receive(tr_NS_BLOCK_ACK(config.nsvci)) -> value rf {
Harald Welte6e594f22017-07-23 16:19:35 +0200362 Tns_block.stop;
363 }
364 /* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */
Harald Welte013d65a2020-09-13 14:41:31 +0200365 [] NSCP.receive(tr_NS_UNITDATA(?, ?, ?)) -> value rf {
Alexander Couzens2c12b242018-07-31 00:30:11 +0200366 NS_SP.send(t_NsUdInd(config.nsei,
Harald Welte013d65a2020-09-13 14:41:31 +0200367 oct2int(rf.pDU_NS_Unitdata.bVCI),
368 rf.pDU_NS_Unitdata.nS_SDU));
Harald Welte6e594f22017-07-23 16:19:35 +0200369 }
370 /* NS-UNITDATA.req from user to NS-UNITDATA PDU on network */
Alexander Couzens2c12b242018-07-31 00:30:11 +0200371 [] NS_SP.receive(t_NsUdReq(config.nsei, ?, ?, omit)) -> value ud_req {
Harald Welte6e594f22017-07-23 16:19:35 +0200372 /* using raw octetstring PDU */
Harald Welte013d65a2020-09-13 14:41:31 +0200373 NSCP.send(ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, ud_req.sdu));
Harald Welte6e594f22017-07-23 16:19:35 +0200374 }
Alexander Couzens2c12b242018-07-31 00:30:11 +0200375 [] NS_SP.receive(t_NsUdReq(config.nsei, ?, omit, ?)) -> value ud_req {
Harald Welte6e594f22017-07-23 16:19:35 +0200376 /* using decoded BSSGP PDU that we need to encode first */
Harald Weltee0abc472018-02-05 09:13:31 +0100377 var octetstring enc := enc_PDU_BSSGP(ud_req.bssgp);
Harald Welte013d65a2020-09-13 14:41:31 +0200378 NSCP.send(ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc));
Harald Welte6e594f22017-07-23 16:19:35 +0200379 }
Harald Welte6fff3642017-07-22 21:36:13 +0200380 }
381 }
382
Harald Welte6e594f22017-07-23 16:19:35 +0200383 } /* while */
384 //deactivate(d);
Harald Welte6fff3642017-07-22 21:36:13 +0200385 }
386}