summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
Commit message (Collapse)AuthorAgeFilesLines
* utils: add osmo_escape_str()Neels Hofmeyr2017-12-181-0/+3
| | | | | | | | | | | | | To report invalid characters in identifiers, it is desirable to escape any weird characters. Otherwise we might print stray newlines or control characters in the log output. ctrl_test.c already uses a print_escaped() function, which will be replaced by osmo_escape_str() in a subsequent patch. control_cmd.c will use osmo_escape_str() to log invalid identifiers. Change-Id: Ic685eb63dead3967d01aaa4f1e9899e5461ca49a
* utils: add osmo_separated_identifiers_valid()Neels Hofmeyr2017-12-171-0/+1
| | | | | | | | For validating CTRL input, we want to verify that an input variable is a series of valid osmo_identifier_valid() separated by dots. Allow validating any additional chars with identifiers, for CTRL vars will be just ".". Change-Id: I13dfd02c8c870620f937d789873ad84c6b1c45de
* logging vty: describe 'logging set-log-mask' command, add OSMO_STRINGIFY_VAL()Neels Hofmeyr2017-12-121-0/+2
| | | | Change-Id: I73ac5873ede858da44e1486d8a5c81da1ed5b19f
* comment: utils: more accurately describe OSMO_STRINGIFY macroNeels Hofmeyr2017-12-101-1/+3
| | | | Change-Id: I7b057c026f9df90608b7cbd12481ab9e7a41d88c
* counters: add osmo_counters_count() returns the amount of countersAlexander Couzens2017-12-051-0/+2
| | | | Change-Id: I9068231d71876e06d27ee67a688d7fb611ac3a1b
* logging: Extend the LOGPSRC macro to put cont in it as wellHolger Hans Peter Freyther2017-12-011-2/+18
| | | | | | | | For the lua console printing I need to print several values with continuation but also specify the filename. Add a "C" for continue and forward arguments. Change-Id: I1d6dcb2567b9ed2c8767f661737b979bc3d1377e
* gsmtap.h: Introduce new GSMTAP type for LTE NAS messagesHarald Welte2017-11-231-0/+1
| | | | Change-Id: I6e1274f17e2d9d2eee16481940642216ca96e3e3
* msgb: add inline msgb_queue_free()Neels Hofmeyr2017-11-201-0/+9
| | | | | Related: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639 (libosmo-netif) Change-Id: Ia291832ca445d4071f0ed9a01730d945ff691cf7
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-133-4/+6
| | | | | | | | 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
* rate_ctr: Enforce counter (and ctr_group) names are valid identifiersHarald Welte2017-10-241-1/+1
| | | | | | | | | | | | | | As rate counters are automatically exposed on the CTRL interface, we need to make sure they don't contain special characters such as '.' which are not permitted/supported by CTRL. In order to be able to run old versions of osmocom programs with libosmocore versions after this commit, we introduce some special name mangling: Any '.' in the names are replaced with ':' during counter group registration, if valid identifiers can be obtained this way. Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56
* Introduce osmo_identifier_valid() function to check validity of identifierHarald Welte2017-10-241-0/+3
| | | | | | | | | We define the notion of an 'osmocom identifier' which is basically a 7-bit US-ASCII without any special characters beyond "-_:@". We introduce a function to verify if an identifier consists only of the permitted characters. Change-Id: I96a8d345c5a69238a12d040f39b70c485a5c421c
* add osmo_talloc_asprintf() and ctrl_cmd_reply_printf()Neels Hofmeyr2017-10-241-0/+18
| | | | | | | | | | | | | | | | Add macro to append to a CTRL commands' reply string, ctrl_cmd_reply_printf(). The talloc_asprintf() part of it is generic enough to qualify for a separate macro, osmo_talloc_asprintf(). The idea is to not have to decide for each bit added to a string whether the string is already allocated or not, but simply be able to issue printf commands and let the macro worry about initial allocation or reallocation. This originally came from osmo-hlr change I1bd62ae0d4eefde7e1517db15a2155640a1bab58, where it was requested to move this bit to libosmocore. Change-Id: Ic9dba0e4a1eb5a7dc3cee2f181b9024ed4fc7005
* Replace bitvec_set_uint() with bitvec_set_u64()Max2017-10-241-0/+2
| | | | | | | | | | | | | | | | | | | Old bitvec_set_uint() uses "unsigned int" as input parameter which length is not guaranteed. It does not allow to specify which bit_value to set and does not check for incorrect length. Overall this makes it harder to re-use and more error-prone. Let's replace it with extended implementation which uses fixed type length parameters and extra checks. The additional parameter allows caller to explicitly indicate the need to use L/H instead of 0/1 for bit vector elements. It's necessary to properly encode some of the messages from 3GPP TS 44.018, for example ยง10.5.2.16 IA Rest Octets. The old function is left for backward compatibility as a tiny wrapper around new function and will be deprecated in follow-up patches. Change-Id: I1b670dacb55fb3063271d045f9faa10fccba10a6 Related: OS#1526
* socket: add function osmo_sock_local_ip() to query local ipPhilipp Maier2017-10-231-0/+2
| | | | | | | | | | In some cases it is required to know the ip-address of the interface through that a given remote IP-Address can be reached. Add function osmo_sock_local_ip() to determine the local ip-address for a given remote ip-address Change-Id: I2988cc52b196fc8476703d1287e24cb4a48491c2
* add function msgb_printf() to print formatted text into msg bufPhilipp Maier2017-10-221-0/+1
| | | | | | | | | | | In ASCII string based protocols it a printf() version that prints directly to the message buffer may be useful. Add function msgb_printf(), make sure that msg buffer bounderies are not exceeded. If the end of the tail buffer is hit, return with an error code. Change-Id: I15e1af68616309555d0ed9ac5da027c9833d42e3
* api doc: fix two doxygen group closing bracesNeels Hofmeyr2017-10-171-1/+1
| | | | Change-Id: I6c1f47d13c5b7a9cb2281de9f017df4f1ed88ba7
* [doc] Expand Doxuygen documentation for osmo_primHarald Welte2017-10-161-4/+23
| | | | | | Also, make sure prim.c is actually part of the 'prim' module. Change-Id: I4363e46a5f606eb2114a9cc1d2086007eaa58d31
* [doc] Put CRC-16 and generic CRC code in one Doxygen moduleHarald Welte2017-10-163-8/+14
| | | | | | .. and add missing API documentation bits Change-Id: I67119894bcbf8c779426a0272bae4c5ce1fbd1ed
* [doc] bits.c: Better / more Doxygen documentationHarald Welte2017-10-161-10/+12
| | | | Change-Id: If824a5c8d8ee6e3dc96a3fddeb105786c0c027c1
* [doc] Add Doxygen API documentation for stats.c and stats_statsd.cHarald Welte2017-10-161-21/+33
| | | | Change-Id: I8e49505f5c19beac90290fdba8821714e8eecd97
* [doc] counter.[ch] Add Doxygen API documentationHarald Welte2017-10-161-16/+5
| | | | | | | This adds a more complete set of API documentation for all osmo_counter relatedd functions and definitions. Change-Id: I24283c05620ee86a8beb165af98a85d754549efb
* [doc] stat_item: Complete doxygen documentation for APIHarald Welte2017-10-161-33/+13
| | | | | | | | The stat_item code base had some incomplete doxygen documentation so far. Let's complete it, and at the same time fix some cosmetic as well as copy+paste issues in the existing documentation bits. Change-Id: Ib514c137b40bf7b9791bd74be99af0b65575f2b6
* Rename 'statistics.c' to 'counter.c'Harald Welte2017-10-152-60/+62
| | | | | | | | | With stat_item, stats.c and stats_statsd.c, it is becoming a bit difficult to understand file naming. Also, the 'statistics.c' file actually only contained osmo_counter handling, so let's rename it to counter.c altogether. Change-Id: I2cfb2310543902b7da46cb15a76e2da317eaed7d
* utils: add osmo_is_hexstr(), add unit testNeels Hofmeyr2017-10-091-0/+5
| | | | | | Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: Idf75946eb0a84e145adad13fc7c78bb7a267aa0a
* Add time conversion helpersMax2017-09-251-0/+5
| | | | | | | Add macros to break down absolute time in seconds into days/hours/minutes passed. Change-Id: I46b9a405c18ed9da8f31b7d5b6dcece5468bafbf
* Expand bit pretty-printerMax2017-09-181-9/+11
| | | | | | | | | | Add OSMO_BIT_PRINT_EX() which is like OSMO_BIT_PRINT() but allows to specify character to be printed for set bits. It's useful to print bytes used as mask where set bit has particular semantics - for example TS mask in OsmoPCU. Change-Id: I72528bc1e376134c5a7b6e7a50c48e38c3f48b0a Related: OS#2282
* add osmo_fd_setup() convenience function to fill-in osmo_fdHarald Welte2017-08-121-0/+4
| | | | | | | | This basically follows the concept of osmo_timer_setup() and allows the caller to fill-in all configurable fields of osmo_fd in one line of code, rather than open-coding it in 5 lines everywhere. Change-Id: I6dbf19ea22fd65302bfc5424c10418d1b7939094
* Rename GSMTAP_CHANNEL_PDCH to GSMTAP_CHANNEL_PDTCHHarald Welte2017-07-291-1/+3
| | | | | | | PDCH is the physical channel, while actually we want to talk about PDTCH the logical channel. Introduce backwards compatibility define. Change-Id: Id6782d2247846e2db29fc58d98684970a66db948
* add DLMGCP logging category for libosmo-mgcpNeels Hofmeyr2017-07-181-1/+2
| | | | | | | In the course of splitting up the openbsc.git repository, we will create libosmo-mgcp and need a library logging category for that purpose. Change-Id: I09c587e2d59472cbde852d467d457254746d9e67
* socket: Add new OSMO_SOCK_F_NO_MCAST_ALL optionHarald Welte2017-07-131-0/+2
| | | | | | | Using this option at socket creation, the caller can request disabling the IP_MULTICAST_ALL socket option. Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
* socket: Allow disabling multicast loop on socket creationHarald Welte2017-07-131-0/+2
| | | | | | | | | | | This introduces a new flag OSMO_SOCK_F_NO_MCAST_LOOP, which can be used to disable the looping back of multicast packets transmitted throug this socket to other local sockets on the machine. As this looping-back is active by default, a single option to deviate from the default is deemed sufficient. Change-Id: I24a5b1ebc3f84d2d5d4734e54df50efaea26490b
* socket.c: Add multicast related convenience functionsHarald Welte2017-07-131-0/+6
| | | | Change-Id: Id703e7a7a1e065181a4c76c088b8dcc1b7fe15a2
* select: Add new osmo_fd_close() functionHarald Welte2017-07-131-0/+1
| | | | | | | | | This is a convenience helper that will both close a fd, mark it as closed and unregister it from the event loop abstraction. In most cases, you probably actually want to use it instead of manually closing and calling osmo_fd_unregister(). Change-Id: Icd0933eed6a24edde7cdcb378e138897ecc5332c
* gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNELHarald Welte2017-07-131-0/+3
| | | | Change-Id: Iaf8a99912f42a56ef785a1642e18238c0b67cf68
* gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap()Harald Welte2017-07-131-0/+1
| | | | Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25
* Add pseudo-random bit sequence generator to libosmcooreHarald Welte2017-07-101-0/+25
| | | | | | | These PRBS sequences are specified in ITU-T O.150. They are typically used as test data to be transmitted for BER (bit error rate) testing. Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
* Deprecate wrappers around loglevel_strsMax2017-07-081-2/+2
| | | | | | | | Add deprecation notice for public API use: it shouldn't be used outside of libosmocore anyway. Change-Id: I792e30dc44f027fd94e1f65af19fe08bac52b95c Related: OS#71
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-2338-163/+115
| | | | | | | | | | | | | | | | | 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
* doxygen: various fixes in core/timer.hNeels Hofmeyr2017-06-231-19/+16
| | | | | | | | | | | | Move a longish comment to the timer group so that it appears in the API doc. Un-doxygen some floating comments that were associated with unrelated code items ('/**' --> '/*'). Add braces to some function names so that the API doc will render as reference links. Change-Id: I3ea5b88cbe9cb54702429158bf47e768e04e8fe7
* api doc typo fix in core/logging.hNeels Hofmeyr2017-06-231-1/+1
| | | | Change-Id: I3f1cd5b10e7beccb61f370d7f8fa2666e56542cf
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-2329-400/+400
| | | | | | | | | | 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
* Move NUM_BYTES macro to core libraryMax2017-06-191-0/+2
| | | | | | | | | It's universally useful so it make sense to have it in the shared core: * move macro from libosmocoding to libosmocore * add OSMO_ prefix * add doxygen docs Change-Id: I5386ba3e1f1cc153ba96c29dc71c9075a052aa02
* Fix compilation warning on deprecated macroPau Espin Pedrol2017-06-182-2/+8
| | | | | | | | | A warning was printed even if the deprecation didn't apply to libosmocore because it is still allowed to use it internally. This patch fixes this case while still printing a warning if external projects build using libosmocore headers. Change-Id: I32212f20756f828af1017482a71e29e4b3adbad4
* update/extend doxygen documentationHarald Welte2017-06-121-7/+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
* socket: Add osmo_sock_init2_ofd() functionPau Espin Pedrol2017-05-261-0/+4
| | | | | | Will be used by osmo-bts-trx Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
* sercomm: More API documentationHarald Welte2017-05-171-1/+27
| | | | Change-Id: I5d5002ceedd10e10d772693478f4f9cab6b1290a
* sercomm: Better integration of driver interfaceHarald Welte2017-05-171-6/+7
| | | | | | | | | We cannot assume a certain UART API like uart_baudrate() which only exists in OsmocomBB. Rather, use generic function prototypes (sercomm_drv_*) which are to be provided by the application / environment to the sercomm core. Change-Id: I01ea3067baf1791000c1a7d537ccce496a1ab1ee
* sercomm: Include in libosmocore MakefileHarald Welte2017-05-171-1/+1
| | | | Change-Id: If9d50d634381f43b2c67b97fea36a462a66e4559
* sercomm: remove unrequired helper functionsHarald Welte2017-05-171-2/+0
| | | | | | | | osmo_sercomm_{bind,get}_uart() are not really needed anymore, as sercomm_inst is public and thus the user can access the uart_id member directly. Change-Id: I6d57709c3764036046202f16a26c9eb87426c8d1
* sercomm: Move HDLC related defines into C fileHarald Welte2017-05-171-7/+0
| | | | | | | Those values are not relevant to the sercomm user, only to the implementation and thus can remain inside sercomm.c Change-Id: I5700a45985b7c119c6338932171aae62ee4e2d22