Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 1 | /* Osmocom HNBLL Interface Types, as per osmo-hnodeb/include/osmocom/hnodeb/hnb_prim.h |
| 2 | * (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| 3 | * All rights reserved. |
| 4 | * Author: Pau Espin Pedrol <pespin@sysmocom.de> |
| 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 | |
| 12 | module HNBLLIF_Types { |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | import from Native_Functions all; |
| 17 | |
| 18 | modulepar { |
| 19 | /* HNBLLIF version supported by the IUT */ |
| 20 | HNBLLIF_Version mp_hnbllif_version := 0; |
| 21 | }; |
| 22 | |
| 23 | const charstring HNBLL_SOCK_DEFAULT := "/tmp/hnb_prim_sock"; |
| 24 | type integer HNBLLIF_Version (0); /* supported versions */ |
| 25 | |
| 26 | /********************** |
| 27 | * CTL SAPI |
| 28 | **********************/ |
| 29 | |
| 30 | |
| 31 | type enumerated HNBLLIF_CTL_MsgType { |
| 32 | HNBLL_IF_CTL_MSG_HELLO ('0000'O) |
| 33 | } with { variant "FIELDLENGTH(16)" }; |
| 34 | |
| 35 | type record HNBLLIF_CTL_hello_req { |
| 36 | HNBLLIF_Sapi sapi, |
| 37 | uint16_t api_version |
| 38 | } with { variant "" }; |
| 39 | |
| 40 | type record HNBLLIF_CTL_hello_cnf { |
| 41 | HNBLLIF_Sapi sapi, |
| 42 | uint16_t api_version |
| 43 | } with { variant "" }; |
| 44 | |
| 45 | type union HNBLLIF_CTL_PrimOpUnion_hello { |
| 46 | HNBLLIF_CTL_hello_req req, |
| 47 | HNBLLIF_CTL_hello_cnf cnf, |
| 48 | octetstring other |
| 49 | } with { variant "" }; |
| 50 | |
| 51 | type record HNBLLIF_CTL_PrimOp_hello { |
| 52 | HNBLLIF_Operation op, |
| 53 | HNBLLIF_CTL_PrimOpUnion_hello u |
| 54 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 55 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 56 | other, OTHERWISE)" |
| 57 | }; |
| 58 | |
| 59 | type union HNBLLIF_CTL_PrimUnion { |
| 60 | HNBLLIF_CTL_PrimOp_hello hello, |
| 61 | octetstring other |
| 62 | } with { variant "" }; |
| 63 | |
| 64 | type record HNBLLIF_CTL_PrimHdr { |
| 65 | HNBLLIF_CTL_MsgType prim, |
| 66 | HNBLLIF_CTL_PrimUnion u |
| 67 | } with { variant (u) "CROSSTAG( hello, prim = HNBLL_IF_CTL_MSG_HELLO; |
| 68 | other, OTHERWISE)" |
| 69 | }; |
| 70 | |
| 71 | /********************** |
| 72 | * IUH SAPI |
| 73 | **********************/ |
| 74 | type enumerated HNBLLIF_IUH_MsgType { |
| 75 | HNBLL_IF_IUH_MSG_CONFIGURE ('0000'O), |
| 76 | HNBLL_IF_IUH_MSG_CONN_ESTABLISH ('0001'O), |
| 77 | HNBLL_IF_IUH_MSG_CONN_RELEASE ('0002'O), |
| 78 | HNBLL_IF_IUH_MSG_CONN_DATA ('0003'O), |
| 79 | HNBLL_IF_IUH_MSG_UNITDATA ('0004'O) |
| 80 | } with { variant "FIELDLENGTH(16)" }; |
| 81 | |
| 82 | /* CONFIGURE */ |
| 83 | type record HNBLLIF_IUH_configure_ind { |
| 84 | uint16_t mcc, |
| 85 | uint16_t mnc, |
| 86 | uint16_t cell_identity, |
| 87 | uint16_t lac, |
| 88 | uint8_t rac, |
| 89 | uint8_t reserved, |
| 90 | uint16_t sac, |
| 91 | uint16_t rnc_id |
| 92 | } with { variant "" }; |
| 93 | |
| 94 | type union HNBLLIF_IUH_PrimOpUnion_configure { |
| 95 | HNBLLIF_IUH_configure_ind ind, |
| 96 | octetstring other |
| 97 | } with { variant "" }; |
| 98 | |
| 99 | type record HNBLLIF_IUH_PrimOp_configure { |
| 100 | HNBLLIF_Operation op, |
| 101 | HNBLLIF_IUH_PrimOpUnion_configure u |
| 102 | } with { variant (u) "CROSSTAG( ind, op = HNBLL_IF_OP_INDICATION; |
| 103 | other, OTHERWISE)" |
| 104 | }; |
| 105 | |
| 106 | /* CONN_ESTABLISH */ |
| 107 | type record HNBLLIF_IUH_conn_establish_req { |
| 108 | uint32_t context_id, |
| 109 | uint8_t domain, |
| 110 | uint8_t est_cause, |
| 111 | uint16_t reserved, //uint16_t nas_node_selector_bitlen; |
| 112 | //uint8_t nas_node_selector[128]; /* TODO: check whether we can decrease this buffer size */ |
| 113 | uint32_t data_len, |
| 114 | octetstring data /* RANAP message */ |
| 115 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 116 | |
| 117 | type record HNBLLIF_IUH_conn_establish_cnf { |
| 118 | uint32_t context_id, |
| 119 | uint8_t domain, |
| 120 | uint8_t est_cause |
| 121 | } with { variant "" }; |
| 122 | |
| 123 | type union HNBLLIF_IUH_PrimOpUnion_conn_establish { |
| 124 | HNBLLIF_IUH_conn_establish_req req, |
| 125 | HNBLLIF_IUH_conn_establish_cnf cnf, |
| 126 | octetstring other |
| 127 | } with { variant "" }; |
| 128 | type record HNBLLIF_IUH_PrimOp_conn_establish { |
| 129 | HNBLLIF_Operation op, |
| 130 | HNBLLIF_IUH_PrimOpUnion_conn_establish u |
| 131 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 132 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 133 | other, OTHERWISE)" |
| 134 | }; |
| 135 | |
| 136 | /* CONN_RELEASE */ |
| 137 | type record HNBLLIF_IUH_conn_release_req { |
| 138 | uint32_t context_id, |
| 139 | uint8_t domain, |
| 140 | uint8_t spare1, |
| 141 | uint8_t cause_type, |
| 142 | uint8_t cause, |
| 143 | uint32_t data_len, |
| 144 | octetstring data /* RANAP message */ |
| 145 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 146 | |
| 147 | |
| 148 | type union HNBLLIF_IUH_PrimOpUnion_conn_release { |
| 149 | HNBLLIF_IUH_conn_release_req req, |
| 150 | octetstring other |
| 151 | } with { variant "" }; |
| 152 | type record HNBLLIF_IUH_PrimOp_conn_release { |
| 153 | HNBLLIF_Operation op, |
| 154 | HNBLLIF_IUH_PrimOpUnion_conn_release u |
| 155 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 156 | other, OTHERWISE)" |
| 157 | }; |
| 158 | |
| 159 | /* CONN_DATA */ |
| 160 | type record HNBLLIF_IUH_conn_data_ind { |
| 161 | uint32_t context_id, |
| 162 | uint8_t domain, |
| 163 | uint8_t spare1, |
| 164 | uint16_t spare2, |
| 165 | uint32_t data_len, |
| 166 | octetstring data /* RANAP message */ |
| 167 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 168 | |
| 169 | type record HNBLLIF_IUH_conn_data_req { |
| 170 | uint32_t context_id, |
| 171 | uint8_t domain, |
| 172 | uint8_t spare1, |
| 173 | uint16_t spare2, |
| 174 | uint32_t data_len, |
| 175 | octetstring data /* RANAP message */ |
| 176 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 177 | |
| 178 | type union HNBLLIF_IUH_PrimOpUnion_conn_data { |
| 179 | HNBLLIF_IUH_conn_data_req req, |
| 180 | HNBLLIF_IUH_conn_data_ind ind, |
| 181 | octetstring other |
| 182 | } with { variant "" }; |
| 183 | type record HNBLLIF_IUH_PrimOp_conn_data { |
| 184 | HNBLLIF_Operation op, |
| 185 | HNBLLIF_IUH_PrimOpUnion_conn_data u |
| 186 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 187 | ind, op = HNBLL_IF_OP_INDICATION; |
| 188 | other, OTHERWISE)" |
| 189 | }; |
| 190 | |
| 191 | /* UNITDATA */ |
| 192 | type record HNBLLIF_IUH_unitdata_ind { |
| 193 | uint32_t data_len, |
| 194 | octetstring data /* RANAP message */ |
| 195 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 196 | |
| 197 | type record HNBLLIF_IUH_unitdata_req { |
| 198 | uint32_t data_len, |
| 199 | octetstring data /* RANAP message */ |
| 200 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 201 | |
| 202 | type union HNBLLIF_IUH_PrimOpUnion_unitdata { |
| 203 | HNBLLIF_IUH_unitdata_req req, |
| 204 | HNBLLIF_IUH_unitdata_ind ind, |
| 205 | octetstring other |
| 206 | } with { variant "" }; |
| 207 | type record HNBLLIF_IUH_PrimOp_unitdata { |
| 208 | HNBLLIF_Operation op, |
| 209 | HNBLLIF_IUH_PrimOpUnion_unitdata u |
| 210 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 211 | ind, op = HNBLL_IF_OP_INDICATION; |
| 212 | other, OTHERWISE)" |
| 213 | }; |
| 214 | |
| 215 | type union HNBLLIF_IUH_PrimUnion { |
| 216 | HNBLLIF_IUH_PrimOp_configure configure, |
| 217 | HNBLLIF_IUH_PrimOp_conn_establish conn_establish, |
| 218 | HNBLLIF_IUH_PrimOp_conn_release conn_release, |
| 219 | HNBLLIF_IUH_PrimOp_conn_data conn_data, |
| 220 | HNBLLIF_IUH_PrimOp_unitdata unitdata, |
| 221 | octetstring other |
| 222 | } with { variant "" }; |
| 223 | |
| 224 | type record HNBLLIF_IUH_PrimHdr { |
| 225 | HNBLLIF_IUH_MsgType prim, |
| 226 | HNBLLIF_IUH_PrimUnion u |
| 227 | } with { variant (u) "CROSSTAG( configure, prim = HNBLL_IF_IUH_MSG_CONFIGURE; |
| 228 | conn_establish, prim = HNBLL_IF_IUH_MSG_CONN_ESTABLISH; |
| 229 | conn_release, prim = HNBLL_IF_IUH_MSG_CONN_RELEASE; |
| 230 | conn_data, prim = HNBLL_IF_IUH_MSG_CONN_DATA; |
| 231 | unitdata, prim = HNBLL_IF_IUH_MSG_UNITDATA; |
| 232 | other, OTHERWISE)" |
| 233 | }; |
| 234 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 235 | /********************** |
| 236 | * AUDIO SAPI |
| 237 | **********************/ |
| 238 | type enumerated HNBLLIF_AUDIO_MsgType { |
| 239 | HNBLL_IF_AUDIO_MSG_CONN_ESTABLISH ('0000'O), |
| 240 | HNBLL_IF_AUDIO_MSG_CONN_RELEASE ('0001'O), |
| 241 | HNBLL_IF_AUDIO_MSG_CONN_DATA ('0002'O) |
| 242 | } with { variant "FIELDLENGTH(16)" }; |
| 243 | |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 244 | const integer HNBLLIF_MAX_RFCIS := 64; |
| 245 | const integer HNBLLIF_MAX_SUBFLOWS := 7; |
| 246 | type record length(HNBLLIF_MAX_RFCIS) of uint8_t HNBLLIF_AUDIO_IPTIs; |
| 247 | type record length(HNBLLIF_MAX_SUBFLOWS) of uint16_t HNBLLIF_AUDIO_RFCI_SubflowSizes; |
| 248 | type record length(HNBLLIF_MAX_RFCIS) of HNBLLIF_AUDIO_RFCI_SubflowSizes HNBLLIF_AUDIO_SubflowSizes; |
Pau Espin Pedrol | 4759074 | 2022-06-09 11:52:21 +0200 | [diff] [blame^] | 249 | type record length(HNBLLIF_MAX_RFCIS) of uint8_t HNBLLIF_AUDIO_RFCIs; |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 250 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 251 | /* CONN_ESTABLISH */ |
| 252 | type record HNBLLIF_AUDIO_conn_establish_req { |
| 253 | uint32_t context_id, |
| 254 | uint16_t remote_rtp_port, |
| 255 | uint8_t reserved, |
| 256 | HNBLLIF_AddrType remote_rtp_address_type, |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 257 | HNBLLIF_Addr remote_addr, |
| 258 | uint8_t transparent, /* 1=transparent; 0=SMpSDU */ |
| 259 | uint8_t data_pdu_type, |
| 260 | uint16_t supported_versions_mask, /* host byte order */ |
| 261 | uint8_t num_rfci, |
| 262 | uint8_t num_subflows, |
| 263 | HNBLLIF_AUDIO_SubflowSizes subflow_sizes, |
| 264 | uint8_t IPTIs_present, /* 1=present; 0=not present */ |
Pau Espin Pedrol | 4759074 | 2022-06-09 11:52:21 +0200 | [diff] [blame^] | 265 | HNBLLIF_AUDIO_IPTIs IPTIs, /* values range 0-15, 4 bits */ |
| 266 | HNBLLIF_AUDIO_RFCIs rfci optional /* only available in audio SAPI ver >= 1 */ |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 267 | } with { variant "" }; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 268 | |
| 269 | type record HNBLLIF_AUDIO_conn_establish_cnf { |
| 270 | uint32_t context_id, |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 271 | uint32_t audio_conn_id, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 272 | uint16_t local_rtp_port, |
| 273 | uint8_t error_code, |
| 274 | HNBLLIF_AddrType local_rtp_address_type, |
| 275 | HNBLLIF_Addr local_addr |
| 276 | } with { variant "" }; |
| 277 | |
| 278 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_establish { |
| 279 | HNBLLIF_AUDIO_conn_establish_req req, |
| 280 | HNBLLIF_AUDIO_conn_establish_cnf cnf, |
| 281 | octetstring other |
| 282 | } with { variant "" }; |
| 283 | type record HNBLLIF_AUDIO_PrimOp_conn_establish { |
| 284 | HNBLLIF_Operation op, |
| 285 | HNBLLIF_AUDIO_PrimOpUnion_conn_establish u |
| 286 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 287 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 288 | other, OTHERWISE)" |
| 289 | }; |
| 290 | |
| 291 | /* CONN_RELEASE */ |
| 292 | type record HNBLLIF_AUDIO_conn_release_req { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 293 | uint32_t audio_conn_id |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 294 | } with { variant "" }; |
| 295 | |
| 296 | |
| 297 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_release { |
| 298 | HNBLLIF_AUDIO_conn_release_req req, |
| 299 | octetstring other |
| 300 | } with { variant "" }; |
| 301 | type record HNBLLIF_AUDIO_PrimOp_conn_release { |
| 302 | HNBLLIF_Operation op, |
| 303 | HNBLLIF_AUDIO_PrimOpUnion_conn_release u |
| 304 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 305 | other, OTHERWISE)" |
| 306 | }; |
| 307 | |
| 308 | /* CONN_DATA */ |
| 309 | type record HNBLLIF_AUDIO_conn_data_ind { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 310 | uint32_t audio_conn_id, |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 311 | uint8_t frame_nr, |
| 312 | uint8_t fqc, /* enumerated IuUP_FQC */ |
| 313 | uint8_t rfci, |
| 314 | uint8_t spare, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 315 | uint32_t data_len, |
| 316 | octetstring data /* RANAP message */ |
| 317 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 318 | |
| 319 | type record HNBLLIF_AUDIO_conn_data_req { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 320 | uint32_t audio_conn_id, |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 321 | uint8_t frame_nr, |
| 322 | uint8_t fqc, /* enumerated IuUP_FQC */ |
| 323 | uint8_t rfci, |
| 324 | uint8_t spare, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 325 | uint32_t data_len, |
| 326 | octetstring data /* RANAP message */ |
| 327 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 328 | |
| 329 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_data { |
| 330 | HNBLLIF_AUDIO_conn_data_req req, |
| 331 | HNBLLIF_AUDIO_conn_data_ind ind, |
| 332 | octetstring other |
| 333 | } with { variant "" }; |
| 334 | type record HNBLLIF_AUDIO_PrimOp_conn_data { |
| 335 | HNBLLIF_Operation op, |
| 336 | HNBLLIF_AUDIO_PrimOpUnion_conn_data u |
| 337 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 338 | ind, op = HNBLL_IF_OP_INDICATION; |
| 339 | other, OTHERWISE)" |
| 340 | }; |
| 341 | |
| 342 | type union HNBLLIF_AUDIO_PrimUnion { |
| 343 | HNBLLIF_AUDIO_PrimOp_conn_establish conn_establish, |
| 344 | HNBLLIF_AUDIO_PrimOp_conn_release conn_release, |
| 345 | HNBLLIF_AUDIO_PrimOp_conn_data conn_data, |
| 346 | octetstring other |
| 347 | } with { variant "" }; |
| 348 | |
| 349 | type record HNBLLIF_AUDIO_PrimHdr { |
| 350 | HNBLLIF_AUDIO_MsgType prim, |
| 351 | HNBLLIF_AUDIO_PrimUnion u |
| 352 | } with { variant (u) "CROSSTAG( conn_establish, prim = HNBLL_IF_AUDIO_MSG_CONN_ESTABLISH; |
| 353 | conn_release, prim = HNBLL_IF_AUDIO_MSG_CONN_RELEASE; |
| 354 | conn_data, prim = HNBLL_IF_AUDIO_MSG_CONN_DATA; |
| 355 | other, OTHERWISE)" |
| 356 | }; |
| 357 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 358 | /********************** |
| 359 | * GTP SAPI |
| 360 | **********************/ |
| 361 | type enumerated HNBLLIF_GTP_MsgType { |
| 362 | HNBLL_IF_GTP_MSG_CONN_ESTABLISH ('0000'O), |
| 363 | HNBLL_IF_GTP_MSG_CONN_RELEASE ('0001'O), |
| 364 | HNBLL_IF_GTP_MSG_CONN_DATA ('0002'O) |
| 365 | } with { variant "FIELDLENGTH(16)" }; |
| 366 | |
| 367 | /* CONN_ESTABLISH */ |
| 368 | type record HNBLLIF_GTP_conn_establish_req { |
| 369 | uint32_t context_id, |
| 370 | uint32_t remote_tei, |
| 371 | uint8_t reserved, |
| 372 | HNBLLIF_AddrType remote_gtpu_address_type, |
| 373 | HNBLLIF_Addr remote_gtpu_addr |
| 374 | } with { variant "" }; |
| 375 | |
| 376 | type record HNBLLIF_GTP_conn_establish_cnf { |
| 377 | uint32_t context_id, |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 378 | uint32_t gtp_conn_id, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 379 | uint32_t local_tei, |
| 380 | uint8_t error_code, |
| 381 | HNBLLIF_AddrType local_gtpu_address_type, |
| 382 | HNBLLIF_Addr local_gtpu_addr |
| 383 | } with { variant "" }; |
| 384 | |
| 385 | type union HNBLLIF_GTP_PrimOpUnion_conn_establish { |
| 386 | HNBLLIF_GTP_conn_establish_req req, |
| 387 | HNBLLIF_GTP_conn_establish_cnf cnf, |
| 388 | octetstring other |
| 389 | } with { variant "" }; |
| 390 | type record HNBLLIF_GTP_PrimOp_conn_establish { |
| 391 | HNBLLIF_Operation op, |
| 392 | HNBLLIF_GTP_PrimOpUnion_conn_establish u |
| 393 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 394 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 395 | other, OTHERWISE)" |
| 396 | }; |
| 397 | |
| 398 | /* CONN_RELEASE */ |
| 399 | type record HNBLLIF_GTP_conn_release_req { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 400 | uint32_t gtp_conn_id |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 401 | } with { variant "" }; |
| 402 | |
| 403 | type union HNBLLIF_GTP_PrimOpUnion_conn_release { |
| 404 | HNBLLIF_GTP_conn_release_req req, |
| 405 | octetstring other |
| 406 | } with { variant "" }; |
| 407 | type record HNBLLIF_GTP_PrimOp_conn_release { |
| 408 | HNBLLIF_Operation op, |
| 409 | HNBLLIF_GTP_PrimOpUnion_conn_release u |
| 410 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 411 | other, OTHERWISE)" |
| 412 | }; |
| 413 | |
| 414 | /* CONN_DATA */ |
| 415 | type record HNBLLIF_GTP_conn_data_req { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 416 | uint32_t gtp_conn_id, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 417 | uint32_t data_len, |
| 418 | octetstring data /* RANAP message */ |
| 419 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 420 | |
| 421 | type record HNBLLIF_GTP_conn_data_ind { |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 422 | uint32_t gtp_conn_id, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 423 | uint32_t data_len, |
| 424 | octetstring data /* RANAP message */ |
| 425 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 426 | |
| 427 | type union HNBLLIF_GTP_PrimOpUnion_conn_data { |
| 428 | HNBLLIF_GTP_conn_data_req req, |
| 429 | HNBLLIF_GTP_conn_data_ind ind, |
| 430 | octetstring other |
| 431 | } with { variant "" }; |
| 432 | type record HNBLLIF_GTP_PrimOp_conn_data { |
| 433 | HNBLLIF_Operation op, |
| 434 | HNBLLIF_GTP_PrimOpUnion_conn_data u |
| 435 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 436 | ind, op = HNBLL_IF_OP_INDICATION; |
| 437 | other, OTHERWISE)" |
| 438 | }; |
| 439 | |
| 440 | type union HNBLLIF_GTP_PrimUnion { |
| 441 | HNBLLIF_GTP_PrimOp_conn_establish conn_establish, |
| 442 | HNBLLIF_GTP_PrimOp_conn_release conn_release, |
| 443 | HNBLLIF_GTP_PrimOp_conn_data conn_data, |
| 444 | octetstring other |
| 445 | } with { variant "" }; |
| 446 | |
| 447 | type record HNBLLIF_GTP_PrimHdr { |
| 448 | HNBLLIF_GTP_MsgType prim, |
| 449 | HNBLLIF_GTP_PrimUnion u |
| 450 | } with { variant (u) "CROSSTAG( conn_establish, prim = HNBLL_IF_GTP_MSG_CONN_ESTABLISH; |
| 451 | conn_release, prim = HNBLL_IF_GTP_MSG_CONN_RELEASE; |
| 452 | conn_data, prim = HNBLL_IF_GTP_MSG_CONN_DATA; |
| 453 | other, OTHERWISE)" |
| 454 | }; |
| 455 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 456 | |
| 457 | /********************** |
| 458 | * General |
| 459 | **********************/ |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 460 | |
| 461 | type enumerated HNBLLIF_AddrType { |
| 462 | HNBLL_IF_ADDR_TYPE_UNSPEC ('00'O), |
| 463 | HNBLL_IF_ADDR_TYPE_IPV4 ('01'O), |
| 464 | HNBLL_IF_ADDR_TYPE_IPV6 ('02'O) |
| 465 | } with { variant "FIELDLENGTH(8)" }; |
| 466 | type octetstring HNBLLIF_Addr length(16); |
| 467 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 468 | type enumerated HNBLLIF_Sapi { |
| 469 | HNBLL_IF_SAPI_CTL (-1), |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 470 | HNBLL_IF_SAPI_IUH ('00000001'O), |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 471 | HNBLL_IF_SAPI_GTP ('00000002'O), |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 472 | HNBLL_IF_SAPI_AUDIO ('00000003'O) |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 473 | } with { variant "FIELDLENGTH(32)" |
| 474 | variant "COMP(2scompl)" |
| 475 | }; |
| 476 | |
| 477 | type enumerated HNBLLIF_Operation { |
| 478 | HNBLL_IF_OP_REQUEST ('0000'O), |
| 479 | HNBLL_IF_OP_RESPONSE ('0001'O), |
| 480 | HNBLL_IF_OP_INDICATION ('0002'O), |
| 481 | HNBLL_IF_OP_CONFIRM ('0003'O) |
| 482 | } with { variant "FIELDLENGTH(16)" }; |
| 483 | |
| 484 | type union HNBLLIF_SapiUnion { |
| 485 | HNBLLIF_CTL_PrimHdr ctl, |
| 486 | HNBLLIF_IUH_PrimHdr iuh, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 487 | HNBLLIF_GTP_PrimHdr gtp, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 488 | HNBLLIF_AUDIO_PrimHdr audio, |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 489 | octetstring other |
| 490 | } with { variant "" }; |
| 491 | |
| 492 | type record HNBLLIF_Message { |
| 493 | HNBLLIF_Sapi sapi, |
| 494 | HNBLLIF_SapiUnion u |
| 495 | } with { variant (u) "CROSSTAG( ctl, sapi = HNBLL_IF_SAPI_CTL; |
| 496 | iuh, sapi = HNBLL_IF_SAPI_IUH; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 497 | gtp, sapi = HNBLL_IF_SAPI_GTP; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 498 | audio, sapi = HNBLL_IF_SAPI_AUDIO; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 499 | other, OTHERWISE)" |
| 500 | }; |
| 501 | |
| 502 | external function enc_HNBLLIF_Message(in HNBLLIF_Message pdu) return octetstring |
| 503 | with { extension "prototype(convert) encode(RAW)" }; |
| 504 | external function dec_HNBLLIF_Message(in octetstring stream) return HNBLLIF_Message |
| 505 | with { extension "prototype(convert) decode(RAW)" }; |
| 506 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 507 | function f_HNBLLIF_AF2addr_type(AddressFamily address_family) |
| 508 | return HNBLLIF_AddrType { |
| 509 | if (address_family == AF_INET) { |
| 510 | return HNBLL_IF_ADDR_TYPE_IPV4; |
| 511 | } else if (address_family == AF_INET6) { |
| 512 | return HNBLL_IF_ADDR_TYPE_IPV6; |
| 513 | } else { |
| 514 | return HNBLL_IF_ADDR_TYPE_UNSPEC; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | function f_HNBLLIF_Addr(HNBLLIF_AddrType addr_type, charstring addr_str) |
| 519 | return HNBLLIF_Addr { |
| 520 | var HNBLLIF_Addr addr; |
| 521 | |
| 522 | if (addr_type == HNBLL_IF_ADDR_TYPE_IPV4) { |
| 523 | addr := f_inet_addr(addr_str); |
| 524 | } else { |
| 525 | addr := f_inet6_addr(addr_str); |
| 526 | } |
| 527 | |
| 528 | return addr; |
| 529 | } |
| 530 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 531 | |
| 532 | } with { encode "RAW" variant "BYTEORDER(first)" }; |