summaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm_utils.h
Commit message (Collapse)AuthorAgeFilesLines
* osmo_rat_type: add OSMO_RAT_EUTRAN_SGSNeels Hofmeyr2019-01-041-0/+1
| | | | | | | osmo-msc is about to implement the SGs interface and requires a RAT indicator for that. Change-Id: I00588396bfe03feba38ecb0717d584594f0b2b46
* gsm_utils: add enum osmo_rat_type, from osmo-msc enum ran_typeNeels Hofmeyr2019-01-031-0/+13
| | | | | | | | | | | | | | | In the MSC, we have RAN types GERAN_A and UTRAN_IU, now we need a similar enum in osmo-hlr's GSUP client. Naming: in the MAP specifications, the RAN type is mostly called RAT type, (Radio Access Network vs. Radio Access Technology?). Since GSUP is more about MAP messages, I'm calling the enum osmo_rat_type. Rationale: osmo-msc and osmo-sgsn want to tell the osmo-hlr which RAT a subscriber is calling on. A subsequent patch will extend the GSUP protocol and add a RAT types IE. Change-Id: I659687aef7a4d67ca372a39fef31dee07aed7631
* gsm: Deprecate buggy gsm_arfcn2band API and introduce gsm_arfcn2band_rcPau Espin Pedrol2018-11-201-1/+2
| | | | | | | | | | | | | | | | | | | ARFCNs are values in well defined ranges. Until this patch, ARFCNs not belonging to any band were blindly assigned to DCS1800 by gsm_arfcn2band, causing unnoticed bugs and misconfigurations in osmo-bsc. Previous API gsm_arfcn2band cannot accomodate this kind of check easily, so let's deprecate it to tell people to use a new API gsm_arfcn2band_rc which performs this kind of checks and allows callers to log failures, misconfigurations, etc. At the same time, modify implementation of gsm_arfcn2band to abort if an invalid ARFCN is passed, this way users of this API can notice they are passing wrong data to it that most probably will produce unexpected results. Related: OS#3063 Change-Id: I780d452dcebce385469e32ef2fd844df6033393a
* gsm_utils: add function to get value strings for gsm48_chan_modePhilipp Maier2018-09-251-0/+2
| | | | | | | The enum gsm48_chan_mode has value strings, but no function to retrieve those strings. Lets add one. Change-Id: If715705e1ebdfcfdfae1c2099932f7bb8b3861a7
* add and tweak inter-BSC HO APINeels Hofmeyr2018-06-181-0/+2
| | | | | | | | | | | | | | | | | | Add: gsm0808_create_handover_detect() gsm0808_create_handover_complete() gsm0808_create_handover_failure() To existing structs gsm0808_old_bss_to_new_bss_info and gsm0808_handover_required, add a final 'more_items' flag that makes future extensions API and ABI compatible. Fix the msgb string for Handover Request Ack. Extend some API doc comments. Related: OS#2283 (inter-BSC Handover, BSC side, MT) Change-Id: I03ee7ce840ecfa0b6a33358e7385528aabd4873f
* Add function to generate random identifierMax2017-10-091-0/+5
| | | | | | | | | | | | | | | | | The function is a wrapper on top of getrandom() (if available via glibc) or corresponding syscall. If neither is available than failure is always returned. It's intended to generate small random data good enough for session identifiers and keys. To generate long-term cryptographic keys it's better to use special crypto libraries (like GnuTLS for example) instead. As an example it's used to replace old insecure random number generator in osmo-auc-gen utility. Change-Id: I0241b814ea4c4ce1458f7ad76e31d390383c2048 Related: OS#1694
* utils: add function gsm_fn_as_gsmtime_str()Philipp Maier2017-07-111-0/+3
| | | | | | | Convert a given frame number into a printable string that displays the sub components of the frame number. Change-Id: I8015d2ded3940b01b35df7b72fc35c70c25e9926
* gsm_utils: Add osmo_dump_gsmtimePau Espin Pedrol2017-07-101-0/+3
| | | | | | Used by osmo-bts, moved from osmo-bts l1sap.c:dump_gsmtime. Change-Id: Ib5452e2c20f53006c0f6d197fb055728947125d8
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-1/+2
| | | | | | | | | | | | | | | | | 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-4/+4
| | | | | | | | | | 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
* dyn TS: add definitions for dynamic TCH/F_TCH/H_PDCHNeels Hofmeyr2016-07-231-0/+1
| | | | | | | | | | | Add: * GSM_PCHAN_TCH_F_TCH_H_PDCH * NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH * RSL_CHAN_OSMO_PDCH * RSL_ACT_OSMO_PDCH Related: OS#1776 Change-Id: Ib1a8b11f37af4686d00ac88beba38557aa29edc2
* Addditional classmark check against A5/4 supportMax2016-04-221-1/+13
| | | | | Add classmark check function according to GSM 04.08 Chapter 10.5.1.7 Fix interface to use unsigned for unsigned value.
* Export names for gsm_chan_t and gsm48_chan_modeMax2016-03-301-0/+3
| | | | This can be used with get_value_string() to improve debugging output.
* fix gsm_7bit_decode API comment: septets, not octetsNeels Hofmeyr2016-02-291-1/+2
|
* Add G-RNTI derived TLLI types defined in 23.003Harald Welte2015-08-181-0/+2
|
* libosmo-gsm: Add PCHAN/LCHAN types for CBCHHarald Welte2014-12-281-0/+3
|
* include: Switch to #pragma once patternSylvain Munaut2014-06-161-5/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* sms: Fix gsm_7bit legacy functions return valueJacob Erlbeck2014-01-091-0/+3
| | | | | | | | | | | | | | The legacy 7bit conversion functions (those without the '_n_' in the name) gave wrong return values on 64 bit platforms due to unproper signed/unsigned conversions and the usage of SIZE_MAX. This patch fixes this by using a smaller max size (see GSM_7BIT_LEGACY_MAX_BUFFER_SIZE, currently set to 64k) for the legacy wrappers and by using unsigned int for max_septets. In addition, there are tests now that check the return values of legacy encoding and decoding. Sponsored-by: On-Waves ehf
* core: Move OSMO_DEPRECATED to new core/defs.h fileJacob Erlbeck2013-08-141-13/+1
| | | | | | | | | | Add a new core/defs.h file for definitions that can be used from within header files without including prototypes and extern declarations. It's primarily meant for macro definitions and basic typedefs. Move the definition of OSMO_DEPRECATED there and use compiler version info to avoid compiler errors.
* sms: Disable deprecated messageJacob Erlbeck2013-08-121-6/+20
| | | | | This is a workaround to make the FreeBSD8.4 and Debian6.0 target build again. The deprecated attribute doesn't have arguments.
* sms: Added result buffer size parameter to 7bit conv funsJacob Erlbeck2013-08-121-7/+52
| | | | | | | | | | | | | The 7bit<->8bit encoding/decoding functions didn't check whether there is still enough space in the destination buffer. Therefore a buffer size parameter has been added to each of the functions which is used to truncate the output if the buffer is too small. In addition, the return value of the decoding functions has been changed to number of characters written (excluding \0), so this value is always equal to strlen(decoded). The old functions are still available as wrapper functions.
* Add special 7-bit encoding and decoding functions for USSD codingAndreas Eversberg2013-08-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Handling 7-bit coding is a little different for USSD, as TS 03.38 states: To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or <CR> character shall be used for padding in this situation [...]. If <CR> is intended to be the last character and the message (including the wanted <CR>) ends on an octet boundary, then another <CR> must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition of <CR> [...] is identical to the definition of <CR><CR>. The receiving entity shall remove the final <CR> character where the message ends on an octet boundary with <CR> as the last character. Jacob has verified the fix with fakeBTS and the wireshark dissector. Fixes: OW#947 Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
* encoding: Provide an overload for the gsm_7bit_encode and a simple testHolger Hans Peter Freyther2013-08-081-0/+1
| | | | | | | This is required for encoding the SMS header using the alpha numeric rules. Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
* gsm: Try to clarify why we have gsm_septet_encode in the header fileHolger Hans Peter Freyther2013-08-071-0/+1
| | | | | These functions are not meant to be used by applications and are only here for the unit tests. Try to document that.
* gsm_utils: refer to ETSI TS 05.08 instead of TS 08.05Bhaskar2013-05-231-1/+1
|
* gsm_septets2octets(): Input parameter should be constHarald Welte2013-03-131-1/+1
|
* gsm: Add method to find ARFCN based on frequencySylvain Munaut2012-12-111-0/+3
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* add GSM_LCHAN_PDTCHHarald Welte2012-04-191-0/+1
|
* sms: SMS where cropped (from VTY), concatenation of SMS where not possibleDennis Wehrle2011-07-241-0/+5
| | | | | | | | | | | | Additionally it wasn't possible to send concatenated sms from the vty. To send multiple sms, it is necessary to use padding bits and add a user_data_header. Therefore the gsm_7bit_encode function was splitted to gsm_7bit_encode and gsm_septets2octets. gsm_septets2octets: this is the old gsm_7bit_encode function + additional padding parameter Additionally the gsm_7bit_decode function was modified to take account for the user_data_header. With the new gsm_get_octet_len function you can get the octet length for a given septet length. I also added several sms tests.
* don't call a function argoment 'class' for the benefit of c++ usersHarald Welte2011-07-231-1/+1
| | | | This had broken lcr compilation...
* gsm/utils: Adding conversion of "mobile power class" to dBmAndreas Eversberg2011-06-261-0/+2
| | | | | Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* Import abis_nm_{chcomb4pchan,pchan4chcomb}() from openbscHarald Welte2011-05-241-0/+26
|
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-0/+117
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>