summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm_utils.c
Commit message (Collapse)AuthorAgeFilesLines
* sms: Fix gsm_7bit legacy functions return valueJacob Erlbeck2014-01-091-6/+11
| | | | | | | | | | | | | | 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
* sms: Added comment about the gsm_7bit_alphabet tableJacob Erlbeck2013-08-121-2/+6
| | | | | The table structure is not intuitive, so this comment shall aid to understand this.
* sms: Added result buffer size parameter to 7bit conv funsJacob Erlbeck2013-08-121-51/+94
| | | | | | | | | | | | | 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/+31
| | | | | | | | | | | | | | | | | | | | | | | | 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-2/+8
| | | | | | | This is required for encoding the SMS header using the alpha numeric rules. Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
* gsm: Revert the gsm_7bit_encode changes as they are wrongHolger Hans Peter Freyther2013-07-071-6/+0
| | | | | | | | | | | | | | | This reverts commit f996b05dbddccb8e8788dd69777a4fedfa2373eb and 2b0cac4ef83137ee0bdd583aee877eac467abeab. A detailed explanation can be found here: http://lists.osmocom.org/pipermail/openbsc/2013-July/004737.html The short description is that: 1.) The API should return (as out parameter) the number of octets used. 2.) The handling for the <CR> encoding only applies to USSD and it is incomplete. On top of that it broke the SMS test.
* Fix encoding of last character at 7bit encoding functionAndreas Eversberg2013-07-061-0/+6
| | | | | | 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.
* gsm_utils: refer to ETSI TS 05.08 instead of TS 08.05Bhaskar2013-05-231-2/+2
|
* gsm_septets2octets(): Input parameter should be constHarald Welte2013-03-131-1/+2
|
* gsm: Add method to find ARFCN based on frequencySylvain Munaut2012-12-111-45/+65
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm_utils.c: in 7bit decoding, first check if the last character was an ↵Nico Golde2012-09-211-5/+5
| | | | extension character before doing anything else
* gsm_utils: Fix up coding style in previous patchHarald Welte2012-09-201-2/+2
| | | | 'if' is not a function, so we have space before parenthesis.
* gsm_utils.c: cleanup + do not use dynamic memory when decoding 7bit messagesNico Golde2012-09-201-14/+13
|
* gsm: Address compiler warning about unused variable 'z'Holger Hans Peter Freyther2012-09-111-3/+4
| | | | | | | | The comment explains why we don't care about the content of z, stop storing it. gsm_utils.c: In function 'gsm_7bit_encode': gsm_utils.c:253:13: warning: variable 'z' set but not used [-Wunused-but-set-variable]
* doxygen: Add main page for all three librariesHarald Welte2011-08-301-0/+40
|
* sms: Fix style issues with the code, add spaces after keywordsHolger Hans Peter Freyther2011-07-241-5/+5
|
* sms: SMS where cropped (from VTY), concatenation of SMS where not possibleDennis Wehrle2011-07-241-29/+89
| | | | | | | | | | | | 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.
* gsm/utils: Adding conversion of "mobile power class" to dBmAndreas Eversberg2011-06-261-0/+41
| | | | | Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-3/+3
| | | | | | | | | | | | 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/+465
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>