Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsmtap_util.c |
| 2 | * GSMTAP support code in libosmocore. */ |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 3 | /* |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 4 | * (C) 2010-2017 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
Harald Welte | e08da97 | 2017-11-13 01:00:26 +0900 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
| 9 | * |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 20 | */ |
| 21 | |
Pau Espin Pedrol | 88955fb | 2023-01-18 18:54:00 +0100 | [diff] [blame] | 22 | #include "config.h" |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 23 | |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 24 | #include <osmocom/core/gsmtap_util.h> |
| 25 | #include <osmocom/core/logging.h> |
| 26 | #include <osmocom/core/gsmtap.h> |
| 27 | #include <osmocom/core/msgb.h> |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 28 | #include <osmocom/core/talloc.h> |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 29 | #include <osmocom/core/select.h> |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 30 | #include <osmocom/core/socket.h> |
Harald Welte | 95871da | 2017-05-15 12:11:36 +0200 | [diff] [blame] | 31 | #include <osmocom/core/byteswap.h> |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 32 | #include <osmocom/core/utils.h> |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 33 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
| 34 | #include <osmocom/gsm/rsl.h> |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 35 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 36 | #include <sys/types.h> |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 37 | |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 38 | #include <stdio.h> |
| 39 | #include <unistd.h> |
| 40 | #include <stdint.h> |
| 41 | #include <string.h> |
| 42 | #include <errno.h> |
| 43 | |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 44 | /*! \addtogroup gsmtap |
| 45 | * @{ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 46 | * GSMTAP utility routines. Encapsulates GSM messages over UDP. |
| 47 | * |
| 48 | * \file gsmtap_util.c */ |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 49 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 50 | /*! one gsmtap instance |
| 51 | * Until gsmtap_inst_fd() is removed from the API at some point in the future, we have to keep the first member as |
| 52 | * 'int' and the second as 'struct osmo_wqueue' (this effectively makes sure that the struct member wq.bfd.fd maintains |
| 53 | * the same memory offset from the start of the struct) to ensure that inlined static 'instances' of gsmtap_inst_fd() in |
| 54 | * old binaries keep working the way they used to even with gsmtap_inst objects obtained from newer versions of libosmocore */ |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame] | 55 | struct gsmtap_inst { |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 56 | int osmo_io_mode; /*!< Indicates whether or not to use Osmo IO mode for message output (thus enabling use of tx queues). |
| 57 | * This field member may not be changed or moved (backwards compatibility) */ |
| 58 | struct osmo_wqueue wq; /*!< the wait queue. This field member may not be changed or moved (backwards compatibility) */ |
| 59 | |
| 60 | struct osmo_io_fd *out; /*!< Used when osmo_io_mode is nonzero */ |
arehbein | f67e458 | 2023-10-24 11:45:54 +0200 | [diff] [blame] | 61 | int sink_fd; |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame] | 62 | }; |
| 63 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 64 | struct _gsmtap_inst_legacy { |
| 65 | int ofd_wq_mode; |
| 66 | struct osmo_wqueue wq; |
| 67 | struct osmo_fd sink_ofd; |
| 68 | }; |
| 69 | osmo_static_assert(offsetof(struct gsmtap_inst, wq) == offsetof(struct _gsmtap_inst_legacy, wq), |
| 70 | gsmtap_inst_new_wq_offset_equals_legacy_wq_offset); |
| 71 | |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame] | 72 | /*! Deprecated, use gsmtap_inst_fd2() instead |
| 73 | * \param[in] gti GSMTAP instance |
| 74 | * \returns file descriptor of GSMTAP instance */ |
| 75 | int gsmtap_inst_fd(struct gsmtap_inst *gti) |
| 76 | { |
| 77 | return gsmtap_inst_fd2(gti); |
| 78 | } |
| 79 | |
| 80 | /*! obtain the file descriptor associated with a gsmtap instance |
| 81 | * \param[in] gti GSMTAP instance |
| 82 | * \returns file descriptor of GSMTAP instance */ |
| 83 | int gsmtap_inst_fd2(const struct gsmtap_inst *gti) |
| 84 | { |
| 85 | return gti->wq.bfd.fd; |
| 86 | } |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 87 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 88 | /*! convert RSL channel number to GSMTAP channel type |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 89 | * \param[in] rsl_chantype RSL channel type |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 90 | * \param[in] link_id RSL link identifier |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 91 | * \param[in] user_plane Is this voice/csd user plane (1) or signaling (0) |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 92 | * \returns GSMTAP channel type |
| 93 | */ |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 94 | uint8_t chantype_rsl2gsmtap2(uint8_t rsl_chantype, uint8_t link_id, bool user_plane) |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 95 | { |
| 96 | uint8_t ret = GSMTAP_CHANNEL_UNKNOWN; |
| 97 | |
| 98 | switch (rsl_chantype) { |
| 99 | case RSL_CHAN_Bm_ACCHs: |
Vadim Yanitskiy | fc02ff4 | 2021-05-26 18:19:03 +0200 | [diff] [blame] | 100 | case RSL_CHAN_OSMO_VAMOS_Bm_ACCHs: |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 101 | if (user_plane) |
| 102 | ret = GSMTAP_CHANNEL_VOICE_F; |
| 103 | else |
| 104 | ret = GSMTAP_CHANNEL_FACCH_F; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 105 | break; |
| 106 | case RSL_CHAN_Lm_ACCHs: |
Vadim Yanitskiy | fc02ff4 | 2021-05-26 18:19:03 +0200 | [diff] [blame] | 107 | case RSL_CHAN_OSMO_VAMOS_Lm_ACCHs: |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 108 | if (user_plane) |
| 109 | ret = GSMTAP_CHANNEL_VOICE_H; |
| 110 | else |
| 111 | ret = GSMTAP_CHANNEL_FACCH_H; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 112 | break; |
| 113 | case RSL_CHAN_SDCCH4_ACCH: |
| 114 | ret = GSMTAP_CHANNEL_SDCCH4; |
| 115 | break; |
| 116 | case RSL_CHAN_SDCCH8_ACCH: |
| 117 | ret = GSMTAP_CHANNEL_SDCCH8; |
| 118 | break; |
| 119 | case RSL_CHAN_BCCH: |
| 120 | ret = GSMTAP_CHANNEL_BCCH; |
| 121 | break; |
| 122 | case RSL_CHAN_RACH: |
| 123 | ret = GSMTAP_CHANNEL_RACH; |
| 124 | break; |
| 125 | case RSL_CHAN_PCH_AGCH: |
| 126 | /* it could also be AGCH... */ |
| 127 | ret = GSMTAP_CHANNEL_PCH; |
| 128 | break; |
Harald Welte | 3b7cd0b | 2017-07-27 14:12:15 +0200 | [diff] [blame] | 129 | case RSL_CHAN_OSMO_PDCH: |
| 130 | ret = GSMTAP_CHANNEL_PDCH; |
| 131 | break; |
Harald Welte | ac7fabe | 2020-02-26 17:24:02 +0100 | [diff] [blame] | 132 | case RSL_CHAN_OSMO_CBCH4: |
| 133 | ret = GSMTAP_CHANNEL_CBCH51; |
| 134 | break; |
| 135 | case RSL_CHAN_OSMO_CBCH8: |
| 136 | ret = GSMTAP_CHANNEL_CBCH52; |
| 137 | break; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | if (link_id & 0x40) |
| 141 | ret |= GSMTAP_CHANNEL_ACCH; |
| 142 | |
| 143 | return ret; |
| 144 | } |
| 145 | |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 146 | /*! convert RSL channel number to GSMTAP channel type |
| 147 | * \param[in] rsl_chantype RSL channel type |
| 148 | * \param[in] link_id RSL link identifier |
| 149 | * \returns GSMTAP channel type |
| 150 | */ |
| 151 | uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t link_id) |
| 152 | { |
| 153 | return chantype_rsl2gsmtap2(rsl_chantype, link_id, false); |
| 154 | } |
| 155 | |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 156 | /*! convert GSMTAP channel type to RSL channel number + Link ID |
| 157 | * \param[in] gsmtap_chantype GSMTAP channel type |
| 158 | * \param[out] rsl_chantype RSL channel mumber |
| 159 | * \param[out] link_id RSL link identifier |
| 160 | */ |
| 161 | void chantype_gsmtap2rsl(uint8_t gsmtap_chantype, uint8_t *rsl_chantype, |
| 162 | uint8_t *link_id) |
| 163 | { |
| 164 | switch (gsmtap_chantype & ~GSMTAP_CHANNEL_ACCH & 0xff) { |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 165 | case GSMTAP_CHANNEL_FACCH_F: |
| 166 | case GSMTAP_CHANNEL_VOICE_F: // TCH/F |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 167 | *rsl_chantype = RSL_CHAN_Bm_ACCHs; |
| 168 | break; |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 169 | case GSMTAP_CHANNEL_FACCH_H: |
| 170 | case GSMTAP_CHANNEL_VOICE_H: // TCH/H |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 171 | *rsl_chantype = RSL_CHAN_Lm_ACCHs; |
| 172 | break; |
| 173 | case GSMTAP_CHANNEL_SDCCH4: // SDCCH/4 |
| 174 | *rsl_chantype = RSL_CHAN_SDCCH4_ACCH; |
| 175 | break; |
| 176 | case GSMTAP_CHANNEL_SDCCH8: // SDCCH/8 |
| 177 | *rsl_chantype = RSL_CHAN_SDCCH8_ACCH; |
| 178 | break; |
| 179 | case GSMTAP_CHANNEL_BCCH: // BCCH |
| 180 | *rsl_chantype = RSL_CHAN_BCCH; |
| 181 | break; |
| 182 | case GSMTAP_CHANNEL_RACH: // RACH |
| 183 | *rsl_chantype = RSL_CHAN_RACH; |
| 184 | break; |
| 185 | case GSMTAP_CHANNEL_PCH: // PCH |
| 186 | case GSMTAP_CHANNEL_AGCH: // AGCH |
| 187 | *rsl_chantype = RSL_CHAN_PCH_AGCH; |
| 188 | break; |
| 189 | case GSMTAP_CHANNEL_PDCH: |
Harald Welte | 3b7cd0b | 2017-07-27 14:12:15 +0200 | [diff] [blame] | 190 | *rsl_chantype = RSL_CHAN_OSMO_PDCH; |
Harald Welte | 93713a5 | 2017-07-12 23:43:40 +0200 | [diff] [blame] | 191 | break; |
| 192 | } |
| 193 | |
| 194 | *link_id = gsmtap_chantype & GSMTAP_CHANNEL_ACCH ? 0x40 : 0x00; |
| 195 | } |
| 196 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 197 | /*! create an arbitrary type GSMTAP message |
Sylvain Munaut | abf66e7 | 2011-09-26 13:23:19 +0200 | [diff] [blame] | 198 | * \param[in] type The GSMTAP_TYPE_xxx constant of the message to create |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 199 | * \param[in] arfcn GSM ARFCN (Channel Number) |
| 200 | * \param[in] ts GSM time slot |
| 201 | * \param[in] chan_type Channel Type |
| 202 | * \param[in] ss Sub-slot |
| 203 | * \param[in] fn GSM Frame Number |
| 204 | * \param[in] signal_dbm Signal Strength (dBm) |
| 205 | * \param[in] snr Signal/Noise Ratio (SNR) |
| 206 | * \param[in] data Pointer to data buffer |
| 207 | * \param[in] len Length of \ref data |
Pau Espin Pedrol | 9a5d90a | 2020-06-30 18:16:33 +0200 | [diff] [blame] | 208 | * \return dynamically allocated message buffer containing data |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 209 | * |
| 210 | * This function will allocate a new msgb and fill it with a GSMTAP |
| 211 | * header containing the information |
| 212 | */ |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 213 | struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 214 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 215 | int8_t snr, const uint8_t *data, unsigned int len) |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 216 | { |
| 217 | struct msgb *msg; |
| 218 | struct gsmtap_hdr *gh; |
| 219 | uint8_t *dst; |
| 220 | |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 221 | msg = msgb_alloc(sizeof(*gh) + len, "gsmtap_tx"); |
| 222 | if (!msg) |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 223 | return NULL; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 224 | |
| 225 | gh = (struct gsmtap_hdr *) msgb_put(msg, sizeof(*gh)); |
| 226 | |
| 227 | gh->version = GSMTAP_VERSION; |
| 228 | gh->hdr_len = sizeof(*gh)/4; |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 229 | gh->type = type; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 230 | gh->timeslot = ts; |
| 231 | gh->sub_slot = ss; |
Harald Welte | 95871da | 2017-05-15 12:11:36 +0200 | [diff] [blame] | 232 | gh->arfcn = osmo_htons(arfcn); |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 233 | gh->snr_db = snr; |
| 234 | gh->signal_dbm = signal_dbm; |
Harald Welte | 95871da | 2017-05-15 12:11:36 +0200 | [diff] [blame] | 235 | gh->frame_number = osmo_htonl(fn); |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 236 | gh->sub_type = chan_type; |
| 237 | gh->antenna_nr = 0; |
| 238 | |
| 239 | dst = msgb_put(msg, len); |
| 240 | memcpy(dst, data, len); |
| 241 | |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 242 | return msg; |
| 243 | } |
| 244 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 245 | /*! create L1/L2 data and put it into GSMTAP |
Sylvain Munaut | abf66e7 | 2011-09-26 13:23:19 +0200 | [diff] [blame] | 246 | * \param[in] arfcn GSM ARFCN (Channel Number) |
| 247 | * \param[in] ts GSM time slot |
| 248 | * \param[in] chan_type Channel Type |
| 249 | * \param[in] ss Sub-slot |
| 250 | * \param[in] fn GSM Frame Number |
| 251 | * \param[in] signal_dbm Signal Strength (dBm) |
| 252 | * \param[in] snr Signal/Noise Ratio (SNR) |
| 253 | * \param[in] data Pointer to data buffer |
| 254 | * \param[in] len Length of \ref data |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 255 | * \return message buffer or NULL in case of error |
Sylvain Munaut | abf66e7 | 2011-09-26 13:23:19 +0200 | [diff] [blame] | 256 | * |
| 257 | * This function will allocate a new msgb and fill it with a GSMTAP |
| 258 | * header containing the information |
| 259 | */ |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 260 | struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type, |
| 261 | uint8_t ss, uint32_t fn, int8_t signal_dbm, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 262 | int8_t snr, const uint8_t *data, unsigned int len) |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 263 | { |
| 264 | return gsmtap_makemsg_ex(GSMTAP_TYPE_UM, arfcn, ts, chan_type, |
| 265 | ss, fn, signal_dbm, snr, data, len); |
| 266 | } |
| 267 | |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 268 | #ifdef HAVE_SYS_SOCKET_H |
| 269 | |
| 270 | #include <sys/socket.h> |
| 271 | #include <netinet/in.h> |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 272 | #include <osmocom/core/osmo_io.h> |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 273 | |
Philipp Maier | ce4a865 | 2023-02-20 10:29:49 +0100 | [diff] [blame] | 274 | /*! Create a new (sending) GSMTAP source socket |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 275 | * \param[in] host host name or IP address in string format |
| 276 | * \param[in] port UDP port number in host byte order |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 277 | * \return file descriptor of the new socket |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 278 | * |
Max | ef5d3bc | 2023-02-18 23:48:27 +0300 | [diff] [blame] | 279 | * Opens a GSMTAP source (sending) socket, connect it to host/port and |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 280 | * return resulting fd. If \a host is NULL, the destination address |
| 281 | * will be localhost. If \a port is 0, the default \ref |
| 282 | * GSMTAP_UDP_PORT will be used. |
| 283 | * */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 284 | int gsmtap_source_init_fd(const char *host, uint16_t port) |
| 285 | { |
| 286 | if (port == 0) |
| 287 | port = GSMTAP_UDP_PORT; |
| 288 | if (host == NULL) |
| 289 | host = "localhost"; |
| 290 | |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 291 | return osmo_sock_init(AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, host, port, |
| 292 | OSMO_SOCK_F_CONNECT); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 293 | } |
| 294 | |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 295 | /*! Create a new (sending) GSMTAP source socket |
| 296 | * \param[in] local_host local host name or IP address in string format |
| 297 | * \param[in] local_port local UDP port number in host byte order |
| 298 | * \param[in] rem_host remote host name or IP address in string format |
| 299 | * \param[in] rem_port remote UDP port number in host byte order |
| 300 | * \return file descriptor of the new socket |
| 301 | * |
| 302 | * Opens a GSMTAP source (sending) socket, connect it to remote host/port, |
| 303 | * bind to local host/port and return resulting fd. |
| 304 | * If \a local_host is NULL, the default address is used. |
| 305 | * If \a local_port is 0, than random unused port will be selected by OS. |
| 306 | * If \a rem_host is NULL, the destination address will be localhost. |
| 307 | * If \a rem_port is 0, the default \ref GSMTAP_UDP_PORT will be used. |
| 308 | */ |
| 309 | int gsmtap_source_init_fd2(const char *local_host, uint16_t local_port, const char *rem_host, uint16_t rem_port) |
| 310 | { |
| 311 | if (!local_host) |
| 312 | return gsmtap_source_init_fd(rem_host, rem_port); |
| 313 | |
| 314 | return osmo_sock_init2(AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, local_host, local_port, |
| 315 | rem_host ? rem_host : "localhost", rem_port ? rem_port : GSMTAP_UDP_PORT, |
| 316 | OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT); |
| 317 | } |
| 318 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 319 | /*! Add a local sink to an existing GSMTAP source and return fd |
Harald Welte | de6e498 | 2012-12-06 21:25:27 +0100 | [diff] [blame] | 320 | * \param[in] gsmtap_fd file descriptor of the gsmtap socket |
| 321 | * \returns file descriptor of locally bound receive socket |
| 322 | * |
| 323 | * In case the GSMTAP socket is connected to a local destination |
| 324 | * IP/port, this function creates a corresponding receiving socket |
| 325 | * bound to that destination IP + port. |
| 326 | * |
| 327 | * In case the gsmtap socket is not connected to a local IP/port, or |
| 328 | * creation of the receiving socket fails, a negative error code is |
| 329 | * returned. |
| 330 | */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 331 | int gsmtap_source_add_sink_fd(int gsmtap_fd) |
| 332 | { |
| 333 | struct sockaddr_storage ss; |
| 334 | socklen_t ss_len = sizeof(ss); |
| 335 | int rc; |
| 336 | |
| 337 | rc = getpeername(gsmtap_fd, (struct sockaddr *)&ss, &ss_len); |
| 338 | if (rc < 0) |
| 339 | return rc; |
| 340 | |
| 341 | if (osmo_sockaddr_is_local((struct sockaddr *)&ss, ss_len) == 1) { |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 342 | rc = osmo_sock_init_sa((struct sockaddr *)&ss, SOCK_DGRAM, |
Philipp Maier | b8a9162 | 2018-08-23 20:18:55 +0200 | [diff] [blame] | 343 | IPPROTO_UDP, |
| 344 | OSMO_SOCK_F_BIND | |
| 345 | OSMO_SOCK_F_UDP_REUSEADDR); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 346 | if (rc >= 0) |
| 347 | return rc; |
| 348 | } |
| 349 | |
| 350 | return -ENODEV; |
| 351 | } |
| 352 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 353 | /*! Send a \ref msgb through a GSMTAP source |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 354 | * \param[in] gti GSMTAP instance |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 355 | * \param[in] msg message buffer |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 356 | * \return 0 in case of success; negative in case of error |
Neels Hofmeyr | c9a4ce6 | 2018-02-16 01:23:29 +0100 | [diff] [blame] | 357 | * NOTE: in case of nonzero return value, the *caller* must free the msg! |
| 358 | * (This enables the caller to attempt re-sending the message.) |
| 359 | * If 0 is returned, the msgb was freed by this function. |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 360 | */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 361 | int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg) |
| 362 | { |
Harald Welte | 13692a6 | 2011-05-22 20:06:11 +0200 | [diff] [blame] | 363 | if (!gti) |
| 364 | return -ENODEV; |
| 365 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 366 | if (gti->osmo_io_mode) |
| 367 | return osmo_iofd_write_msgb(gti->out, msg); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 368 | else { |
| 369 | /* try immediate send and return error if any */ |
| 370 | int rc; |
| 371 | |
arehbein | 1584b2a | 2023-10-12 00:20:17 +0200 | [diff] [blame] | 372 | rc = write(gsmtap_inst_fd2(gti), msg->data, msg->len); |
Neels Hofmeyr | 90539ac | 2018-02-16 01:24:03 +0100 | [diff] [blame] | 373 | if (rc < 0) { |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 374 | return rc; |
| 375 | } else if (rc >= msg->len) { |
| 376 | msgb_free(msg); |
| 377 | return 0; |
| 378 | } else { |
| 379 | /* short write */ |
| 380 | return -EIO; |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | |
Harald Welte | 9e34f08 | 2021-11-25 15:35:50 +0100 | [diff] [blame] | 385 | /*! Send a \ref msgb through a GSMTAP source; free the message even if tx queue full. |
| 386 | * \param[in] gti GSMTAP instance |
| 387 | * \param[in] msg message buffer; always freed, caller must not reference it later. |
| 388 | * \return 0 in case of success; negative in case of error |
| 389 | */ |
| 390 | int gsmtap_sendmsg_free(struct gsmtap_inst *gti, struct msgb *msg) |
| 391 | { |
| 392 | int rc; |
| 393 | rc = gsmtap_sendmsg(gti, msg); |
| 394 | if (rc < 0) |
| 395 | msgb_free(msg); |
| 396 | return rc; |
| 397 | } |
| 398 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 399 | /*! send an arbitrary type through GSMTAP. |
Sylvain Munaut | abf66e7 | 2011-09-26 13:23:19 +0200 | [diff] [blame] | 400 | * See \ref gsmtap_makemsg_ex for arguments |
| 401 | */ |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 402 | int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts, |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 403 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 404 | int8_t signal_dbm, int8_t snr, const uint8_t *data, |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 405 | unsigned int len) |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 406 | { |
| 407 | struct msgb *msg; |
Neels Hofmeyr | a4952aa | 2018-02-16 01:26:00 +0100 | [diff] [blame] | 408 | int rc; |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 409 | |
Harald Welte | 13692a6 | 2011-05-22 20:06:11 +0200 | [diff] [blame] | 410 | if (!gti) |
| 411 | return -ENODEV; |
| 412 | |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 413 | msg = gsmtap_makemsg_ex(type, arfcn, ts, chan_type, ss, fn, signal_dbm, |
Harald Welte | e34a940 | 2010-06-29 22:31:21 +0200 | [diff] [blame] | 414 | snr, data, len); |
| 415 | if (!msg) |
| 416 | return -ENOMEM; |
| 417 | |
Neels Hofmeyr | a4952aa | 2018-02-16 01:26:00 +0100 | [diff] [blame] | 418 | rc = gsmtap_sendmsg(gti, msg); |
| 419 | if (rc) |
| 420 | msgb_free(msg); |
| 421 | return rc; |
Harald Welte | e779c36 | 2010-06-29 20:51:13 +0200 | [diff] [blame] | 422 | } |
| 423 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 424 | /*! send a message from L1/L2 through GSMTAP. |
Sylvain Munaut | abf66e7 | 2011-09-26 13:23:19 +0200 | [diff] [blame] | 425 | * See \ref gsmtap_makemsg for arguments |
| 426 | */ |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 427 | int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts, |
| 428 | uint8_t chan_type, uint8_t ss, uint32_t fn, |
Vadim Yanitskiy | 833e8fa | 2021-01-04 17:40:05 +0100 | [diff] [blame] | 429 | int8_t signal_dbm, int8_t snr, const uint8_t *data, |
Sylvain Munaut | 15ae715 | 2011-09-26 13:05:07 +0200 | [diff] [blame] | 430 | unsigned int len) |
| 431 | { |
| 432 | return gsmtap_send_ex(gti, GSMTAP_TYPE_UM, arfcn, ts, chan_type, ss, fn, |
| 433 | signal_dbm, snr, data, len); |
| 434 | } |
| 435 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 436 | /*! Add a local sink to an existing GSMTAP source and return fd |
Vadim Yanitskiy | 2f65bb1 | 2019-03-25 15:57:09 +0700 | [diff] [blame] | 437 | * \param[in] gti existing GSMTAP source |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 438 | * \returns file descriptor of locally bound receive socket |
| 439 | * |
| 440 | * In case the GSMTAP socket is connected to a local destination |
| 441 | * IP/port, this function creates a corresponding receiving socket |
| 442 | * bound to that destination IP + port. |
| 443 | * |
| 444 | * In case the gsmtap socket is not connected to a local IP/port, or |
| 445 | * creation of the receiving socket fails, a negative error code is |
| 446 | * returned. |
| 447 | * |
| 448 | * The file descriptor of the receiving socket is automatically added |
| 449 | * to the libosmocore select() handling. |
| 450 | */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 451 | int gsmtap_source_add_sink(struct gsmtap_inst *gti) |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 452 | { |
arehbein | f67e458 | 2023-10-24 11:45:54 +0200 | [diff] [blame] | 453 | return gti->sink_fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd2(gti)); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 454 | } |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 455 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 456 | /* Registered in Osmo IO as a no-op to set the write callback. */ |
| 457 | static void gsmtap_ops_noop_cb(struct osmo_io_fd *iofd, int res, struct msgb *msg) |
| 458 | { |
| 459 | } |
| 460 | |
| 461 | static struct osmo_io_ops gsmtap_ops = { .write_cb = gsmtap_ops_noop_cb }; |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 462 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 463 | /*! Open GSMTAP source socket, connect and register osmo_fd |
Max | edb5f33 | 2023-02-25 16:33:52 +0300 | [diff] [blame] | 464 | * \param[in] local_host IP address in string format |
| 465 | * \param[in] local_port UDP port number in host byte order |
| 466 | * \param[in] rem_host host name or IP address in string format |
| 467 | * \param[in] rem_port UDP port number in host byte order |
Katerina Barone-Adesi | c28c6a0 | 2013-02-15 13:27:59 +0100 | [diff] [blame] | 468 | * \param[in] ofd_wq_mode Register \ref osmo_wqueue (1) or not (0) |
Harald Welte | 2d2e2cc | 2016-04-25 12:11:20 +0200 | [diff] [blame] | 469 | * \return callee-allocated \ref gsmtap_inst |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 470 | * |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 471 | * Open GSMTAP source (sending) socket, connect it to remote host/port, |
| 472 | * bind it local host/port, |
Harald Welte | 47379ca | 2011-08-17 16:35:24 +0200 | [diff] [blame] | 473 | * allocate 'struct gsmtap_inst' and optionally osmo_fd/osmo_wqueue |
Vadim Yanitskiy | 2f65bb1 | 2019-03-25 15:57:09 +0700 | [diff] [blame] | 474 | * registration. |
| 475 | */ |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 476 | struct gsmtap_inst *gsmtap_source_init2(const char *local_host, uint16_t local_port, |
| 477 | const char *rem_host, uint16_t rem_port, int ofd_wq_mode) |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 478 | { |
| 479 | struct gsmtap_inst *gti; |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 480 | int fd; |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 481 | |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 482 | fd = gsmtap_source_init_fd2(local_host, local_port, rem_host, rem_port); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 483 | if (fd < 0) |
| 484 | return NULL; |
| 485 | |
| 486 | gti = talloc_zero(NULL, struct gsmtap_inst); |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 487 | gti->osmo_io_mode = ofd_wq_mode; |
| 488 | /* Still using the wq member for its 'fd' field only, since we are keeping it for now, anyways */ |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 489 | gti->wq.bfd.fd = fd; |
arehbein | f67e458 | 2023-10-24 11:45:54 +0200 | [diff] [blame] | 490 | gti->sink_fd = -1; |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 491 | |
| 492 | if (ofd_wq_mode) { |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 493 | gti->out = osmo_iofd_setup(gti, gti->wq.bfd.fd, "gsmtap_inst.io_fd", OSMO_IO_FD_MODE_READ_WRITE, &gsmtap_ops, NULL); |
arehbein | 90d79f4 | 2023-11-17 16:00:57 +0100 | [diff] [blame] | 494 | if (gti->out == NULL) |
| 495 | goto err_cleanup; |
| 496 | if (osmo_iofd_register(gti->out, gti->wq.bfd.fd) < 0) |
| 497 | goto err_cleanup; |
| 498 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 499 | /* osmo write queue previously used was set up with value of 64 */ |
| 500 | osmo_iofd_set_txqueue_max_length(gti->out, 64); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | return gti; |
arehbein | 90d79f4 | 2023-11-17 16:00:57 +0100 | [diff] [blame] | 504 | |
| 505 | err_cleanup: |
| 506 | talloc_free(gti); |
| 507 | close(fd); |
| 508 | return NULL; |
Harald Welte | d58ba46 | 2011-04-27 10:57:49 +0200 | [diff] [blame] | 509 | } |
| 510 | |
Max | a747d36 | 2023-02-18 23:45:42 +0300 | [diff] [blame] | 511 | /*! Open GSMTAP source socket, connect and register osmo_fd |
| 512 | * \param[in] host host name or IP address in string format |
| 513 | * \param[in] port UDP port number in host byte order |
| 514 | * \param[in] ofd_wq_mode Register \ref osmo_wqueue (1) or not (0) |
| 515 | * \return callee-allocated \ref gsmtap_inst |
| 516 | * |
| 517 | * Open GSMTAP source (sending) socket, connect it to host/port, |
| 518 | * allocate 'struct gsmtap_inst' and optionally osmo_fd/osmo_wqueue |
| 519 | * registration. |
| 520 | */ |
| 521 | struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port, |
| 522 | int ofd_wq_mode) |
| 523 | { |
| 524 | return gsmtap_source_init2(NULL, 0, host, port, ofd_wq_mode); |
| 525 | } |
| 526 | |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 527 | void gsmtap_source_free(struct gsmtap_inst *gti) |
| 528 | { |
Harald Welte | 3ef6120 | 2023-06-28 20:04:16 +0200 | [diff] [blame] | 529 | if (!gti) |
| 530 | return; |
| 531 | |
arehbein | f38077e | 2023-10-13 17:20:15 +0200 | [diff] [blame] | 532 | if (gti->osmo_io_mode) { |
| 533 | osmo_iofd_free(gti->out); |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 534 | |
arehbein | f67e458 | 2023-10-24 11:45:54 +0200 | [diff] [blame] | 535 | if (gti->sink_fd != -1) { |
| 536 | close(gti->sink_fd); |
| 537 | gti->sink_fd = -1; |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 538 | } |
arehbein | f67e458 | 2023-10-24 11:45:54 +0200 | [diff] [blame] | 539 | |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 540 | } |
| 541 | |
Vadim Yanitskiy | 2f4186a | 2021-12-29 21:58:19 +0600 | [diff] [blame] | 542 | talloc_free(gti); |
| 543 | } |
| 544 | |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 545 | #endif /* HAVE_SYS_SOCKET_H */ |
Harald Welte | de6e498 | 2012-12-06 21:25:27 +0100 | [diff] [blame] | 546 | |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 547 | const struct value_string gsmtap_gsm_channel_names[] = { |
| 548 | { GSMTAP_CHANNEL_UNKNOWN, "UNKNOWN" }, |
| 549 | { GSMTAP_CHANNEL_BCCH, "BCCH" }, |
| 550 | { GSMTAP_CHANNEL_CCCH, "CCCH" }, |
| 551 | { GSMTAP_CHANNEL_RACH, "RACH" }, |
| 552 | { GSMTAP_CHANNEL_AGCH, "AGCH" }, |
| 553 | { GSMTAP_CHANNEL_PCH, "PCH" }, |
| 554 | { GSMTAP_CHANNEL_SDCCH, "SDCCH" }, |
| 555 | { GSMTAP_CHANNEL_SDCCH4, "SDCCH/4" }, |
| 556 | { GSMTAP_CHANNEL_SDCCH8, "SDCCH/8" }, |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 557 | { GSMTAP_CHANNEL_FACCH_F, "FACCH/F" }, |
| 558 | { GSMTAP_CHANNEL_FACCH_H, "FACCH/H" }, |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 559 | { GSMTAP_CHANNEL_PACCH, "PACCH" }, |
| 560 | { GSMTAP_CHANNEL_CBCH52, "CBCH" }, |
| 561 | { GSMTAP_CHANNEL_PDCH, "PDCH" } , |
| 562 | { GSMTAP_CHANNEL_PTCCH, "PTTCH" }, |
| 563 | { GSMTAP_CHANNEL_CBCH51, "CBCH" }, |
| 564 | { GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH, "LSACCH" }, |
| 565 | { GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH4, "SACCH/4" }, |
| 566 | { GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH8, "SACCH/8" }, |
Harald Welte | 6773304 | 2020-03-08 17:21:29 +0100 | [diff] [blame] | 567 | { GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_FACCH_F, "SACCH/F" }, |
| 568 | { GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_FACCH_H, "SACCH/H" }, |
| 569 | { GSMTAP_CHANNEL_VOICE_F, "TCH/F" }, |
| 570 | { GSMTAP_CHANNEL_VOICE_H, "TCH/H" }, |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 571 | { 0, NULL } |
| 572 | }; |
| 573 | |
| 574 | /* for debugging */ |
| 575 | const struct value_string gsmtap_type_names[] = { |
| 576 | { GSMTAP_TYPE_UM, "GSM Um (MS<->BTS)" }, |
| 577 | { GSMTAP_TYPE_ABIS, "GSM Abis (BTS<->BSC)" }, |
| 578 | { GSMTAP_TYPE_UM_BURST, "GSM Um burst (MS<->BTS)" }, |
| 579 | { GSMTAP_TYPE_SIM, "SIM Card" }, |
| 580 | { GSMTAP_TYPE_TETRA_I1, "TETRA V+D" }, |
| 581 | { GSMTAP_TYPE_TETRA_I1_BURST, "TETRA bursts" }, |
| 582 | { GSMTAP_TYPE_WMX_BURST, "WiMAX burst" }, |
Vadim Yanitskiy | 0a60e42 | 2023-03-11 03:40:52 +0700 | [diff] [blame] | 583 | { GSMTAP_TYPE_GB_LLC, "GPRS Gb LLC" }, |
| 584 | { GSMTAP_TYPE_GB_SNDCP, "GPRS Gb SNDCP" }, |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 585 | { GSMTAP_TYPE_GMR1_UM, "GMR-1 air interfeace (MES-MS<->GTS)"}, |
| 586 | { GSMTAP_TYPE_UMTS_RLC_MAC, "UMTS RLC/MAC" }, |
| 587 | { GSMTAP_TYPE_UMTS_RRC, "UMTS RRC" }, |
| 588 | { GSMTAP_TYPE_LTE_RRC, "LTE RRC" }, |
| 589 | { GSMTAP_TYPE_LTE_MAC, "LTE MAC" }, |
| 590 | { GSMTAP_TYPE_LTE_MAC_FRAMED, "LTE MAC with context hdr" }, |
| 591 | { GSMTAP_TYPE_OSMOCORE_LOG, "libosmocore logging" }, |
| 592 | { GSMTAP_TYPE_QC_DIAG, "Qualcomm DIAG" }, |
Vadim Yanitskiy | 0a60e42 | 2023-03-11 03:40:52 +0700 | [diff] [blame] | 593 | { GSMTAP_TYPE_LTE_NAS, "LTE Non-Access Stratum" }, |
| 594 | { GSMTAP_TYPE_E1T1, "E1/T1 lines" }, |
Harald Welte | 5e3aaf9 | 2023-03-09 18:04:24 +0100 | [diff] [blame] | 595 | { GSMTAP_TYPE_GSM_RLP, "GSM Radio Link Protocol" }, |
Harald Welte | aa3ba46 | 2017-07-13 00:01:02 +0200 | [diff] [blame] | 596 | { 0, NULL } |
| 597 | }; |
| 598 | |
Harald Welte | de6e498 | 2012-12-06 21:25:27 +0100 | [diff] [blame] | 599 | /*! @} */ |