aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
AgeCommit message (Collapse)AuthorFilesLines
2018-01-19logging: allow to log only the basename of each sourceNeels Hofmeyr1-0/+1
In the C API, add another enum log_file_type value, and when set print only the basename of the source file path. Rationale: especially when not building directly in the source dir, the paths to the source files can become rather long. Usually, just the basename of the file is sufficient to identify the source line. Change-Id: If3e4d5fb2066f8bf86e59c82d1752b1a843cf58e
2018-01-19logging: separate the '<000b>' subsys from filename loggingNeels Hofmeyr1-1/+13
Add a separate flag and API to switch the category-in-hex output: log_set_print_category_hex(). Add log_set_print_filename2() to modify only the print_filename flag. The old log_set_print_filename() function still affects both flags. Explain the rationale in the comment for log_set_print_filename(). There is no need to deprecate log_set_print_filename(); it might cause compiler warnings and break strict builds unnecessarily. Add VTY command 'logging print category-hex (0|1)'. Since there is no VTY command to switch filename output, nothing needs to be adjusted there (a command will be added in a subsequent patch). Change-Id: Iba03a2b7915853c6dccaf6c393c31405320538b4
2018-01-17logging: add ability to log the log-level with API and vtyNeels Hofmeyr1-0/+4
Log the log level string after the category name, if enabled. The default behavior remains unchanged. Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
2017-12-18utils: add osmo_escape_str()Neels Hofmeyr1-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
2017-12-17utils: add osmo_separated_identifiers_valid()Neels Hofmeyr1-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
2017-12-12logging vty: describe 'logging set-log-mask' command, add OSMO_STRINGIFY_VAL()Neels Hofmeyr1-0/+2
Change-Id: I73ac5873ede858da44e1486d8a5c81da1ed5b19f
2017-12-10comment: utils: more accurately describe OSMO_STRINGIFY macroNeels Hofmeyr1-1/+3
Change-Id: I7b057c026f9df90608b7cbd12481ab9e7a41d88c
2017-12-05counters: add osmo_counters_count() returns the amount of countersAlexander Couzens1-0/+2
Change-Id: I9068231d71876e06d27ee67a688d7fb611ac3a1b
2017-12-01logging: Extend the LOGPSRC macro to put cont in it as wellHolger Hans Peter Freyther1-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
2017-11-23gsmtap.h: Introduce new GSMTAP type for LTE NAS messagesHarald Welte1-0/+1
Change-Id: I6e1274f17e2d9d2eee16481940642216ca96e3e3
2017-11-20msgb: add inline msgb_queue_free()Neels Hofmeyr1-0/+9
Related: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639 (libosmo-netif) Change-Id: Ia291832ca445d4071f0ed9a01730d945ff691cf7
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte3-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
2017-10-24rate_ctr: Enforce counter (and ctr_group) names are valid identifiersHarald Welte1-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
2017-10-24Introduce osmo_identifier_valid() function to check validity of identifierHarald Welte1-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
2017-10-24add osmo_talloc_asprintf() and ctrl_cmd_reply_printf()Neels Hofmeyr1-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
2017-10-24Replace bitvec_set_uint() with bitvec_set_u64()Max1-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
2017-10-23socket: add function osmo_sock_local_ip() to query local ipPhilipp Maier1-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
2017-10-22add function msgb_printf() to print formatted text into msg bufPhilipp Maier1-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
2017-10-17api doc: fix two doxygen group closing bracesNeels Hofmeyr1-1/+1
Change-Id: I6c1f47d13c5b7a9cb2281de9f017df4f1ed88ba7
2017-10-16[doc] Expand Doxuygen documentation for osmo_primHarald Welte1-4/+23
Also, make sure prim.c is actually part of the 'prim' module. Change-Id: I4363e46a5f606eb2114a9cc1d2086007eaa58d31
2017-10-16[doc] Put CRC-16 and generic CRC code in one Doxygen moduleHarald Welte3-8/+14
.. and add missing API documentation bits Change-Id: I67119894bcbf8c779426a0272bae4c5ce1fbd1ed
2017-10-16[doc] bits.c: Better / more Doxygen documentationHarald Welte1-10/+12
Change-Id: If824a5c8d8ee6e3dc96a3fddeb105786c0c027c1
2017-10-16[doc] Add Doxygen API documentation for stats.c and stats_statsd.cHarald Welte1-21/+33
Change-Id: I8e49505f5c19beac90290fdba8821714e8eecd97
2017-10-16[doc] counter.[ch] Add Doxygen API documentationHarald Welte1-16/+5
This adds a more complete set of API documentation for all osmo_counter relatedd functions and definitions. Change-Id: I24283c05620ee86a8beb165af98a85d754549efb
2017-10-16[doc] stat_item: Complete doxygen documentation for APIHarald Welte1-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
2017-10-15Rename 'statistics.c' to 'counter.c'Harald Welte2-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
2017-10-09utils: add osmo_is_hexstr(), add unit testNeels Hofmeyr1-0/+5
Will be used by OsmoHLR to validate VTY and CTRL input. Change-Id: Idf75946eb0a84e145adad13fc7c78bb7a267aa0a
2017-09-25Add time conversion helpersMax1-0/+5
Add macros to break down absolute time in seconds into days/hours/minutes passed. Change-Id: I46b9a405c18ed9da8f31b7d5b6dcece5468bafbf
2017-09-18Expand bit pretty-printerMax1-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
2017-08-12add osmo_fd_setup() convenience function to fill-in osmo_fdHarald Welte1-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
2017-07-29Rename GSMTAP_CHANNEL_PDCH to GSMTAP_CHANNEL_PDTCHHarald Welte1-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
2017-07-18add DLMGCP logging category for libosmo-mgcpNeels Hofmeyr1-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
2017-07-13socket: Add new OSMO_SOCK_F_NO_MCAST_ALL optionHarald Welte1-0/+2
Using this option at socket creation, the caller can request disabling the IP_MULTICAST_ALL socket option. Change-Id: I5ab5de45c0b64ceb3636ea98245a23defa24ffd4
2017-07-13socket: Allow disabling multicast loop on socket creationHarald Welte1-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
2017-07-13socket.c: Add multicast related convenience functionsHarald Welte1-0/+6
Change-Id: Id703e7a7a1e065181a4c76c088b8dcc1b7fe15a2
2017-07-13select: Add new osmo_fd_close() functionHarald Welte1-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
2017-07-13gsmtap: Add value_strings for GSMTAP_TYPE and GSMTAP_CHANNELHarald Welte1-0/+3
Change-Id: Iaf8a99912f42a56ef785a1642e18238c0b67cf68
2017-07-13gsmtap_util: Add chantype_gsmtap2rsl() as inverse of chantype_rsl2gsmtap()Harald Welte1-0/+1
Change-Id: Ie1bc00670887064da0fea61c3dab036c23ceea25
2017-07-10Add pseudo-random bit sequence generator to libosmcooreHarald Welte1-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
2017-07-08Deprecate wrappers around loglevel_strsMax1-2/+2
Add deprecation notice for public API use: it shouldn't be used outside of libosmocore anyway. Change-Id: I792e30dc44f027fd94e1f65af19fe08bac52b95c Related: OS#71
2017-06-23doxygen: unify use of \file across the boardNeels Hofmeyr38-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
2017-06-23doxygen: various fixes in core/timer.hNeels Hofmeyr1-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
2017-06-23api doc typo fix in core/logging.hNeels Hofmeyr1-1/+1
Change-Id: I3f1cd5b10e7beccb61f370d7f8fa2666e56542cf
2017-06-23doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr29-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
2017-06-19Move NUM_BYTES macro to core libraryMax1-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
2017-06-18Fix compilation warning on deprecated macroPau Espin Pedrol2-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
2017-06-12update/extend doxygen documentationHarald Welte1-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
2017-05-26socket: Add osmo_sock_init2_ofd() functionPau Espin Pedrol1-0/+4
Will be used by osmo-bts-trx Change-Id: I3c655a4af64fb80497a5aaa811cce8005dba9cd9
2017-05-17sercomm: More API documentationHarald Welte1-1/+27
Change-Id: I5d5002ceedd10e10d772693478f4f9cab6b1290a
2017-05-17sercomm: Better integration of driver interfaceHarald Welte1-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