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 | |
| 235 | |
| 236 | /********************** |
| 237 | * General |
| 238 | **********************/ |
| 239 | type enumerated HNBLLIF_Sapi { |
| 240 | HNBLL_IF_SAPI_CTL (-1), |
| 241 | HNBLL_IF_SAPI_IUH ('00000001'O)//, |
| 242 | //HNBLL_IF_SAPI_GTP ('00000002'O), |
| 243 | //HNBLL_IF_SAPI_AUDIO ('00000003'O), |
| 244 | } with { variant "FIELDLENGTH(32)" |
| 245 | variant "COMP(2scompl)" |
| 246 | }; |
| 247 | |
| 248 | type enumerated HNBLLIF_Operation { |
| 249 | HNBLL_IF_OP_REQUEST ('0000'O), |
| 250 | HNBLL_IF_OP_RESPONSE ('0001'O), |
| 251 | HNBLL_IF_OP_INDICATION ('0002'O), |
| 252 | HNBLL_IF_OP_CONFIRM ('0003'O) |
| 253 | } with { variant "FIELDLENGTH(16)" }; |
| 254 | |
| 255 | type union HNBLLIF_SapiUnion { |
| 256 | HNBLLIF_CTL_PrimHdr ctl, |
| 257 | HNBLLIF_IUH_PrimHdr iuh, |
| 258 | octetstring other |
| 259 | } with { variant "" }; |
| 260 | |
| 261 | type record HNBLLIF_Message { |
| 262 | HNBLLIF_Sapi sapi, |
| 263 | HNBLLIF_SapiUnion u |
| 264 | } with { variant (u) "CROSSTAG( ctl, sapi = HNBLL_IF_SAPI_CTL; |
| 265 | iuh, sapi = HNBLL_IF_SAPI_IUH; |
| 266 | other, OTHERWISE)" |
| 267 | }; |
| 268 | |
| 269 | external function enc_HNBLLIF_Message(in HNBLLIF_Message pdu) return octetstring |
| 270 | with { extension "prototype(convert) encode(RAW)" }; |
| 271 | external function dec_HNBLLIF_Message(in octetstring stream) return HNBLLIF_Message |
| 272 | with { extension "prototype(convert) decode(RAW)" }; |
| 273 | |
| 274 | |
| 275 | } with { encode "RAW" variant "BYTEORDER(first)" }; |