Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* dual-faced port that wraps an Unixdomain port and encodes/decodes L1CTL |
| 2 | * (C) 2017-2019 Harald Welte <laforge@gnumonks.org> |
| 3 | * contributions by sysmocom - s.f.m.c. GmbH |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 12 | module L1CTL_PortType { |
| 13 | import from L1CTL_Types all; |
| 14 | import from UD_PortType all; |
Harald Welte | aaa0dfd | 2021-02-04 16:58:53 +0100 | [diff] [blame] | 15 | import from Socket_API_Definitions all; |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 16 | import from UD_Types all; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 17 | import from Osmocom_Types all; |
| 18 | import from GSM_Types all; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 19 | import from GSM_RR_Types all; |
Vadim Yanitskiy | 150d6d1 | 2022-10-20 19:10:04 +0700 | [diff] [blame] | 20 | import from GSM_RestOctets all; |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 21 | import from L1CTL_PortType_CtrlFunct all; |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 22 | |
| 23 | type record L1CTL_connect { |
| 24 | charstring path |
| 25 | } |
| 26 | |
| 27 | type record L1CTL_connect_result { |
| 28 | UD_Result_code result_code optional, |
| 29 | charstring err optional |
| 30 | } |
| 31 | |
Harald Welte | f68765d | 2017-08-20 22:54:57 +0200 | [diff] [blame] | 32 | modulepar { |
| 33 | charstring m_l1ctl_sock_path := "/tmp/osmocom_l2"; |
| 34 | } |
| 35 | |
Harald Welte | aaa0dfd | 2021-02-04 16:58:53 +0100 | [diff] [blame] | 36 | function f_L1CTL_getMsgLen(in octetstring stream, inout Socket_API_Definitions.ro_integer args) return integer { |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 37 | var integer stream_len := lengthof(stream); |
| 38 | var integer len; |
| 39 | if (stream_len < 2) { |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 40 | return -1; |
| 41 | } |
| 42 | len := 2 + oct2int(substr(stream, 0, 2)); |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 43 | return len; |
| 44 | } |
| 45 | |
Vadim Yanitskiy | e243ef6 | 2021-11-06 16:32:06 +0300 | [diff] [blame] | 46 | function f_L1CTL_rx_data(L1CTL_PT pt, |
| 47 | template (present) RslChannelNr chan_nr := ?, |
| 48 | template (present) RslLinkId link_id := ?) |
| 49 | return L1ctlDlMessage { |
| 50 | var L1ctlDlMessage dl; |
| 51 | timer T := 2.0; |
| 52 | |
| 53 | T.start; |
| 54 | alt { |
| 55 | [] pt.receive(tr_L1CTL_DATA_IND(chan_nr, link_id)) -> value dl { |
| 56 | return dl; |
| 57 | } |
| 58 | [] pt.receive { repeat; } |
| 59 | [] T.timeout { |
| 60 | setverdict(fail, "Timeout waiting for L1CTL DATA.ind"); |
| 61 | mtc.stop; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /* Unreachable, make TITAN happy */ |
| 66 | return dl; |
| 67 | } |
| 68 | |
Vadim Yanitskiy | 1acc7bb | 2020-11-14 04:24:57 +0700 | [diff] [blame] | 69 | function f_L1CTL_FBSB(L1CTL_PT pt, GsmBandArfcn arfcn, |
| 70 | L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED, |
| 71 | integer rxlev_exp := 57) |
| 72 | { |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 73 | timer T := 15.0; |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 74 | for (var integer i := 0; i < 10; i := i+1) { |
Stefan Sperling | 0258590 | 2018-08-30 17:03:50 +0200 | [diff] [blame] | 75 | var L1ctlDlMessage dl; |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 76 | pt.send(ts_L1CTL_FBSB_REQ(arfcn, valueof(t_L1CTL_FBSB_F_ALL), 0, ccch_mode, rxlev_exp)); |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 77 | T.start |
| 78 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 79 | [] pt.receive(tr_L1CTL_FBSB_CONF(0)) { return; }; |
Stefan Sperling | 0258590 | 2018-08-30 17:03:50 +0200 | [diff] [blame] | 80 | [i >= 9] pt.receive(tr_L1CTL_FBSB_CONF(?)) -> value dl { |
| 81 | setverdict(fail, "FBSB Failed with non-zero return code ", dl.payload.fbsb_conf.result); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 82 | mtc.stop; |
Harald Welte | 7d7d26c | 2018-02-22 18:52:28 +0100 | [diff] [blame] | 83 | }; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 84 | [] pt.receive(tr_L1CTL_FBSB_CONF(?)) { |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 85 | f_sleep(1.0); |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 86 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 87 | [] pt.receive { repeat; }; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 88 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 89 | setverdict(fail, "Timeout waiting for L1CTL_FBSB_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 90 | mtc.stop; |
Harald Welte | 3757e60 | 2018-03-10 17:12:02 +0100 | [diff] [blame] | 91 | }; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | function f_L1CTL_CCCH_MODE(L1CTL_PT pt, L1ctlCcchMode ccch_mode) { |
| 97 | timer T := 2.0; |
| 98 | pt.send(ts_L1CTL_CCCH_MODE_REQ(ccch_mode)); |
| 99 | T.start; |
| 100 | alt { |
| 101 | [] pt.receive(tr_L1CTL_CCCH_MODE_CONF) { } |
| 102 | [] pt.receive { repeat; } |
| 103 | [] T.timeout { |
Vadim Yanitskiy | de8af3d | 2019-06-12 01:34:05 +0700 | [diff] [blame] | 104 | setverdict(fail, "Timeout waiting for L1CTL_CCCH_MODE_CONF"); |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 105 | mtc.stop; |
Harald Welte | 8fe9eba | 2018-03-09 17:03:49 +0100 | [diff] [blame] | 106 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 107 | } |
| 108 | } |
| 109 | |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 110 | function f_L1CTL_TCH_MODE(L1CTL_PT pt, |
| 111 | template (value) L1ctlUlMessage tch_mode_req_tmpl := ts_L1CTL_TCH_MODE_REQ) { |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 112 | timer T := 2.0; |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 113 | pt.send(tch_mode_req_tmpl); |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 114 | T.start; |
| 115 | alt { |
| 116 | [] pt.receive(tr_L1CTL_MsgType(L1CTL_TCH_MODE_CONF)) { } |
| 117 | [] pt.receive { repeat; } |
| 118 | [] T.timeout { |
| 119 | setverdict(fail, "Timeout waiting for L1CTL_TCH_MODE_CONF"); |
| 120 | mtc.stop; |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
Vadim Yanitskiy | e432ba9 | 2019-05-31 18:44:13 +0700 | [diff] [blame] | 125 | function f_L1CTL_RACH(L1CTL_PT pt, uint8_t ra, uint8_t combined := 1, uint16_t offset := 0, |
| 126 | template (value) RslChannelNr chan_nr := ts_RslChanNr_RACH(0), |
| 127 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0)) |
| 128 | return GsmFrameNumber { |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 129 | var L1ctlDlMessage rc; |
| 130 | var GsmFrameNumber fn; |
| 131 | timer T := 2.0; |
| 132 | T.start |
Vadim Yanitskiy | e432ba9 | 2019-05-31 18:44:13 +0700 | [diff] [blame] | 133 | pt.send(ts_L1CTL_RACH_REQ(ra, combined, offset, chan_nr, link_id)) |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 134 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 135 | [] pt.receive(tr_L1CTL_RACH_CONF) -> value rc { fn := rc.dl_info.frame_nr }; |
| 136 | [] pt.receive { repeat; }; |
| 137 | [] T.timeout { |
| 138 | setverdict(fail, "Timeout waiting for L1CTL_RACH_CONF"); |
| 139 | mtc.stop; |
| 140 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 141 | } |
| 142 | return fn; |
| 143 | } |
| 144 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 145 | function f_L1CTL_EXT_RACH( |
| 146 | L1CTL_PT pt, uint16_t ra11, L1ctlRachSynchSeq seq, |
| 147 | uint8_t combined := 1, uint16_t offset := 0 |
| 148 | ) return GsmFrameNumber { |
| 149 | var L1ctlDlMessage rc; |
| 150 | var GsmFrameNumber fn; |
| 151 | timer T := 2.0; |
| 152 | |
| 153 | T.start; |
| 154 | pt.send(ts_L1CTL_EXT_RACH_REQ(ra11, seq, combined, offset)); |
| 155 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 156 | [] pt.receive(tr_L1CTL_RACH_CONF) -> value rc { fn := rc.dl_info.frame_nr }; |
| 157 | [] pt.receive { repeat; }; |
| 158 | [] T.timeout { |
| 159 | setverdict(fail, "Timeout waiting for (extended) L1CTL_RACH_CONF"); |
| 160 | mtc.stop; |
| 161 | } |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | return fn; |
| 165 | } |
| 166 | |
Harald Welte | 3705273 | 2018-03-09 19:38:46 +0100 | [diff] [blame] | 167 | function f_L1CTL_PARAM(L1CTL_PT pt, uint8_t ta, uint8_t tx_power) { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 168 | pt.send(ts_L1CTL_PAR_REQ(ta, tx_power)); |
Harald Welte | 3705273 | 2018-03-09 19:38:46 +0100 | [diff] [blame] | 169 | } |
| 170 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 171 | function f_L1CTL_WAIT_IMM_ASS(L1CTL_PT pt, uint8_t ra, GsmFrameNumber rach_fn) return ImmediateAssignment { |
Vadim Yanitskiy | 23b7440 | 2019-09-09 16:43:29 +0200 | [diff] [blame] | 172 | var template GsmRrMessage rr_imm_ass; |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 173 | var L1ctlDlMessage dl; |
| 174 | var GsmRrMessage rr; |
| 175 | timer T := 10.0; |
Vadim Yanitskiy | 23b7440 | 2019-09-09 16:43:29 +0200 | [diff] [blame] | 176 | |
| 177 | /* Prepare generic template (for both CS and PS) */ |
| 178 | rr_imm_ass := tr_IMM_ASS(ra, rach_fn); |
| 179 | rr_imm_ass.payload.imm_ass.ded_or_tbf := ?; |
| 180 | rr_imm_ass.payload.imm_ass.pkt_chan_desc := *; |
| 181 | rr_imm_ass.payload.imm_ass.chan_desc := *; |
| 182 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 183 | T.start; |
| 184 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 185 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
| 186 | rr := dec_GsmRrMessage(dl.payload.data_ind.payload); |
| 187 | log("PCH/AGCH DL RR: ", rr); |
| 188 | if (match(rr, rr_imm_ass)) { |
| 189 | log("Received IMM.ASS for our RACH!"); |
| 190 | } else { |
| 191 | repeat; |
| 192 | } |
| 193 | }; |
| 194 | [] pt.receive { repeat }; |
| 195 | [] T.timeout { |
| 196 | setverdict(fail, "Timeout waiting for IMM ASS"); |
| 197 | mtc.stop; |
| 198 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 199 | } |
| 200 | T.stop; |
| 201 | return rr.payload.imm_ass; |
| 202 | } |
| 203 | |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 204 | function f_L1CTL_WAIT_IMM_ASS_TBF_DL(L1CTL_PT pt, GprsTlli tlli) return ImmediateAssignment { |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 205 | var template PacketDlAssign dl_ass := tr_PacketDlAssign(tlli); |
| 206 | var template IaRestOctets rest := tr_IaRestOctets_DLAss(dl_ass); |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 207 | var L1ctlDlMessage dl; |
| 208 | var GsmRrMessage rr; |
| 209 | timer T := 10.0; |
| 210 | T.start; |
| 211 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 212 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
| 213 | /* TODO: use decmatch tr_IaRestOctets_DLAss(...) instead */ |
| 214 | rr := dec_GsmRrMessage(dl.payload.data_ind.payload); |
| 215 | log("PCH/AGCN DL RR: ", rr); |
| 216 | if (match(rr, tr_IMM_TBF_ASS(dl := true, rest := rest))) { |
| 217 | log("Received IMM.ASS for our TLLI!"); |
| 218 | } else { |
| 219 | repeat; |
| 220 | } |
| 221 | }; |
| 222 | [] pt.receive { repeat }; |
| 223 | [] T.timeout { |
| 224 | setverdict(fail, "Timeout waiting for TBF IMM ASS"); |
| 225 | mtc.stop; |
| 226 | } |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 227 | } |
| 228 | T.stop; |
| 229 | return rr.payload.imm_ass; |
| 230 | } |
| 231 | |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 232 | function f_L1CTL_TBF_CFG(L1CTL_PT pt, boolean is_uplink, TfiUsfArr tfi_usf) { |
| 233 | timer T := 2.0; |
| 234 | T.start; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 235 | pt.send(ts_L1CTL_TBF_CFG_REQ(is_uplink, tfi_usf)); |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 236 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 237 | [] pt.receive(tr_L1CTL_TBF_CFG_CONF(is_uplink)) {} |
| 238 | [] pt.receive { repeat }; |
| 239 | [] T.timeout { |
| 240 | setverdict(fail, "Timeout waiting for L1CTL_TBF_CFG_CONF"); |
| 241 | mtc.stop; |
| 242 | }; |
Harald Welte | b3c226e | 2017-07-30 17:18:01 +0200 | [diff] [blame] | 243 | } |
| 244 | T.stop; |
| 245 | } |
| 246 | |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 247 | /* Send DM_EST_REQ from parameters derived from IMM ASS */ |
Vadim Yanitskiy | 204d1b8 | 2020-05-27 19:40:01 +0700 | [diff] [blame] | 248 | function f_L1CTL_DM_EST_REQ_IA(L1CTL_PT pt, ImmediateAssignment imm_ass, L1ctlMA ma := {}) { |
| 249 | /* FIXME: handle Packet Channel Description */ |
| 250 | if (imm_ass.ded_or_tbf.tbf == true) { |
| 251 | setverdict(fail, "TBF assignment is not handled by ", __SCOPE__); |
| 252 | mtc.stop; |
| 253 | } |
| 254 | |
| 255 | /* Single channel or frequency hopping? */ |
| 256 | if (not imm_ass.chan_desc.h) { |
| 257 | pt.send(ts_L1CTL_DM_EST_REQ_H0(imm_ass.chan_desc.chan_nr, |
| 258 | imm_ass.chan_desc.tsc, |
| 259 | imm_ass.chan_desc.arfcn)); |
| 260 | } else { |
| 261 | /* TODO: we probably want to apply a bitmask from imm_ass.mobile_allocation |
| 262 | * on the list of channels, if it's present. Use all channels for now. */ |
| 263 | pt.send(ts_L1CTL_DM_EST_REQ_H1(imm_ass.chan_desc.chan_nr, |
| 264 | imm_ass.chan_desc.tsc, |
| 265 | imm_ass.chan_desc.maio_hsn.hsn, |
| 266 | imm_ass.chan_desc.maio_hsn.maio, |
| 267 | ma)); |
| 268 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 269 | } |
| 270 | |
Harald Welte | 3dc2046 | 2018-03-10 23:03:38 +0100 | [diff] [blame] | 271 | /* Send DM_REL_REQ from parameters derived from IMM ASS */ |
| 272 | function f_L1CTL_DM_REL_REQ(L1CTL_PT pt, RslChannelNr chan_nr) { |
| 273 | pt.send(ts_L1CTL_DM_REL_REQ(chan_nr)); |
| 274 | } |
| 275 | |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 276 | function f_L1CTL_RESET(L1CTL_PT pt, L1ctlResetType res_type := L1CTL_RES_T_FULL) { |
| 277 | timer T := 2.0; |
| 278 | pt.send(t_L1ctlResetReq(res_type)); |
| 279 | T.start; |
| 280 | alt { |
Vadim Yanitskiy | e7c4a99 | 2020-10-19 13:10:23 +0700 | [diff] [blame] | 281 | [] pt.receive(tr_L1CTL_MsgType(L1CTL_RESET_CONF)) { } |
| 282 | [] pt.receive { repeat; } |
| 283 | [] T.timeout { |
| 284 | setverdict(fail, "Timeout waiting for L1CTL_RESET_CONF"); |
| 285 | mtc.stop; |
| 286 | } |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 287 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 288 | } |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 289 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 290 | function f_L1CTL_CRYPTO_REQ(L1CTL_PT pt, RslChannelNr chan_nr, uint8_t algo, octetstring key) { |
| 291 | pt.send(ts_L1CTL_CRYPTO_REQ(chan_nr, algo, key)); |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 292 | } |
| 293 | |
Harald Welte | f68765d | 2017-08-20 22:54:57 +0200 | [diff] [blame] | 294 | function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := m_l1ctl_sock_path) { |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 295 | var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen); |
| 296 | f_L1CTL_setGetMsgLen(pt, -1, vl_f, {}); |
Harald Welte | d1209a6 | 2017-07-29 12:55:06 +0200 | [diff] [blame] | 297 | pt.send(L1CTL_connect:{path:=l1ctl_sock_path}); |
| 298 | pt.receive(L1CTL_connect_result:{result_code := SUCCESS, err:=omit}); |
Harald Welte | 6fc784e | 2018-02-25 23:31:37 +0100 | [diff] [blame] | 299 | f_L1CTL_setGetMsgLen(pt, 0, vl_f, {}); |
Harald Welte | aca6e07 | 2018-03-10 17:15:38 +0100 | [diff] [blame] | 300 | f_L1CTL_RESET(pt); |
Harald Welte | d1209a6 | 2017-07-29 12:55:06 +0200 | [diff] [blame] | 301 | } |
Harald Welte | 9e4725d | 2017-07-16 23:18:09 +0200 | [diff] [blame] | 302 | |
Harald Welte | 52c713c | 2017-07-16 15:44:44 +0200 | [diff] [blame] | 303 | private function L1CTL_to_UD_connect(in L1CTL_connect pin, out UD_connect pout) { |
| 304 | pout.path := pin.path; |
| 305 | pout.id := 0; |
| 306 | } with { extension "prototype(fast)" } |
| 307 | |
| 308 | private function UD_to_L1CTL_connect_result(in UD_connect_result pin, out L1CTL_connect_result pout) { |
| 309 | pout.result_code := pin.result.result_code; |
| 310 | pout.err := pin.result.err; |
| 311 | } with { extension "prototype(fast)" } |
| 312 | |
| 313 | private function L1CTL_to_UD_ul(in L1ctlUlMessage pin, out UD_send_data pout) { |
| 314 | var L1ctlUlMessageLV msg_lv := { msg := pin }; |
| 315 | pout.data := enc_L1ctlUlMessageLV(msg_lv); |
| 316 | pout.id := 0; |
| 317 | } with { extension "prototype(fast)" } |
| 318 | |
| 319 | private function UD_to_L1CTL_dl(in UD_send_data pin, out L1ctlDlMessage pout) { |
| 320 | var L1ctlDlMessageLV msg_lv := dec_L1ctlDlMessageLV(pin.data); |
| 321 | pout:= msg_lv.msg; |
| 322 | } with { extension "prototype(fast)" } |
| 323 | |
| 324 | type port L1CTL_PT message { |
| 325 | out L1ctlUlMessage |
| 326 | out L1CTL_connect |
| 327 | in L1ctlDlMessage |
| 328 | in L1CTL_connect_result |
| 329 | in UD_listen_result |
| 330 | in UD_connected |
| 331 | } with { extension "user UD_PT |
| 332 | out(L1ctlUlMessage -> UD_send_data: function(L1CTL_to_UD_ul); |
| 333 | L1CTL_connect -> UD_connect: function(L1CTL_to_UD_connect)) |
| 334 | in(UD_send_data -> L1ctlDlMessage: function(UD_to_L1CTL_dl); |
| 335 | UD_connect_result -> L1CTL_connect_result: function(UD_to_L1CTL_connect_result); |
| 336 | UD_listen_result -> UD_listen_result: simple; |
| 337 | UD_connected -> UD_connected: simple |
| 338 | )" } |
| 339 | } |