aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm48_ie.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-07gsm48_ie: fix various issues in doxygen docsVadim Yanitskiy1-7/+8
Change-Id: Id168c5115588b2dbc48605ee0bba13ccc9913bbe
2023-10-17gsm48_ie.c: change bearer cap structure in outgoing CSD callsManawyrm1-1/+1
Outgoing CSD calls were previously encoded with the Bearer Capability 1 - Octet 4 "Structure" field set to 3 - Unstructured. Many Nokia, Sony Ericsson and Huawei devices won't accept incoming CSD calls with these bits set. Set them to 0 - Service data unit integrity for now, which seems to work and make all tested devices happy. Change-Id: Ieb5bca3d3578abd28e18808752e1c312ce7c4ce0
2023-10-17gsm48_ie.c: add 3.1kHz audio bearer capability for CSD callsManawyrm1-0/+2
GSM48_BCAP_ITCAP_3k1_AUDIO should be handled just like fax or unregistricted digital CSD calls. The transfer capability just indicates that an (external) interworking function should convert the call into an analog modem call on the network edge. The CSD call is still regular V.110/RLP non-transparent data. Change-Id: I44b76be0f6a891bc1d8f55ede1ef140ea0a19e3d
2023-07-26gsm48_ie: fix gsm48_encode_bearer_cap(): encode bcap->data.transpVadim Yanitskiy1-1/+3
Currently this function is hard-coding the "Connection element (octet 6c)" (see Table 10.5.101h/3GPP TS 24.008) to "Transparent" (0). This breaks non-transparent data calls. Use the value from bcap->data.transp. The decoding equivalent of this function needs no changes, it does populate this field already. Change-Id: I7339908864e8a2aef6f2b48a108650167e413c7f Related: OS#6110, OS#4394
2023-02-28doxygen: fix various typos in commands \param and \returnsVadim Yanitskiy1-1/+1
Change-Id: If87cec3739449c6a54e24fb2cb81e746d8244da2
2023-02-19gsm: fix invalid check in gsm48_decode_ssversion()Vadim Yanitskiy1-1/+1
Change-Id: I648a4b052d0ec7af97d513630aa4279884436dda Fixes: OS#5910
2023-01-02gsm48_ie: gsm48_decode_freq_list(): make 'cd' argument const2023q1Vadim Yanitskiy1-2/+3
Change-Id: Ide9110b984d3302aec6b439c563eb10e2dcdec9e
2022-07-03gsm48_ie: fix parsing of Bearer capability IE without octet 3aMychaela Falconia1-0/+17
The testcase in gsm0408_test is still failing because the encoder produces a different result (with octet 3a present). There is no way to tell the encoder to use the implicit coding, and in general this is not that critical, so we can live with that. Change-Id: I722c168f01bffa915cb155eac234a796549d3762
2022-07-03gsm48_ie: fix coding style: while is not a functionVadim Yanitskiy1-3/+3
Change-Id: Id28bf61c5e1dfb6da1c89a5502eb869b67fed6c6
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2020-11-12gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier1-0/+246
3GPP TS 24.008 section 10.5.1.7 describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. This is fixed version of Ic8b2bfd00330235f5bed00771e421588abfaac1f, which got reverted because it used the keyword "class" as struct member, which lead into problems with c++ builds. This is now fixed. Change-Id: Id8732551b33616227609cd6fcf6c3133751a89eb Related: OS#4796 SYS#5114
2020-11-11Revert "gsm_04_08: add parser for Mobile Station Classmark 3"Harald Welte1-246/+0
This reverts commit a4939dc8461c0a2d8e67aa3bb95bfb73ad9225b7, which caused massive build failures in C++ programs like osmo-pcu - unsurprisingly, as it calls a struct member "class", which is a reserved keyword in C++. Change-Id: Ia43e56385e7b580f492c560aee8ff8b1e8a0e1d8
2020-11-10gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier1-0/+246
3GPP TS 24.008 section 10.5.1.7 describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. Change-Id: Ic8b2bfd00330235f5bed00771e421588abfaac1f Related: OS#4796 SYS#5114
2019-06-07gsm48_decode_bcd_number2: fix ENOSPC edge caseOliver Smith1-3/+13
Return ENOSPC if the decoding buffer is one byte too small, instead of returning 0 and silently truncating the string. Add a new "truncated" variable to detect if the loop breaks in the final iteration. The string is not truncated if there is exactly one 0xf ('\0') higher nibble remaining. This is covered by the existing test case "long 15-digit (maximum) MSISDN, limited buffer". Related: OS#4049 Change-Id: Ie05900aca50cc7fe8a45d17844dbfcd905fd82fe
2019-05-29gsm48_encode_bcd_number(): clarify optional LHV header initializationVadim Yanitskiy1-1/+7
Change-Id: Iafd911dd55691b3715391e3899cd6971245c8d7f
2019-05-28gsm48_decode_bcd_number2(): return -EINVAL if LV has too big lengthVadim Yanitskiy1-2/+2
Change-Id: Ie07b2e8bc2f9628904e88448b4ee63b359655123
2019-05-28gsm48_decode_bcd_number2(): fix: return -ENOSPC on truncationVadim Yanitskiy1-3/+13
The documentation of gsm48_decode_bcd_number2() clearly states that the output truncation is a erroneous case, so it should actually return negative in such cases. Let's return -ENOSPC. Change-Id: I75680f232001ba419a587fed4c24f32c70c3ad2b
2019-05-28gsm48_decode_bcd_number2(): fix output truncationVadim Yanitskiy1-2/+2
Thanks to the new unit test for BCD number encoding / decoding, it was discovered that gsm48_decode_bcd_number2() does not properly handle encoded LV if the output buffer size is equal to the original MSISDN length + 1 (\0-terminator): one digit is lost. For example, decoding of 15-digit long MSISDN to a buffer of size 16 (15 digits + 1 for \0) would give us only 14 digits. The problem was that 'output_len' was being decremented before checking the remaining buffer length and writing a digit to it. As a result, the maximum length was always one byte shorter. Change-Id: I61d49387fedbf7b238e21540a5eff22f6861e27a Fixes: OS#4025
2019-05-05gsm48_decode_bcd_number2(): allow avoiding deprecationNeels Hofmeyr1-23/+25
gsm48_decode_bcd_number() is marked as deprecated, so gsm48_decode_bcd_number2() will cause deprecation warnings as long as it calls gsm48_decode_bcd_number(). Hence move the code to gsm48_decode_bcd_number2(). Change-Id: I81925e9afb3451de9b8a268d482f79ee20ca14d6
2019-05-05gsm48_decode_bcd_number2(): fix input len checkNeels Hofmeyr1-2/+3
The input_len argument for gsm48_decode_bcd_number2() includes the BCD length *and* the length byte itself, so add the missing +1. Also clarify the API doc for the input_len argument. Change-Id: I87599641325c04aae2be224ec350b1a145039528
2019-05-03add gsm48_decode_bcd_number2() from osmo-mscNeels Hofmeyr1-1/+27
gsm48_decode_bcd_number() is unable to provide proper bounds validation of input and output data, hence osmo-msc's vlr.c introduced a static decode_bcd_number_safe() a long time ago. Move to libosmocore. I need to use the same function to decode an MSISDN during inter-MSC Handover, instead of making it public in osmo-msc, rather deprecate the unsafe function and provide a safer version for all callers. Mark the old one deprecated. Change-Id: Idb6ae6e2f3bea11ad420dae14d021ac36d99e921
2018-11-18gsm48: gsm48_decode_freq_list: Improve documentation of paramter fPau Espin Pedrol1-1/+1
Change-Id: Id8e3afff737211ded3c5689f2c83b1a544b42f9d
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte1-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
2017-06-23doxygen: unify use of \file across the boardNeels Hofmeyr1-4/+5
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
2017-06-23doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr1-35/+35
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
2017-06-12update/extend doxygen documentationHarald Welte1-35/+87
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
2014-01-13gsm/gsm48ie: Fix range 256 W[i] decoding0.6.5Jacob Erlbeck1-4/+4
Currently w[14]/w[15] and w[18]/w[19] are swapped in range 256 format decoding in gsm48_decode_freq_list(). This patch fixes this. Sponsored-by: On-Waves ehf
2012-08-24GSM 04.08: Add support for parsing CSD related bearer capabilitiesHarald Welte1-5/+90
Also adds a test case for both encoder and decoder of this IE
2012-08-24gsm48_ie: annotate functions with chapter numbers from 04.08 specHarald Welte1-29/+29
2011-09-02gsm/gsm48_ie: Fix other range format decodingAndreas.Eversberg1-66/+63
As it turns out, the other range were affected too, so Anreas wrote the fix for them as well. Written-by: Andreas.Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-01gsm/gsm48_ie: Fix Range 256 format decodingSylvain Munaut1-20/+35
From the mail: --- appended is another patch for fixing a bug in the calculation of the frequency lists. This time the patch is for the "Range 256 format". The problem is that the operand for the "smod" operation might be negative, in this case the simplified version won't work as expected. In the patch I introduced a separate function for "smod" which takes care of the sign. I have not yet checked if the other formats are also affected, this would be the case if the "smod" operand can be negative. There might be other solutions to fix the problem without the need for a separate function, however I have not thought further about it. A test vector is the following frequency list ("Range 256 format", first byte is the length): 09 8b 1c 83 8c 15 ef 02 2d 30 The correct ARFCNs are 569 571 576 578 586 608 712 715 719 The uncorrected version would instead return: 444 457 460 464 569 576 578 586 608 This means four ARFCNs are wrong which will cause problems if for example the frequency list contains the ARFCNs for hopping. ---- Written-by: Dieter Spaar <spaar@mirider.augusta.de> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-30gsm/gsm48_ie: Fix frequency list decodingAndreas.Eversberg1-1/+1
Fix-by: Andreas.Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-6/+6
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>
2011-03-23This patch moves the GSM-specific functions to the new libraryPablo Neira Ayuso1-0/+1095
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>