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 | |
| 244 | /* CONN_ESTABLISH */ |
| 245 | type record HNBLLIF_AUDIO_conn_establish_req { |
| 246 | uint32_t context_id, |
| 247 | uint16_t remote_rtp_port, |
| 248 | uint8_t reserved, |
| 249 | HNBLLIF_AddrType remote_rtp_address_type, |
| 250 | HNBLLIF_Addr remote_addr |
| 251 | } with { variant "" }; |
| 252 | |
| 253 | type record HNBLLIF_AUDIO_conn_establish_cnf { |
| 254 | uint32_t context_id, |
| 255 | uint16_t local_rtp_port, |
| 256 | uint8_t error_code, |
| 257 | HNBLLIF_AddrType local_rtp_address_type, |
| 258 | HNBLLIF_Addr local_addr |
| 259 | } with { variant "" }; |
| 260 | |
| 261 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_establish { |
| 262 | HNBLLIF_AUDIO_conn_establish_req req, |
| 263 | HNBLLIF_AUDIO_conn_establish_cnf cnf, |
| 264 | octetstring other |
| 265 | } with { variant "" }; |
| 266 | type record HNBLLIF_AUDIO_PrimOp_conn_establish { |
| 267 | HNBLLIF_Operation op, |
| 268 | HNBLLIF_AUDIO_PrimOpUnion_conn_establish u |
| 269 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 270 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 271 | other, OTHERWISE)" |
| 272 | }; |
| 273 | |
| 274 | /* CONN_RELEASE */ |
| 275 | type record HNBLLIF_AUDIO_conn_release_req { |
| 276 | uint32_t context_id |
| 277 | } with { variant "" }; |
| 278 | |
| 279 | |
| 280 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_release { |
| 281 | HNBLLIF_AUDIO_conn_release_req req, |
| 282 | octetstring other |
| 283 | } with { variant "" }; |
| 284 | type record HNBLLIF_AUDIO_PrimOp_conn_release { |
| 285 | HNBLLIF_Operation op, |
| 286 | HNBLLIF_AUDIO_PrimOpUnion_conn_release u |
| 287 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 288 | other, OTHERWISE)" |
| 289 | }; |
| 290 | |
| 291 | /* CONN_DATA */ |
| 292 | type record HNBLLIF_AUDIO_conn_data_ind { |
| 293 | uint32_t context_id, |
| 294 | uint32_t data_len, |
| 295 | octetstring data /* RANAP message */ |
| 296 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 297 | |
| 298 | type record HNBLLIF_AUDIO_conn_data_req { |
| 299 | uint32_t context_id, |
| 300 | uint32_t data_len, |
| 301 | octetstring data /* RANAP message */ |
| 302 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 303 | |
| 304 | type union HNBLLIF_AUDIO_PrimOpUnion_conn_data { |
| 305 | HNBLLIF_AUDIO_conn_data_req req, |
| 306 | HNBLLIF_AUDIO_conn_data_ind ind, |
| 307 | octetstring other |
| 308 | } with { variant "" }; |
| 309 | type record HNBLLIF_AUDIO_PrimOp_conn_data { |
| 310 | HNBLLIF_Operation op, |
| 311 | HNBLLIF_AUDIO_PrimOpUnion_conn_data u |
| 312 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 313 | ind, op = HNBLL_IF_OP_INDICATION; |
| 314 | other, OTHERWISE)" |
| 315 | }; |
| 316 | |
| 317 | type union HNBLLIF_AUDIO_PrimUnion { |
| 318 | HNBLLIF_AUDIO_PrimOp_conn_establish conn_establish, |
| 319 | HNBLLIF_AUDIO_PrimOp_conn_release conn_release, |
| 320 | HNBLLIF_AUDIO_PrimOp_conn_data conn_data, |
| 321 | octetstring other |
| 322 | } with { variant "" }; |
| 323 | |
| 324 | type record HNBLLIF_AUDIO_PrimHdr { |
| 325 | HNBLLIF_AUDIO_MsgType prim, |
| 326 | HNBLLIF_AUDIO_PrimUnion u |
| 327 | } with { variant (u) "CROSSTAG( conn_establish, prim = HNBLL_IF_AUDIO_MSG_CONN_ESTABLISH; |
| 328 | conn_release, prim = HNBLL_IF_AUDIO_MSG_CONN_RELEASE; |
| 329 | conn_data, prim = HNBLL_IF_AUDIO_MSG_CONN_DATA; |
| 330 | other, OTHERWISE)" |
| 331 | }; |
| 332 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame^] | 333 | /********************** |
| 334 | * GTP SAPI |
| 335 | **********************/ |
| 336 | type enumerated HNBLLIF_GTP_MsgType { |
| 337 | HNBLL_IF_GTP_MSG_CONN_ESTABLISH ('0000'O), |
| 338 | HNBLL_IF_GTP_MSG_CONN_RELEASE ('0001'O), |
| 339 | HNBLL_IF_GTP_MSG_CONN_DATA ('0002'O) |
| 340 | } with { variant "FIELDLENGTH(16)" }; |
| 341 | |
| 342 | /* CONN_ESTABLISH */ |
| 343 | type record HNBLLIF_GTP_conn_establish_req { |
| 344 | uint32_t context_id, |
| 345 | uint32_t remote_tei, |
| 346 | uint8_t reserved, |
| 347 | HNBLLIF_AddrType remote_gtpu_address_type, |
| 348 | HNBLLIF_Addr remote_gtpu_addr |
| 349 | } with { variant "" }; |
| 350 | |
| 351 | type record HNBLLIF_GTP_conn_establish_cnf { |
| 352 | uint32_t context_id, |
| 353 | uint32_t local_tei, |
| 354 | uint8_t error_code, |
| 355 | HNBLLIF_AddrType local_gtpu_address_type, |
| 356 | HNBLLIF_Addr local_gtpu_addr |
| 357 | } with { variant "" }; |
| 358 | |
| 359 | type union HNBLLIF_GTP_PrimOpUnion_conn_establish { |
| 360 | HNBLLIF_GTP_conn_establish_req req, |
| 361 | HNBLLIF_GTP_conn_establish_cnf cnf, |
| 362 | octetstring other |
| 363 | } with { variant "" }; |
| 364 | type record HNBLLIF_GTP_PrimOp_conn_establish { |
| 365 | HNBLLIF_Operation op, |
| 366 | HNBLLIF_GTP_PrimOpUnion_conn_establish u |
| 367 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 368 | cnf, op = HNBLL_IF_OP_CONFIRM; |
| 369 | other, OTHERWISE)" |
| 370 | }; |
| 371 | |
| 372 | /* CONN_RELEASE */ |
| 373 | type record HNBLLIF_GTP_conn_release_req { |
| 374 | uint32_t context_id, |
| 375 | uint32_t remote_tei |
| 376 | } with { variant "" }; |
| 377 | |
| 378 | type union HNBLLIF_GTP_PrimOpUnion_conn_release { |
| 379 | HNBLLIF_GTP_conn_release_req req, |
| 380 | octetstring other |
| 381 | } with { variant "" }; |
| 382 | type record HNBLLIF_GTP_PrimOp_conn_release { |
| 383 | HNBLLIF_Operation op, |
| 384 | HNBLLIF_GTP_PrimOpUnion_conn_release u |
| 385 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 386 | other, OTHERWISE)" |
| 387 | }; |
| 388 | |
| 389 | /* CONN_DATA */ |
| 390 | type record HNBLLIF_GTP_conn_data_req { |
| 391 | uint32_t context_id, |
| 392 | uint32_t remote_tei, |
| 393 | uint32_t data_len, |
| 394 | octetstring data /* RANAP message */ |
| 395 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 396 | |
| 397 | type record HNBLLIF_GTP_conn_data_ind { |
| 398 | uint32_t context_id, |
| 399 | uint32_t local_tei, |
| 400 | uint32_t data_len, |
| 401 | octetstring data /* RANAP message */ |
| 402 | } with { variant (data_len) "LENGTHTO (data)" }; |
| 403 | |
| 404 | type union HNBLLIF_GTP_PrimOpUnion_conn_data { |
| 405 | HNBLLIF_GTP_conn_data_req req, |
| 406 | HNBLLIF_GTP_conn_data_ind ind, |
| 407 | octetstring other |
| 408 | } with { variant "" }; |
| 409 | type record HNBLLIF_GTP_PrimOp_conn_data { |
| 410 | HNBLLIF_Operation op, |
| 411 | HNBLLIF_GTP_PrimOpUnion_conn_data u |
| 412 | } with { variant (u) "CROSSTAG( req, op = HNBLL_IF_OP_REQUEST; |
| 413 | ind, op = HNBLL_IF_OP_INDICATION; |
| 414 | other, OTHERWISE)" |
| 415 | }; |
| 416 | |
| 417 | type union HNBLLIF_GTP_PrimUnion { |
| 418 | HNBLLIF_GTP_PrimOp_conn_establish conn_establish, |
| 419 | HNBLLIF_GTP_PrimOp_conn_release conn_release, |
| 420 | HNBLLIF_GTP_PrimOp_conn_data conn_data, |
| 421 | octetstring other |
| 422 | } with { variant "" }; |
| 423 | |
| 424 | type record HNBLLIF_GTP_PrimHdr { |
| 425 | HNBLLIF_GTP_MsgType prim, |
| 426 | HNBLLIF_GTP_PrimUnion u |
| 427 | } with { variant (u) "CROSSTAG( conn_establish, prim = HNBLL_IF_GTP_MSG_CONN_ESTABLISH; |
| 428 | conn_release, prim = HNBLL_IF_GTP_MSG_CONN_RELEASE; |
| 429 | conn_data, prim = HNBLL_IF_GTP_MSG_CONN_DATA; |
| 430 | other, OTHERWISE)" |
| 431 | }; |
| 432 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 433 | |
| 434 | /********************** |
| 435 | * General |
| 436 | **********************/ |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 437 | |
| 438 | type enumerated HNBLLIF_AddrType { |
| 439 | HNBLL_IF_ADDR_TYPE_UNSPEC ('00'O), |
| 440 | HNBLL_IF_ADDR_TYPE_IPV4 ('01'O), |
| 441 | HNBLL_IF_ADDR_TYPE_IPV6 ('02'O) |
| 442 | } with { variant "FIELDLENGTH(8)" }; |
| 443 | type octetstring HNBLLIF_Addr length(16); |
| 444 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 445 | type enumerated HNBLLIF_Sapi { |
| 446 | HNBLL_IF_SAPI_CTL (-1), |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 447 | HNBLL_IF_SAPI_IUH ('00000001'O), |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame^] | 448 | HNBLL_IF_SAPI_GTP ('00000002'O), |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 449 | HNBLL_IF_SAPI_AUDIO ('00000003'O) |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 450 | } with { variant "FIELDLENGTH(32)" |
| 451 | variant "COMP(2scompl)" |
| 452 | }; |
| 453 | |
| 454 | type enumerated HNBLLIF_Operation { |
| 455 | HNBLL_IF_OP_REQUEST ('0000'O), |
| 456 | HNBLL_IF_OP_RESPONSE ('0001'O), |
| 457 | HNBLL_IF_OP_INDICATION ('0002'O), |
| 458 | HNBLL_IF_OP_CONFIRM ('0003'O) |
| 459 | } with { variant "FIELDLENGTH(16)" }; |
| 460 | |
| 461 | type union HNBLLIF_SapiUnion { |
| 462 | HNBLLIF_CTL_PrimHdr ctl, |
| 463 | HNBLLIF_IUH_PrimHdr iuh, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame^] | 464 | HNBLLIF_GTP_PrimHdr gtp, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 465 | HNBLLIF_AUDIO_PrimHdr audio, |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 466 | octetstring other |
| 467 | } with { variant "" }; |
| 468 | |
| 469 | type record HNBLLIF_Message { |
| 470 | HNBLLIF_Sapi sapi, |
| 471 | HNBLLIF_SapiUnion u |
| 472 | } with { variant (u) "CROSSTAG( ctl, sapi = HNBLL_IF_SAPI_CTL; |
| 473 | iuh, sapi = HNBLL_IF_SAPI_IUH; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame^] | 474 | gtp, sapi = HNBLL_IF_SAPI_GTP; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 475 | audio, sapi = HNBLL_IF_SAPI_AUDIO; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 476 | other, OTHERWISE)" |
| 477 | }; |
| 478 | |
| 479 | external function enc_HNBLLIF_Message(in HNBLLIF_Message pdu) return octetstring |
| 480 | with { extension "prototype(convert) encode(RAW)" }; |
| 481 | external function dec_HNBLLIF_Message(in octetstring stream) return HNBLLIF_Message |
| 482 | with { extension "prototype(convert) decode(RAW)" }; |
| 483 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 484 | function f_HNBLLIF_AF2addr_type(AddressFamily address_family) |
| 485 | return HNBLLIF_AddrType { |
| 486 | if (address_family == AF_INET) { |
| 487 | return HNBLL_IF_ADDR_TYPE_IPV4; |
| 488 | } else if (address_family == AF_INET6) { |
| 489 | return HNBLL_IF_ADDR_TYPE_IPV6; |
| 490 | } else { |
| 491 | return HNBLL_IF_ADDR_TYPE_UNSPEC; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | function f_HNBLLIF_Addr(HNBLLIF_AddrType addr_type, charstring addr_str) |
| 496 | return HNBLLIF_Addr { |
| 497 | var HNBLLIF_Addr addr; |
| 498 | |
| 499 | if (addr_type == HNBLL_IF_ADDR_TYPE_IPV4) { |
| 500 | addr := f_inet_addr(addr_str); |
| 501 | } else { |
| 502 | addr := f_inet6_addr(addr_str); |
| 503 | } |
| 504 | |
| 505 | return addr; |
| 506 | } |
| 507 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 508 | |
| 509 | } with { encode "RAW" variant "BYTEORDER(first)" }; |