Harald Welte | 1733a38 | 2017-07-23 17:26:17 +0200 | [diff] [blame] | 1 | module BSSGP_Emulation { |
Harald Welte | 1733a38 | 2017-07-23 17:26:17 +0200 | [diff] [blame] | 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* BSSGP Emulation in TTCN-3 |
Harald Welte | f536524 | 2021-01-17 13:46:57 +0100 | [diff] [blame] | 4 | * (C) 2018-2021 Harald Welte <laforge@gnumonks.org> |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 11 | * |
| 12 | * This code implements BSSGP asa hierarchy of components: |
| 13 | * - the main BSSGP_CT which runs on top of a NSE (NS Entity). |
| 14 | * - demultiplex based on BVCI. BVCI=0 is handled to a user port |
| 15 | * - a per-BVC BSSGP_BVC_CT which runs on top of BSSGP_CT, it handles |
| 16 | * one PTP BVCI (i.e. one cell) |
| 17 | * - demultiplex based on TLLI |
| 18 | * - a per-TLLI BSSGP_Client_CT which runs on top of BSSGP_BVC_CT |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 21 | import from General_Types all; |
| 22 | import from Osmocom_Types all; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 23 | import from NS_Types all; |
| 24 | import from NS_Emulation all; |
| 25 | import from BSSGP_Types all; |
| 26 | import from Osmocom_Gb_Types all; |
| 27 | import from IPL4asp_Types all; |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 28 | import from Misc_Helpers all; |
Harald Welte | 1733a38 | 2017-07-23 17:26:17 +0200 | [diff] [blame] | 29 | |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 30 | #ifdef BSSGP_EM_L3 |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 31 | import from MobileL3_GMM_SM_Types all; |
| 32 | import from MobileL3_Types all; |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 33 | #endif |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 34 | |
| 35 | import from LLC_Types all; |
| 36 | import from LLC_Templates all; |
| 37 | |
Harald Welte | a2526a8 | 2018-02-18 19:03:36 +0100 | [diff] [blame] | 38 | import from SNDCP_Types all; |
| 39 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 40 | /*********************************************************************** |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 41 | * Communication between Client Components and per-BVC component |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 42 | ***********************************************************************/ |
| 43 | |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 44 | type record BssgpStatusIndication { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 45 | Nsei nsei optional, |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 46 | BssgpBvci bvci, |
| 47 | BvcState state |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | type record BssgpResetIndication { |
| 51 | BssgpBvci bvci |
| 52 | }; |
| 53 | |
| 54 | template (value) BssgpStatusIndication |
| 55 | ts_BssgpStsInd(template (omit) Nsei nsei, template (value) BssgpBvci bvci, |
| 56 | template (value) BvcState state) := { |
| 57 | nsei := nsei, |
| 58 | bvci := bvci, |
| 59 | state := state |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 60 | } |
| 61 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 62 | template (present) BssgpStatusIndication |
| 63 | tr_BssgpStsInd(template Nsei nsei, template (present) BssgpBvci bvci, |
| 64 | template (present) BvcState state) := { |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 65 | nsei := nsei, |
| 66 | bvci := bvci, |
| 67 | state := state |
| 68 | } |
| 69 | |
| 70 | type enumerated BvcState { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 71 | /* SGSN role: waiting to be reset by the peer */ |
| 72 | BVC_S_WAIT_RESET, |
| 73 | /* PCU role: waiting for NS_ALIVE_UNBLOCKED */ |
| 74 | BVC_S_WAIT_NS_ALIVE_UNBLOCKED, |
| 75 | /* BVC-BLOCKED state */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 76 | BVC_S_BLOCKED, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 77 | /* BVC-UNBLOCKED state */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 78 | BVC_S_UNBLOCKED |
| 79 | }; |
| 80 | |
| 81 | /* port from our (internal) point of view */ |
| 82 | type port BSSGP_SP_PT message { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 83 | in PDU_BSSGP, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 84 | PDU_LLC |
| 85 | #ifdef BSSGP_EM_L3 |
| 86 | , |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 87 | PDU_L3_MS_SGSN, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 88 | PDU_L3_SGSN_MS |
| 89 | #endif |
| 90 | ; |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 91 | out PDU_BSSGP, |
| 92 | PDU_LLC, |
| 93 | PDU_SN, |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 94 | NsStatusIndication, |
| 95 | BssgpStatusIndication, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 96 | ASP_Event |
| 97 | #ifdef BSSGP_EM_L3 |
| 98 | , |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 99 | PDU_L3_MS_SGSN, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 100 | PDU_L3_SGSN_MS |
| 101 | #endif |
| 102 | ; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 103 | } with { extension "internal" }; |
| 104 | |
| 105 | /* port from the user point of view */ |
| 106 | type port BSSGP_PT message { |
| 107 | in ASP_Event, |
| 108 | NsStatusIndication, |
| 109 | BssgpStatusIndication, |
Harald Welte | 955aa94 | 2019-05-03 01:29:29 +0200 | [diff] [blame] | 110 | PDU_BSSGP, |
| 111 | PDU_LLC, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 112 | PDU_SN |
| 113 | #ifdef BSSGP_EM_L3 |
| 114 | , |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 115 | PDU_L3_MS_SGSN, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 116 | PDU_L3_SGSN_MS |
| 117 | #endif |
| 118 | ; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 119 | out PDU_BSSGP, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 120 | PDU_LLC |
| 121 | #ifdef BSSGP_EM_L3 |
| 122 | , |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 123 | PDU_L3_SGSN_MS, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 124 | PDU_L3_MS_SGSN |
| 125 | #endif |
| 126 | ; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 127 | } with { extension "internal" }; |
| 128 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 129 | signature BSSGP_register_client(hexstring imsi, OCT4 tlli); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 130 | signature BSSGP_unregister_client(hexstring imsi); |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 131 | signature BSSGP_llgmm_assign(OCT4 tlli_old, OCT4 tlli); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 132 | |
| 133 | type port BSSGP_PROC_PT procedure { |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 134 | inout BSSGP_register_client, BSSGP_unregister_client, BSSGP_llgmm_assign; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 135 | } with { extension "internal" }; |
| 136 | |
| 137 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 138 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 139 | /*********************************************************************** |
| 140 | * Client Component for a single MS/TLLI |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 141 | *********************************************************************** |
| 142 | * This is what most users will want to derive their test cases from. It |
| 143 | * provides a set of three different ports (PTP, signaling, procedure) |
| 144 | * for (currently up to 3) different Cells. Those ports are all connected |
| 145 | * to one or multiple different per-BVC compoennts, depending on whether |
| 146 | * they share the same BSS or not. |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 147 | ***********************************************************************/ |
| 148 | |
| 149 | type component BSSGP_Client_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 150 | /* one port array for each client; allows talking to up to 3 BVC/Cell (handover, ...) */ |
| 151 | port BSSGP_PT BSSGP[3]; /* PTP-BVC */ |
| 152 | port BSSGP_PT BSSGP_SIG[3]; /* Signaling BVC */ |
Harald Welte | 9b461a9 | 2020-12-10 23:41:14 +0100 | [diff] [blame] | 153 | port BSSGP_PT BSSGP_GLOBAL[3]; /* Signaling BVC */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 154 | port BSSGP_PROC_PT BSSGP_PROC[3]; /* registration / deregistration */ |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 155 | }; |
| 156 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 157 | function f_bssgp_client_register(hexstring imsi, OCT4 tlli, BSSGP_PROC_PT PT := BSSGP_PROC[0]) |
| 158 | runs on BSSGP_Client_CT { |
| 159 | PT.call(BSSGP_register_client:{imsi, tlli}) { |
| 160 | [] PT.getreply(BSSGP_register_client:{imsi, tlli}) {}; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | function f_bssgp_client_unregister(hexstring imsi, BSSGP_PROC_PT PT := BSSGP_PROC[0]) |
| 165 | runs on BSSGP_Client_CT { |
| 166 | PT.call(BSSGP_unregister_client:{imsi}) { |
| 167 | [] PT.getreply(BSSGP_unregister_client:{imsi}) {}; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /* TS 44.064 7.2.1.1 LLGMM-ASSIGN */ |
| 172 | function f_bssgp_client_llgmm_assign(OCT4 tlli_old, OCT4 tlli_new, BSSGP_PROC_PT PT := BSSGP_PROC[0]) |
| 173 | runs on BSSGP_Client_CT { |
| 174 | PT.call(BSSGP_llgmm_assign:{tlli_old, tlli_new}) { |
| 175 | [] PT.getreply(BSSGP_llgmm_assign:{tlli_old, tlli_new}) {}; |
| 176 | } |
| 177 | } |
| 178 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 179 | /*********************************************************************** |
| 180 | * Main Component |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 181 | *********************************************************************** |
| 182 | * This component exists once, and it runs on to of the NS_Emulation. |
| 183 | * It handles the BVC-RESET for the signaling BVCI, and dispatches messages |
| 184 | * to the per-BVC components running above it. Messages are routed by: |
| 185 | * - PTP BVCI in NS header (if non-0) |
| 186 | * - BVCI IE in messages on BVCI=0 in NS header |
| 187 | * Messages for which no unique BVC can be identified (like paging without |
| 188 | * a BVCI IE set) are broadcast to all BVC components. |
| 189 | * We also broadcast state changes (BssgpStatusIndication) and reset events |
| 190 | * (BssgpResetIndication) of the signaling BVC to all per-BVC components. |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 191 | ***********************************************************************/ |
| 192 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 193 | function BssgpStart(BssgpConfig cfg, charstring id) runs on BSSGP_CT { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 194 | g_cfg := cfg; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 195 | |
| 196 | /* create the per-BVC components based on the configuration */ |
| 197 | for (var integer i := 0; i < lengthof(g_cfg.bvc); i := i+1) { |
| 198 | var BssgpBvcConfig bvc_cfg := g_cfg.bvc[i]; |
| 199 | var charstring bvc_id := id & "-BVCI" & int2str(bvc_cfg.bvci); |
| 200 | /* create, connect and start the BVC component */ |
| 201 | var BSSGP_BVC_CT bvc_ct := BSSGP_BVC_CT.create(bvc_id); |
| 202 | connect(bvc_ct:BVC, self:BVC); |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 203 | bvc_ct.start(f_bssgp_bvc_main(bvc_cfg, g_cfg.sgsn_role, g_cfg.nsei, bvc_id)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 204 | /* populate the BVC state table */ |
| 205 | BvcTable[i] := { |
| 206 | bvci := bvc_cfg.bvci, |
| 207 | cell_id := bvc_cfg.cell_id, |
| 208 | comp_ref := bvc_ct |
| 209 | }; |
| 210 | } |
| 211 | |
| 212 | if (g_cfg.sgsn_role) { |
| 213 | /* The SGSN side waits for an inbound BVC-RESET on the signaling BVC */ |
| 214 | f_sign_change_state(BVC_S_WAIT_RESET); |
| 215 | } else { |
| 216 | /* The BSS/PCU side waits for an inbound NsStatusIndication to Tx BVC-RESET */ |
| 217 | f_sign_change_state(BVC_S_WAIT_NS_ALIVE_UNBLOCKED); |
| 218 | } |
| 219 | |
| 220 | /* main loop */ |
| 221 | f_bssgp_ScanEvents(); |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 222 | } |
| 223 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 224 | /* master component, exists once per BSSGP instance (NSE) */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 225 | type component BSSGP_CT { |
Stefan Sperling | f82bbb6 | 2018-05-03 19:14:28 +0200 | [diff] [blame] | 226 | /* UDP ports towards the bottom (IUT) */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 227 | port NS_PT BSCP; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 228 | |
| 229 | /* control by the user */ |
| 230 | port BSSGP_CT_PROC_PT PROC; |
| 231 | |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 232 | /* global port for procedures without any relation to a BVC |
| 233 | * (currently only) SUSPEND/RESUME */ |
| 234 | port BSSGP_SP_PT GLOBAL; |
| 235 | |
Harald Welte | 0083ea6 | 2020-12-02 21:30:44 +0100 | [diff] [blame] | 236 | /* RAN INFORMATION MGMT */ |
| 237 | port BSSGP_SP_PT RIM; |
| 238 | |
Harald Welte | bdf96d8 | 2020-11-27 18:58:46 +0100 | [diff] [blame] | 239 | /* port to a management instance */ |
| 240 | port BSSGP_BVC_MGMT_SP_PT MGMT; |
| 241 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 242 | var BssgpConfig g_cfg; |
| 243 | |
| 244 | /* Signaling BVC (BVCI=0) */ |
| 245 | var BvcState g_sign_bvc_state := BVC_S_WAIT_RESET; |
| 246 | timer g_T2 := 60.0; |
| 247 | |
| 248 | /* port to per-BVC components */ |
| 249 | port BSSGP_BVC_SP_PT BVC; |
| 250 | /* per-BVC state table */ |
Harald Welte | 633805b | 2021-02-03 17:47:18 +0100 | [diff] [blame] | 251 | var BvcEntity BvcTable[64]; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | /* one element in the per-BVC state table */ |
| 255 | type record BvcEntity { |
| 256 | /* PTP BVCI of this BVC/Cell */ |
| 257 | BssgpBvci bvci, |
| 258 | /* Cell Identity of this cell */ |
| 259 | BssgpCellId cell_id, |
| 260 | /* reference to the per-BVC/cell component */ |
| 261 | BSSGP_BVC_CT comp_ref |
| 262 | }; |
| 263 | |
| 264 | /* find the per-BVC component for a given BVCI */ |
| 265 | private function f_comp_for_bvci(BssgpBvci bvci) runs on BSSGP_CT return BSSGP_BVC_CT { |
| 266 | var integer i; |
| 267 | |
| 268 | for (i := 0; i < lengthof(BvcTable); i := i+1) { |
| 269 | if (BvcTable[i].bvci == bvci) { |
| 270 | return BvcTable[i].comp_ref; |
| 271 | } |
| 272 | } |
| 273 | return null; |
| 274 | } |
| 275 | |
| 276 | /* We are in BVC_S_WAIT_RSET state (only happens in SGSN role) */ |
| 277 | altstep as_sig_wait_reset() runs on BSSGP_CT { |
| 278 | var NsUnitdataIndication udi; |
| 279 | |
| 280 | /* Respond to RESET for signalling BVCI 0 */ |
| 281 | [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, 0, omit), 0)) -> value udi { |
| 282 | log("Rx BVC-RESET for Signaling BVCI=0"); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 283 | f_sign_change_state(BVC_S_UNBLOCKED); |
Harald Welte | bdf96d8 | 2020-11-27 18:58:46 +0100 | [diff] [blame] | 284 | if (MGMT.checkstate("Connected")) { |
| 285 | MGMT.send(BssgpResetIndication:{0}); |
| 286 | } |
| 287 | BSCP.send(f_BnsUdReq(ts_BVC_RESET_ACK(0, omit), 0, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 288 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 289 | } |
| 290 | |
Harald Welte | 27a70cc | 2020-12-09 11:57:41 +0100 | [diff] [blame] | 291 | private template PDU_BSSGP tr_GLOBAL_SIG := ( |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 292 | {pDU_BSSGP_SUSPEND:=?}, {pDU_BSSGP_SUSPEND_ACK:=?}, {pDU_BSSGP_SUSPEND_NACK:=?}, |
Harald Welte | f8e5c5d | 2020-11-27 22:37:23 +0100 | [diff] [blame] | 293 | {pDU_BSSGP_RESUME:=?}, {pDU_BSSGP_RESUME_ACK:=?}, {pDU_BSSGP_RESUME_NACK:=?}, |
Harald Welte | f536524 | 2021-01-17 13:46:57 +0100 | [diff] [blame] | 294 | {pDU_BSSGP_SGSN_INVOKE_TRACE:=?}, {pDU_BSSGP_OVERLOAD:=?}, {pDU_BSSGP_STATUS:=?} |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 295 | ); |
| 296 | |
Harald Welte | 0083ea6 | 2020-12-02 21:30:44 +0100 | [diff] [blame] | 297 | /* BSSGP messages that should arrive on the RIM port */ |
| 298 | private template PDU_BSSGP tr_RIM := ( |
| 299 | {pDU_BSSGP_RAN_INFORMATION:=?}, {pDU_BSSGP_RAN_INFORMATION_REQUEST:=?}, |
| 300 | {pDU_BSSGP_RAN_INFORMATION_ACK:=?}, {pDU_BSSGP_RAN_INFORMATION_ERROR:=?}, |
| 301 | {pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR:=?} |
| 302 | ); |
| 303 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 304 | /* We are in BVC_S_UNBLOCKED state */ |
| 305 | altstep as_sig_unblocked() runs on BSSGP_CT { |
| 306 | var BSSGP_BVC_CT bvc_comp_ref; |
| 307 | var BSSGP_Client_CT vc_conn; |
| 308 | var NsUnitdataIndication udi; |
| 309 | var NsUnitdataRequest udr; |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 310 | var PDU_BSSGP bssgp; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 311 | |
| 312 | /* Messages PTP BVCI in BVCI field of NS: dispatch by that */ |
| 313 | [] BSCP.receive(f_BnsUdInd(?, (2..65535))) -> value udi { |
| 314 | bvc_comp_ref := f_comp_for_bvci(valueof(udi.bvci)); |
| 315 | if (isbound(bvc_comp_ref) and bvc_comp_ref != null) { |
| 316 | /* dispatch to BVC component */ |
| 317 | BVC.send(udi) to bvc_comp_ref; |
| 318 | } else { |
| 319 | setverdict(fail, "Rx BSSGP for unknown PTP BVCI ", udi.bvci, ": ", udi.bssgp); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 320 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(udi.bvci, BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp), udi.bvci, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 321 | } |
| 322 | } |
| 323 | |
| 324 | /* Messages with BVCI = 0 (Signaling) in BVCI field of NS */ |
Harald Welte | 27a70cc | 2020-12-09 11:57:41 +0100 | [diff] [blame] | 325 | [] BSCP.receive(f_BnsUdInd(tr_GLOBAL_SIG, 0)) -> value udi { |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 326 | GLOBAL.send(udi.bssgp); |
| 327 | } |
Harald Welte | 0083ea6 | 2020-12-02 21:30:44 +0100 | [diff] [blame] | 328 | [] BSCP.receive(f_BnsUdInd(tr_RIM, 0)) -> value udi { |
| 329 | if (RIM.checkstate("Connected")) { |
| 330 | RIM.send(udi.bssgp); |
| 331 | } |
| 332 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 333 | |
| 334 | /* Route based on PTP BVCI in payload/IE of signaling PDU */ |
| 335 | [] BSCP.receive(f_BnsUdInd(?, 0)) -> value udi { |
| 336 | var template (omit) BssgpBvci ptp_bvci := f_BSSGP_BVCI_get(udi.bssgp); |
| 337 | if (istemplatekind(ptp_bvci, "omit")) { |
| 338 | log("Rx on SIG BVCI without PTP BVCI: broadcasting"); |
| 339 | for (var integer i := 0; i < lengthof(BvcTable); i := i+1) { |
| 340 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 341 | BVC.send(udi) to BvcTable[i].comp_ref; |
| 342 | } |
| 343 | } |
| 344 | } else { |
| 345 | bvc_comp_ref := f_comp_for_bvci(valueof(ptp_bvci)); |
| 346 | if (isbound(bvc_comp_ref) and bvc_comp_ref != null) { |
| 347 | /* dispatch to BVC component */ |
| 348 | BVC.send(udi) to bvc_comp_ref; |
| 349 | } else { |
| 350 | setverdict(fail, "Rx SIG BSSGP for unknown PTP BVCI ", ptp_bvci, ": ", udi.bssgp); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 351 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(udi.bvci, BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp), 0, 0)); |
Pau Espin Pedrol | 847a165 | 2021-02-05 12:08:04 +0100 | [diff] [blame] | 352 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 353 | } |
| 354 | } |
| 355 | |
| 356 | /* Handle PS-PAGING on SIGN BVCI with no conditional BVCI IE */ |
| 357 | [] BSCP.receive(f_BnsUdInd(PDU_BSSGP:{pDU_BSSGP_PAGING_PS:=?}, 0)) -> value udi { |
| 358 | /* FIXME: use LA, RA or BSS Area to dispatch instead of broadcast */ |
| 359 | for (var integer i := 0; i < lengthof(BvcTable); i := i+1) { |
| 360 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 361 | BVC.send(udi) to BvcTable[i].comp_ref; |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | /* Handle CS-PAGING on SIGN BVCI with no conditional BVCI IE */ |
| 366 | [] BSCP.receive(f_BnsUdInd(PDU_BSSGP:{pDU_BSSGP_PAGING_CS:=?}, 0)) -> value udi { |
| 367 | /* FIXME: use LA, RA or BSS Area to dispatch instead of broadcast */ |
| 368 | for (var integer i := 0; i < lengthof(BvcTable); i := i+1) { |
| 369 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 370 | BVC.send(udi) to BvcTable[i].comp_ref; |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | /* per-BVC component sends us something; forward to NS without any validation */ |
| 376 | [] BVC.receive(NsUnitdataRequest:?) -> value udr { |
| 377 | /* patch in the NSEI, as the per-BVC components have no idea about it */ |
| 378 | udr.nsei := g_cfg.nsei; |
| 379 | BSCP.send(udr); |
| 380 | } |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 381 | |
Harald Welte | 27a70cc | 2020-12-09 11:57:41 +0100 | [diff] [blame] | 382 | [] GLOBAL.receive(tr_GLOBAL_SIG) -> value bssgp { |
Harald Welte | 57de220 | 2020-11-24 18:15:02 +0100 | [diff] [blame] | 383 | BSCP.send(f_BnsUdReq(bssgp, 0, 0)); |
| 384 | } |
Harald Welte | 0083ea6 | 2020-12-02 21:30:44 +0100 | [diff] [blame] | 385 | |
| 386 | [] RIM.receive(tr_RIM) -> value bssgp { |
| 387 | BSCP.send(f_BnsUdReq(bssgp, 0, 0)); |
| 388 | } |
| 389 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | /* We are in BVC_S_WAIT_NS_ALIVE_UNBLOCKED (only happens in BSS role) */ |
| 393 | altstep as_sig_wait_ns_alive_unblocked() runs on BSSGP_CT { |
| 394 | var NsStatusIndication nsi; |
Harald Welte | dc0a090 | 2020-11-10 21:03:29 +0100 | [diff] [blame] | 395 | [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement (NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED, true}) -> value nsi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 396 | /* if we just became NS-unblocked, send a BCC-RESET */ |
| 397 | if (g_cfg.sgsn_role == false) { |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 398 | BSCP.send(f_BnsUdReq(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, 0, omit), 0, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 399 | g_T2.start; |
| 400 | /* The BVC_RESET_ACK is handled in the as_sig_allstate() below */ |
| 401 | } |
| 402 | /* Idea: We could send BVC-UNBLOCK here like some SGSN do */ |
| 403 | } |
| 404 | |
| 405 | } |
| 406 | |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 407 | /* handling of events irrespective of BVC state (before state-specific handling) */ |
| 408 | altstep as_sig_allstate_pre() runs on BSSGP_CT { |
| 409 | var NsUnitdataIndication udi; |
| 410 | |
| 411 | /* Respond to RESET for signalling BVCI 0 */ |
| 412 | [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, 0, omit), 0)) -> value udi { |
| 413 | log("Rx BVC-RESET for Signaling BVCI=0"); |
| 414 | if (MGMT.checkstate("Connected")) { |
| 415 | MGMT.send(BssgpResetIndication:{0}); |
| 416 | } |
| 417 | BSCP.send(f_BnsUdReq(ts_BVC_RESET_ACK(0, omit), 0, 0)); |
| 418 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 419 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 420 | BVC.send(BssgpResetIndication:{0}) to BvcTable[i].comp_ref; |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | /* any BLOCK or UNBLOCK for the SIGNALING BVCI are illegal */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 426 | [] BSCP.receive(f_BnsUdInd(tr_BVC_BLOCK(0, ?), 0)) -> value udi { |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 427 | setverdict(fail, "Rx BVC-BLOCK illegal for BVCI=0: ", udi); |
| 428 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 429 | [] BSCP.receive(f_BnsUdInd(tr_BVC_UNBLOCK(0), 0)) -> value udi { |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 430 | setverdict(fail, "Rx BVC-UNBLOCK illegal for BVCI=0: ", udi); |
| 431 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 432 | [] BSCP.receive(f_BnsUdInd(tr_BVC_BLOCK_ACK(0), 0)) -> value udi { |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 433 | setverdict(fail, "Rx BVC-BLOCK-ACK illegal for BVCI=0: ", udi); |
| 434 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 435 | [] BSCP.receive(f_BnsUdInd(tr_BVC_UNBLOCK_ACK(0), 0)) -> value udi { |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 436 | setverdict(fail, "Rx BVC-UNBLOCK-ACK illegal for BVCI=0: ", udi); |
| 437 | } |
| 438 | |
| 439 | /* BVC-RESET-ACK for BVCI=0 while T2 is running: Answer to a BVC-RESET we sent earlier */ |
| 440 | [g_T2.running] BSCP.receive(f_BnsUdInd(tr_BVC_RESET_ACK(0, omit), 0)) -> value udi { |
| 441 | log("BVCI(0) Rx BVC-RESET-ACK"); |
| 442 | g_T2.stop; |
| 443 | f_sign_change_state(BVC_S_UNBLOCKED); |
| 444 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 445 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 446 | BVC.send(BssgpResetIndication:{0}) to BvcTable[i].comp_ref; |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | [] g_T2.timeout { |
| 451 | setverdict(fail, "Timeout waiting for BVC-RESET-ACK on BVCI=0"); |
| 452 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(udi.bvci, BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp), 0, 0)); |
| 453 | g_T2.start; |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | /* handling of events irrespective of BVC state (after state-specific handling) */ |
| 458 | altstep as_sig_allstate_post() runs on BSSGP_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 459 | var BSSGP_Client_CT vc_conn; |
| 460 | var NsUnitdataIndication udi; |
| 461 | var NsStatusIndication nsi; |
| 462 | var ASP_Event evt; |
| 463 | var BSSGP_BVC_CT bvc_comp_ref; |
| 464 | var BssgpBvci bvci; |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 465 | var BssgpResetRequest brr; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 466 | |
| 467 | /* Respond to RESET for signalling BVCI 0 */ |
| 468 | [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, 0, omit), 0)) -> value udi { |
| 469 | log("Rx BVC-RESET for Signaling BVCI=0"); |
Harald Welte | bdf96d8 | 2020-11-27 18:58:46 +0100 | [diff] [blame] | 470 | if (MGMT.checkstate("Connected")) { |
| 471 | MGMT.send(BssgpResetIndication:{0}); |
| 472 | } |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 473 | BSCP.send(f_BnsUdReq(ts_BVC_RESET_ACK(0, omit), 0, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 474 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 475 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 476 | BVC.send(BssgpResetIndication:{0}) to BvcTable[i].comp_ref; |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | /* any BLOCK or UNBLOCK for the SIGNALING BVCI are illegal */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 482 | [] BSCP.receive(f_BnsUdInd(tr_BVC_BLOCK(0, ?), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 483 | setverdict(fail, "Rx BVC-BLOCK illegal for BVCI=0: ", udi); |
| 484 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 485 | [] BSCP.receive(f_BnsUdInd(tr_BVC_UNBLOCK(0), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 486 | setverdict(fail, "Rx BVC-UNBLOCK illegal for BVCI=0: ", udi); |
| 487 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 488 | [] BSCP.receive(f_BnsUdInd(tr_BVC_BLOCK_ACK(0), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 489 | setverdict(fail, "Rx BVC-BLOCK-ACK illegal for BVCI=0: ", udi); |
| 490 | } |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 491 | [] BSCP.receive(f_BnsUdInd(tr_BVC_UNBLOCK_ACK(0), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 492 | setverdict(fail, "Rx BVC-UNBLOCK-ACK illegal for BVCI=0: ", udi); |
| 493 | } |
| 494 | |
| 495 | /* Respond to BLOCK for wrong BVCI */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 496 | [] BSCP.receive(f_BnsUdInd(tr_BVC_BLOCK(?, ?), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 497 | setverdict(fail, "Rx BVC-BLOCK for unknown BVCI"); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 498 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(0, BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp), 0, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | /* Respond to RESET with wrong BVCI */ |
| 502 | [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, ?, ?), 0)) -> value udi { |
| 503 | var BssgpBvci ptp_bvci := oct2int(udi.bssgp.pDU_BSSGP_BVC_RESET.bVCI.unstructured_value); |
| 504 | setverdict(fail, "Rx BVC-RESET for unknown BVCI ", ptp_bvci); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 505 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(ptp_bvci, BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp), 0, 0)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 506 | } |
| 507 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 508 | /* Forwarding of ASP_Event to per-BVC components */ |
| 509 | [] BSCP.receive(ASP_Event:?) -> value evt { |
| 510 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 511 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 512 | BVC.send(evt) to BvcTable[i].comp_ref; |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | /* Keep NS Status Indicaitons to us; no need to inform per-BVC components [for now?] */ |
Harald Welte | dc0a090 | 2020-11-10 21:03:29 +0100 | [diff] [blame] | 517 | [] BSCP.receive(tr_NsStsInd(g_cfg.nsei)) -> value nsi { } |
Harald Welte | 445fc61 | 2020-11-10 19:15:30 +0100 | [diff] [blame] | 518 | /* We should never see any different NSEI: There's one BSSGP_CT per NSE */ |
Harald Welte | dc0a090 | 2020-11-10 21:03:29 +0100 | [diff] [blame] | 519 | [] BSCP.receive(tr_NsStsInd(?)) -> value nsi { |
Harald Welte | 445fc61 | 2020-11-10 19:15:30 +0100 | [diff] [blame] | 520 | setverdict(fail, "Rx NsStatusInd for wrong NSEI ", nsi); |
| 521 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 522 | |
| 523 | /* Procedure port request to resolve the per-BVC component for a given ptp BVCI */ |
| 524 | [] PROC.getcall(BSSGP_get_bvci_ct:{?}) -> param(bvci) sender vc_conn { |
| 525 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 526 | if (BvcTable[i].bvci == bvci) { |
| 527 | PROC.reply(BSSGP_get_bvci_ct:{bvci} value BvcTable[i].comp_ref) to vc_conn; |
| 528 | return; |
| 529 | } |
| 530 | } |
| 531 | } |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 532 | |
| 533 | /* default case of handling unknown PDUs */ |
| 534 | [] BSCP.receive(f_BnsUdInd(?, ?)) -> value udi { |
| 535 | setverdict(fail, "Rx Unexpected BSSGP PDU ", udi.bssgp," in state ", g_sign_bvc_state); |
| 536 | BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(0, BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, udi.bssgp), 0, 0)); |
| 537 | } |
| 538 | |
| 539 | [] MGMT.receive(BssgpResetRequest:?) -> value brr { |
| 540 | BSCP.send(f_BnsUdReq(ts_BVC_RESET(brr.cause, 0, omit), 0, 0)); |
| 541 | g_T2.start; |
| 542 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | /* send the highest decoded layer of the message through given port */ |
| 546 | private function f_send_bssgp_dec(BssgpDecoded dec, BSSGP_Client_CT vc_conn, BSSGP_SP_PT pt) { |
| 547 | #ifdef BSSGP_EM_L3 |
| 548 | if (ispresent(dec.l3_mt)) { |
| 549 | pt.send(dec.l3_mt) to vc_conn; |
| 550 | } else if (ispresent(dec.l3_mo)) { |
| 551 | pt.send(dec.l3_mo) to vc_conn; |
| 552 | } else |
| 553 | #endif |
| 554 | if (ispresent(dec.sndcp)) { |
| 555 | pt.send(dec.sndcp) to vc_conn; |
| 556 | } else if (ispresent(dec.llc)) { |
| 557 | pt.send(dec.llc) to vc_conn; |
| 558 | } else { |
| 559 | pt.send(dec.bssgp) to vc_conn; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | |
| 564 | function f_llc_get_n_u_tx(inout LLC_Entity llc) return uint9_t { |
| 565 | var uint9_t ret := llc.n_u_tx_next; |
| 566 | llc.n_u_tx_next := llc.n_u_tx_next + 1; |
| 567 | return ret; |
| 568 | } |
| 569 | |
| 570 | #ifdef BSSGP_EM_L3 |
| 571 | function f_llc_sapi_by_l3_mo(PDU_L3_MS_SGSN l3_mo) return BIT4 { |
| 572 | if (ischosen(l3_mo.msgs.gprs_mm)) { |
| 573 | return c_LLC_SAPI_LLGMM; |
| 574 | } else if (ischosen(l3_mo.msgs.gprs_sm)) { |
| 575 | return c_LLC_SAPI_LLGMM; |
| 576 | } else if (ischosen(l3_mo.msgs.sms)) { |
| 577 | return c_LLC_SAPI_LLSMS; |
| 578 | } |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 579 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No LLC SAPI for ", l3_mo)); |
| 580 | return '0000'B; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | private function f_llc_sapi_by_l3_mt(PDU_L3_SGSN_MS l3_mt) return BIT4 { |
| 584 | if (ischosen(l3_mt.msgs.gprs_mm)) { |
| 585 | return c_LLC_SAPI_LLGMM; |
| 586 | } else if (ischosen(l3_mt.msgs.gprs_sm)) { |
| 587 | return c_LLC_SAPI_LLGMM; |
| 588 | } else if (ischosen(l3_mt.msgs.sms)) { |
| 589 | return c_LLC_SAPI_LLSMS; |
| 590 | } |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 591 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No LLC SAPI for ", l3_mt)); |
| 592 | return '0000'B; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 593 | } |
| 594 | #endif |
| 595 | |
| 596 | /* main loop of BSSGP_CT */ |
| 597 | private function f_bssgp_ScanEvents() runs on BSSGP_CT { |
| 598 | while (true) { |
| 599 | alt { |
| 600 | [g_sign_bvc_state == BVC_S_WAIT_RESET] as_sig_wait_reset(); |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 601 | [] as_sig_allstate_pre(); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 602 | [g_sign_bvc_state == BVC_S_WAIT_NS_ALIVE_UNBLOCKED] as_sig_wait_ns_alive_unblocked(); |
| 603 | [g_sign_bvc_state == BVC_S_UNBLOCKED] as_sig_unblocked(); |
Harald Welte | e588792 | 2020-11-27 19:04:46 +0100 | [diff] [blame] | 604 | [g_sign_bvc_state == BVC_S_WAIT_RESET] as_sig_wait_reset(); |
| 605 | [] as_sig_allstate_post(); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 606 | } |
| 607 | } /* while */ |
| 608 | } |
| 609 | |
| 610 | /* generate a send template. Cannot be a real template as we want to use g_cfg.nsei */ |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 611 | private function f_BnsUdReq(template PDU_BSSGP pdu, BssgpBvci bvci, integer lsp) |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 612 | runs on BSSGP_CT return NsUnitdataRequest { |
| 613 | var NsUnitdataRequest udr := { |
| 614 | bvci := bvci, |
| 615 | nsei := g_cfg.nsei, |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 616 | lsp := lsp, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 617 | /* for some weird reason we get "Dynamic test case error: Text encoder: Encoding an |
| 618 | * unbound integer value." when trying to send the reocrd rather than the octetstring */ |
| 619 | //sdu := omit, |
| 620 | //bssgp := valueof(pdu) |
| 621 | sdu := enc_PDU_BSSGP(valueof(pdu)), |
| 622 | bssgp := omit |
| 623 | } |
| 624 | return udr; |
| 625 | } |
| 626 | |
| 627 | /* generate a receive template. Cannot be a real template as we want to use g_cfg.nsei */ |
| 628 | private function f_BnsUdInd(template PDU_BSSGP pdu, template BssgpBvci bvci) |
| 629 | runs on BSSGP_CT return template (present) NsUnitdataIndication { |
| 630 | var template (present) NsUnitdataIndication udi := { |
| 631 | bvci := bvci, |
| 632 | nsei := g_cfg.nsei, |
Harald Welte | 80a249a | 2020-11-17 19:57:40 +0100 | [diff] [blame] | 633 | nsvci := ?, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 634 | sdu := *, |
| 635 | bssgp := pdu |
| 636 | } |
| 637 | return udi; |
| 638 | } |
| 639 | |
| 640 | /* change state of signaling BVCI; notify per-BVC components */ |
| 641 | private function f_sign_change_state(BvcState new_state) runs on BSSGP_CT { |
| 642 | if (new_state == g_sign_bvc_state) { |
| 643 | return; |
| 644 | } |
| 645 | log("BVCI(0) State Transition: ", g_sign_bvc_state, " -> ", new_state); |
| 646 | g_sign_bvc_state := new_state; |
| 647 | for (var integer i := 0; i < sizeof(BvcTable); i := i+1) { |
| 648 | if (isbound(BvcTable[i].comp_ref) and BvcTable[i].comp_ref != null) { |
| 649 | BVC.send(ts_BssgpStsInd(g_cfg.nsei, 0, g_sign_bvc_state)) to BvcTable[i].comp_ref; |
| 650 | } |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | /* User wants to get per-BVC component reference from BSSGP_CT */ |
| 655 | signature BSSGP_get_bvci_ct(BssgpBvci bvci) return BSSGP_BVC_CT; |
| 656 | |
| 657 | type port BSSGP_CT_PROC_PT procedure { |
| 658 | inout BSSGP_get_bvci_ct |
| 659 | } with { extension "internal" }; |
| 660 | |
| 661 | /* convenience wrapper function for user */ |
| 662 | function f_bssgp_get_bvci_ct(BssgpBvci bvci, BSSGP_CT_PROC_PT PT) return BSSGP_BVC_CT { |
| 663 | var BSSGP_BVC_CT res; |
| 664 | PT.call(BSSGP_get_bvci_ct:{bvci}) { |
| 665 | [] PT.getreply(BSSGP_get_bvci_ct:{bvci})-> value res { |
| 666 | return res; |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | /*********************************************************************** |
| 672 | * per-BVC (Cell) Component |
| 673 | *********************************************************************** |
| 674 | * Any number of these components runs on top of the BSSGP_CT, each |
| 675 | * representing one PTP BVC within this NSE. Users (test cases) can |
| 676 | * register with TLLI and/or IMSI via the procedure port. |
| 677 | ***********************************************************************/ |
| 678 | |
| 679 | /* per-BVC component. Exists once per cell within a BSSGP_CT */ |
| 680 | type component BSSGP_BVC_CT { |
| 681 | /* port towards the underlying BSSGP_CT */ |
| 682 | port BSSGP_BVC_PT BVC; |
| 683 | |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 684 | /* port to a management instance */ |
| 685 | port BSSGP_BVC_MGMT_SP_PT MGMT; |
| 686 | |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 687 | /* per-BVC global port for e.g. BVC Flow Control */ |
| 688 | port BSSGP_SP_PT GLOBAL; |
| 689 | |
| 690 | /* BSSGP-User SAP towards the user (per-TLLI, Client) */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 691 | port BSSGP_SP_PT BSSGP_SP; |
Stefan Sperling | f82bbb6 | 2018-05-03 19:14:28 +0200 | [diff] [blame] | 692 | port BSSGP_SP_PT BSSGP_SP_SIG; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 693 | port BSSGP_PROC_PT BSSGP_PROC; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 694 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 695 | var BssgpBvcConfig g_cfg; |
| 696 | var boolean g_sgsn_role; |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 697 | var Nsei g_nsei; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 698 | |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 699 | /* default Link Selector Parameter for this BVC (for traffic unrelated to a TLLI) */ |
| 700 | var integer g_bvc_lsp; |
| 701 | |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 702 | var BvcState g_ptp_bvc_state := BVC_S_BLOCKED; |
| 703 | timer g_T1 := 15.0; |
| 704 | timer g_T2 := 60.0; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 705 | var boolean g_t1_waits_for_block_ack := false; |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 706 | /* for re-transmissions */ |
| 707 | var BssgpCause g_last_block_cause; |
| 708 | var BssgpCause g_last_reset_cause; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 709 | |
Harald Welte | 633805b | 2021-02-03 17:47:18 +0100 | [diff] [blame] | 710 | var ClientEntity ClientTable[64]; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 711 | }; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 712 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 713 | /* port between global BSSGP_CT and per-BVC BSSGP_BVC_CT */ |
| 714 | type port BSSGP_BVC_SP_PT message { |
| 715 | in NsUnitdataRequest; |
| 716 | out ASP_Event, |
| 717 | BssgpStatusIndication, |
| 718 | BssgpResetIndication, |
| 719 | NsUnitdataIndication; |
| 720 | } with { extension "internal" }; |
| 721 | type port BSSGP_BVC_PT message { |
| 722 | in ASP_Event, |
| 723 | BssgpStatusIndication, |
| 724 | BssgpResetIndication, |
| 725 | NsUnitdataIndication; |
| 726 | out NsUnitdataRequest; |
| 727 | } with { extension "internal" }; |
Alexander Couzens | 6b449fb | 2018-07-31 14:19:36 +0200 | [diff] [blame] | 728 | |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 729 | /* port between BSSGP_BVC_CT and a management instance */ |
| 730 | type port BSSGP_BVC_MGMT_SP_PT message { |
| 731 | in BssgpResetRequest, |
| 732 | BssgpBlockRequest, |
| 733 | BssgpUnblockRequest; |
| 734 | out BssgpStatusIndication, |
| 735 | BssgpResetIndication; |
| 736 | } with { extension "internal" }; |
| 737 | type port BSSGP_BVC_MGMT_PT message { |
| 738 | in BssgpStatusIndication, |
| 739 | BssgpResetIndication; |
| 740 | out BssgpResetRequest, |
| 741 | BssgpBlockRequest, |
| 742 | BssgpUnblockRequest; |
| 743 | } with { extension "internal" }; |
| 744 | |
| 745 | type record BssgpResetRequest { |
| 746 | BssgpCause cause |
| 747 | }; |
| 748 | type record BssgpBlockRequest { |
| 749 | BssgpCause cause |
| 750 | }; |
| 751 | type record BssgpUnblockRequest { |
| 752 | }; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 753 | |
| 754 | /* one element in the per-TLLI state table */ |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 755 | type record ClientEntity { |
| 756 | OCT4 tlli, |
| 757 | OCT4 tlli_old optional, |
| 758 | hexstring imsi, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 759 | BSSGP_Client_CT comp_ref, |
| 760 | /* LLC entities, one for each SAPI */ |
| 761 | LLC_Entity llc[16] |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 762 | }; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 763 | type record LLC_Entity { |
| 764 | boolean sgsn_role, |
| 765 | /* N(U) on transmit side for next PDU */ |
| 766 | uint9_t n_u_tx_next, |
| 767 | /* N(U) on receive side, last PDU */ |
| 768 | uint9_t n_u_rx_last optional |
| 769 | }; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 770 | type record length(16) of LLC_Entity LLC_Entities; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 771 | |
Harald Welte | f536524 | 2021-01-17 13:46:57 +0100 | [diff] [blame] | 772 | private template PDU_BSSGP tr_GLOBAL_PTP := ( |
| 773 | {pDU_BSSGP_STATUS:=?} |
| 774 | ); |
| 775 | |
Alexander Couzens | cdfb751 | 2018-07-31 15:37:14 +0200 | [diff] [blame] | 776 | function f_llc_create(boolean sgsn_role := false) return LLC_Entities { |
| 777 | var LLC_Entities llc; |
| 778 | for (var integer i := 0; i < 16; i := i+1) { |
| 779 | llc[i] := valueof(t_LLC_init(sgsn_role)); |
| 780 | } |
| 781 | return llc; |
| 782 | } |
| 783 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 784 | private template LLC_Entity t_LLC_init(boolean sgsn_role := false) := { |
| 785 | sgsn_role := sgsn_role, |
| 786 | n_u_tx_next := 0, |
| 787 | n_u_rx_last := - |
| 788 | } |
| 789 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 790 | /* configuration of BSSGP_CT */ |
| 791 | type record BssgpConfig { |
| 792 | Nsvci nsei, |
| 793 | boolean sgsn_role, |
| 794 | BssgpBvcConfigs bvc |
| 795 | }; |
| 796 | /* Configuration of one BVC (Cell) BSSGP_BVC_CT */ |
| 797 | type record BssgpBvcConfig { |
| 798 | BssgpBvci bvci, |
| 799 | BssgpCellId cell_id, |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 800 | BssgpDecodeDepth depth, |
| 801 | BssgpCreateCallback create_cb |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 802 | }; |
| 803 | type record of BssgpBvcConfig BssgpBvcConfigs; |
Oliver Smith | aac9b9c | 2019-09-02 08:36:36 +0200 | [diff] [blame] | 804 | type enumerated BssgpDecodeDepth { |
| 805 | BSSGP_DECODE_DEPTH_BSSGP, |
| 806 | BSSGP_DECODE_DEPTH_LLC, |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 807 | BSSGP_DECODE_DEPTH_SNDCP |
| 808 | #ifdef BSSGP_EM_L3 |
| 809 | , |
Oliver Smith | aac9b9c | 2019-09-02 08:36:36 +0200 | [diff] [blame] | 810 | BSSGP_DECODE_DEPTH_L3 |
Harald Welte | 93331e7 | 2020-09-12 20:51:05 +0200 | [diff] [blame] | 811 | #endif |
Oliver Smith | aac9b9c | 2019-09-02 08:36:36 +0200 | [diff] [blame] | 812 | }; |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 813 | /* call-back function type: Called for inbound BSSGP for unknown TLLIs; could create BSSGP_ClienT_CT */ |
| 814 | type function BssgpCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT; |
| 815 | |
| 816 | /* Default Create Callback function: Fail and terminate */ |
| 817 | function DefaultCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT { |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 818 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Couldn't find Component for TLLI ", tlli)); |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 819 | } |
Oliver Smith | aac9b9c | 2019-09-02 08:36:36 +0200 | [diff] [blame] | 820 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 821 | /* |
| 822 | private function f_tbl_init() runs on BSSGP_BVC_CT { |
| 823 | var integer i; |
| 824 | for (i := 0; i < sizeof(ImsiTable); i := i+1) { |
| 825 | ImsiTable[i] := -; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 826 | } |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 827 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 828 | for (i := 0; i < sizeof(TlliTable); i := i+1) { |
| 829 | TlliTable[i] := -; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 830 | } |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 831 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 832 | */ |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 833 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 834 | private function f_tbl_client_add(hexstring imsi, OCT4 tlli, BSSGP_Client_CT vc_conn) |
| 835 | runs on BSSGP_BVC_CT { |
| 836 | var integer i; |
| 837 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 838 | if (not isvalue(ClientTable[i].comp_ref)) { |
| 839 | log("Adding Client=", vc_conn, ", IMSI=", imsi, ", TLLI=", tlli, ", index=", i); |
| 840 | ClientTable[i] := { |
| 841 | tlli := tlli, |
| 842 | tlli_old := omit, |
| 843 | imsi := imsi, |
| 844 | comp_ref := vc_conn, |
| 845 | llc := - |
| 846 | }; |
| 847 | for (var integer j := 0; j < sizeof(ClientTable[i].llc); j := j+1) { |
| 848 | ClientTable[i].llc[j] := valueof(t_LLC_init(g_sgsn_role)); |
| 849 | } |
| 850 | return; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 851 | } |
| 852 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 853 | testcase.stop("Client Table full"); |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 854 | } |
| 855 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 856 | private function f_tbl_client_del(hexstring imsi, BSSGP_Client_CT vc_conn) runs on BSSGP_BVC_CT { |
| 857 | var integer i; |
| 858 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 859 | if (isvalue(ClientTable[i].imsi) and ClientTable[i].imsi == imsi) { |
| 860 | if (ClientTable[i].comp_ref != vc_conn) { |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 861 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 862 | log2str("Cannot unregister index=", i, " IMSI ", |
| 863 | imsi, " registred to ", ClientTable[i].comp_ref, |
| 864 | " from ", vc_conn)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 865 | } |
| 866 | log("Removing Client IMSI=", imsi, ", index=", i); |
| 867 | ClientTable[i] := { |
| 868 | tlli := -, |
| 869 | tlli_old := omit, |
| 870 | imsi := ''H, |
| 871 | comp_ref := null, |
| 872 | llc := - }; |
| 873 | return; |
| 874 | } |
| 875 | } |
| 876 | log("Warning: Could not find client for IMSI ", imsi); |
| 877 | return; |
| 878 | } |
| 879 | |
| 880 | /* TS 44.064 7.2.1.1 LLGMM-ASSIGN */ |
| 881 | private function f_tbl_client_llgmm_assign(OCT4 tlli_old, OCT4 tlli_new, BSSGP_Client_CT vc_conn) |
| 882 | runs on BSSGP_BVC_CT { |
| 883 | var integer i := f_tbl_idx_by_comp(vc_conn); |
| 884 | |
| 885 | if (tlli_old == 'FFFFFFFF'O and tlli_new != 'FFFFFFFF'O) { |
| 886 | /* TLLI assignment */ |
| 887 | ClientTable[i].tlli := tlli_new; |
| 888 | ClientTable[i].tlli_old := omit; |
| 889 | } else if (tlli_old != 'FFFFFFFF'O and tlli_new != 'FFFFFFFF'O) { |
| 890 | /* TLLI change: both active */ |
| 891 | ClientTable[i].tlli := tlli_new; |
| 892 | ClientTable[i].tlli_old := tlli_old; |
| 893 | } else if (tlli_old != 'FFFFFFFF'O and tlli_new == 'FFFFFFFF'O) { |
| 894 | /* TLLI unassignment: old shall be unassigned; new stays */ |
| 895 | ClientTable[i].tlli_old := omit; |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | private function f_tbl_comp_by_imsi(hexstring imsi) runs on BSSGP_BVC_CT return BSSGP_Client_CT { |
| 900 | var integer i; |
| 901 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 902 | if (isvalue(ClientTable[i].imsi) and isvalue(ClientTable[i].comp_ref) |
| 903 | and ClientTable[i].imsi == imsi) { |
| 904 | return ClientTable[i].comp_ref; |
| 905 | } |
| 906 | } |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 907 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Couldn't find Component for IMSI ", imsi)); |
| 908 | return ClientTable[0].comp_ref; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 909 | } |
| 910 | |
| 911 | private function f_tbl_comp_by_tlli(OCT4 tlli) runs on BSSGP_BVC_CT return BSSGP_Client_CT { |
| 912 | var integer i; |
| 913 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 914 | if (isvalue(ClientTable[i].comp_ref) and |
| 915 | (isvalue(ClientTable[i].tlli) and (ClientTable[i].tlli == tlli or |
| 916 | isvalue(ClientTable[i].tlli_old) and ClientTable[i].tlli_old == tlli) )) { |
| 917 | return ClientTable[i].comp_ref; |
| 918 | } |
| 919 | } |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 920 | return null; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | private function f_tbl_idx_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_BVC_CT return integer { |
| 924 | var integer i; |
| 925 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 926 | if (isvalue(ClientTable[i].comp_ref) and ClientTable[i].comp_ref == comp_ref) { |
| 927 | return i; |
| 928 | } |
| 929 | } |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 930 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Couldn't find Client for Component ", comp_ref)); |
| 931 | return 1; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | private function f_tbl_tlli_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_BVC_CT return OCT4 { |
| 935 | var integer i; |
| 936 | for (i := 0; i < sizeof(ClientTable); i := i+1) { |
| 937 | if (isvalue(ClientTable[i].tlli) and isvalue(ClientTable[i].comp_ref) |
| 938 | and ClientTable[i].comp_ref == comp_ref) { |
| 939 | return ClientTable[i].tlli; |
| 940 | } |
| 941 | } |
Pau Espin Pedrol | 011e32f | 2021-02-05 12:07:04 +0100 | [diff] [blame] | 942 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Couldn't find TLLI for Component ", comp_ref)); |
| 943 | return '00000000'O; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 944 | } |
| 945 | |
| 946 | /* PDU_BSSGP enhanced with LLC and possibly L3 decoded payloads */ |
| 947 | type record BssgpDecoded { |
| 948 | PDU_BSSGP bssgp, |
| 949 | PDU_LLC llc optional, |
| 950 | #ifdef BSSGP_EM_L3 |
| 951 | PDU_L3_MS_SGSN l3_mo optional, |
| 952 | PDU_L3_SGSN_MS l3_mt optional, |
| 953 | #endif |
| 954 | PDU_SN sndcp optional |
| 955 | } |
| 956 | |
| 957 | /* Decode a PDU_BSSGP into a BssgpDecoded (i.e. with LLC/L3 decoded, as applicable) */ |
| 958 | private function f_dec_bssgp(PDU_BSSGP bssgp) runs on BSSGP_BVC_CT return BssgpDecoded { |
| 959 | var BssgpDecoded dec := { |
| 960 | bssgp := bssgp, |
| 961 | llc := omit, |
| 962 | #ifdef BSSGP_EM_L3 |
| 963 | l3_mo := omit, |
| 964 | l3_mt := omit, |
| 965 | #endif |
| 966 | sndcp := omit |
| 967 | }; |
| 968 | |
| 969 | /* Decode LLC, if it is a PDU that contains LLC */ |
| 970 | if (g_cfg.depth >= BSSGP_DECODE_DEPTH_LLC) { |
| 971 | if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) { |
| 972 | dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_DL_UNITDATA.lLC_PDU.lLC_PDU); |
| 973 | } else if (ischosen(bssgp.pDU_BSSGP_UL_UNITDATA)) { |
| 974 | dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_UL_UNITDATA.lLC_PDU.lLC_PDU); |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | /* Decode SNDCP, if it is a LLC PDU containing user plane data */ |
| 979 | if (g_cfg.depth >= BSSGP_DECODE_DEPTH_SNDCP) { |
| 980 | if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_USER)) { |
| 981 | dec.sndcp := dec_PDU_SN(dec.llc.pDU_LLC_UI.information_field_UI); |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | #ifdef BSSGP_EM_L3 |
| 986 | /* Decode L3, if it is a LLC PDU containing L3 */ |
| 987 | if (g_cfg.depth >= BSSGP_DECODE_DEPTH_L3) { |
| 988 | if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_L3)) { |
| 989 | if (g_sgsn_role) { |
| 990 | dec.l3_mo := dec_PDU_L3_MS_SGSN(dec.llc.pDU_LLC_UI.information_field_UI); |
| 991 | } else { |
| 992 | dec.l3_mt := dec_PDU_L3_SGSN_MS(dec.llc.pDU_LLC_UI.information_field_UI); |
| 993 | } |
| 994 | } |
| 995 | } |
| 996 | #endif |
| 997 | |
| 998 | return dec; |
| 999 | } |
| 1000 | |
| 1001 | private function f_ptp_sendUnblock() runs on BSSGP_BVC_CT { |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1002 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_UNBLOCK(g_cfg.bvci), 0, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1003 | g_t1_waits_for_block_ack := false; |
| 1004 | g_T1.start; |
| 1005 | } |
| 1006 | |
| 1007 | private function f_ptp_sendBlock(BssgpCause cause) runs on BSSGP_BVC_CT { |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1008 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_BLOCK(g_cfg.bvci, cause), 0, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1009 | g_t1_waits_for_block_ack := true; |
| 1010 | g_T1.start; |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1011 | g_last_block_cause := cause; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
| 1014 | private function f_ptp_sendStatus(BssgpCause cause, PDU_BSSGP pdu) runs on BSSGP_BVC_CT { |
| 1015 | /* FIXME: Make sure correct Signaling or PTP BVCI is used! */ |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1016 | BVC.send(ts_ptp_BnsUdReq(ts_BSSGP_STATUS(g_cfg.bvci, cause, pdu), g_cfg.bvci, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1017 | } |
| 1018 | |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1019 | private function f_ptp_sendReset(BssgpCause cause := BSSGP_CAUSE_OM_INTERVENTION) runs on BSSGP_BVC_CT { |
Harald Welte | c967d0e | 2020-09-14 16:07:26 +0200 | [diff] [blame] | 1020 | var PDU_BSSGP pdu; |
| 1021 | |
| 1022 | /* The Cell Identifier IE is mandatory in the BVC-RESET PDU sent from BSS to |
| 1023 | * SGSN in order to reset a BVC corresponding to a PTP functional entity. The |
| 1024 | * Cell Identifier IE shall not be used in any other BVC-RESET PDU. */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1025 | if (g_sgsn_role) { |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1026 | pdu := valueof(ts_BVC_RESET(cause, g_cfg.bvci, omit)); |
Harald Welte | c967d0e | 2020-09-14 16:07:26 +0200 | [diff] [blame] | 1027 | } else { |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1028 | pdu := valueof(ts_BVC_RESET(cause, g_cfg.bvci, g_cfg.cell_id)); |
Harald Welte | c967d0e | 2020-09-14 16:07:26 +0200 | [diff] [blame] | 1029 | } |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 1030 | |
| 1031 | /* BVC-RESET is always sent via the SIGNALLING BVCI, see Table 5.4.1 */ |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1032 | BVC.send(ts_ptp_BnsUdReq(pdu, 0, g_bvc_lsp)); |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 1033 | g_T2.start; |
| 1034 | //f_change_state(BVC_S_WAIT_RESET); |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1035 | g_last_reset_cause := cause; |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 1036 | } |
| 1037 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1038 | /* PTP-BVC is in BVC_S_BLOCKED state */ |
| 1039 | private altstep as_ptp_blocked() runs on BSSGP_BVC_CT { |
| 1040 | var NsUnitdataIndication udi; |
| 1041 | |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1042 | [g_T1.running and not g_t1_waits_for_block_ack] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_UNBLOCK_ACK(g_cfg.bvci), 0)) { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1043 | g_T1.stop; |
| 1044 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1045 | } |
| 1046 | |
Harald Welte | ddfc667 | 2020-11-24 23:13:01 +0100 | [diff] [blame] | 1047 | /* Inbound BVC-UNBLOCK from peer */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1048 | [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_UNBLOCK(g_cfg.bvci), 0)) { |
| 1049 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_UNBLOCK_ACK(g_cfg.bvci), 0, g_bvc_lsp)); |
Harald Welte | ddfc667 | 2020-11-24 23:13:01 +0100 | [diff] [blame] | 1050 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1051 | } |
| 1052 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1053 | /* RESET-ACK before T2 timeout: reset successful. In SGSN role, CellID must be present */ |
| 1054 | [g_T2.running and g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET_ACK(g_cfg.bvci, g_cfg.cell_id), 0)) -> value udi { |
| 1055 | g_T2.stop; |
| 1056 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1057 | } |
| 1058 | /* RESET-ACK before T2 timeout: reset successful. In BSS role, CellID must be absent */ |
| 1059 | [g_T2.running and not g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET_ACK(g_cfg.bvci, omit), 0)) -> value udi { |
| 1060 | g_T2.stop; |
| 1061 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1062 | } |
| 1063 | |
Harald Welte | ab50cc2 | 2020-11-25 17:11:08 +0100 | [diff] [blame] | 1064 | [] as_ptp_handle_inbound_reset(); |
| 1065 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1066 | [] g_T2.timeout { |
| 1067 | /* BVC-RESET-ACK PDU was not received within T2: retransmit */ |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1068 | f_ptp_sendReset(g_last_reset_cause); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1069 | } |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1070 | |
| 1071 | [] MGMT.receive(BssgpUnblockRequest:?) { |
| 1072 | f_ptp_sendUnblock(); |
| 1073 | } |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 1074 | } |
| 1075 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1076 | /* PTP-BVC is in UNBLOCKED state */ |
| 1077 | private altstep as_ptp_unblocked() runs on BSSGP_BVC_CT { |
| 1078 | var NsUnitdataIndication udi; |
| 1079 | var NsStatusIndication nsi; |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1080 | var BssgpBlockRequest bbr; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1081 | var BSSGP_Client_CT vc_conn; |
| 1082 | var ASP_Event evt; |
| 1083 | var PDU_BSSGP bs_pdu; |
| 1084 | var PDU_LLC llc; |
| 1085 | #ifdef BSSGP_EM_L3 |
| 1086 | var PDU_L3_MS_SGSN l3_mo; |
| 1087 | var PDU_L3_SGSN_MS l3_mt; |
| 1088 | #endif |
| 1089 | |
| 1090 | /* bogus unblock, just respond with ACK */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1091 | [] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_UNBLOCK(g_cfg.bvci), 0)) -> value udi { |
| 1092 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_UNBLOCK_ACK(g_cfg.bvci), 0, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1093 | } |
| 1094 | /* Respond to BLOCK with BLOCK-ACK + change state */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1095 | [] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_BLOCK(g_cfg.bvci, ?), 0)) -> value udi { |
| 1096 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_BLOCK_ACK(g_cfg.bvci), 0, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1097 | g_T1.stop; |
| 1098 | f_ptp_change_state(BVC_S_BLOCKED); |
| 1099 | } |
| 1100 | /* BLOCK-ACK before T1 timeout: mark as blocked */ |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1101 | [g_T1.running and g_t1_waits_for_block_ack] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_BLOCK_ACK(g_cfg.bvci), 0)) -> value udi { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1102 | g_T1.stop; |
| 1103 | f_ptp_change_state(BVC_S_BLOCKED); |
| 1104 | } |
| 1105 | /* Re-transmit BLOCK / UNBLOCK on T1 timeout */ |
| 1106 | [not g_t1_waits_for_block_ack] g_T1.timeout { |
| 1107 | f_ptp_sendUnblock(); |
| 1108 | } |
| 1109 | [g_t1_waits_for_block_ack] g_T1.timeout { |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1110 | f_ptp_sendBlock(g_last_block_cause); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1111 | } |
| 1112 | |
Harald Welte | ab50cc2 | 2020-11-25 17:11:08 +0100 | [diff] [blame] | 1113 | [] as_ptp_handle_inbound_reset(); |
| 1114 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1115 | [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_FC_BVC, g_cfg.bvci)) -> value udi { |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1116 | if (GLOBAL.checkstate("Connected")) { |
| 1117 | GLOBAL.send(udi.bssgp); |
| 1118 | } else { |
| 1119 | /* simply acknowledge all per-BVC Flow Control Messages */ |
| 1120 | var OCT1 tag := udi.bssgp.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value; |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1121 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_FC_BVC_ACK(tag), g_cfg.bvci, g_bvc_lsp)); |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1122 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1123 | } |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1124 | |
Pau Espin Pedrol | 6ee0126 | 2021-02-05 13:05:06 +0100 | [diff] [blame] | 1125 | [not g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_FC_BVC_ACK(?), g_cfg.bvci)) -> value udi { |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1126 | if (GLOBAL.checkstate("Connected")) { |
| 1127 | GLOBAL.send(udi.bssgp); |
| 1128 | } else { |
| 1129 | /* ignore any incoming flow control ACK */ |
| 1130 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1131 | } |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1132 | |
Harald Welte | f536524 | 2021-01-17 13:46:57 +0100 | [diff] [blame] | 1133 | [] BVC.receive(tr_ptp_BnsUdInd(tr_GLOBAL_PTP, g_cfg.bvci)) -> value udi { |
| 1134 | if (GLOBAL.checkstate("Connected")) { |
| 1135 | GLOBAL.send(udi.bssgp); |
| 1136 | } else { |
| 1137 | setverdict(fail, "Received BSSGP STATUS ", udi.bssgp); |
| 1138 | } |
| 1139 | } |
| 1140 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1141 | /* Any other PTP BSSGP message: If it has TLLI, route to component; otherwise broadcast */ |
| 1142 | [] BVC.receive(tr_ptp_BnsUdInd(?, g_cfg.bvci)) -> value udi { |
| 1143 | var BssgpDecoded dec := f_dec_bssgp(udi.bssgp); |
| 1144 | var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp); |
| 1145 | if (isvalue(tlli)) { |
| 1146 | vc_conn := f_tbl_comp_by_tlli(valueof(tlli)); |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 1147 | if (vc_conn == null) { |
| 1148 | g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec); |
| 1149 | } else { |
| 1150 | f_send_bssgp_dec(dec, vc_conn, BSSGP_SP); |
| 1151 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1152 | } else { |
| 1153 | log("No TLLI: Broadcasting ", dec); |
| 1154 | /* broadcast this message to all components */ |
| 1155 | // TITAN DOESN'T DO THIS, *SIGH*: "BSSGP_SP.send(dec) to all component;" |
| 1156 | for (var integer i := 0; i < sizeof(ClientTable); i := i+1) { |
| 1157 | if (isbound(ClientTable[i].comp_ref) and ClientTable[i].comp_ref != null) { |
| 1158 | f_send_bssgp_dec(dec, ClientTable[i].comp_ref, BSSGP_SP); |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | } |
| 1163 | |
| 1164 | /* Any other SIG BSSGP message: If it has TLLI, route to component; otherwise broadcast */ |
| 1165 | [] BVC.receive(tr_ptp_BnsUdInd(?, 0)) -> value udi { |
| 1166 | var BssgpDecoded dec := f_dec_bssgp(udi.bssgp); |
| 1167 | var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp); |
| 1168 | if (isvalue(tlli)) { |
| 1169 | vc_conn := f_tbl_comp_by_tlli(valueof(tlli)); |
Harald Welte | 4d112c9 | 2020-11-12 19:48:31 +0100 | [diff] [blame] | 1170 | if (vc_conn == null) { |
| 1171 | g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec); |
| 1172 | } else { |
| 1173 | f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG); |
| 1174 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1175 | } else { |
| 1176 | log("No TLLI: Broadcasting ", dec); |
| 1177 | /* broadcast this message to all components */ |
| 1178 | // TITAN DOESN'T DO THIS, *SIGH*: "BSSGP_SP.send(dec) to all component;" |
| 1179 | for (var integer i := 0; i < sizeof(ClientTable); i := i+1) { |
| 1180 | if (isbound(ClientTable[i].comp_ref) and ClientTable[i].comp_ref != null) { |
| 1181 | f_send_bssgp_dec(dec, ClientTable[i].comp_ref, BSSGP_SP_SIG); |
| 1182 | } |
| 1183 | } |
| 1184 | } |
| 1185 | } |
| 1186 | |
| 1187 | /* ConnHdlr sends BSSGP on BVCI=0 port: forward it to BSSGP_CT */ |
| 1188 | [] BSSGP_SP_SIG.receive(PDU_BSSGP:?)-> value bs_pdu sender vc_conn { |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1189 | BVC.send(ts_ptp_BnsUdReq(bs_pdu, 0, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1190 | } |
| 1191 | |
| 1192 | /* ConnHdlr sends BSSGP on BVCI=PTP port: forward it to BSSGP_CT */ |
| 1193 | [] BSSGP_SP.receive(PDU_BSSGP:?)-> value bs_pdu sender vc_conn { |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1194 | BVC.send(ts_ptp_BnsUdReq(bs_pdu, g_cfg.bvci, g_bvc_lsp)); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1195 | } |
| 1196 | |
| 1197 | #ifdef BSSGP_EM_L3 |
| 1198 | /* ConnHdlr sends L3: Encode and send as UL_UD / DL_UD */ |
| 1199 | [g_sgsn_role] BSSGP_SP.receive(PDU_L3_SGSN_MS:?) -> value l3_mt sender vc_conn { |
| 1200 | var integer idx := f_tbl_idx_by_comp(vc_conn); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1201 | var OCT4 tlli := ClientTable[idx].tlli; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1202 | var octetstring l3_enc := enc_PDU_L3_SGSN_MS(l3_mt); |
| 1203 | var BIT4 sapi := f_llc_sapi_by_l3_mt(l3_mt); |
| 1204 | var integer n_u := f_llc_get_n_u_tx(ClientTable[idx].llc[bit2int(sapi)]); |
| 1205 | var octetstring llc_enc := enc_PDU_LLC(valueof(ts_LLC_UI(l3_enc, sapi, '1'B, n_u))); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1206 | BVC.send(ts_ptp_BnsUdReq(ts_BSSGP_DL_UD(tlli, llc_enc), g_cfg.bvci, oct2int(tlli))); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1207 | } |
| 1208 | [not g_sgsn_role] BSSGP_SP.receive(PDU_L3_MS_SGSN:?) -> value l3_mo sender vc_conn { |
| 1209 | var integer idx := f_tbl_idx_by_comp(vc_conn); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1210 | var OCT4 tlli := ClientTable[idx].tlli; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1211 | var octetstring l3_enc := enc_PDU_L3_MS_SGSN(l3_mo); |
| 1212 | var BIT4 sapi := f_llc_sapi_by_l3_mo(l3_mo); |
| 1213 | var integer n_u := f_llc_get_n_u_tx(ClientTable[idx].llc[bit2int(sapi)]); |
| 1214 | var octetstring llc_enc := enc_PDU_LLC(valueof(ts_LLC_UI(l3_enc, sapi, '1'B, n_u))); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1215 | BVC.send(ts_ptp_BnsUdReq(ts_BSSGP_UL_UD(tlli, g_cfg.cell_id, llc_enc), g_cfg.bvci, oct2int(tlli))); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1216 | } |
| 1217 | #endif |
| 1218 | |
| 1219 | /* ConnHdlr sends raw LLC: Encode and send as UL_UD / DL_UD */ |
| 1220 | [not g_sgsn_role] BSSGP_SP.receive(PDU_LLC:?) -> value llc sender vc_conn { |
| 1221 | var integer idx := f_tbl_idx_by_comp(vc_conn); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1222 | var OCT4 tlli := ClientTable[idx].tlli; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1223 | var octetstring llc_enc := enc_PDU_LLC(llc); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1224 | BVC.send(ts_ptp_BnsUdReq(ts_BSSGP_UL_UD(tlli, g_cfg.cell_id, llc_enc), g_cfg.bvci, oct2int(tlli))); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1225 | } |
| 1226 | [g_sgsn_role] BSSGP_SP.receive(PDU_LLC:?) -> value llc sender vc_conn { |
| 1227 | var integer idx := f_tbl_idx_by_comp(vc_conn); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1228 | var OCT4 tlli := ClientTable[idx].tlli; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1229 | var octetstring llc_enc := enc_PDU_LLC(llc); |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1230 | BVC.send(ts_ptp_BnsUdReq(ts_BSSGP_DL_UD(tlli, llc_enc), g_cfg.bvci, oct2int(tlli))); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1231 | } |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1232 | |
Harald Welte | 71449b0 | 2020-12-09 11:58:23 +0100 | [diff] [blame] | 1233 | /* Testcase sends us BSSGP on global port */ |
| 1234 | [] GLOBAL.receive(PDU_BSSGP:?)-> value bs_pdu sender vc_conn { |
| 1235 | BVC.send(ts_ptp_BnsUdReq(bs_pdu, g_cfg.bvci, g_bvc_lsp)); |
| 1236 | } |
| 1237 | |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1238 | [] MGMT.receive(BssgpBlockRequest:?) -> value bbr { |
| 1239 | f_ptp_sendBlock(bbr.cause); |
| 1240 | } |
Harald Welte | 853c0ad | 2018-02-15 17:45:29 +0100 | [diff] [blame] | 1241 | } |
| 1242 | |
Harald Welte | ab50cc2 | 2020-11-25 17:11:08 +0100 | [diff] [blame] | 1243 | private altstep as_ptp_handle_inbound_reset() runs on BSSGP_BVC_CT { |
| 1244 | var NsUnitdataIndication udi; |
| 1245 | /* we are a SGSN: BSS/PCU-originated RESET must have a cell ID */ |
| 1246 | [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, g_cfg.cell_id), 0)) -> value udi { |
| 1247 | log("Rx BVC-RESET from BVCI=", g_cfg.bvci); |
Harald Welte | 3c90515 | 2020-11-26 20:56:09 +0100 | [diff] [blame] | 1248 | if (MGMT.checkstate("Connected")) { |
| 1249 | MGMT.send(BssgpResetIndication:{g_cfg.bvci}); |
| 1250 | } |
Harald Welte | ab50cc2 | 2020-11-25 17:11:08 +0100 | [diff] [blame] | 1251 | /* Respond to RESET with correct BVCI but without CellID */ |
| 1252 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, omit), 0, g_bvc_lsp)); |
| 1253 | /* FIXME: reset all state? What about clients? */ |
| 1254 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1255 | } |
| 1256 | /* we are a BSS/PCU: SGSN-originated RESET must not have a cell ID */ |
| 1257 | [not g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, omit), 0)) -> value udi { |
| 1258 | log("Rx BVC-RESET from BVCI=", g_cfg.bvci); |
Harald Welte | 3c90515 | 2020-11-26 20:56:09 +0100 | [diff] [blame] | 1259 | if (MGMT.checkstate("Connected")) { |
| 1260 | MGMT.send(BssgpResetIndication:{g_cfg.bvci}); |
| 1261 | } |
Harald Welte | ab50cc2 | 2020-11-25 17:11:08 +0100 | [diff] [blame] | 1262 | /* Respond to RESET with correct BVCI with CellID */ |
| 1263 | BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, g_cfg.cell_id), 0, g_bvc_lsp)); |
| 1264 | /* FIXME: reset all state? What about clients? */ |
| 1265 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1266 | } |
| 1267 | } |
| 1268 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1269 | /* Events permitted in all states */ |
| 1270 | private altstep as_ptp_allstate() runs on BSSGP_BVC_CT { |
| 1271 | var NsUnitdataIndication udi; |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1272 | var BssgpResetRequest brr; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1273 | var BSSGP_Client_CT vc_conn; |
| 1274 | var OCT4 tlli, tlli_old; |
| 1275 | var hexstring imsi; |
| 1276 | |
| 1277 | /* Signaling BVC was reset */ |
| 1278 | [] BVC.receive(BssgpResetIndication:{0}) { |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1279 | if (MGMT.checkstate("Connected")) { |
| 1280 | MGMT.send(BssgpResetIndication:{0}); |
| 1281 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1282 | if (not g_sgsn_role) { |
| 1283 | f_ptp_change_state(BVC_S_BLOCKED); |
| 1284 | /* when the BSS side signaling PTP is RESET, all PTP BVC must start the |
| 1285 | * reset procedure */ |
| 1286 | f_ptp_sendReset(); |
| 1287 | } else { |
| 1288 | f_ptp_change_state(BVC_S_UNBLOCKED); |
| 1289 | } |
| 1290 | } |
| 1291 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1292 | /* Ignore those for now */ |
| 1293 | [] BVC.receive(ASP_Event:?) { } |
| 1294 | [] BVC.receive(BssgpStatusIndication:?) { } |
| 1295 | |
| 1296 | /* catch-all */ |
| 1297 | [] BVC.receive(tr_ptp_BnsUdInd(?, 0)) -> value udi { |
| 1298 | setverdict(fail, "Received unexpected NS (SIG): ", udi); |
| 1299 | } |
| 1300 | [] BVC.receive(tr_ptp_BnsUdInd(?, ?)) -> value udi { |
| 1301 | setverdict(fail, "Received unexpected NS (PTP): ", udi); |
| 1302 | } |
| 1303 | [] BVC.receive { |
| 1304 | setverdict(fail, "Received unexpected message from BSSGP_CT"); |
| 1305 | } |
| 1306 | |
| 1307 | /* registration/deregistration of Clients (per-TLLI components) */ |
| 1308 | [] BSSGP_PROC.getcall(BSSGP_register_client:{?,?}) -> param(imsi, tlli) sender vc_conn { |
| 1309 | f_tbl_client_add(imsi, tlli, vc_conn); |
| 1310 | BSSGP_PROC.reply(BSSGP_register_client:{imsi, tlli}) to vc_conn; |
| 1311 | } |
| 1312 | [] BSSGP_PROC.getcall(BSSGP_unregister_client:{?}) -> param(imsi) sender vc_conn { |
| 1313 | f_tbl_client_del(imsi, vc_conn); |
| 1314 | BSSGP_PROC.reply(BSSGP_unregister_client:{imsi}) to vc_conn; |
| 1315 | } |
| 1316 | [] BSSGP_PROC.getcall(BSSGP_llgmm_assign:{?,?}) -> param(tlli_old, tlli) sender vc_conn { |
| 1317 | f_tbl_client_llgmm_assign(tlli_old, tlli, vc_conn); |
| 1318 | BSSGP_PROC.reply(BSSGP_llgmm_assign:{tlli_old, tlli}) to vc_conn; |
| 1319 | } |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1320 | |
| 1321 | [] MGMT.receive(BssgpResetRequest:?) -> value brr { |
Harald Welte | 52cecbb | 2020-11-25 21:57:31 +0100 | [diff] [blame] | 1322 | f_ptp_change_state(BVC_S_BLOCKED); |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1323 | f_ptp_sendReset(brr.cause); |
| 1324 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1325 | } |
| 1326 | |
| 1327 | /* main loop for per-BVC component */ |
| 1328 | private function f_bssgp_bvc_ScanEvents() runs on BSSGP_BVC_CT { |
| 1329 | while (true) { |
| 1330 | alt { |
| 1331 | [g_ptp_bvc_state == BVC_S_BLOCKED] as_ptp_blocked(); |
| 1332 | [g_ptp_bvc_state == BVC_S_UNBLOCKED] as_ptp_unblocked(); |
| 1333 | [] as_ptp_allstate(); |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | |
| 1338 | /* main function for per-BVC Component */ |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 1339 | private function f_bssgp_bvc_main(BssgpBvcConfig cfg, boolean sgsn_role, Nsei nsei, charstring id) runs on BSSGP_BVC_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1340 | g_cfg := cfg; |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 1341 | g_nsei := nsei; |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1342 | g_bvc_lsp := cfg.bvci; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1343 | g_sgsn_role := sgsn_role; |
| 1344 | f_bssgp_bvc_ScanEvents(); |
| 1345 | } |
| 1346 | |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1347 | template (value) NsUnitdataRequest ts_ptp_BnsUdReq(template (value) PDU_BSSGP pdu, template (value) BssgpBvci bvci, |
| 1348 | template (value) integer lsp) := { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1349 | bvci := bvci, |
| 1350 | nsei := 0, // overwritten in BSSGP_CT |
Harald Welte | c450552 | 2020-11-11 18:55:09 +0100 | [diff] [blame] | 1351 | lsp := lsp, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1352 | /* for some weird reason we get "Dynamic test case error: Text encoder: Encoding an |
| 1353 | * unbound integer value." when trying to send the reocrd rather than the octetstring */ |
| 1354 | //sdu := omit, |
| 1355 | //bssgp := valueof(pdu) |
| 1356 | sdu := enc_PDU_BSSGP(valueof(pdu)), |
| 1357 | bssgp := omit |
| 1358 | } |
| 1359 | |
| 1360 | template (present) NsUnitdataIndication tr_ptp_BnsUdInd(template (present) PDU_BSSGP pdu, template (present) BssgpBvci bvci) := { |
| 1361 | bvci := bvci, |
| 1362 | nsei := ?, |
Harald Welte | 80a249a | 2020-11-17 19:57:40 +0100 | [diff] [blame] | 1363 | nsvci := ?, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1364 | sdu := *, |
| 1365 | bssgp := pdu |
| 1366 | } |
| 1367 | |
| 1368 | /* change state of PTP BVC; broadcast state change to clients */ |
| 1369 | private function f_ptp_change_state(BvcState new_state) runs on BSSGP_BVC_CT { |
| 1370 | if (new_state == g_ptp_bvc_state) { |
| 1371 | return; |
| 1372 | } |
| 1373 | log("BVCI(", g_cfg.bvci, ") State Transition: ", g_ptp_bvc_state, " -> ", new_state); |
| 1374 | g_ptp_bvc_state := new_state; |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1375 | if (MGMT.checkstate("Connected")) { |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 1376 | MGMT.send(ts_BssgpStsInd(g_nsei, g_cfg.bvci, g_ptp_bvc_state)); |
Harald Welte | 199f386 | 2020-11-15 22:37:45 +0100 | [diff] [blame] | 1377 | } |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1378 | for (var integer i := 0; i < sizeof(ClientTable); i := i+1) { |
| 1379 | if (isbound(ClientTable[i].comp_ref) and ClientTable[i].comp_ref != null) { |
Harald Welte | fba7afd | 2020-11-24 23:12:31 +0100 | [diff] [blame] | 1380 | BSSGP_SP.send(ts_BssgpStsInd(g_nsei, g_cfg.bvci, g_ptp_bvc_state)) to ClientTable[i].comp_ref; |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1381 | } |
| 1382 | } |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 1383 | } |
| 1384 | |
| 1385 | /* attempt to extract the TLLI from a BSSGP PDU */ |
| 1386 | function f_bssgp_get_tlli(PDU_BSSGP bssgp) return template OCT4 { |
| 1387 | if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) { |
| 1388 | return bssgp.pDU_BSSGP_DL_UNITDATA.tLLI_current; |
| 1389 | } else if (ischosen(bssgp.pDU_BSSGP_UL_UNITDATA)) { |
| 1390 | return bssgp.pDU_BSSGP_UL_UNITDATA.tLLI; |
| 1391 | } else if (ischosen(bssgp.pDU_BSSGP_RA_CAPABILITY)) { |
| 1392 | return bssgp.pDU_BSSGP_RA_CAPABILITY.tLLI.tLLI_Value; |
| 1393 | } else if (ischosen(bssgp.pDU_BSSGP_RA_CAPABILITY_UPDATE)) { |
| 1394 | return bssgp.pDU_BSSGP_RA_CAPABILITY_UPDATE.tLLI.tLLI_Value; |
| 1395 | } else if (ischosen(bssgp.pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK)) { |
| 1396 | return bssgp.pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK.tLLI.tLLI_Value; |
Harald Welte | 650bd72 | 2021-01-17 10:58:56 +0100 | [diff] [blame] | 1397 | } else if (ischosen(bssgp.pDU_BSSGP_RADIO_STATUS) and |
| 1398 | ispresent(bssgp.pDU_BSSGP_RADIO_STATUS.tLLI)) { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 1399 | return bssgp.pDU_BSSGP_RADIO_STATUS.tLLI.tLLI_Value; |
| 1400 | } else if (ischosen(bssgp.pDU_BSSGP_SUSPEND)) { |
| 1401 | return bssgp.pDU_BSSGP_SUSPEND.tLLI.tLLI_Value; |
| 1402 | } else if (ischosen(bssgp.pDU_BSSGP_SUSPEND_ACK)) { |
| 1403 | return bssgp.pDU_BSSGP_SUSPEND_ACK.tLLI.tLLI_Value; |
| 1404 | } else if (ischosen(bssgp.pDU_BSSGP_SUSPEND_NACK)) { |
| 1405 | return bssgp.pDU_BSSGP_SUSPEND_NACK.tLLI.tLLI_Value; |
| 1406 | } else if (ischosen(bssgp.pDU_BSSGP_RESUME)) { |
| 1407 | return bssgp.pDU_BSSGP_RESUME.tLLI.tLLI_Value; |
| 1408 | } else if (ischosen(bssgp.pDU_BSSGP_RESUME_ACK)) { |
| 1409 | return bssgp.pDU_BSSGP_RESUME_ACK.tLLI.tLLI_Value; |
| 1410 | } else if (ischosen(bssgp.pDU_BSSGP_RESUME_NACK)) { |
| 1411 | return bssgp.pDU_BSSGP_RESUME_NACK.tLLI.tLLI_Value; |
| 1412 | } else if (ischosen(bssgp.pDU_BSSGP_FLUSH_LL)) { |
| 1413 | return bssgp.pDU_BSSGP_FLUSH_LL.tLLI.tLLI_Value; |
| 1414 | } else if (ischosen(bssgp.pDU_BSSGP_FLUSH_LL_ACK)) { |
| 1415 | return bssgp.pDU_BSSGP_FLUSH_LL_ACK.tLLI.tLLI_Value; |
| 1416 | } else if (ischosen(bssgp.pDU_BSSGP_LLC_DISCARDED)) { |
| 1417 | return bssgp.pDU_BSSGP_LLC_DISCARDED.tLLI.tLLI_Value; |
| 1418 | } else if (ischosen(bssgp.pDU_BSSGP_LLC_DISCARDED)) { |
| 1419 | return bssgp.pDU_BSSGP_LLC_DISCARDED.tLLI.tLLI_Value; |
| 1420 | } else if (ischosen(bssgp.pDU_BSSGP_PAGING_CS) and |
| 1421 | isvalue(bssgp.pDU_BSSGP_PAGING_CS.tLLI)) { |
| 1422 | return bssgp.pDU_BSSGP_PAGING_CS.tLLI.tLLI_Value; |
| 1423 | } else if (ischosen(bssgp.pDU_BSSGP_FLOW_CONTROL_MS)) { |
| 1424 | return bssgp.pDU_BSSGP_FLOW_CONTROL_MS.tLLI.tLLI_Value; |
| 1425 | } else if (ischosen(bssgp.pDU_BSSGP_FLOW_CONTROL_MS_ACK)) { |
| 1426 | return bssgp.pDU_BSSGP_FLOW_CONTROL_MS_ACK.tLLI.tLLI_Value; |
| 1427 | } |
| 1428 | /* TODO: Handover, PFC, LCS */ |
| 1429 | return omit; |
| 1430 | } |
| 1431 | |
Harald Welte | f70997d | 2018-02-17 10:11:19 +0100 | [diff] [blame] | 1432 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 1433 | |
Harald Welte | 1733a38 | 2017-07-23 17:26:17 +0200 | [diff] [blame] | 1434 | } |