summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm48.c
Commit message (Collapse)AuthorAgeFilesLines
* gsm/gsm48.c: add call independent SS message namesVadim Yanitskiy2018-04-171-0/+12
| | | | Change-Id: I697639d8469e5dda617b27995c4a92e1f0c0bead
* protocol/gsm_04_08.h: drop incorrect GSM48_PDISC_USSDVadim Yanitskiy2018-04-171-1/+0
| | | | | | | | | | | | According to the GSM TS 04.07, section 11.2.3.1.1 "Protocol discriminator", bits 1 to 4 of the first octet of a standard L3 message contain the protocol discriminator IE. Meanwhile, the GSM48_PDISC_USSD represents value 0x11, i.e. 0b10001, that requires 5 bits, and moreover it is not documented anywhere. Let's drop it. Change-Id: Ic4eb8a6db4ff1dfd535bd0c84e7acf1908422f64
* add gsm48_reject_value_namesNeels Hofmeyr2018-04-091-0/+33
| | | | | | | | | | | | | | There seems to be quite some confusion / overlap between enum gsm48_reject_value, gsm48_gsm_cause and gsm48_gmm_cause. I tried to go with gsm48_gsm_cause_names[], but e.g. GSM48_REJECT_CONGESTION is not represented. Instead of attempting to mix/merge those enums, provide a separate value string array for enum gsm48_reject_value. This will be used by osmo-msc's libvlr (refactoring of FSM result handling), I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1. Change-Id: I6661f139e68a498fb1bef10c266c2f064b72774a
* implement support for 3-digit MNC with leading zerosNeels Hofmeyr2018-02-281-54/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable representing three-digit MNC with leading zeros. The MNCs 23 and 023 are actually different; so far we treated both as 23. Re-encode an incoming BCD or string of 023 as it were, i.e. not dropping the leading zero as 23. Break ABI compatibility by changing the size and ordering of structs gprs_ra_id, osmo_plmn_id, osmo_cell_global_id, ... by adding an mnc_3_digits flag. Change ordering in gprs_ra_id because the canonical oder is {Mobile Country Code, Mobile Network Code}, so have the mcc member first. ABI compatibility cannot be maintained for struct gprs_ra_id, since it is a direct member of structs bssgp_bvc_ctx and bssgp_paging_info, and even just adding a flag to the end would cause ABI changes of those structs. Similarly, osmo_plmn_id is a direct member of osmo_location_area_id, and so forth. Add new API to set and read this additional flag to preserve leading zeros: - osmo_plmn_to_bcd(), osmo_plmn_from_bcd() after gsm48_mcc_mnc_to_bcd() and gsm48_mcc_mnc_from_bcd(). - gsm48_decode_lai2(), gsm48_generate_lai2() after gsm48_decode_lai(), gsm48_generate_lai(). - gsm0808_create_layer3_2() after gsm0808_create_layer3() and gsm0808_create_layer3_aoip(). - various osmo_*_name() functions in gsm23003.h (osmo_rai_name() still in gsm48.h close to struct gprs_ra_id definition). The amount and duplication of these may seem a bit overboard, but IMO they do make sense in this way. Though most code will soon see patches unifying the data structures used, in some cases (vty, ctrl) they are required singled out. Without these functions, the formatting ("%0*u", mnc_3_digits ? 3 : 2, mnc) would be duplicated all over our diverse repositories. In various log output, include the leading MNC zeros. Mark one TODO in card_fs_sim.c, I am not sure how to communicate a leading zero to/from a SIM card FS. The focus here is on the core network / BSS. To indicate ABI incompatibility, bump libosmogsm and libosmogb LIBVERSIONs; adjust debian files accordingly. Implementation choices: - The default behavior upon zero-initialization will be the mnc_3_digits flag set to false, which yields exactly the previous behavior. - I decided against packing the mnc with the mnc_3_digits field into a sub-struct because it would immediately break all builds of dependent projects: it would require immediate merging of numerous patches in other repositories, and it would make compiling older code against a newer libosmocore unneccessarily hard. Change-Id: Id2240f7f518494c9df6c8bda52c0d5092f90f221
* Revert "Add function to encode classmark"Harald Welte2018-02-221-16/+0
| | | | | | | | | | | This breaks all existing / older osmocom-bb builds, and hence cannot be accpeted. See also https://gerrit.osmocom.org/#/c/6679 Related: OS#2985 This reverts commit 3c38e60cd55814a7b4c34f22e0b2e6e671f883c4. Change-Id: Icfc52ca4e5cbe3a444d98037d27fa101e3614e06
* Add function to encode classmarkMax2018-02-151-0/+16
| | | | | | The code is based on Osmocom-BB implementation. Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
* Add generic Mobile Identity encoderMax2018-02-151-14/+17
| | | | | | | | 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
* gsm48_pdisc_names: Use conscise, short namesHarald Welte2018-01-241-15/+15
| | | | | | | Some times I *really* regret ever having merged OSMO_VALUE_STRING, as it generates completely unusable and way too long strings :( Change-Id: I8de7c01f9ea1d66c384e57449c4140186f5ce6c5
* Add function to properly encode RAIMax2018-01-081-20/+21
| | | | | | | | | | | | | 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
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-0/+2
| | | | | | | | 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
* Fix compilation warnings: use correct log type for uint32_tPau Espin Pedrol2017-06-231-1/+2
| | | | Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-3/+4
| | | | | | | | | | | | | | | | | 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
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-25/+25
| | | | | | | | | | 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
* gsm/gsm48.c: drop useless assignmentVadim Yanitskiy2017-06-131-1/+0
| | | | Change-Id: I96c1ba70e332199a4ca95e827a7562f953975af4
* update/extend doxygen documentationHarald Welte2017-06-121-10/+70
| | | | | | | | | 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
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-151-8/+9
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* add gsm48_pdisc_msgtype_name()Neels Hofmeyr2017-03-161-0/+198
| | | | | | | | | | | | | | | 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-161-0/+19
| | | | | | | 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
* gsm0408: Completing GSM 04.08 RR message typesPhilipp2016-10-271-0/+108
| | | | | | | | | | | - Add missing message types to be up to date with the latest specification release (3GPP TS 04.18) - Add value strings to translate RR message type identifiers into human readable strings. (see gsm48_rr_msg_name() in gsm48.h Change-Id: I3ceb070bf4dc8f5a071a5d43c6aa2d4e84c2dec6
* COSMETIC: moving rr_cause_name() in gsm48.cPhilipp2016-10-271-5/+5
| | | | | | | | | | rr_cause_name() is located a far of from value_string rr_cause_names[] while other value string functions are located right below their related value string definitions. This commit moves rr_cause_name() below rr_cause_names[] as it should be Change-Id: Ie6c03a6ea02c370d8733db5ba2a709610cd70ce7
* Add function to check GMM encryptabilityMax2016-07-071-0/+25
| | | | | | | | Check if particular GMM message can be encrypted according to 3GPP TS 24.008 ยง 4.7.1.2 Related: OS#1582 Change-Id: I7ad0e03c2c738d174dd6bc3453f332eeb8da1e7d
* Revert "gsm48: move to hex TMSI representation"Holger Freyther2016-05-201-1/+2
| | | | | | | | | | | | | | | | | This is a "flag" day change. Old OpenBSC break with new libosmocore because suddenly there is the 0x in front. I am afraid we need to find a better solution here. I think we will need to create a gsm48_mi_to_string variant that takes a mode parameter to enable the TMSI mode and deprecate the old method. Right now we should not break old versions of OpenBSC. This reverts commit 78ad042f94afd5bf7de477ae634e9d2fdd9c9dc4. Change-Id: I2f61e626f2f9088b492e1b643c3dcc9bce77d52b Reviewed-on: https://gerrit.osmocom.org/86 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
* gsm48: move to hex TMSI representationVadim Yanitskiy2016-05-201-2/+1
| | | | | | | | | | | | | Previously, we traditionally displayed a TMSI in its integer representation, which is quite unusual in the telecom world. A TMSI is normally printed as a series of 8 hex digits. Review at https://gerrit.osmocom.org/57/ Change-Id: Ifd25365bfa3b4ee95b16979740c3229948ce17f2 Reviewed-on: https://gerrit.osmocom.org/57 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org> Reviewed-by: Holger Freyther <holger@freyther.de>
* Set DTX in Cell OptionsMax2016-05-121-1/+45
| | | | | | | | | | | | * rename field of struct gsm48_cell_options to better match the spec * add comments with spec references * add function for setting DTX in cell options struct * add necessary enum type Change-Id: I5a8924f57669c951b2e51b663d95f1d360062a54 Reviewed-on: https://gerrit.osmocom.org/39 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Jenkins Builder
* Export names for gsm_chan_t and gsm48_chan_modeMax2016-03-301-1/+25
| | | | This can be used with get_value_string() to improve debugging output.
* Revert "gsm48: move to hex TMSI representation"Harald Welte2016-03-171-1/+1
| | | | This reverts commit f451ce66eb8206bad1078849723edcb209632834.
* gsm48: move to hex TMSI representationVadim Yanitskiy2016-03-171-1/+1
| | | | Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com>
* gsm48: factor out MCC+MNC BCD parsing for re-use in UMTSNeels Hofmeyr2016-03-151-21/+34
| | | | | | | | | | For 3G, I need a BCD composer/parser similar to gsm48_generate_lai()/ gsm48_decode_lai(). Those functions also handle a trivial extra member (lac) which I don't need in this way for 3G. So create new functions to take on the MCC+MNC BCD handling and call those from gsm48_generate_lai() and gsm48_decode_lai(). In this way, the 3G code in openbsc can use only the BCD functionality without code duplication.
* comment typoNeels Hofmeyr2016-02-291-1/+1
|
* Introduce gsm48_mi_type_name() functionHarald Welte2015-08-181-0/+14
|
* gsm48: Added 'Network Daylight Saving Time' info elementJacob Erlbeck2013-09-161-0/+1
| | | | | | | | This information element has been added to the MM Information message in GSM24.008. This patch adds it to the tlv_definition to keep the TLV parser from breaking. Ticket: OW#978
* gsm0408: Avoid unaligned memory access in gsm48_generate_mid_from_tmsiHolger Hans Peter Freyther2013-07-031-2/+2
| | | | | | | | The &buf[3] is unlikely to be aligned properly. Use memcpy instead of an assignment. Add a small testcase that verifies that I didn't mess up the conversion. Alignment trap: osmo-nitb (3293) PC=0x492b7094 Instr=0xe5803003 Address=0xbeb259db FSR 0x801
* GSM48: Avoid unaligned access in gsm48_construct_raAndreas Eversberg2012-11-051-1/+3
| | | | | This avoids an unaligned access on platforms that don't support them, such as ARMv4/ARMv5.
* gsm48_decode_lai(): return real integers for mcc/mnc, not hex!Harald Welte2012-07-131-6/+13
| | | | This is to make it orthogonal with gsm48_encode_lai()
* import gsm48_decode_lai() function from osmocom-bb/mobile sysinfo.cHarald Welte2012-07-131-0/+14
|
* Fix generation of GPRS Routing Area in case of 3-digit MNCGus Bourg2011-12-141-1/+1
| | | | | This fixes a simple typo that causes erroneous GPRS Routing Area encoding if you use 3-digit MNCs.
* add some utility functions for paging related calculation (TS 05.02)Harald Welte2011-06-261-7/+7
|
* add gsm48_number_of_paging_subchannels() functionHarald Welte2011-06-261-0/+13
| | | | (from openbsc's rsl_number_of_paging_subchannels)
* utils: use namespace prefix osmo_*Pablo Neira Ayuso2011-05-071-6/+6
| | | | | | | | | | | | Summary of changes: s/bcd2char/osmo_bcd2char/g s/char2bcd/osmo_char2bcd/g s/hexparse/osmo_hexparse/g s/hexdump/osmo_hexdump/g s/hexdump_nospc/osmo_hexdump_nospc/g s/ubit_dump/osmo_ubit_dump/g s/static_assert/osmo_static_assert/g
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-4/+4
| | | | | | | | | | | | This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
* This patch moves the GSM-specific functions to the new libraryPablo Neira Ayuso2011-03-231-0/+415
libosmogsm which is provided by libosmocore. I have also moved generate_backtrace() to backtrace.c instead of gsm_utils.c, otherwise the timer and msgfile tests depend on libosmogsm. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>