summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* msgb: Allow size==headroom in msgb_alloc_headroom*()Pau Espin Pedrol2019-09-261-2/+2
| | | | | | | | | Nothinh really forbids this case, it's totally fine allocating all space of msgb as headroom. osmo-pcu actually does that in gprs_rlcmac_ul_tbf::snd_ul_ud(). Related: OS#4029 Change-Id: Ibe05d08e3169a2603e891f76682a3b352a93ec7a
* logging: Move extern declaration of osmo_log_target_list from logging.h to ↵Pau Espin Pedrol2019-09-202-1/+1
| | | | | | | | | logging_internal.h This list is really not needed by applications and currently only used internally in logging.c and logging_vty.c. Change-Id: I5dca069512bfcd0826194427c5482fad8bfd0232
* ecu_fr: increase test coverage for FR ECU implementationPhilipp Maier2019-09-201-2/+4
| | | | | | | | | | | | | The ECU implementation for FR is currently tested by calling the related functions directly and by using the generic ECU abstraction layer. However, the test "test_fr_concealment" only tests directly. Lets add a version that uses the generic ECU abstraction layer as well. The generic ECU abstraction layer obsolets the public API functions osmo_ecu_fr_reset() and osmo_ecu_fr_conceal(), lets tag those functions as dprecated. Change-Id: Ib0c8a9b164f14ea4fa00688f760a76cdb4890af4
* cosmetic: Add comment on GSM-FR ECU structPhilipp Maier2019-09-201-0/+1
| | | | Change-Id: Ic0a3a407c592262104af315f845f0bbd116ab26b
* cosmetic: Move comment to the right placePhilipp Maier2019-09-201-1/+1
| | | | Change-Id: I3d548fcc7d500baf37134b14af91bc7b284ce6ad
* logging.h: add L1 SAPI related context and filterOliver Smith2019-09-181-0/+2
| | | | | | | First user is osmo-bts in I6b7bb2e1d61502b61214f854a4ec5cbb7267545b. Related: OS#2356 Change-Id: I814cb3328d99faca9220adb5a80ffb934f219d7d
* logging_internal.h: Fix osmo_log_info definitionPau Espin Pedrol2019-09-171-1/+1
| | | | | | | | | Global symbol osmo_log_info is declared in logging.c as non-const, because it is modified. As soon as logging_internal.h is included into logging.c, the compiler warns about osmo_log_info being declared twice differently. Change-Id: Iea961c3caeb12ddf60c99d4dca644bb9ab538767
* tdef: fixup osmo_tdef_set()Neels Hofmeyr2019-09-111-1/+1
| | | | | | | | | | | | I missed code review, so here are my comments in form of a follow-up patch for Id56a1226d724a374f04231df85fe5b49ffd2c43c. - Fix 'as_unit' arg name to 'val_unit' as in the C file and API doc. - Explain rounding-up behavior of value conversion in API doc. - Use osmo_tdef_get_entry() instead of a loop. Related: OS#4190 Change-Id: Ia91c2f17e40fb9e79ffa5a7f28ce9c3605664402
* tdef_vty.h: Add missing header dependenciesPau Espin Pedrol2019-09-071-0/+3
| | | | | | | enum node_type is defined in osmocom/vty/command.h va_list is defined in stdarg.h Change-Id: Ia439a7097ae7a9765e229e5f66e07af3fe490ecc
* tdef: Introduce API osmo_tdef_set()Pau Espin Pedrol2019-09-071-0/+1
| | | | | | | | | This API is already useful for users willing to set a given timer to a given value. It will also contain code later that checks for value being inside valid range for that timer. Related: OS#4190 Change-Id: Id56a1226d724a374f04231df85fe5b49ffd2c43c
* Introduce BTS_FEAT_ETWS_PN for communicating ETWS PN capabilityHarald Welte2019-09-051-0/+1
| | | | | | | | | | As 3GPP doesn't specify how the BSC shall communicate ETWS Primary Notifications over Abis/RSL, we have to use a vendor-specific RSL message for this. And in order to know if the peer supports this feature, we introduces BTS_FEAT_ETWS_PN. Change-Id: I89c24a81ada6627694a9632e87485a61cbd3e680 Related: OS#4046, OS#4047
* gsm_08_58: Add vendor-specific Message Type for ETWS Primary WarningHarald Welte2019-09-051-0/+2
| | | | | Change-Id: I36fc2ffc22728887d1cb8768c7fcd9739a8ec0fc Related: OS#4046, OS#4047
* codec/ecu: Introduce new generic Error Concealment Unit abstractionHarald Welte2019-09-021-0/+54
| | | | | | | | | | | | | | | | | | | | We don't want to expose the details of a given ECU implementation to the user (e.g. osmo-bts), but have a generic abstraction layer where an ECU implementation can simply register a few call-back functions with the generic core. As the developer and copyright holder of the related code, I hereby state that any ECU implementation using 'struct osmo_ecu_ops' and registering with the 'osmo_ecu_register()' function shall not be considered as a derivative work under any applicable copyright law; the copyleft terms of GPLv2 shall hence not apply to any such ECU implementation. The intent of the above exception is to allow anyone to combine third party Error Concealment Unit implementations with libosmocore, including but not limited to such published by ETSI. Change-Id: I4d33c9c7c2d4c7462ff38a49c178b65accae1915
* cbsp: Fix endless loop iteration when decoding cell list IEsHarald Welte2019-08-311-0/+1
| | | | | | | | The CBSP code assumed that gsm0808_decode_cell_id_u() would return the number of bytes it has consumed/parsed. But it actually always returns '0', whcih makes us run in an endless loop :( Change-Id: I5758af4ec11a827d4b888a3a16c4ec22de90a7d6
* OSMO_SOCKADDR_STR_FMT_ARGS: guard against NULL pointerNeels Hofmeyr2019-08-301-1/+1
| | | | | | | The pointless '(R)->ip?' condition of the previous commit made me want to protect against R == NULL instead. Change-Id: Ie2f47ad8ae585aaf67a6476c67f8e014820a72bc
* OSMO_SOCKADDR_STR_FMT_ARGS: remove useless conditionNeels Hofmeyr2019-08-301-1/+1
| | | | | | | Since (R)->ip is a char[], it is always non-NULL. The (x ? : "") condition is completely pointless. Remove it. Change-Id: I13ed06776a784cfa99bbdfca2bb4dfe12913a1ec
* context: Add support for [per-thread] global talloc contextsHarald Welte2019-08-272-3/+26
| | | | | | | | | | Rather than having applications maintain their own talloc cotexts, let's offer some root talloc contexts in libosmocore. Let's also make them per thread right from the beginning. This will help some multi-threaded applications to use talloc in a thread-safe way. Change-Id: Iae39cd57274bf6753ecaf186f229e582b42662e3
* Cosmetic: l1sap.h: change /* !< to /*!<Oliver Smith2019-08-231-5/+5
| | | | Change-Id: Icaec95a9c6105fd17bc1151fdc77394f4efd3b70
* osmo_tdef_get(): allow passing -1 as default timeoutNeels Hofmeyr2019-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The intention of osmo_tdef_get()'s val_if_not_present argument was to return a default timeout, or to optionally abort the program for missing timer definitions if the default timeout is < 0. This was the case in the original implementation of this API in osmo-bsc, but in the migration to libosmocore, the argument was by accident changed to an unsigned type. In consequence, the assertion in the implementation that was intended to abort the program seemed bogus to coverity, and was fixed by removal in I7a544d2d43b83135def296674f777e48fe5fd80a -- the wrong direction, as is obvious from the API doc for osmo_tdef_get(). Note that osmo-bsc master passes -1 in various places and expects the program-abort behavior that was missing from the libosmocore implementation. Change the val_if_not_present argument to a signed type, and revert removal of the assertion, so that passing -1 has the effect described in the API doc: program abort on missing timer definition. This bug was not detected because it is hard to write tests that expect a program abort to happen, hence no tests for this API feature exist. Related: OS#4152 Change-Id: Ie61c3c85069916336e6dbd91a2c16f7634816417
* codec/ecu_fr: Mark input TCH frame as 'const' as we only read itHarald Welte2019-08-121-1/+1
| | | | Change-Id: I64c6d3dc08ff87b673ba6225f98546e86f91bcfd
* gsm/gsm48.h: drop meaningless 'const' from gsm48_mi_to_string()Vadim Yanitskiy2019-07-261-2/+1
| | | | Change-Id: I5eb17edadf89ac47b4ca86c9e822037f7c0e518e
* Add Cell Broadcast related definitions from 3GPP TS 23.041Harald Welte2019-07-202-0/+90
| | | | Change-Id: I1e2c62cb9047648907c91b99f764f6caba8f4493
* cbsp: Introduce osmo_cbsp_errstrHarald Welte2019-07-201-0/+2
| | | | | | | | | | | | | | Rather than having the encoder/decoder library print some log messages in case of encoding/decoding errors, let's provide something akin to 'errno', but with a string instead of a numeric error code. The 'osmo_cbsp_errstr' global variable (if set) contains a human-readable string describing the most recent encoding/decoding error. It exists separately for each thread and hence can be used safely in multi-threaded environments. Change-Id: Id9a5a595a76ba278647aee9470ded213d8464103
* CBSP (Cell Broadcast Service Protocol; 3GPP TS 48.049) supportHarald Welte2019-07-203-0/+422
| | | | | | | | | | This introduces definitions as well as a parser+encoder for the Cell Broadcast Service Protocol (CBSP) as specified in 3GPP TS 48.049. CBSP is used on the interface between CBC and BSC. Related: OS#3537 Change-Id: I5b7ae08f67e415967b60ac4b824db9e22ca00935
* libosmogsm/l1sap.h: extend ph_rach_ind_param with lqual_cbVadim Yanitskiy2019-07-101-0/+1
| | | | | | | | | | | | The link quality, defined by C/I (Carrier-to-Interference) ratio, can be computed from the training sequence of each burst, where we can compare the "ideal" training sequence with the actual training sequence and then express that in cB (centiBels, dB * 10). By analogy with both RSSI and ToA, it can be used to filter out false-positive detections and ghost Access Bursts. Change-Id: Ie2a66ebd040b61d6daf49e04bf8a84d3d64764ee
* Revert "utils.h: require a semi colon after OSMO_ASSERT"Vadim Yanitskiy2019-07-091-2/+2
| | | | | | | | | | | | | This reverts commit 4e284b637943980a405a8c44f2712b749ded428f. Unfortunately, some projects such as OsmoMSC, OsmoBTS and OpenBSC do contain OSMO_ASSERT statements without a semi colon. Thus, this change causes compilation errors when building them. Please note that only the OSMO_ASSERT's definition is reverted, while changes to other files (adding missing semicolons) are kept. Change-Id: I6da4d7397d993f6c1af658cb5ae1e49c92a1b350
* utils.h: require a semi colon after OSMO_ASSERTAlexander Couzens2019-07-081-2/+2
| | | | | | | | | When using `OSMO_ASSERT(exp);` clang will warn about an empty expression because the semi colon was superflous. Use do {} while (0) to enfore the need of a semi colon. This might break other test. Change-Id: I2272d29a81496164bebd1696a694383a28a86434
* add define for magic tmsi constantEric Wild2019-06-171-0/+1
| | | | Change-Id: I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec
* (minor) fix typo in commentsKévin Redon2019-06-131-3/+3
| | | | Change-Id: I697af428a2ea9a0ccd3f04ba8ec4664935ae29f8
* minor: don't redefine macrosKévin Redon2019-06-132-0/+4
| | | | | | | | | | | the DEBUG macro name and ARRAY_SIZE macro function are frequently used in other projects. If these projects also use libosmocore, the macros will be redefined. This also generates a warning message during compilation. Not redefining the macros removes the warning message and possible (but unlikely) mis-redefinition. Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
* protocol/gsm_04_08.h: do not check if unsigned is positiveVadim Yanitskiy2019-06-121-3/+3
| | | | Change-Id: I6b486b52a3733d5fd5e8ba18acbc9374e2e8bd7e
* core/utils: drop meaningless const from return value of osmo_luhn()Vadim Yanitskiy2019-06-121-1/+1
| | | | Change-Id: I085da06f31a0a6862ae2ba041fafc134cc240f7e
* fsm: Allow millisecond granularity in osmo_fsm built-in timerHarald Welte2019-06-051-0/+15
| | | | | | | | | | | | | | | | | | | | | | | So far, the public API of osmo_fsm only allowed integral seconds as timeout. Let's change that to milli-seconds in order to cover more use cases. This introduces * osmo_fsm_inst_state_chg_ms() * osmo_fsm_inst_state_chg_keep_or_start_timer_ms() Which both work exactly like their previous counterparts without the _ms suffix - the only difference being that the timeout parameter is specified in milli-seconds, not in seconds. The value range for an unsigned long in milli-seconds even on a 32bit platform extends to about 48 days. This patch also removes the documentation notice about limiting the maximum value to 0x7fffffff due to time_t signed-ness. We don't use time_t but unsigned long. Change-Id: I35b330e460e80bb67376c77e997e464439ac5397
* lapdm: Allow user to specify T200 values; Use correct N200 valuesHarald Welte2019-06-051-3/+9
| | | | | | | | | | | | | | | | | | TS 04.06 specifies a N200 re-transmission counter that depends on the channel type, which we didn't care about at all so far. Let's have the caller tell us the channel type so we can internally look up the correct N200 value for it. At the same time, permit the user to specify T200 re-transmission timer values for each SAPI on both DCCH and ACCH, which is required at least in the BTS as per GSM TS 12.21. Also, extend the timer resolution of the API from seconds to milli-seconds, which is more applicable as particularly on the FACCH the recommended values are in the 200ms range. Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c Related: OS#3906 Related: OS#2294 Related: OS#4037
* gsm0808_utils: Add gsm0808_decode_cell_id_u()Harald Welte2019-06-041-0/+1
| | | | | | | | | This function parses a single Cell ID list element into a 'union gsm0808_cell_id_u'. This function is going to be used by the upcoming CBSP support. Related: OS#3537 Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
* rest_octets: Remove SI2ter + SI2bis encoders that don't do anythingHarald Welte2019-05-281-2/+0
| | | | | | | | The library should either provide functions that implement encoding of those rest octets, or it shouldn't. Providing a function that doesn't do anything but pad the buffer is useless. Change-Id: Ie10684de6a6b2663e2a871fcdb2b275b6ad7a1e7
* rest_octets: Implement actual SI6 rest octets encodingHarald Welte2019-05-281-1/+38
| | | | | | | | | There's very little sense behind introducing a function into libosmogsm which doesn't implement 90% of the spec. Let's allow the caller to provide the various optional bits of information to the encoder, rather than generating mostly static SI6 rest octets. Change-Id: Id75005a0c4a02ce7f809692d58b3bd226bc582b2
* rest_octets: Add function to parse SI3 rest octetsHarald Welte2019-05-281-0/+3
| | | | | | Change-Id: I690cf308311f910005a325d50f5d5d825678d2b2 Related: OS#3075 Related: OS#4023
* rest_octets: Suffix encoder functiosn with _encodeHarald Welte2019-05-281-10/+12
| | | | | | ... otherwise it's not really clear what they do. Change-Id: I08e0ca9a8d13c7aa40b9d90f34f0e13adb87d4e0
* tdef: Fix license: GPLv2+ instead of AGPLv3+Harald Welte2019-05-271-4/+6
| | | | | | | | | | | | libosmo{core,gsm,vty} code is GPLv2+. The tdef code originated in osmo-msc.git and was moved here without changing the license. That was a mistake, it always was meant to be under GPLv2-or-later after moving to libosmocore.git. Copyright is with sysmocom, so I as the managing director can approve the license change. Change-Id: Ie483ff6f6ea0a56c477649677b4b163c49df11d7
* oap_client: Fix license: GPLv2+ instead of AGPLv3+Harald Welte2019-05-271-4/+5
| | | | | | | | | | | | libosmo{core,gsm,vty} code is GPLv2+. The OAP code originated in osmo-msc.git and was moved here without changing the license. That was a mistake, it always was meant to be under GPLv2-or-later after moving to libosmocore.git. Copyright is with sysmocom, so I as the managing director can approve the license change. Change-Id: I08311fa8214c15f8df8945b9894226608cf96f15
* rsl: Add osmocom-specific extensions to RSL channel numbers for CBCHHarald Welte2019-05-271-0/+4
| | | | | | | | | | | We don't really *need* it in libosmocore as such, but the lack of having all osmocom extensions listed here lead to using overlapping definitions: 0x18 was used for dynamic PDCH on the Abis side, but also for CBCH on the L1SAP side. Let's list them all here to increase visibility in case anyone wants to extend this further... Related: OS#4027 Change-Id: I93e557358cf1c1b622f77f906959df7ca6d5cb12
* protocol/gsm_12_21.h: fix copy-pasted struct descriptionVadim Yanitskiy2019-05-241-1/+1
| | | | Change-Id: Ic6d32c886f6f8f859e382d48f9e1b509000db9ba
* TLV: Add one-shot TLV encoderHarald Welte2019-05-191-0/+6
| | | | | | | | | | | | | | | | | So far, the TLV code contained two types of functions * tlp_parse() to parse all TLVs according to definition into tlvp_parsed * various helper functions to encode individual TLVs during message generation This patch implements the inverse of tlv_parse(): tlv_encode(), which takes a full 'struct tlv_pared' and encodes all IEs found in it. The order of IEs is in numerically ascending order of the tag. As many protocols have different IE/TLV ordering requirements, let's add a tlv_encode_ordered() function where the caller can specify the TLV ordering during the one-shot encode. Change-Id: I761a30bf20355a9f80a4a8e0c60b0b0f78515efe
* Cosmetic: GSUP: fix too long comment lineOliver Smith2019-05-191-2/+2
| | | | Change-Id: I60ba8fef8924e58bc73cff5c7ff77ebb76d8bfaa
* Deprecate usage of osmo_counter_*Daniel Willmann2019-05-191-2/+10
| | | | | | | There's not many of those around any more, let's try to move them to osmo_stat_items Change-Id: If67f64c6ec7a3f3114c962df9db50107d9ea86e2
* Revert "Change GSM48_PDISC_* to enum type"Harald Welte2019-05-181-20/+18
| | | | | | | This reverts commit ece1d8509d5c5af7a60ab5e1a5dddade1b181dc9 which causes build failures due to compile warnings everywhere. Change-Id: Ic131439ea206a0b0f57968ef701667da73711b51
* Change GSM48_PDISC_* to enum typeMax2019-05-171-18/+20
| | | | | | | | An enum is more clear than an int and #defines for passing around, also in case you have a switch () statement, the compiler will issue warnings for unhandled cases. Change-Id: Icbbe8786a776081d7643193f154e6270224399e6
* gsm_23_003: add GSM23003_MSISDN_{MIN,MAX}_DIGITSOliver Smith2019-05-151-0/+3
| | | | | | | | | | | Add the constant, so it can be used in create-subscriber-on-demand related patches. ITU-T Rec. E.164 6.1 states that maximum international number length should be 15. I did not find a source for a minimum length, but I've added the constant and set it to 1 for consistency (based on the existing osmo_msisdn_str_valid() function). Related: OS#2542 Change-Id: Idc74f4d94ad44b9fc1b6d43178f5f33d551ebfb1
* gsm0808: Introduce Osmocom extensions to announce Osmux supportPau Espin Pedrol2019-05-132-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | IE GSM0808_IE_OSMO_OSMUX_SUPPORT (T, 1 byte) is sent in AoIP appended to BSSMAP RESET in order to announce the peer that its MGW supports handling Osmux streams upon call set up. IE GSM0808_IE_OSMO_OSMUX_CID (TV, T 1 byte & V 1 byte) is sent in AoIP during call set up: * MSC->BSC Assignment Request * BSC->MSC Assignemnt Complete The 1 byte value contains the local Osmux CID, aka the recvCID aka CID where the peer sending the Assign Req/Compl will look for Osmux frames on that call. Hence, the peer receiving this CID value must use it to send Osmux frames for that call. As a result, a given call leg BSC<->MSC can have one different Osmux CID per direction. For example: * MS => MGW_BSC ==CID 0==> MGW_MSC * MS <= MGW_BSC <=CID 1=== MGW_MSC This allows for setups with 256 call legs per BSC on scenarios where NAT is not a problem, where MSC can have a pool of 256 CID per MGW_BSC (or remote peer). Related: OS#2551 Change-Id: I28f83e2e32b9533c99e65ccc1562900ac2aec74e