path: root/include/osmocom
AgeCommit message (Collapse)AuthorFilesLines
2018-02-15fsm: Add a function to change the FSM instance ID laterDaniel Willmann1-0/+2
Sometimes we want to create an FSM instance before we know its name. In that case we should be able to update the id later. Change-Id: Ic216e5b11d4440f8e106a297714f4f06c1152945
2018-02-15Add function to encode classmarkMax1-0/+1
The code is based on Osmocom-BB implementation. Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
2018-02-15Add generic Mobile Identity encoderMax1-0/+1
Add generic function which allows caller to set Mobile Identity explicitly. This allows to use IMEI or IMEISV for example. Make gsm48_generate_mid_from_imsi() into wrapper around new function. Change-Id: Id79be7abfff75ecd0d248bbeed93e605abeec9b3
2018-02-14gsmtap.h: define TETRA DMO mode channelsallesklar21-0/+5
Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
2018-02-13Add helper functions for ACC bit flags in rach control IE.Stefan Sperling1-2/+43
Add inline functions to manipulate and query ACC flag bits in the rach_control.t2 and rach_control.t3 octets. These function definitions also serve as documentation of the purpose of rach_control.t2/t3. Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163 Related: OS#2591
2018-02-09Add GSM 04.08 type-of-number / numbering-plan-id definitionsHarald Welte1-0/+22
Change-Id: Idd8d8a7a1c7f0b6cb9318e4f19ebadb415df2ed1
2018-02-09osmo_msgbdump_{l2,l3}(): Proper typecastHarald Welte1-2/+2
This avoids compiler warnings like /tmp/work/sysmobts_v2-poky-linux-gnueabi/osmo-pcu/0.4+gitAUTOINC+4c112dc5a6-r1.18/recipe-sysroot/usr/include/osmocom/core/msgb.h: In function 'const char* msgb_hexdump_l2(const msgb*)': error: invalid conversion from 'void*' to 'const unsigned char*' [-fpermissive] return osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)); which we've been getting in osmo-pcu builds on some platforms. Change-Id: I0ec652a1a569ec1507d8411cf1ef87afabcca799
2018-02-09msgb: Add msgb_hexdump_{l2,l3}() to dump l2 or l3 part of message bufferHarald Welte1-0/+14
Change-Id: I98e85397fb541ee0fd711f2e1852f63f3bb87359
2018-02-05GSUP: change osmo_gsup_encode() return typeMax1-1/+1
* match return type of osmo_gsup_encode() with osmo_gsup_decode() to allow propagating error to caller * check return value of osmo_gsup_encode() in GSUP test * return errors instead of braking app with aseert Change-Id: Idaa1deecb6d9e15329bd51867b4f6a03357461f0 Related: OS#2864
2018-02-05utils: add helper wrapper for osmo_strlcpy()Max1-0/+3
Add wrapper for osmo_strlcpy() which uses sizeof() to automatically determine buffer's size and use it for GSMTAP logging. This is pretty common use case for osmo_strlcpy() so it's a good idea to save some typing by using generic define. Related: OS#2864 Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
2018-02-03gsm48_hdr_msg_type(): SS is in the same group as MM/CCHarald Welte1-1/+1
Change-Id: I1ddadeacced9650885f454b81f3f0df531ea1e5d
2018-02-03gsm48_hdr_msg_type[_r99]: Fix bit-masksHarald Welte1-2/+2
TS 24.007 is quite clear: The upper two bits of the message type octet are *not* part of the message type in any of the L3 protocols which implement sequence numbers. it doesn't matter if it's R98 or R99, or whether the sequence number is 1bit or 2bits wide. Related: OS#2908 Change-Id: Iec875a77f5458322dfbef174f5abfc0e8c09d464
2018-01-27gsm_04_08.h: Reduce T310 default to 30s.Harald Welte1-1/+1
3GPP doesn't specify a network-side T310 default, but waiting for 180s (3 minutes!) for the next message after CALL CONFIRMED is clearly way too long and will just use radio resources for no good reason. Change-Id: Ia52f9358bc86b23c72af9c80e2fff5cb0004b57a Related: OS#2884
2018-01-27gsm_04_08.h: Clearly annotate timers that don't have a 3GPP Default valueHarald Welte1-7/+7
Change-Id: I44fffaec1f7c0d819aa2ebc85e97f19581fc689c
2018-01-24SMS: Add value_string for TS 04.11 CP and RP stateHarald Welte2-0/+11
Change-Id: I1b2f6fc6f455b0ba2a5732c567a4867bca97c3b0
2018-01-24fsm: add functions for unlinking and changing parentsPhilipp Maier1-0/+4
At the moment it is not possible to unlink a child from from its parent, nor is it possible to assign a new parent to a child FSM. - osmo_fsm_inst_unlink_parent(): Make it possible to unlink childs from a parent. - osmo_fsm_inst_change_parent(): Make it possible to change the parent of a child. Change-Id: I6d18cbd4ada903cf3720b3ad2a89fc643085beef
2018-01-19MNCC: Add MNCC to string dumperHarald Welte1-0/+9
As MNCC is rather hard to debug (wireshark cannot trace UNIX domain sockets), let's add our own decoder that we can use from related debug log statements in the respective programs. Change-Id: I216aaf70868ba5f3860a60c4b2442957531a3011
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
2018-01-17gsm0480: fix USSD OCTET STRING length confusionVadim Yanitskiy1-2/+22
According to the GSM 04.80 (version 5.0.0) specification Annex A "Expanded ASN.1 Module "SS-Protocol", the maximum size of a USSD OCTET STRING is 160 bytes. Thus according to ETSI TS 123 038 (version 10.0.0) specification "USSD packing of 7 bit characters", in 160 octets, it's possible to pack (160 * 8) / 7 = 182.8, that is 182 characters. The remaining 6 bits are set to zero. This change defines both mentioned values: - GSM0480_USSD_OCTET_STRING_LEN 160 - GSM0480_USSD_7BIT_STRING_LEN 182 keeping the old MAX_LEN_USSD_STRING 'as is' due to compatibility reasons. Now the new value is used for ss_request structure, while old one is still used for deprecated ussd_request structure. Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e
2018-01-15libosmocodec: implement ECU (Error Concealment Unit) for FRPhilipp Maier1-0/+15
When a bad GSM voice frame is received, it's being replaced by a silence frame. This may cause unpleasant audio effects. This change implements a functionality to craft a replacement frame from the last known good frame. Currently, only FR is supported, support for other codecs may be added latter. Change-Id: I06a21f60db01bfe1c2b838f93866fad1d53fdcd1
2018-01-12Deprecate gsm48_construct_ra()Max1-1/+1
It's just a tiny wrapper around gsm48_encode_ra() with less strict type signature. Related OS#1640 Change-Id: I79d6d1133afbf32e891a6b0e3a244c6885ea9614
2018-01-12gsm: add gsm0808_speech_codec_type_namesNeels Hofmeyr1-0/+5
Used for logging Speech Codec List entries in osmo-bsc, during handover decision. Change-Id: Ie6418d16db333188e9bcd2b32b7216f277ae8832
2018-01-08Add function to properly encode RAIMax2-0/+2
Add gsm48_encode_ra() which takes appropriate struct as [out] parameter instead of generic buffer. Using uint8_t buffer instead of proper struct type prooved to be error-prone - see Coverity CID57877, CID57876. Old gsm48_construct_ra() is made into tiny wrapper around new function. The test output is adjusted because of the change in function return value which was constant and hence ignored anyway. Related: OS#1640 Change-Id: I31f9605277f4945f207c2c44ff82e62399f8db74
2018-01-04Fix incorrect spec referenceMax1-1/+1
RAI is defined in 3GPP TS 24.008 § Change-Id: I484485d8c4c56b58dfecc1193bcdd48e61957422
2017-12-20logging vty: tweak general 'logging' command docNeels Hofmeyr1-1/+1
'logging' is not only for terminals, also for stderr and other log targets. Change-Id: If1ee59c7d1073502259b7d60008206ac3d8e87a3
2017-12-20libosmocodec: add FR bit offset definitionsPhilipp Maier1-0/+272
This change defines the GSM FR bit positions as described in RFC 3551, which will be used by further ECU (Error Correction Unit) implementation. Change-Id: I1d0a198af0f8dd1f690b5a81f5c9eb92c43aefed
2017-12-20libosmocodec: add FR/HR/EFR frame length definitionsVadim Yanitskiy1-0/+7
There are some projects, such as OsmoBTS and OsmocomBB, which are dealing with raw TCH payloads, so they need to have the FR/HR/EFR frame length defined. At the moment, each project defines them itself. Let's share these definitions. Change-Id: Ib19dd1bf81712d034157f9ce061008be0000ef38
2017-12-20ports: define proper VTY and CTRL ports for OsmoHNBGWNeels Hofmeyr2-0/+3
So far it uses 2323, a development default. Instead, assign new ports, appending to the common range of VTY and CTRL ports: 4261 and 4262. Related: https://osmocom.org/projects/cellular-infrastructure/wiki/Port_Numbers Related: I28bd7a97d24455f88fadc6724d45c3264ba2fce4 (osmo-gsm-manuals) Change-Id: Ife52a968a41cb286f640006587877971ff66c1a4
2017-12-18add ctrl_cmd_parse2() to return parsing errorsNeels Hofmeyr1-0/+1
If a control command fails to parse, we so far discard specific error messages and instead send just "Command parser error". In ctrl_cmd_parse() we actually compose detailed error replies, but in the end simply talloc_free() them and return NULL. A first step to report these errors to the ctrl command issuer is to not return NULL and instead return the cmd with type = CTRL_TYPE_ERROR. Add ctrl_cmd_parse2() to return such instead of NULL. To stay API compatible, provide ctrl_cmd_parse2() to return a cmd on errors. ctrl_cmd_parse() retains identical behavior but becomes just a simple wrapper around ctrl_cmd_parse2() which discards the cmd on error. No need really to deprecate ctrl_cmd_parse() yet; especially as long as compiler warnings might break jenkins builds. Change-Id: I5047c9f977d70b03eea77cbcfd2b96d43ea46880
2017-12-18ctrl: prep test: separate new ctrl_handle_msg() from handle_control_read()Neels Hofmeyr1-0/+2
In order to allow unit testing the ctrl iface msgb handling, have a separate msgb entry point function from the actual fd read function. An upcoming patch will prove a memory leak in CTRL msgb handling by a unit test that needs this separation. Change-Id: Ie09e39db668b866eeb80399b82e7b04b8f5ad7c3
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-18add osmo_auth_c3() (separate from gsm_milenage())Neels Hofmeyr1-0/+2
To send a Ciphering Mode Command, we may need to derive a Kc from UMTS AKA tokens. gsm_milenage() derives Kc from 3G tokens, but also derives an SRES. For SRES, it requires an OPC, which may need to be derived from OP first. All we need is a Kc, so we could feed a zero OPC ... but to simplify the function call for cases where just a Kc is required, separate the c3 function out from gsm_milenage(), as osmo_auth_c3(). Obviously call osmo_auth_c3() from gsm_milenage() (meaning that osmo-hlr's 55.205 derived auc tests still cover exactly that implementation). Prepares: If04e405426c55a81341747a9b450a69188525d5c (osmo-msc) Related: OS#2745 Change-Id: I85a1d6ae95ad9e5ce9524ef7fc06414848afc2aa
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-11Add functions for extended RACH codingMax1-1/+6
Add support for extended RACH (11 bit) according 3GPP TS 45.003 §5.3.2: * convolutional code with puncturing * encoding/decoding routines * corresponding tests Change-Id: I85a34a82d5cd39a594ee89d91a2338226066ab5d Related: OS#1548
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-20tlv_put: guard against NULL val and 0 lenNeels Hofmeyr1-2/+13
For example encode_auth_info() from gsup.c calls msgb_tlv_put(msg, iei, 0, NULL) to put a tag and len with content data following later. However, this would cause a memcpy() from a NULL pointer, in tlv_put(). Allow passing NULL and len = 0 for cases like the above: If val is NULL, use memset(0) instead of memcpy(). If len is zero, do not copy nor memset anything. Hence make tlv_put() behave in a well-defined and valid way for any and all input args; no negative fallout is possible from this patch. Add proper API doc comment. Fixes a sanitizer build failure in gsup_test: ../../../../src/libosmocore/include/osmocom/gsm/tlv.h:99:2: runtime error: null pointer passed as argument 2, which is declared to never be null Helps fix sanitizer build on debian 9. Change-Id: I13dce9cd1228817890d3e81edeeb660c893c1d64
2017-11-20msgb: add inline msgb_queue_free()Neels Hofmeyr1-0/+9
Related: Iaad35f03e3bdfabf3ba82b16e563c0a5d1f03639 (libosmo-netif) Change-Id: Ia291832ca445d4071f0ed9a01730d945ff691cf7
2017-11-20ports.h: Use same VTY port number for osmo-mgw and osmo-bsc_mgcpHarald Welte1-1/+1
It was decided that osmo-mgw as direct successor of osmo-bsc_mgcp will use the same VTY port number (similar to osmo-nitb, osmo-bsc and osmo-bsc-sccplite all using the same VTY port number) Change-Id: Iec1da9f3b4d170416279f05876d9e1ae2970c577
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte6-13/+18
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-11-10vty: add port number for osmo-mgwPhilipp Maier1-0/+1
Change-Id: Ied224fe94b5152fd19e259396fbc0eaf69be4b96
2017-11-08vty: deprecate now empty node commandsNeels Hofmeyr1-2/+2
Following I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b a deprecation of vty_install_default() and install_default() commands is indicated. However, compiler warnings may clutter build output or even fail strict builds, hence I am submitting the deprecation in a separate patch. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: Icf5d83f641e838cebcccc635a043e94ba352abff
2017-10-24GPRS: constify NS printing routine parametersMax1-1/+1
Change-Id: I549ab7c26ac1489e01f281594bafe44b0681dc83
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