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