summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* src/logging.c: Fix EMBEDDED buildHarald Welte2017-05-151-1/+1
| | | | | | | We don't enable/build _file_output in EMBEDDED builds, so we shouldn'r refer to that symbol. Change-Id: I491aa8ee9d20a96cbb2814700475afe03eb99c9e
* Make EARFCN size calculation more robustMax2017-05-142-6/+22
| | | | | | | | | | | | | * add osmo_earfcn_bit_size_ext() function which allows to specify how many EARFCNs we should skip when estimating required bit size for SI2quater * make old osmo_earfcn_bit_size() into wrapper over newly added function and mark it as deprecated This is necessary to properly estimate necessary space for EARFCNs when they are spread over several SI2q messages with different index. Change-Id: I92e12e91605bdab9916a3f665705287572434f74 Related: RT#8792
* gsm_04_08: Add missing GSM cause valueDaniel Willmann2017-05-121-0/+3
| | | | | | | | | | | | Table 10.5.157 in 10.5.6.6 of 3GPP TS 04.08 is badly formatted. The first value 0x19 "LLC or SNDCP failure" is in the same line as the heading and has not been included in the struct_value so far. Table 10.5.157 in 10.5.6.6 of 3GPP TS 24.008 fixes this formatting issue and also defines two more values 0x08 and 0x18 which are now added to the struct value_string. Change-Id: I5bcc52f739ff0677011d024448afcc2a54869638
* doc: fix incorrect return value descriptionMax2017-05-101-1/+1
| | | | | Change-Id: Ieba009273f911bc4217122a6346220aeb29e8bc4 Related: OS#1614
* timer: add osmo_timer_setup()Pablo Neira Ayuso2017-05-099-16/+21
| | | | | | | | | | | | | | | Add a new function timer function to set up the timer, similar to what we have in the Linux kernel. This patch also converts existing opencoded timer setup in the libosmocore tree as initial client of this new function. This patch implicitly removes function callback passed by reference that defeat compile time type validation. Compile-tested only, but I ran make check that reports success when testing timer infrastructure. Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
* vty: cleanup logging functionsMax2017-05-092-14/+15
| | | | | | | | | | | | * remove unused parameter from logging_vty_add_cmds() * mark log level descriptors static * change internal static function int check_log_to_target() to more appropriate bool should_log_to_target() * deprecate log_vty_command_*() from public API as it should only be used by logging_vty_add_cmds() Change-Id: I0e9ddd7ba3ce211302d99a3494eb408907a2916e Related: OS#71
* gprs: add value strings for NS PDU typeMax2017-05-092-2/+27
| | | | | | | | Add value strings for Service Control PDUs according to 3GPP TS 48.016 §9 and use them for logging. Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610
* Simplify ctrl cmd lookupMax2017-05-082-32/+25
| | | | | | | Replace if-else ladder & gotos with single switch statement & explicit return to make reading code easier. Change-Id: Ida1b389b571c60c26813cd29e61b3e4423c5df0f
* gsm0808: fix control flow issuePhilipp Maier2017-05-081-3/+2
| | | | | | | | | | | | | | | | | | Coverity Scan reported a control flow issue in line 206: CID 166898: Control flow issues (DEADCODE) The second branch of the if statement can not be reached. The purpose of the second if branch was to filter out zero length elements if the header states that it is a non extended speech codec type. This makes no sense, since the header needs at least one byte. This patch removes the second if branch, zero length elements are catched by the already existing zero length check at the beginning of the function Change-Id: I89751fc0d598734c64ef1fdced75b7c4fa77c616
* core/conv: strip unused memalign() callVadim Yanitskiy2017-05-071-10/+1
| | | | | | | | | The alligned memory allocation is only required for SSE, which is currently unsupported. Moreover, it's better to use dedicated _mm_malloc() and _mm_free() from xmmintrin.h instead, which are introduced by Intel specifically for SIMD computations. Change-Id: Ide764d1c643527323334ef14335be7f8915f7622
* Fix broken ctrl commandsMax2017-05-031-1/+2
| | | | | | | | | | | Recent changes to libosmoctrl resulted in ctrl comands being broken because local lookup helper returned incorrect value for ROOT_NODE. Note: although this commit seems to fix it for me, I'm still not sure how the logic behind lookup function return values work. Would be nice to get it documented. Change-Id: Iddd20602047ebd9be1b668593f5dfa6f1d3e8369
* Add SW Description (de)marshallingMax2017-04-282-0/+160
| | | | | | | | | | | | | | | | * data structure representing 3GPP TS 52.021 §9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * functions to extract/estimate buffer size for SW Description * test harness (partially taken from OpenBSC) There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614
* Uninitialized variable in ipa_ccm_make_id_resp_from_req()Harald Welte2017-04-271-0/+2
| | | | | | | | | | We are allocating a buffer on the stack without initializing it, and then passing it into ipa_ccm_make_id_resp(). There is no real danger from this, as the buffer is only uninitialized if num_ies is 0, but let's memset() it for good style Change-Id: If5761a47b8cba73ddcc02a88cfa5c87c1970c04e Fixes: coverity CID#167040
* control_if: Don't use magic number '5' when allocating vectorHarald Welte2017-04-271-1/+1
| | | | | | We have a proper constant for this (_LAST_CTRL_NODE), so let's use it. Change-Id: I46275e644166156cb665da70d2964008f1c6cd88
* control_if: Add control interface commands for FSMsHarald Welte2017-04-273-1/+180
| | | | | | | | | This allows programmatic access to introspection of FSM instances, which is quite handy from e.g. external test cases: Send a message to the code, then use the CTRL interface to check if that message has triggered the right kind of state transition. Change-Id: I0f80340ee9c61c88962fdd6764a6098a844d0d1e
* control_if: Add helper function for 'local execution' of control commandHarald Welte2017-04-271-0/+28
| | | | | | | | Sometimes (particularly when testing), we may want to parse+execute an arbitrary control command simply form a string buffer, rather than from a msgb. Let's add a helper for that. Change-Id: Iaca748e0d942bb2a1ee7c2776b37485e1439eb0c
* control_if: Add API to initialize control interface without TCP port bindHarald Welte2017-04-261-27/+63
| | | | | | | When executing test cases, we don't want to bind to a local TCP port, as we cannot make assumptions as to which ports are actually free. Change-Id: I5717f9dd92d1f143f069cecd4b4c8ba3d03b25f8
* ctrl: Allow installation of additional node lookup helpersHarald Welte2017-04-261-0/+41
| | | | | | | | | | | | The existing code assumes that the main application knows about all control command nodes and can thus present one lookup function. As libraries are getting their own control interface handling, this is too restrictive, and we need a way how library code can dynamically register more node lookup helpers. We can now do this by means of a ctrl_lookup_register() function. Change-Id: Ib69908d1c57f5bb721d5496e3b4a5258fca450e3
* fix spelling in API docu, command reply, logging, descriptionsThorsten Alteholz2017-04-235-5/+5
| | | | | | sections: ctrl, gb, gsm, vty Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70
* fsm: Re-set fsm_inst->T to 0 after timer expirationHarald Welte2017-04-161-1/+4
| | | | | | | | | | If the user starts the FSM timer with a given timer number during fsm_inst_state_chg() with a timeout, we should remove that "T" number after timer expiration. Otherwise it might be confusing if e.g. the VTY interface shows FSM instances with a certain timer number assigned, but that timer is not actually running anymore. Change-Id: I71167ec1000dc4c6954d851d3b92f6bf12984925
* osmo_fsm: Lookup functions to find FSM Instance by name or IDHarald Welte2017-04-161-0/+24
| | | | | | | Introduce two lookup helper functions to resolve a fsm_instance based on the FSM and name or ID. Also, add related test cases. Change-Id: I707f3ed2795c28a924e64adc612d378c21baa815
* ipa: Introduce helpers to encode IPA CCM ID RESPONSEHarald Welte2017-04-152-1/+120
| | | | | | | | | | The ipa.c file already contained code to parse an ID RESPONSE into the 'struct ipaccess_unit', but it didn't so far contain code to put together an ID RESPONSE packet based on that structure. Let's change that with ipa_ccm_make_id_resp() and a helper wrapper ipa_ccm_make_id_resp_from_req(). Change-Id: Icbcd8827a75fd5f3393351c1ca372de85275ad35
* core/conv: implement optimized Viterbi decoderTom Tsou2017-04-114-1/+806
| | | | | | | | | | | | | | | | | | | | Add a separate, faster convolution decoding implementation for rates up to N=4 and constraint lengths of K=5 and K=7, which covers the most GSM code uses. The decoding algorithm exploits the symmetric structure of the Viterbi add-compare-select (ACS) operation - commonly known as the ACS butterfly. This shift-register optimization can be found in the well-known text by Dave Forney. Forney, G.D., "The Viterbi Algorithm," Proc. of the IEEE, March 1973. Implementation is non-architecture specific and improves performance on x86 as well as ARM processors. Existing API is unchanged with optimized code being called internally for supported codes. The original code was relicensed under GPLv2-or-later with permission of copyright holder - Tom Tsou. Change-Id: I74d355274b4176a7d924f91ef3c96912ce338fb2
* Add osmo_sock_init2() function, allowing both BIND *and* CONNECTHarald Welte2017-04-091-33/+187
| | | | | | | | | The old osmo_sock_init() function allows only either a bind (for a server socket), or a connect (for a client socket), but not both together. So there's no way to have a client socket that is bound to a specific local IP and/or port, which is needed for some use cases. Change-Id: Idab124bcca47872f55311a82d6818aed590965e6
* Add struct osmo_prim_event_map and osmo_event_for_prim()Harald Welte2017-04-091-0/+18
| | | | | | This can be used to map from an osmo_prim to an osmo_fsm event. Change-Id: I52350f4ebe97811b2a692e5a69a2cd39a853583c
* compiler warnings: take care of compiler warning "unused-result"Thorsten Alteholz2017-04-081-0/+7
| | | | | | | | Though it makes no sense to handle the return code of freopen() here, the compiler complains about it. The #pragma statements take care of that. Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
* gsm0808: make gsm0808_create_reset_ack() accessiblePhilipp Maier2017-04-081-0/+1
| | | | | | | | | | | The create function to generate the RESET ACKNOWLEDGE message is not accessible from outside, as it does not appear in limosmogsm.map. It also has not testcase. This commit adds gsm0808_create_reset_ack() to the map file and also adds a testcase. Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
* gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier2017-04-082-0/+57
| | | | | | | | | | gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
* gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier2017-04-082-0/+53
| | | | | | | | | | gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
* gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier2017-04-082-0/+34
| | | | | | | | | | gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
* gsm0808: Add utils for Cell Identifier ListPhilipp Maier2017-04-082-0/+80
| | | | | | | | | | The planned support for true A over IP requires the encoding of the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528
* gsm0808: Add utils for Encryption InformationPhilipp Maier2017-04-082-0/+73
| | | | | | | | | | The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb
* gsm0808: Add utils for Channel TypePhilipp Maier2017-04-082-0/+75
| | | | | | | | | | The planned support for true A over IP requires the encoding of the a Channel Type element (see also ASSIGNMENT REQUEST). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: Id0e2164d84b8cbcc6fe6a090fc7f40a1251421d7
* gsm0808: Add AoIP specific elements to gsm0808_create_... functionsPhilipp Maier2017-04-082-5/+58
| | | | | | | | | the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34
* gsm0808: Add utils for Speech Codec List and Speech CodecPhilipp Maier2017-04-082-0/+190
| | | | | | | | | | The planned support for true A over IP requires the encoding and decoding of a so called "Speech Codec Element" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I0e1e2edf47adaa45b22d4b0bcae3640dba7ca200
* gsm0808: Add utils for AoIP Transport Layer AddressPhilipp Maier2017-04-083-1/+125
| | | | | | | | | | The planned support for true A over IP requires the encoding and decoding of a so called "AoIP Transport Layer Address" element. This commt adds parsing functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I57933b0a06a3f54ec2a41e6ecb6ced9fbbc89332
* select: Find the highest fd when filling the fd_setsHolger Hans Peter Freyther2017-04-041-1/+12
| | | | | | | | | | | | | | | Instead of returning maxfd, which is the highest fd ever seen, take the highest we have seen on this iteration. This makes a tiny difference for the osmo-sip-connector and its event loop integration. select.c ignores the return value of this function right now. This was seen while debugging the eventloop integration of the osmo-sip-connector before and after a VTY connection. The fds being polled didn't go down. Change-Id: I1a6d7271273ec08bb511c21b936891bc508843e4
* logging: Add log_info_cat for DLSS7/DLSCCP/DLSUA/DLM3UAHarald Welte2017-04-031-0/+20
| | | | | | | In Change-Id I61f452208088dc7097165deecef7c058ebb4bd4e we introduced the #defines but didn't introduce the new log_info_cat information. Change-Id: I218aa4cb1fc7640a75663be29bac672dfa8770f5
* Fix LAPD UA message buffer memory leak.Jean-Francois Dionne2017-03-291-5/+5
| | | | | | | | | The state check in lapd_dl_reset causes some buffers never to be released. Using talloc report LAPD UA message buffers are never released after each call and cause a memory leak. Change-Id: I2799b70623f2ec4dbc725eb213e332e98da02a3e
* Add support for PCU version reportMax2017-03-231-0/+1
| | | | | | | | Expand 3GPP TS 52.021 §9.4.43 Probable Cause with Osmocom-specific value for PCU version reporting to enable sending it via OML alarms. Change-Id: If57459c0610f2c7b36d599b13087c8deef8bdd9e Related: OS#1614
* abis: add message type namesMax2017-03-222-0/+104
| | | | | | | | Add human-readable names for Message Types from 3GPP TS 52.021 §9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
* abis: add attribute namesMax2017-03-212-0/+72
| | | | | | | Add human-readable names for Attributes from 3GPP TS 52.021 §9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614
* build: fix build dependencies for generated sourcesNeels Hofmeyr2017-03-201-1/+3
| | | | | | | | Ensure that a changed conv_gen.py and/or conv_codes_gsm.py result in regeneration of the gsm0503* generated sources. Before this patch, manual cleaning of the generated files was necessary to benefit from a code update. Change-Id: Ib4328662c21280c0ea6aa9391a64ada2c6598704
* build: coding/gsm0503: fix build in sep. dir: -I builddirNeels Hofmeyr2017-03-201-0/+1
| | | | | | | | To allow building coding/gsm0503_interleaving.c which includes the generated bit*gen.h (via bits.h), add -I to the builddir include path in order to find the generated bit*gen.h headers there. Change-Id: I0d465bc109765b1315d615243bea6af027afa368
* logging: fail gracefully if log_info() was not calledHarald Welte2017-03-161-0/+21
| | | | | | | | The logging code crashes if osmo_log_info is not set, which is typically achieved by calling log_init(). Let's fail with a reasonable assert and error message if the user forgets that. Change-Id: If3007860d2efe6ea9aec27e7d7439d44a7cd19c2
* add gsm48_pdisc_msgtype_name()Neels Hofmeyr2017-03-162-0/+202
| | | | | | | | | | | | | | | Composing the message type string requires knowing the protocol discriminator. To ease printing the message type, add this function to switch between the defined value_string[]s depending on pdisc. Also publish the message type value_string[]s -- without inline functions to access them because it is anyway more convenient to use gsm48_pdisc_msgtype_name() instead. Since gsm48_pdisc_msgtype_name() is nontrivial, do not add as inline function -- in case the message type is not known, it needs a static string buffer. Change-Id: I0fca8e95ed5c2148b1a7440eff3fc9c7583898df
* add gsm48_pdisc_names and gsm48_pdisc_name()Neels Hofmeyr2017-03-162-0/+20
| | | | | | | I often want to log the protocol discriminator in the openbsc debug log. It's more useful to get the name directly instead of looking it up every time. Change-Id: I0f053e2a4360b27ffccda7cf82469fb1b1cbb3ae
* auth_milenage: fix check against too large indNeels Hofmeyr2017-03-161-1/+1
| | | | | | | To ensure that the IND index appended to SEQ does not affect the SEQ, the check should read '>= seq_1', not '>'. Change-Id: Ib1251159eee02aa07fae1b429ffec2e4604bf6a8
* ctrl_type_vals: explicitly terminateNeels Hofmeyr2017-03-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use CTRL_TYPE_UNKNOWN as value_string[] terminator, use an explicit, more obvious { 0, NULL } termination. Set an explicit string for CTRL_TYPE_UNKNOWN. No other value_string[]s to date have such a "hidden" terminator. BTW, a { 0, "string" } item is not a terminator, only { 0, NULL } is, so we can set a string for CTRL_TYPE_UNKNOWN == 0. Also, having a string value for CTRL_TYPE_UNKNOWN is not harmful because all code paths explicitly check for the CTRL_TYPE_*s that are valid. Adjust the test expectation. From the ctrl_type_vals enum, remove the = 0, because it is implicitly 0 anyway. One motivation to press this fixup: I am trying to add a script that checks whether all value_string[]s are terminated to our jenkins jobs, and to find that this one is terminated, it would need to interpret the CTRL_TYPE_UNKNOWN constant, which would make things far more complex. At this point, all of the value_string[]s have an explicit termination, and I would like to enforce this from now on -- for readable code and to not spend more time on the validator. The patch adding ctrl_type_vals (Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28) was accepted by another reviewer before I could reconfirm my -1, so this is a fixup to enable the termination checking script patches. Related: I2bc93ab4781487e7685cfb63091a489cd126b1a8 (adds script to libosmocore) I7fe3678b524d602fc6aa14bc0ed06308df809a3e (uses in jenkins.sh) Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28 (adds ctrl_type_vals) Change-Id: Ia99f37464c7b36b587da2cc78f52c82725f02cbc
* fix wrong return codeThorsten Alteholz2017-03-151-1/+1
| | | | | | | | | | | | In case we are a daemon, we do not need to daemonize again. On the other hand everything is fine and we also do not need to bail out with an error. The daemonize template at [1] does the same. [1] http://www.itp.uzh.ch/~dpotter/howto/daemonize Change-Id: Ia4dcf7344bd65934faa3d7d46563f6e0532c232e