aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsmtap_util.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-18Move src/*.{c,h} to src/core/Pau Espin Pedrol1-554/+0
This way we have all libosmocore.so in an own subdir instead of having lots of files in the parent dir, which also contains subdirs to other libraries. This also matches the schema under include/osmocom/. Change-Id: I6c76fafebdd5e961aed88bbecd2c16bc69d580e2
2022-01-05VTY: implement 'no log gsmtap [HOSTNAME]' commandVadim Yanitskiy1-0/+16
Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-11-25gsmtap: Add gsmtap_sendmsg_free() as alternative to gsmtap_sendmsg()Harald Welte1-0/+14
gsmtap_sendmsg() places the burden of freeing the msgb in case of erroneous return codes on the caller. A review of existing users shows that this is overly optimistic and many calls get it wrong, opening up memory leaks. Let's add a new function gsmtap_sendmsg_free() which behaves like gsmtap_sendmsg() but always takes ownership: Either it is sent + freed, or it is just freed. Change-Id: I106b09f2a49bf24ce0e8d11fd4d4ee93e9cafdf5 Related: OS#5329
2021-05-26gsm_08_58.h: add Osmocom specific Bm/Lm CBITs for VAMOSVadim Yanitskiy1-0/+2
Change-Id: If33c1695922d110c0d2c60d5c0136caf2587194e Related: SYS#4895, OS#4941, SYS#5315, OS#4940
2021-01-04gsmtap_util: SNR can be negative, use a signed integerVadim Yanitskiy1-4/+4
In 'struct gsmtap_hdr' field 'snr_db' is defined as a signed integer, however all functions that fill this structure accept an unsigned integer. This is wrong, because SNR can be negative. Let's use 'int8_t' instead of 'uint8_t'. Changing from unsigned to signed should be relatively safe compared to the opposite. Most of the callers I am aware of always do pass 0 anyway. Change-Id: I9f432be5c346d563bf518111c14ff04d4a63f592 Related: SYS#5073
2020-07-09Revert "gsmtap_makemsg_ex: NULL for unknown chan_type"Pau Espin Pedrol1-5/+1
Reverting due to being completely normal for some applications to submit usning this channel type when decoding/parsing failed and hence not being able to determine channel type. This reverts Change-Id Ib4147a33a75c3cf425c30da8b0678c7fba8a371d (commit 12f93be6073ed89055862baafbfe0e08e50ed17a.) Change-Id: I6ebaa89cc3422df1d7fd2365a6176cb2902d1c67
2020-05-20gsmtap_makemsg_ex: NULL for unknown chan_typeOliver Smith1-1/+5
Related: osmo-bts Ic22ab71e520ab44429a93724250d349d16250801 Change-Id: Ib4147a33a75c3cf425c30da8b0678c7fba8a371d
2020-03-08gsmtap: Solve TCH / FACCH confusion once and for allHarald Welte1-10/+30
* What we used to call TCH/F and TCH/H in gsmtap are actually only FACCH/F and FACCH/H, i.e. the signaling part of Bm/Lm channels * Give them proper names with backwards compatibility #define * Split VOICE into VOICE_F and VOICE_H. If we don't differentiate this, a receiver is not able to determine the RSL channel ID of a frame without looking at external state/context. That in turn has been a design feature of GSMTAP Um format so far, and programs like osmo-bts-virtual rely on it. Change-Id: I952044a17334f35712e087dc41781805000aebc1 Related: OS#2557
2020-03-08Add GSMTAP_CHANNEL_VOICE to gsmtap_gsm_channel_names[] value_stringHarald Welte1-0/+1
In Change-Id If223020933b083fe359a2e8ff5fab1ce64a363d8 we introduced GSMTAP_CHANNEL_VOICE, but we didn't add it to gsmtap_gsm_channel_names[] Change-Id: I7ab696d3e0edb13632e048a9e05be03612d3d28c Related: OS#2557
2020-02-28chantype_rsl2gsmtap(): Add entries for CBCHHarald Welte1-0/+6
This adds missing entries for CBCH in the conversion between RSL-style channel numbers and GSMTAP channel types. Without this change, you will see tons of messages like virtphy[19865]: Wed Feb 26 16:16:28 2020 DVIRPHY <0002> gsmtapl1_if.c:267 MS 0000: Ignoring unknown channel type UNKNOWN (0) if running virtphy of osmocom-bb with a BTS that broadcasts CBCH. Change-Id: I19bbd2942adf441f58955ac896ef968bfd8aec5f
2019-03-28src/gsmtap_util.c: fix possible memleak in gsmtap_source_init()Vadim Yanitskiy1-0/+1
In gsmtap_source_init() we dynamically allocate a gsmtap_inst struct, but don't free it if the subsequent call to osmo_fd_register() fails. Change-Id: I970b493f3a64fbe9c3f68fcfba5097ee3ff72960
2019-03-25Doxygen: fix incorrect / missing parameter descriptionVadim Yanitskiy1-3/+3
Change-Id: Ibc63a5d4442a192efab8b5b30e0beb3545642ecc
2019-03-21select: Rename BSC_FD_* constants to OSMO_FD_*Harald Welte1-2/+2
The naming of these constants dates back to when the code was private within OpenBSC. Everything else was renamed (bsc_fd -> osmo_fd) at the time, but somehow the BSC_FD_* defines have been missed at the time. Keep compatibility #defines around, but allow us to migrate the applications to a less confusing naming meanwhile. Change-Id: Ifae33ed61a7cf0ae54ad487399e7dd2489986436
2018-08-24gsmtap_util: make sure SO_REUSEADDR is applied for GSMTAPPhilipp Maier1-1/+3
When gsmtap adding a new sink it does not supply OSMO_SOCK_F_UDP_REUSEADDR in order to have SO_REUSEADDR applied. In most cases, the gsmtap sink is just receiving packets to toss them immediately, so having one of them is sufficient. However, in other use cases - particularly virt_phy - we actually want to receve and process GSMTAP messages via multicast Applying SO_REUSEADDR (like we did before disabling it globally for UDP in I4a8ffb8d598aca88801a4a0322944d7cdd8d4047 on August 1st) resolves the issue. Change-Id: I1399a428467ca12f1564a14eb8ffb294d4f59874 Related: OS#3497
2018-02-16memleak: fix all libosmocore callers of gsmtap_sendmsg() to free on failureNeels Hofmeyr1-1/+5
gsmtap_sendmsg() does not free the msgb if it returns a failure rc, so the callers must check the rc and free the msg. Change-Id: I7cf64ed9b14247298ed8b4ab8735627f8235a499
2018-02-16memleak: gsmtap_sendmsg(): don't return 0 when no data was writtenNeels Hofmeyr1-1/+1
If less than the msgb size was written by write(), we want to return -EIO. Hence do not return zero when write() wrote zero bytes, return -EIO in that case as well. Previously, if write() returned zero, gsmtap_sendmsg() would return zero *without* freeing the msg, hence neither would the (ideal) caller. So this fixes a corner-case memleak. Change-Id: I099ae1c663c018da5db884f7e9d52c45af3ed817
2018-02-16gsmtap_sendmsg(): clarify API doc concerning msgb ownershipNeels Hofmeyr1-0/+3
Not freeing on error does enable callers to try to re-send as well, so it is a kind of useful feature, even though I find it likely for callers to either forget about freeing the msg on error or double-free by accident... I considered changing gsmtap_sendmsg() to always free, but since it is public API, I chose to keep and document its current behavior properly instead. We don't know what callers may exist out there. Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte1-0/+2
Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-07-28chantype_rsl2gsmtap/gsmtap2rsl: Fix PDCH channel type conversionHarald Welte1-1/+4
Change-Id: I88a06e8ba894f16006a8efa259fc536cf300de32
2017-07-13gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNELHarald Welte1-0/+45
Change-Id: Iaf8a99912f42a56ef785a1642e18238c0b67cf68
2017-07-13gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap()Harald Welte1-1/+40
Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25
2017-06-23doxygen: unify use of \file across the boardNeels Hofmeyr1-4/+5
Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr1-11/+11
Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-12update/extend doxygen documentationHarald Welte1-0/+1
It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
2017-05-15use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte1-4/+3
This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
2017-01-06Remove direct loggingMax1-3/+0
Drop perror() calls from GSMTAP code: it's application job to do the proper logging - library code should not write to stdout/stderr directly. Change-Id: Ifa149e65d76c6e64fda2946725c16672233aff2e
2016-11-26Fix unchecked return valueof osmo_fd_register()Harald Welte1-4/+12
Change-Id: Ib040a7f94eb1bbec8270b66fd4c2aedef9d5346a Fixes: Coverity CID 57636
2016-05-05Update doxygen annotations in libosmocoreHarald Welte1-1/+20
This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
2013-02-15misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi1-3/+3
Doxygen generates quite a lot of warnings on libosmocore. Some of them are obvious typos - this patch aims to fix such low-hanging fruit.
2013-01-11add some missing doxygen annotation for libosmocore functionsHarald Welte1-1/+14
2011-09-26gsmtap: Fix doxygen doc for the recent additionsSylvain Munaut1-2/+22
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-26gsmtap: Add a _ex version of gsmtap_{makemsg,send} to specify content typeSylvain Munaut1-4/+21
From: iZsh <izsh@fail0verflow.com> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-08-17doxygen: Add documentation for gsmtap_util.[ch]Harald Welte1-6/+51
2011-06-13socket: add OSMO_SOCK_F_[CONNECT|BIND|NON_BLOCK] flagsPablo Neira Ayuso1-2/+4
This extends the socket infrastructure in libosmocore to allow to create non-blocking sockets. Basically, it replaces the connect0_bind1 parameter by one flags parameter.
2011-05-29gsmtap_util: Remove msg_free from the wq call backSylvain Munaut1-3/+0
write_queue already frees the message after the callback is called. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-05-22gsmtap: deal with apps that call gsmtap_send*() with NULL gsmtap_instHarald Welte1-0/+6
2011-05-22GSMTAP/socket code: Check for sys/socket.h and conditionally compileHarald Welte1-6/+8
2011-05-22gsmtap: rework GSMTAP API to be more future-proof0.3.1Harald Welte1-86/+106
* use write_queue where applicable * provide functions that work on raw FD and those with osmo_fd * add support for multiple gsmtap instances (no global variables)
2011-05-07select: use namespace prefix osmo_fd* and osmo_select*Pablo Neira Ayuso1-6/+6
Summary of changes: s/struct bsc_fd/struct osmo_fd/g s/bsc_register_fd/osmo_fd_register/g s/bsc_unregister_fd/osmo_fd_unregister/g s/bsc_select_main/osmo_select_main/g
2011-05-04GSMTAP: add function to create a 'sink' for gsmtap packetsHarald Welte1-2/+55
This can be helpful where we send GSMTAP messages to the loopback device (localhost, 127.0.0.1) from where the kernel would then send ICMP reject packets as nobody is listening on that port.
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-7/+7
This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2010-06-29[gsmtap] add new gsmtap_makemsg() functionHarald Welte1-8/+23
This generates a gsmtap message without actually enqueueing to a bsc_select style queue.
2010-06-29Add gsmtap utility functions to libosmocore0.1.13Harald Welte1-0/+185
This is imported from OsmocomBB/Layer23