aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
AgeCommit message (Collapse)AuthorFilesLines
2017-05-17sercomm: make rx msg size configurable per instanceHarald Welte1-0/+1
Change-Id: I835506e26e83232e1e7290c0da04d389c8d7fb40
2017-05-17sercomm: introduce osmo_ naming prefix in struct and function namesHarald Welte1-14/+14
Change-Id: If4e22f182a47b72b1fe43146716a4fbccceb62e6
2017-05-17sercomm: Enable multiple instances of 'sercomm'Harald Welte1-11/+36
Rather than having one global instance, let's permit multiple instances of sercomm to co-exist, with all API functions extended by the instance as first argument. Change-Id: I0f3b53f464b119d65747bcb0be0af2d631e1cc05
2017-05-17Import sercomm.c from osmocom-bbHarald Welte1-0/+61
This imports the file src/target/firmware/comm/sercomm.c from osmocom-bb.git without introducing any modifications. It will not even be built yet, as Makefile integration is intentionally left until it has been adapted to work inside libosmocore. Change-Id: I9ee199381c7b5986a9540d124836cdddd0f66c86
2017-05-17l1sap: Add frame-number to measurement indication structPhilipp Maier1-0/+1
The distribution of the channel measurement calculations over multiple timeslots (continous calculation) requires to keep track of the frame number in struct info_meas_ind_param Change-Id: I8c783b4a92ae2c3cc5d17936a146eb49d47eac37
2017-05-15stats: Disable stats*.c on embedded targetsHarald Welte1-0/+10
Change-Id: I6beb4fcc394ed7d3f8dd7a097b6e998245ecf401
2017-05-15gsm/tlv.h: fix copy-paste errorVadim Yanitskiy1-2/+2
Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
2017-05-15gsm0808 + ipa: fix compilation on systems without sys/socket.hHarald Welte2-2/+2
Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
2017-05-15tlv: Add tlvp_val{16,32}be() to get TLV values in unaligned host byte orderHarald Welte1-0/+23
Change-Id: I3749e1e4974742bc8c32722e0e998775b5394829
2017-05-15introduce byteswap.h with osmo_{htonl,ntohl,htons,ntohs}Harald Welte1-0/+43
We need to have an architecture-independend way of endian conversion / byte swapping functions which will also work on embedded (bare iron) builds. Let's introduce osmocom/core/bytesawp.h for this purpose. Change-Id: Ibc0cc1e36d4ed63a35cf8ceff3af0f26e5ac7a3d
2017-05-15endian.h: Make it work on 'bare iron' builds (and possibly more platforms)Harald Welte1-1/+13
We can use __BYTE_ORDER__ which seems to be defined by both gcc and clang/llvm. Change-Id: Id6821c99e88242126d9697099b1dd92c6212526a
2017-05-14Make EARFCN size calculation more robustMax1-1/+4
* 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
2017-05-12gsm_04_08: Add missing GSM cause valueDaniel Willmann1-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
2017-05-09timer: add osmo_timer_setup()Pablo Neira Ayuso1-0/+2
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
2017-05-09vty: cleanup logging functionsMax2-3/+3
* 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
2017-05-09gprs: add value strings for NS PDU typeMax1-0/+2
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
2017-04-28Add SW Description (de)marshallingMax1-0/+16
* 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
2017-04-27control_if: Add control interface commands for FSMsHarald Welte1-0/+2
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
2017-04-27control_if: Add helper function for 'local execution' of control commandHarald Welte1-0/+1
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
2017-04-26control_if: Add API to initialize control interface without TCP port bindHarald Welte1-0/+1
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
2017-04-26ctrl: Allow installation of additional node lookup helpersHarald Welte1-0/+2
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
2017-04-16osmo_fsm: Lookup functions to find FSM Instance by name or IDHarald Welte1-0/+4
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
2017-04-15ipa: Introduce helpers to encode IPA CCM ID RESPONSEHarald Welte1-0/+7
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
2017-04-15msgb: Add msgb_pull_to_l2() analogous to msgb_pull_to_l3()Harald Welte1-0/+15
Introduce msgb_pull_to_l2() which pulls (removes) any msgb contents in front of the L2 header (msg->l2h). Change-Id: I7786a1b30f9e7eaa3dcdb3cbb2a85a126588f6cd
2017-04-14vty/command.h: Introduce VTY nodes for libosmo-sigtranHarald Welte1-0/+8
This adds several VTY nodes required by the libosmo-sigtran VTY interface. Change-Id: I184a7e3187b48c15c71bf773f86e188fe1daad15
2017-04-09Add osmo_sock_init2() function, allowing both BIND *and* CONNECTHarald Welte1-0/+4
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
2017-04-09Add struct osmo_prim_event_map and osmo_event_for_prim()Harald Welte1-0/+14
This can be used to map from an osmo_prim to an osmo_fsm event. Change-Id: I52350f4ebe97811b2a692e5a69a2cd39a853583c
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier1-0/+5
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
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier1-0/+3
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
2017-04-08gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier1-0/+2
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
2017-04-08gsm0808: Add utils for Cell Identifier ListPhilipp Maier2-0/+16
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
2017-04-08gsm0808: Add utils for Encryption InformationPhilipp Maier2-0/+18
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
2017-04-08gsm0808: Add utils for Channel TypePhilipp Maier2-0/+17
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
2017-04-08gsm0808: Add AoIP specific elements to gsm0808_create_... functionsPhilipp Maier1-2/+19
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
2017-04-08gsm0808: Add utils for Speech Codec List and Speech CodecPhilipp Maier2-0/+41
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
2017-04-08gsm0808: Add utils for AoIP Transport Layer AddressPhilipp Maier1-0/+30
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
2017-04-08add VTY port number for osmo-stpHarald Welte1-0/+1
Change-Id: I978e1b73aa8097a7db6318d78f9f93457e6ce2af
2017-04-03logging.h: #define DLSS7, DLSCCP, DLSUA, DLM3UA for libosmo-sigtranHarald Welte1-1/+5
Change-Id: I61f452208088dc7097165deecef7c058ebb4bd4e
2017-03-23Add support for PCU version reportMax1-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
2017-03-22abis: add message type namesMax1-0/+1
Add human-readable names for Message Types from 3GPP TS 52.021 §9.1 Related: OS#1614 Change-Id: Ide8202b4387351f57ceee34a9eb8c30aef09a663
2017-03-21abis: add attribute namesMax1-0/+1
Add human-readable names for Attributes from 3GPP TS 52.021 §9.4 Change-Id: I861247c01557dac7e484ef6fb9b170f69c8a7f55 Related: OS#1614
2017-03-16add gsm48_pdisc_msgtype_name()Neels Hofmeyr1-0/+5
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
2017-03-16add gsm48_pdisc_names and gsm48_pdisc_name()Neels Hofmeyr1-0/+4
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
2017-03-15fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()Neels Hofmeyr1-1/+1
To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7
2017-03-15ctrl_type_vals: explicitly terminateNeels Hofmeyr1-1/+1
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
2017-03-15linuxlist.h: add llist_first/last_entry macrosNeels Hofmeyr1-0/+30
Copy list_first_entry, list_first_entry_or_null and list_last_entry from current linux kernel's tools/include/linux/list.h and rename to llist_*. Slightly adjust API doc but stay as close to the source as possible. This can replace similar implementations in osmo-bts-octphy's l1_if.c, in openbsc's gtphub.c and in osmo-hlr's gsup_server.c. Change-Id: I4eac5be0c0b2cede04464c4c3a0873102d952453
2017-03-15osmo_auth_gen_vec: UMTS auth: fix SQN as SEQ || INDNeels Hofmeyr1-0/+2
So far we incremented SQN by 1, which doesn't match the procedures described in 3GPP TS 33.102. An IND (index) denotes a non-significant part of SQN, and the significant SEQ part needs to be incremented. In OsmoHLR we furthermore want to use the "exception" suggested in annex C.3.4, so that each HLR's client has a fixed IND index. In other words, we will not assign IND cyclically, but keep IND unchanged per auth vector consumer. Add 'ind_bitlen' and 'ind' to the osmo_sub_auth_data.u.umts structure and increment SQN accordingly. Add a comment explaining the details. Because 'ind_bitlen' is still passed as zero, the milenage_test does not change its behavior, which is a feature I want to clearly show in this patch. The test will be expanded for the newly implemented SQN scheme in a subsequent patch. Adjust osmo-auc-gen.c to still show the right SQN and SQN.MS -- because it is passing ind_bitlen == 0, osmo-auc-gen can rely on single increments and know SQN.MS is sqn - 1. Note that osmo-auc-gen_test output remains unchanged. Related: OS#1968 Change-Id: Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf
2017-03-14gsm_04_08: add _NUM_CHREQ_T to enumAlexander Couzens1-0/+1
_NUM_CHREQ_T defines the last element of the enum Change-Id: Id67ba8de89dd6288e449197438e9e1c5d7f5a134
2017-03-14gsm0408: add chreq_type for CHREQ_T_PDCH_ONE_PHASE and CHREQ_T_PDCH_TWO_PHASEAlexander Couzens1-0/+2
The previous version of this commit got reverted to avoid a breakage in openbsc. The problem is openbsc use an array of chreq_type with a manual defined size. This array is using enums as index which breaks if any elements got added into the middle, because the size of the array can't hold elements greater or equal than the size. Change-Id: I6676105507fe4e5627f740dfe4c2770f766ad068
2017-03-07libosmocoding: migrate transcoding routines from OsmoBTSVadim Yanitskiy5-0/+210
There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1