blob: 921ac59bc44effe2c7b01c26fb255fb05358e079 [file] [log] [blame]
Harald Welte365f4ed2017-11-23 00:00:43 +01001module BSSMAP_Emulation {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* BSSMAP Emulation, runs on top of BSSAP_CodecPort. It multiplexes/demultiplexes
4 * the individual connections, so there can be separate TTCN-3 components handling
5 * each of the connections.
6 *
7 * The BSSMAP_Emulation.main() function processes SCCP primitives from the SCCP
8 * stack via the BSSAP_CodecPort, and dispatches them to the per-connection components.
9 *
10 * Outbound BSSAP/SCCP connections are initiated by sending a BSSAP_Conn_Req primitive
11 * to the component running the BSSMAP_Emulation.main() function.
12 *
13 * For each new inbound connections, the BssmapOps.create_cb() is called. It can create
14 * or resolve a TTCN-3 component, and returns a component reference to which that inbound
15 * connection is routed/dispatched.
16 *
17 * If a pre-existing component wants to register to handle a future inbound connection, it can
18 * do so by registering an "expect" with the expected Layer 3 (DTAP) payload. This is e.g. useful
19 * if you are simulating BTS + MSC, and first trigger a connection from BTS/RSL side in a
20 * component which then subsequently should also handle the MSC emulation.
21 *
22 * Inbound Unit Data messages (such as are dispatched to the BssmapOps.unitdata_cb() callback,
23 * which is registered with an argument to the main() function below.
24 *
Harald Welte0b476062018-01-21 19:07:32 +010025 * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org>
Harald Welte35bb7162018-01-03 21:07:52 +010026 * All rights reserved.
27 *
28 * Released under the terms of GNU General Public License, Version 2 or
29 * (at your option) any later version.
30 */
31
32
Harald Welte0b476062018-01-21 19:07:32 +010033import from General_Types all;
Harald Welte9dadc522018-02-06 13:56:04 +010034import from Osmocom_Types all;
Harald Welteb3414b22017-11-23 18:22:10 +010035import from SCCP_Emulation all;
Harald Welte365f4ed2017-11-23 00:00:43 +010036import from SCCPasp_Types all;
37import from BSSAP_Types all;
Harald Welte004f5fb2017-12-16 17:54:40 +010038import from BSSAP_CodecPort all;
Harald Welte365f4ed2017-11-23 00:00:43 +010039import from BSSMAP_Templates all;
Harald Weltec82eef42017-11-24 20:40:12 +010040import from MGCP_Types all;
41import from MGCP_Templates all;
42import from IPA_Emulation all;
Harald Welte0b476062018-01-21 19:07:32 +010043import from MobileL3_Types all;
Harald Welte365f4ed2017-11-23 00:00:43 +010044
45/* General "base class" component definition, of which specific implementations
46 * derive themselves by means of the "extends" feature */
47type component BSSAP_ConnHdlr {
48 /* port towards MSC Emulator core / SCCP connection dispatchar */
49 port BSSAP_Conn_PT BSSAP;
Harald Welteca519982018-01-21 19:28:26 +010050 /* procedure based port to register for incoming connections */
51 port BSSMAPEM_PROC_PT BSSAP_PROC;
Harald Welte365f4ed2017-11-23 00:00:43 +010052}
53
54/* Auxiliary primitive that can happen on the port between per-connection client and this dispatcher */
55type enumerated BSSAP_Conn_Prim {
56 /* SCCP tell us that connection was released */
57 MSC_CONN_PRIM_DISC_IND,
58 /* we tell SCCP to release connection */
Harald Welte71b69332018-01-21 20:43:53 +010059 MSC_CONN_PRIM_DISC_REQ,
60 /* Connection confirmed indication */
61 MSC_CONN_PRIM_CONF_IND
Harald Welte365f4ed2017-11-23 00:00:43 +010062}
63
Harald Welteb3414b22017-11-23 18:22:10 +010064type record BSSAP_Conn_Req {
65 SCCP_PAR_Address addr_peer,
66 SCCP_PAR_Address addr_own,
67 PDU_BSSAP bssap
68}
69
Harald Welte0b476062018-01-21 19:07:32 +010070/* similar to PDU_BSSAP with DTAP, but DTAP is already decoded! */
71type record PDU_DTAP_MO {
72 OCT1 dlci optional,
Daniel Willmann92f66272018-02-06 15:50:52 +010073 boolean skip_seq_patching optional,
Harald Welte0b476062018-01-21 19:07:32 +010074 PDU_ML3_MS_NW dtap
75}
76
77/* similar to PDU_BSSAP with DTAP, but DTAP is already decoded! */
78type record PDU_DTAP_MT {
79 OCT1 dlci optional,
80 PDU_ML3_NW_MS dtap
81}
82
83template PDU_DTAP_MT ts_PDU_DTAP_MT(template PDU_ML3_NW_MS dtap, template OCT1 dlci := omit) := {
84 dlci := dlci,
85 dtap := dtap
86}
87
Daniel Willmann92f66272018-02-06 15:50:52 +010088template PDU_DTAP_MO ts_PDU_DTAP_MO(template PDU_ML3_MS_NW dtap, template OCT1 dlci := '00'O, boolean skip_seq_patching := false) := {
Harald Welte0b476062018-01-21 19:07:32 +010089 dlci := dlci,
Daniel Willmann92f66272018-02-06 15:50:52 +010090 skip_seq_patching := skip_seq_patching,
Harald Welte0b476062018-01-21 19:07:32 +010091 dtap := dtap
92}
93
94template PDU_DTAP_MT tr_PDU_DTAP_MT(template PDU_ML3_NW_MS dtap, template OCT1 dlci := *) := {
95 dlci := dlci,
96 dtap := dtap
97}
98
99template PDU_DTAP_MO tr_PDU_DTAP_MO(template PDU_ML3_MS_NW dtap, template OCT1 dlci := *) := {
100 dlci := dlci,
Harald Welte930d0a72018-03-22 22:08:40 +0100101 skip_seq_patching := ?,
Harald Welte0b476062018-01-21 19:07:32 +0100102 dtap := dtap
103}
104
105
Harald Welte365f4ed2017-11-23 00:00:43 +0100106/* port between individual per-connection components and this dispatcher */
107type port BSSAP_Conn_PT message {
Harald Weltea4ca4462018-02-09 00:17:14 +0100108 /* BSSAP or direct DTAP messages from/to clients */
109 inout PDU_BSSAP, PDU_DTAP_MO, PDU_DTAP_MT,
110 /* misc indications / requests between SCCP and client */
111 BSSAP_Conn_Prim,
112 /* Client requests us to create SCCP Connection */
113 BSSAP_Conn_Req,
114 /* MGCP, only used for IPA SCCPlite (MGCP in IPA mux) */
115 MgcpCommand, MgcpResponse;
Harald Welte365f4ed2017-11-23 00:00:43 +0100116} with { extension "internal" };
117
118
119/* represents a single BSSAP connection over SCCP */
120type record ConnectionData {
121 /* reference to the instance of the per-connection component */
122 BSSAP_ConnHdlr comp_ref,
Harald Weltec82eef42017-11-24 20:40:12 +0100123 integer sccp_conn_id,
124 /* most recent MGCP transaction ID (Used on MSC side) */
125 MgcpTransId mgcp_trans_id optional,
126 /* CIC that has been used for voice of this channel (BSC side) */
Harald Welte9dadc522018-02-06 13:56:04 +0100127 integer cic optional,
128 /* array of N(SD) values for MO DTAP messages, indexed by discriminator */
129 uint2_t n_sd[4]
Harald Welte365f4ed2017-11-23 00:00:43 +0100130}
131
Harald Welte17d21152018-01-27 00:47:11 +0100132type record ImsiMapping {
133 BSSAP_ConnHdlr comp_ref,
134 hexstring imsi optional,
135 OCT4 tmsi
136}
137
Harald Welte365f4ed2017-11-23 00:00:43 +0100138type component BSSMAP_Emulation_CT {
139 /* SCCP port on the bottom side, using ASP primitives */
Harald Welte004f5fb2017-12-16 17:54:40 +0100140 port BSSAP_CODEC_PT BSSAP;
Harald Welte365f4ed2017-11-23 00:00:43 +0100141 /* BSSAP port to the per-connection clients */
142 port BSSAP_Conn_PT CLIENT;
Harald Weltec82eef42017-11-24 20:40:12 +0100143 /* MGCP port */
144 port IPA_MGCP_PT MGCP;
Harald Welte365f4ed2017-11-23 00:00:43 +0100145
146 /* use 16 as this is also the number of SCCP connections that SCCP_Emulation can handle */
147 var ConnectionData ConnectionTable[16];
Harald Welte66fecd42017-11-24 23:53:23 +0100148
Harald Welte624f9632017-12-16 19:26:04 +0100149 /* pending expected incoming connections */
150 var ExpectData ExpectTable[8];
Harald Welte17d21152018-01-27 00:47:11 +0100151
152 /* tables for mapping inbound unitdata (like paging) */
153 var ImsiMapping ImsiTable[16];
154
Harald Welte624f9632017-12-16 19:26:04 +0100155 /* procedure based port to register for incoming connections */
156 port BSSMAPEM_PROC_PT PROC;
157
Harald Weltebe620f62017-11-25 00:23:54 +0100158 var charstring g_bssmap_id;
Harald Welte66fecd42017-11-24 23:53:23 +0100159 var integer g_next_e1_ts := 1;
Harald Welte0b476062018-01-21 19:07:32 +0100160 var BssmapOps g_bssmap_ops;
Harald Welte365f4ed2017-11-23 00:00:43 +0100161};
162
Harald Welteb3414b22017-11-23 18:22:10 +0100163private function f_conn_id_known(integer sccp_conn_id)
164runs on BSSMAP_Emulation_CT return boolean {
165 var integer i;
166 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
167 if (ConnectionTable[i].sccp_conn_id == sccp_conn_id){
168 return true;
169 }
170 }
171 return false;
172}
173
174private function f_comp_known(BSSAP_ConnHdlr client)
175runs on BSSMAP_Emulation_CT return boolean {
176 var integer i;
177 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
178 if (ConnectionTable[i].comp_ref == client) {
179 return true;
180 }
181 }
182 return false;
183}
Harald Welte365f4ed2017-11-23 00:00:43 +0100184
Harald Weltee98bb2e2017-11-29 12:09:48 +0100185private function f_cic_known(integer cic)
186runs on BSSMAP_Emulation_CT return boolean {
187 var integer i;
188 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
189 if (ConnectionTable[i].cic == cic) {
190 return true;
191 }
192 }
193 return false;
194}
195
Harald Welte365f4ed2017-11-23 00:00:43 +0100196/* resolve component reference by connection ID */
197private function f_comp_by_conn_id(integer sccp_conn_id)
198runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
199 var integer i;
200 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
201 if (ConnectionTable[i].sccp_conn_id == sccp_conn_id) {
202 return ConnectionTable[i].comp_ref;
203 }
204 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200205 setverdict(fail, "BSSMAP Connection table not found by SCCP Connection ID ", sccp_conn_id);
206 mtc.stop;
Harald Welte365f4ed2017-11-23 00:00:43 +0100207}
208
Harald Weltec82eef42017-11-24 20:40:12 +0100209/* resolve component reference by CIC */
210private function f_comp_by_mgcp_tid(MgcpTransId tid)
211runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
212 var integer i;
213 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
214 if (ConnectionTable[i].mgcp_trans_id == tid) {
215 return ConnectionTable[i].comp_ref;
216 }
217 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200218 setverdict(fail, "BSSMAP Connection table not found by MGCP Transaction ID ", tid);
219 mtc.stop;
Harald Weltec82eef42017-11-24 20:40:12 +0100220}
221
222private function f_comp_store_mgcp_tid(BSSAP_ConnHdlr client, MgcpTransId tid)
223runs on BSSMAP_Emulation_CT {
224 var integer i;
225 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
226 if (ConnectionTable[i].comp_ref == client) {
227 ConnectionTable[i].mgcp_trans_id := tid;
228 return;
229 }
230 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200231 setverdict(fail, "BSSMAP Connection table not found by component ", client);
232 mtc.stop;
Harald Weltec82eef42017-11-24 20:40:12 +0100233}
234
235private function f_comp_by_cic(integer cic)
236runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
237 var integer i;
238 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
239 if (ConnectionTable[i].cic == cic) {
240 return ConnectionTable[i].comp_ref;
241 }
242 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200243 setverdict(fail, "BSSMAP Connection table not found by CIC ", cic);
244 mtc.stop;
Harald Weltec82eef42017-11-24 20:40:12 +0100245}
246
247private function f_comp_store_cic(BSSAP_ConnHdlr client, integer cic)
248runs on BSSMAP_Emulation_CT {
249 var integer i;
250 for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
251 if (ConnectionTable[i].comp_ref == client) {
252 ConnectionTable[i].cic := cic;
253 return;
254 }
255 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200256 setverdict(fail, "BSSMAP Connection table not found by component ", client);
257 mtc.stop;
Harald Weltec82eef42017-11-24 20:40:12 +0100258}
259
Harald Welte365f4ed2017-11-23 00:00:43 +0100260/* resolve connection ID by component reference */
261private function f_conn_id_by_comp(BSSAP_ConnHdlr client)
262runs on BSSMAP_Emulation_CT return integer {
263 for (var integer i := 0; i < sizeof(ConnectionTable); i := i+1) {
264 if (ConnectionTable[i].comp_ref == client) {
265 return ConnectionTable[i].sccp_conn_id;
266 }
267 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200268 setverdict(fail, "BSSMAP Connection table not found by component ", client);
269 mtc.stop;
Harald Welte365f4ed2017-11-23 00:00:43 +0100270}
271
Harald Welte9dadc522018-02-06 13:56:04 +0100272/* resolve ConnectionTable index component reference */
273private function f_idx_by_comp(BSSAP_ConnHdlr client)
274runs on BSSMAP_Emulation_CT return integer {
275 for (var integer i := 0; i < sizeof(ConnectionTable); i := i+1) {
276 if (ConnectionTable[i].comp_ref == client) {
277 return i;
278 }
279 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200280 setverdict(fail, "BSSMAP Connection table not found by component ", client);
281 mtc.stop;
Harald Welte9dadc522018-02-06 13:56:04 +0100282}
283
Harald Welteb3414b22017-11-23 18:22:10 +0100284private function f_gen_conn_id()
285runs on BSSMAP_Emulation_CT return integer {
286 var integer conn_id;
287
288 do {
289 conn_id := float2int(rnd()*SCCP_Emulation.tsp_max_ConnectionId);
290 } while (f_conn_id_known(conn_id) == true);
291
292 return conn_id;
293}
294
Harald Welte365f4ed2017-11-23 00:00:43 +0100295private function f_conn_table_init()
296runs on BSSMAP_Emulation_CT {
297 for (var integer i := 0; i < sizeof(ConnectionTable); i := i+1) {
298 ConnectionTable[i].comp_ref := null;
299 ConnectionTable[i].sccp_conn_id := -1;
Harald Weltec82eef42017-11-24 20:40:12 +0100300 ConnectionTable[i].mgcp_trans_id := omit;
301 ConnectionTable[i].cic := omit;
Harald Welte9dadc522018-02-06 13:56:04 +0100302 ConnectionTable[i].n_sd := { 0, 0, 0, 0 };
Harald Welte365f4ed2017-11-23 00:00:43 +0100303 }
Harald Welte17d21152018-01-27 00:47:11 +0100304 for (var integer i := 0; i < sizeof(ImsiTable); i := i+1) {
305 ImsiTable[i].comp_ref := null;
306 ImsiTable[i].imsi := omit;
307 ImsiTable[i].tmsi := 'FFFFFFFF'O;
308 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100309}
310
311private function f_conn_table_add(BSSAP_ConnHdlr comp_ref, integer sccp_conn_id)
312runs on BSSMAP_Emulation_CT {
313 for (var integer i := 0; i < sizeof(ConnectionTable); i := i+1) {
314 if (ConnectionTable[i].sccp_conn_id == -1) {
315 ConnectionTable[i].comp_ref := comp_ref;
316 ConnectionTable[i].sccp_conn_id := sccp_conn_id;
Harald Welte9dadc522018-02-06 13:56:04 +0100317 ConnectionTable[i].n_sd := { 0, 0, 0, 0 };
Harald Welteb3414b22017-11-23 18:22:10 +0100318 log("Added conn table entry ", i, comp_ref, sccp_conn_id);
Harald Welte365f4ed2017-11-23 00:00:43 +0100319 return;
320 }
321 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200322 testcase.stop("BSSMAP Connection table full!");
Harald Welte365f4ed2017-11-23 00:00:43 +0100323}
324
325private function f_conn_table_del(integer sccp_conn_id)
326runs on BSSMAP_Emulation_CT {
327 for (var integer i := 0; i < sizeof(ConnectionTable); i := i+1) {
328 if (ConnectionTable[i].sccp_conn_id == sccp_conn_id) {
Harald Welteb3414b22017-11-23 18:22:10 +0100329 log("Deleted conn table entry ", i,
330 ConnectionTable[i].comp_ref, sccp_conn_id);
Harald Welte365f4ed2017-11-23 00:00:43 +0100331 ConnectionTable[i].sccp_conn_id := -1;
332 ConnectionTable[i].comp_ref := null;
Harald Welte0a4317a2017-11-25 00:32:46 +0100333 return
Harald Welte365f4ed2017-11-23 00:00:43 +0100334 }
335 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200336 setverdict(fail, "BSSMAP Connection table attempt to delete non-existant ", sccp_conn_id);
337 mtc.stop;
Harald Welte365f4ed2017-11-23 00:00:43 +0100338}
339
Harald Welte17d21152018-01-27 00:47:11 +0100340private function f_imsi_table_find(hexstring imsi, template OCT4 tmsi)
341runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
342 for (var integer i := 0; i < sizeof(ImsiTable); i := i+1) {
343 if (ImsiTable[i].imsi == imsi or
344 isvalue(tmsi) and match(ImsiTable[i].tmsi, tmsi)) {
345 return ImsiTable[i].comp_ref;
346 }
347 }
348 return null;
349}
350
Harald Welte365f4ed2017-11-23 00:00:43 +0100351/* handle (optional) userData portion of various primitives and dispatch it to the client */
Harald Welte004f5fb2017-12-16 17:54:40 +0100352private function f_handle_userData(BSSAP_ConnHdlr client, PDU_BSSAP bssap)
Harald Welte365f4ed2017-11-23 00:00:43 +0100353runs on BSSMAP_Emulation_CT {
Harald Welte365f4ed2017-11-23 00:00:43 +0100354 /* decode + send decoded BSSAP to client */
Harald Welte1b2748e2017-11-24 23:40:16 +0100355
Harald Welte473676b2018-01-27 20:38:01 +0100356 if (ischosen(bssap.pdu.bssmap)) {
357 /* BSC Side: If this is an assignment command, store CIC */
358 if (ischosen(bssap.pdu.bssmap.assignmentRequest) and
359 ispresent(bssap.pdu.bssmap.assignmentRequest.circuitIdentityCode)) {
360 var BSSMAP_IE_CircuitIdentityCode cic_ie :=
361 bssap.pdu.bssmap.assignmentRequest.circuitIdentityCode;
362 var integer cic := (oct2int(cic_ie.cicHigh) * 256) + oct2int(cic_ie.cicLow);
363 f_comp_store_cic(client, cic);
364 }
Harald Welte1b2748e2017-11-24 23:40:16 +0100365 }
366
Harald Welte0b476062018-01-21 19:07:32 +0100367 if (ischosen(bssap.pdu.dtap) and g_bssmap_ops.decode_dtap) {
368 if (g_bssmap_ops.role_ms) {
369 /* we are the MS, so any message to us must be MT */
370 var PDU_DTAP_MT mt := {
371 dlci := bssap.dlci,
372 dtap := dec_PDU_ML3_NW_MS(bssap.pdu.dtap)
373 };
374 CLIENT.send(mt) to client;
375 } else {
376 /* we are the Network, so any message to us must be MO */
377 var PDU_DTAP_MO mo := {
378 dlci := bssap.dlci,
379 dtap := dec_PDU_ML3_MS_NW(bssap.pdu.dtap)
380 };
381 CLIENT.send(mo) to client;
382 }
383 } else {
384 CLIENT.send(bssap) to client;
385 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100386}
387
388/* call-back type, to be provided by specific implementation; called when new SCCP connection
389 * arrives */
Harald Welte004f5fb2017-12-16 17:54:40 +0100390type function BssmapCreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
Harald Welte365f4ed2017-11-23 00:00:43 +0100391runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr;
392
393type function BssmapUnitdataCallback(PDU_BSSAP bssap)
394runs on BSSMAP_Emulation_CT return template PDU_BSSAP;
395
Harald Welte17d21152018-01-27 00:47:11 +0100396/* handle common Unitdata such as Paging */
397private function CommonBssmapUnitdataCallback(PDU_BSSAP bssap)
398runs on BSSMAP_Emulation_CT return template PDU_BSSAP {
399 if (match(bssap, tr_BSSMAP_Paging)) {
400 var BSSAP_ConnHdlr client := null;
401 client := f_imsi_table_find(bssap.pdu.bssmap.paging.iMSI.digits,
402 bssap.pdu.bssmap.paging.tMSI.tmsiOctets);
403 if (isvalue(client)) {
404 log("CommonBssmapUnitdataCallback: IMSI/TMSI found in table, dispatching to ",
405 client);
406 CLIENT.send(bssap) to client;
407 return omit;
408 }
409 log("CommonBssmapUnitdataCallback: IMSI/TMSI not found in table");
410 } else {
411 log("CommonBssmapUnitdataCallback: Not a paging message");
412 }
413 /* ELSE: handle in user callback */
414 return g_bssmap_ops.unitdata_cb.apply(bssap);
415}
416
Harald Welte365f4ed2017-11-23 00:00:43 +0100417type record BssmapOps {
418 BssmapCreateCallback create_cb,
Harald Welte0b476062018-01-21 19:07:32 +0100419 BssmapUnitdataCallback unitdata_cb,
420 boolean decode_dtap,
Harald Weltea4ca4462018-02-09 00:17:14 +0100421 boolean role_ms,
422 /* needed for performing BSSMAP RESET */
423 SCCP_PAR_Address sccp_addr_local optional,
424 SCCP_PAR_Address sccp_addr_peer optional
Harald Welte365f4ed2017-11-23 00:00:43 +0100425}
426
Harald Welte9dadc522018-02-06 13:56:04 +0100427template BIT4 t_ML3_DISC_CC_MM_SS := ('0011'B, '0101'B, '1011'B);
428
429/* patch N(SD) into enc_l3, according to 24.007 11.2.3.2 */
430function f_ML3_patch_seq(inout ConnectionData cd, in PDU_ML3_MS_NW dtap, inout octetstring enc_l3) {
431 var uint2_t seq_nr;
432 if (ischosen(dtap.msgs.cc) or ischosen(dtap.msgs.mm) or ischosen(dtap.msgs.ss)) {
433 seq_nr := cd.n_sd[0];
434 cd.n_sd[0] := (cd.n_sd[0] + 1) mod 4;
435 } else if (ischosen(dtap.msgs.gcc)) {
436 seq_nr := cd.n_sd[1];
437 cd.n_sd[1] := (cd.n_sd[1] + 1) mod 2;
438 } else if (ischosen(dtap.msgs.bcc)) {
439 seq_nr := cd.n_sd[2];
440 cd.n_sd[2] := (cd.n_sd[2] + 1) mod 2;
441 } else if (ischosen(dtap.msgs.loc)) {
442 seq_nr := cd.n_sd[3];
443 cd.n_sd[3] := (cd.n_sd[3] + 1) mod 2;
444 } else {
445 /* no sequence number to patch */
446 return;
447 }
448 log("patching N(SD)=", seq_nr, " into dtap ", enc_l3);
449 enc_l3[1] := (enc_l3[1] and4b '3f'O) or4b bit2oct(int2bit(seq_nr, 8) << 6);
450 log("patched enc_l3: ", enc_l3);
451}
452
Harald Welte49518bf2018-02-10 11:39:19 +0100453private function f_bssap_l3_is_rr(PDU_BSSAP bssap) return boolean {
454 var template octetstring l3 := f_bssap_extract_l3(bssap);
455 if (not isvalue(l3)) {
456 return false;
457 }
458 var octetstring l3v := valueof(l3);
Harald Welte96505f02018-03-18 21:31:07 +0100459 if (lengthof(l3v) < 1) {
460 return false;
461 }
Harald Welte49518bf2018-02-10 11:39:19 +0100462 /* lower 4 bits of first octet are protocol discriminator */
463 if ((oct2bit(l3v[0]) and4b '00001111'B) == '00000110'B) {
464 return true;
465 }
466 return false;
467}
468
Harald Weltea4ca4462018-02-09 00:17:14 +0100469private altstep as_reset_ack() runs on BSSMAP_Emulation_CT {
470 var BSSAP_N_UNITDATA_ind ud_ind;
471 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind {
472 log("Respoding to inbound RESET with RESET-ACK");
473 BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
474 ts_BSSMAP_ResetAck));
475 repeat;
476 }
477}
478
479
480private function f_bssap_wait_for_reset() runs on BSSMAP_Emulation_CT {
481 var BSSAP_N_UNITDATA_ind ud_ind;
482 timer T := 20.0;
483
484 T.start;
485 alt {
486 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind {
487 BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
488 ts_BSSMAP_ResetAck));
489 }
490 [] as_reset_ack();
491 [] BSSAP.receive {
492 repeat;
493 }
494 [] T.timeout {
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200495 setverdict(fail, "Timeout waiting for BSSAP RESET");
496 mtc.stop;
Harald Weltea4ca4462018-02-09 00:17:14 +0100497 }
498 }
499}
500
501function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own) runs on BSSMAP_Emulation_CT {
502 timer T := 5.0;
503
504 BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0)));
505 T.start;
506 alt {
507 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck)) {
508 log("Received RESET-ACK in response to RESET, we're ready to go!");
509 }
510 [] as_reset_ack();
511 [] BSSAP.receive { repeat };
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200512 [] T.timeout {
513 setverdict(fail, "Timeout waiting for RESET-ACK after sending RESET");
514 mtc.stop;
515 }
Harald Weltea4ca4462018-02-09 00:17:14 +0100516 }
517}
518
Harald Weltebe620f62017-11-25 00:23:54 +0100519function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
Harald Welte365f4ed2017-11-23 00:00:43 +0100520
Harald Weltebe620f62017-11-25 00:23:54 +0100521 g_bssmap_id := id;
Harald Welte0b476062018-01-21 19:07:32 +0100522 g_bssmap_ops := ops;
Harald Welte365f4ed2017-11-23 00:00:43 +0100523 f_conn_table_init();
Daniel Willmannd47106b2018-01-17 12:20:56 +0100524 f_expect_table_init();
Harald Welte365f4ed2017-11-23 00:00:43 +0100525
Harald Weltea4ca4462018-02-09 00:17:14 +0100526 if (isvalue(ops.sccp_addr_peer) and isvalue(ops.sccp_addr_local)) {
Harald Welte7f582582018-02-14 20:20:11 +0100527 f_sleep(1.0); /* HACK to wait for M3UA/ASP to be ACTIVE */
Harald Weltea4ca4462018-02-09 00:17:14 +0100528 f_bssap_reset(ops.sccp_addr_peer, ops.sccp_addr_local);
529 }
530
Harald Welte365f4ed2017-11-23 00:00:43 +0100531 while (true) {
Harald Welte004f5fb2017-12-16 17:54:40 +0100532 var BSSAP_N_UNITDATA_ind ud_ind;
533 var BSSAP_N_CONNECT_ind conn_ind;
534 var BSSAP_N_CONNECT_cfm conn_cfm;
535 var BSSAP_N_DATA_ind data_ind;
536 var BSSAP_N_DISCONNECT_ind disc_ind;
Harald Welteb3414b22017-11-23 18:22:10 +0100537 var BSSAP_Conn_Req creq;
Harald Welte365f4ed2017-11-23 00:00:43 +0100538 var BSSAP_ConnHdlr vc_conn;
539 var PDU_BSSAP bssap;
Harald Welte0b476062018-01-21 19:07:32 +0100540 var PDU_DTAP_MO dtap_mo;
541 var PDU_DTAP_MT dtap_mt;
Harald Weltec82eef42017-11-24 20:40:12 +0100542 var MgcpCommand mgcp_req;
543 var MgcpResponse mgcp_resp;
Harald Welte624f9632017-12-16 19:26:04 +0100544 var BSSAP_ConnHdlr vc_hdlr;
545 var octetstring l3_info;
Harald Welte17d21152018-01-27 00:47:11 +0100546 var hexstring imsi;
547 var OCT4 tmsi;
Harald Welte365f4ed2017-11-23 00:00:43 +0100548
549 alt {
550 /* SCCP -> Client: UNIT-DATA (connectionless SCCP) from a BSC */
Harald Welte004f5fb2017-12-16 17:54:40 +0100551 [] BSSAP.receive(BSSAP_N_UNITDATA_ind:?) -> value ud_ind {
Harald Welte365f4ed2017-11-23 00:00:43 +0100552 /* Connectionless Procedures like RESET */
553 var template PDU_BSSAP resp;
Harald Welte17d21152018-01-27 00:47:11 +0100554 resp := CommonBssmapUnitdataCallback(ud_ind.userData);
Harald Welte365f4ed2017-11-23 00:00:43 +0100555 if (isvalue(resp)) {
Harald Welte004f5fb2017-12-16 17:54:40 +0100556 BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress,
557 ud_ind.calledAddress, resp));
Harald Welte365f4ed2017-11-23 00:00:43 +0100558 }
559 }
560
561 /* SCCP -> Client: new connection from BSC */
Harald Welte004f5fb2017-12-16 17:54:40 +0100562 [] BSSAP.receive(BSSAP_N_CONNECT_ind:?) -> value conn_ind {
Harald Weltebe620f62017-11-25 00:23:54 +0100563 vc_conn := ops.create_cb.apply(conn_ind, id);
Harald Welte365f4ed2017-11-23 00:00:43 +0100564 /* store mapping between client components and SCCP connectionId */
565 f_conn_table_add(vc_conn, conn_ind.connectionId);
566 /* handle user payload */
567 f_handle_userData(vc_conn, conn_ind.userData);
568 /* confirm connection establishment */
Harald Welte004f5fb2017-12-16 17:54:40 +0100569 BSSAP.send(ts_BSSAP_CONNECT_res(conn_ind.connectionId, omit));
Harald Welte365f4ed2017-11-23 00:00:43 +0100570 }
571
572 /* SCCP -> Client: connection-oriented data in existing connection */
Harald Welte004f5fb2017-12-16 17:54:40 +0100573 [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value data_ind {
Harald Welte365f4ed2017-11-23 00:00:43 +0100574 vc_conn := f_comp_by_conn_id(data_ind.connectionId);
Harald Welte5cc4aa22017-11-23 18:51:28 +0100575 if (ispresent(data_ind.userData)) {
576 f_handle_userData(vc_conn, data_ind.userData);
577 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100578 }
579
580 /* SCCP -> Client: disconnect of an existing connection */
Harald Welte004f5fb2017-12-16 17:54:40 +0100581 [] BSSAP.receive(BSSAP_N_DISCONNECT_ind:?) -> value disc_ind {
Harald Welte365f4ed2017-11-23 00:00:43 +0100582 vc_conn := f_comp_by_conn_id(disc_ind.connectionId);
Harald Welte5cc4aa22017-11-23 18:51:28 +0100583 if (ispresent(disc_ind.userData)) {
584 f_handle_userData(vc_conn, disc_ind.userData);
585 }
Harald Welte365f4ed2017-11-23 00:00:43 +0100586 /* notify client about termination */
587 var BSSAP_Conn_Prim prim := MSC_CONN_PRIM_DISC_IND;
588 CLIENT.send(prim) to vc_conn;
589 f_conn_table_del(disc_ind.connectionId);
590 /* TOOD: return confirm to other side? */
591 }
592
Harald Welteb3414b22017-11-23 18:22:10 +0100593 /* SCCP -> Client: connection confirm for outbound connection */
Harald Welte004f5fb2017-12-16 17:54:40 +0100594 [] BSSAP.receive(BSSAP_N_CONNECT_cfm:?) -> value conn_cfm {
Harald Welte71b69332018-01-21 20:43:53 +0100595 vc_conn := f_comp_by_conn_id(conn_cfm.connectionId);
596 var BSSAP_Conn_Prim prim := MSC_CONN_PRIM_CONF_IND;
597 CLIENT.send(prim) to vc_conn;
Harald Welteb3414b22017-11-23 18:22:10 +0100598 /* handle user payload */
Harald Welte5cc4aa22017-11-23 18:51:28 +0100599 if (ispresent(conn_cfm.userData)) {
600 f_handle_userData(vc_conn, conn_cfm.userData);
601 }
Harald Welteb3414b22017-11-23 18:22:10 +0100602 }
603
Harald Welte365f4ed2017-11-23 00:00:43 +0100604 /* Disconnect request client -> SCCP */
605 [] CLIENT.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_REQ) -> sender vc_conn {
606 var integer conn_id := f_conn_id_by_comp(vc_conn);
Harald Welte004f5fb2017-12-16 17:54:40 +0100607 BSSAP.send(ts_BSSAP_DISC_req(conn_id, 0));
Harald Welte365f4ed2017-11-23 00:00:43 +0100608 f_conn_table_del(conn_id);
609 }
610
611 /* BSSAP from client -> SCCP */
Harald Welteb3414b22017-11-23 18:22:10 +0100612 [] CLIENT.receive(BSSAP_Conn_Req:?) -> value creq sender vc_conn {
613 var integer conn_id;
Harald Welte004f5fb2017-12-16 17:54:40 +0100614 /* send to dispatcher */
Harald Welteb3414b22017-11-23 18:22:10 +0100615
616 if (f_comp_known(vc_conn) == false) {
617 /* unknown client, create new connection */
618 conn_id := f_gen_conn_id();
619
620 /* store mapping between client components and SCCP connectionId */
621 f_conn_table_add(vc_conn, conn_id);
622
Harald Welte004f5fb2017-12-16 17:54:40 +0100623 BSSAP.send(ts_BSSAP_CONNECT_req(creq.addr_peer, creq.addr_own, conn_id,
624 creq.bssap));
Harald Welteb3414b22017-11-23 18:22:10 +0100625 } else {
626 /* known client, send via existing connection */
627 conn_id := f_conn_id_by_comp(vc_conn);
Harald Welte004f5fb2017-12-16 17:54:40 +0100628 BSSAP.send(ts_BSSAP_DATA_req(conn_id, creq.bssap));
Harald Welteb3414b22017-11-23 18:22:10 +0100629 }
630
Harald Welte49518bf2018-02-10 11:39:19 +0100631 /* InitialL3 contains RR (PAG RESP) or MM (CM SRV REQ), we must increment
632 * counter only on MM/CC/SS, but not on RR */
633 if (g_bssmap_ops.role_ms and not f_bssap_l3_is_rr(creq.bssap)) {
Harald Welte9dadc522018-02-06 13:56:04 +0100634 /* we have just sent the first MM message, increment the counter */
635 var integer idx := f_idx_by_comp(vc_conn);
636 ConnectionTable[idx].n_sd[0] := 1;
637 log("patch: N(SD) for ConnIdx ", idx, " set to 1");
638 }
639
Harald Welteb3414b22017-11-23 18:22:10 +0100640 }
641
Harald Welte365f4ed2017-11-23 00:00:43 +0100642 [] CLIENT.receive(PDU_BSSAP:?) -> value bssap sender vc_conn {
643 var integer conn_id := f_conn_id_by_comp(vc_conn);
Harald Welte004f5fb2017-12-16 17:54:40 +0100644 /* send it to dispatcher */
645 BSSAP.send(ts_BSSAP_DATA_req(conn_id, bssap));
Harald Welte365f4ed2017-11-23 00:00:43 +0100646 }
647
Harald Welte0b476062018-01-21 19:07:32 +0100648 [g_bssmap_ops.role_ms] CLIENT.receive(PDU_DTAP_MO:?) -> value dtap_mo sender vc_conn {
Harald Welte9dadc522018-02-06 13:56:04 +0100649 var integer idx := f_idx_by_comp(vc_conn);
Harald Welte0b476062018-01-21 19:07:32 +0100650 /* convert from decoded DTAP to encoded DTAP */
651 var octetstring l3_enc := enc_PDU_ML3_MS_NW(dtap_mo.dtap);
Harald Welte9dadc522018-02-06 13:56:04 +0100652 /* patch correct L3 send sequence number N(SD) into l3_enc */
Daniel Willmann92f66272018-02-06 15:50:52 +0100653 if (dtap_mo.skip_seq_patching == false) {
654 f_ML3_patch_seq(ConnectionTable[idx], dtap_mo.dtap, l3_enc);
655 }
Harald Welte0b476062018-01-21 19:07:32 +0100656 bssap := valueof(ts_BSSAP_DTAP(l3_enc, dtap_mo.dlci));
Harald Welte9dadc522018-02-06 13:56:04 +0100657 BSSAP.send(ts_BSSAP_DATA_req(ConnectionTable[idx].sccp_conn_id, bssap));
Harald Welte0b476062018-01-21 19:07:32 +0100658 }
659
660 [not g_bssmap_ops.role_ms] CLIENT.receive(PDU_DTAP_MT:?) -> value dtap_mt sender vc_conn {
661 var integer conn_id := f_conn_id_by_comp(vc_conn);
662 /* convert from decoded DTAP to encoded DTAP */
663 var octetstring l3_enc := enc_PDU_ML3_NW_MS(dtap_mt.dtap);
664 bssap := valueof(ts_BSSAP_DTAP(l3_enc, dtap_mo.dlci));
665 BSSAP.send(ts_BSSAP_DATA_req(conn_id, bssap));
666 }
667
668
Harald Weltec82eef42017-11-24 20:40:12 +0100669 /* Handling of MGCP in IPA SCCPLite case. This predates 3GPP AoIP
670 * and uses a MGCP session in parallel to BSSAP. BSSAP uses CIC
671 * as usual, and MGCP uses "CIC@mgw" endpoint naming, where CIC
672 * is printed as hex string, e.g. a@mgw for CIC 10 */
673
674 /* CLIENT -> MGCP */
675 [] CLIENT.receive(MgcpCommand:?) -> value mgcp_req sender vc_conn {
676 /* MGCP request from Handler (we're MSC) */
677 /* store the transaction ID we've seen */
678 f_comp_store_mgcp_tid(vc_conn, mgcp_req.line.trans_id);
679 /* simply forward any MGCP from the client to the port */
680 MGCP.send(mgcp_req);
681 }
682 [] CLIENT.receive(MgcpResponse:?) -> value mgcp_resp sender vc_conn {
683 /* MGCP response from Handler (we're BSC/MGW) */
684 /* simply forward any MGCP from the client to the port */
685 MGCP.send(mgcp_resp);
686 }
687
688 /* MGCP -> CLIENT */
689 [] MGCP.receive(MgcpCommand:?) -> value mgcp_req {
690 /* MGCP request from network side (we're BSC/MGW) */
691 /* Extract CIC from local part of endpoint name */
692 var integer cic := f_mgcp_ep_extract_cic(mgcp_req.line.ep);
Harald Weltee98bb2e2017-11-29 12:09:48 +0100693 if (match(mgcp_req, tr_RSIP) and f_cic_known(cic) == false) {
694 /* ignore RSIP for unknown CIC */
695 } else {
696 /* Resolve the vc_conn by the CIC */
697 vc_conn := f_comp_by_cic(cic);
698 CLIENT.send(mgcp_req) to vc_conn;
699 }
Harald Weltec82eef42017-11-24 20:40:12 +0100700 }
701 [] MGCP.receive(MgcpResponse:?) -> value mgcp_resp {
702 /* MGCP response from network side (we're MSC) */
703 /* Resolve the vc_conn by the transaction ID */
704 vc_conn := f_comp_by_mgcp_tid(mgcp_resp.line.trans_id);
705 CLIENT.send(mgcp_resp) to vc_conn;
706 }
707
Harald Welte624f9632017-12-16 19:26:04 +0100708
709 [] PROC.getcall(BSSMAPEM_register:{?,?}) -> param(l3_info, vc_hdlr) {
710 f_create_expect(l3_info, vc_hdlr);
Harald Weltee32ad992018-05-31 22:17:46 +0200711 PROC.reply(BSSMAPEM_register:{l3_info, vc_hdlr}) to vc_hdlr;
Harald Welte624f9632017-12-16 19:26:04 +0100712 }
713
Harald Welte17d21152018-01-27 00:47:11 +0100714 [] PROC.getcall(BSSMAPEM_register_imsi:{?,?,?}) -> param(imsi, tmsi, vc_hdlr) {
715 f_create_imsi(imsi, tmsi, vc_hdlr);
Harald Weltee32ad992018-05-31 22:17:46 +0200716 PROC.reply(BSSMAPEM_register_imsi:{imsi, tmsi, vc_hdlr}) to vc_hdlr;
Harald Welte17d21152018-01-27 00:47:11 +0100717 }
718
719
Harald Welte365f4ed2017-11-23 00:00:43 +0100720 }
721 }
722}
723
Harald Weltec82eef42017-11-24 20:40:12 +0100724private function f_mgcp_ep_extract_cic(charstring inp) return integer {
Harald Welte525a9c12017-11-24 23:40:41 +0100725 var charstring local_part := regexp(inp, "(*)@*", 0);
Harald Weltec82eef42017-11-24 20:40:12 +0100726 return hex2int(str2hex(local_part));
727
728}
Harald Welte365f4ed2017-11-23 00:00:43 +0100729
Harald Welte624f9632017-12-16 19:26:04 +0100730/***********************************************************************
731 * "Expect" Handling (mapping for expected incoming SCCP connections)
732 ***********************************************************************/
733
734/* data about an expected future incoming connection */
735type record ExpectData {
736 /* L3 payload based on which we can match it */
737 octetstring l3_payload optional,
738 /* component reference for this connection */
739 BSSAP_ConnHdlr vc_conn
740}
741
742/* procedure based port to register for incoming connections */
743signature BSSMAPEM_register(in octetstring l3, in BSSAP_ConnHdlr hdlr);
744
Harald Welte17d21152018-01-27 00:47:11 +0100745/* procedure based port to register for incoming IMSI/TMSI */
746signature BSSMAPEM_register_imsi(in hexstring imsi, in OCT4 tmsi, in BSSAP_ConnHdlr hdlr);
747
Harald Welte624f9632017-12-16 19:26:04 +0100748type port BSSMAPEM_PROC_PT procedure {
Harald Welte17d21152018-01-27 00:47:11 +0100749 inout BSSMAPEM_register, BSSMAPEM_register_imsi;
Harald Welte624f9632017-12-16 19:26:04 +0100750} with { extension "internal" };
751
752/* CreateCallback that can be used as create_cb and will use the expectation table */
753function ExpectedCreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
754runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
755 var BSSAP_ConnHdlr ret := null;
756 var octetstring l3_info;
757 var integer i;
758
759 if (not ischosen(conn_ind.userData.pdu.bssmap.completeLayer3Information)) {
760 setverdict(fail, "N-CONNECT.ind with L3 != COMPLETE L3");
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200761 mtc.stop;
Harald Welte624f9632017-12-16 19:26:04 +0100762 return ret;
763 }
764 l3_info := conn_ind.userData.pdu.bssmap.completeLayer3Information.layer3Information.layer3info;
765
766 for (i := 0; i < sizeof(ExpectTable); i:= i+1) {
767 if (not ispresent(ExpectTable[i].l3_payload)) {
768 continue;
769 }
770 if (l3_info == ExpectTable[i].l3_payload) {
771 ret := ExpectTable[i].vc_conn;
772 /* release this entry to be used again */
773 ExpectTable[i].l3_payload := omit;
774 ExpectTable[i].vc_conn := null;
775 log("Found Expect[", i, "] for ", l3_info, " handled at ", ret);
776 /* return the component reference */
777 return ret;
778 }
779 }
780 setverdict(fail, "Couldn't find Expect for incoming connection ", conn_ind);
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200781 mtc.stop;
Harald Welte624f9632017-12-16 19:26:04 +0100782 return ret;
783}
784
785private function f_create_expect(octetstring l3, BSSAP_ConnHdlr hdlr)
786runs on BSSMAP_Emulation_CT {
787 var integer i;
788 for (i := 0; i < sizeof(ExpectTable); i := i+1) {
789 if (not ispresent(ExpectTable[i].l3_payload)) {
790 ExpectTable[i].l3_payload := l3;
791 ExpectTable[i].vc_conn := hdlr;
792 log("Created Expect[", i, "] for ", l3, " to be handled at ", hdlr);
793 return;
794 }
795 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200796 testcase.stop("No space left in ExpectTable");
Harald Welte624f9632017-12-16 19:26:04 +0100797}
798
Harald Welte17d21152018-01-27 00:47:11 +0100799private function f_create_imsi(hexstring imsi, OCT4 tmsi, BSSAP_ConnHdlr hdlr)
800runs on BSSMAP_Emulation_CT {
801 for (var integer i := 0; i < sizeof(ImsiTable); i := i+1) {
802 if (not ispresent(ImsiTable[i].imsi)) {
803 ImsiTable[i].imsi := imsi;
804 ImsiTable[i].tmsi := tmsi;
805 ImsiTable[i].comp_ref := hdlr;
806 log("Created IMSI[", i, "] for ", imsi, tmsi, " to be handled at ", hdlr);
807 return;
808 }
809 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +0200810 testcase.stop("No space left in ImsiTable");
Harald Welte17d21152018-01-27 00:47:11 +0100811}
812
813
Daniel Willmannd47106b2018-01-17 12:20:56 +0100814private function f_expect_table_init()
815runs on BSSMAP_Emulation_CT {
816 for (var integer i := 0; i < sizeof(ExpectTable); i := i+1) {
817 ExpectTable[i].l3_payload := omit;
818 }
819}
Harald Welte624f9632017-12-16 19:26:04 +0100820
Harald Welte17d21152018-01-27 00:47:11 +0100821/* helper function for clients to register their IMSI/TMSI */
822function f_bssmap_register_imsi(hexstring imsi, OCT4 tmsi)
823runs on BSSAP_ConnHdlr {
824 BSSAP_PROC.call(BSSMAPEM_register_imsi:{imsi, tmsi, self}) {
825 [] BSSAP_PROC.getreply(BSSMAPEM_register_imsi:{?,?,?}) {};
826 }
827}
828
829
Harald Welte365f4ed2017-11-23 00:00:43 +0100830}