summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0480.c
Commit message (Collapse)AuthorAgeFilesLines
* gsm/gsm0480.c: use DLGLOBAL and LOGL_ERROR for loggingVadim Yanitskiy2019-07-211-13/+13
| | | | Change-Id: Id38272ff93fae6d2fdf39df4ffc74856d6c9a898
* gsm/gsm0480.c: parse_ss(): drop needless debug printVadim Yanitskiy2019-07-211-2/+0
| | | | Change-Id: Ie18c291d0cfe3b246d09ac6cfd9591951a2984c8
* gsm/gsm0480: introduce gsm0480_create_release_complete()Vadim Yanitskiy2019-02-081-0/+21
| | | | | | | | | | | | In OsmoMSC, it's required to be able to specify a particular GSM 04.07 transaction ID for GSM 04.80 Release complete message instead of the hard-coded value, that is used gsm0480_create_ussd_release_complete(). Let's finally deprecate gsm0480_create_ussd_release_complete(), and introduce a new function without USSD prefix, as this message is also used in other "structured" supplementary services. Change-Id: Ie3ac85fcef90a5e532334ba3482804d5305c88d7
* Rename msgb_wrap_with_TL()Max2019-01-211-9/+9
| | | | | | | | | | | | | | | This resolves an issue introduced in 84fb5bb6a09a6a358f98c654c84c3b99a0f24eef when msgb_wrap_with_TL() was introduced as an inline function with *exactly the same name* as in osmo-msc.git and openbsc.git. We *NEVER* do something like this. Functions moved from applications to library *MUST* always be renamed. This has been the case for almost a decade now. With this subsequent change we make sure the libosmocore function has a different name and doesn't clash. After this commit, old openbsc.git and osmo-bsc.git should again build fine. Change-Id: If1e851ac605c8d2fde3da565b0bd674ea6350c2e
* Fix typos in SS opcode namesMax2018-12-191-2/+2
| | | | Change-Id: I8fa1961c85b3fd714bc8df56fe4af6be4060c208
* gsm0480: fix copy-pasted note for gsm0480_gen_return_error()Vadim Yanitskiy2018-12-141-3/+0
| | | | | | InvokeID is mandatory for ReturnError component. Change-Id: Ie1c7116d368c2029b9f524cb74ffa316e282ec83
* Move msgb_push helpers to public headerMax2018-11-191-39/+10
| | | | | | | | | | The msgb_wrap_with_TL() is generally useful so it make sense to make it public to facilitate code re-use. Other helpers can be implemented as trivial wrappers over existing tlv.h functions. Update headers and code accordingly. Change-Id: I37e91d031fba28cf1c6735b8069b0265746f55e6
* libosmogsm: (re)introduce gsm48_push_l3hdr()Vadim Yanitskiy2018-08-051-19/+16
| | | | | | | | | | | | | There was gsm0480_l3hdr_push() declared in a header file, but not exposed in 'libosmogsm.map'. Furthermore, for some reason it was a part of GSM 04.80 API, what is not actually correct. Let's rename this symbol, and properly expose it as a part of the GSM 04.08 API. Also, let's introduce an auxiliary wrapper for messages, where the transaction identifier is required (see GSM 04.07, section 11.2.3.1.2). Change-Id: I8a045efe8335d83fcbe8d43eb180972e3b1d9dda
* gsm/gsm0480.c: use the local msgb allocatorVadim Yanitskiy2018-08-051-3/+3
| | | | Change-Id: I23b4b0e1c237b9b27c1db1c9a824b5329d41a38b
* gsm/gsm0480.c: prevent NULL-pointer dereferenceVadim Yanitskiy2018-08-051-2/+10
| | | | Change-Id: I444d95941837458b46e581298f76f3a9926c8552
* 04.80: New gsm0480_gen_{reject,return_error}() functionsHarald Welte2018-07-291-0/+64
| | | | | | | Add functions to generate TS 04.80 (supplementary services) Reject and ReturnError components. Change-Id: I6e5ee39c3d03364f7833ec717593d5ddb0a4c5f9
* USSD: Introduce gsm0480_gen_ussd_resp_7bit()Harald Welte2018-07-291-1/+22
| | | | | | | | | | Contrary to the existing gsm0480_create_ussd_resp(), the new function only generates the value part of the FACILITY IE, and not the IE Tag/Length or the 04.08 L3 header. This is needed in the context of GSUP-encapsulated USSD, as here we don't work with L3 messages, but only pass on the FACILITY IE value. Change-Id: Ide240279240322f643e142229eb7829f538c6314
* gsm0480: Factor out msgb allocation helper functionHarald Welte2018-07-291-1/+6
| | | | Change-Id: If25b467481023eadaaf3f78157eceff4b81d24d2
* gsm 04.80: Add value_string for component type and op codeHarald Welte2018-06-161-0/+32
| | | | Change-Id: I2615a88db5224d65f37c7cc505e183ec8b196e8a
* gsm/gsm0480: refactor and expose gsm0480_parse_facility_ie()Vadim Yanitskiy2018-06-111-16/+30
| | | | | | | | | | | | | | This function can be used when there is only a part of GSM 04.80 message available - Facility IE, e.g. when a message is carried over GSUP/MAP. Let's expose it. Refactoring includes the following: - adding the 'gsm0480_' prefix; - correcting inverted return value; - cosmetic code style changes. Change-Id: I623c39ffbe6cdee65eade8435a2faa04d0da193e
* gsm/gsm0480.c: introduce gsm0480_extract_ie_by_tag()Vadim Yanitskiy2018-06-111-0/+88
| | | | | | | | In some cases, there is no need to parse the whole message, e.g. during the conversion from DTAP to GSUP/MAP. This function can be used to extract given IE from a message. Change-Id: I3989d061903352473305f80712f1a1560d05df3d
* gsm0480: fix: don't overwrite the data of RELEASE_COMPLETEVadim Yanitskiy2018-05-291-2/+6
| | | | | | | | | | | According to the 3GPP TS 04.80, table 2.5 'Release complete', a RELEASE_COMPLETE message may containg optional FACILITY element. Meanwhile, the 0xff byte is used to indicate that there is no decoded message (legacy field). Let's avoid overwriting of a decoded message. Change-Id: I0c85292222749a48ca0c4b2e93f4fa2d61468c18
* gsm0480: drop messages with incorrect data lengthVadim Yanitskiy2018-04-041-9/+12
| | | | | | | | | | If either an INVOKE, either a RETURN_RESULT component has the data with incorrect length (see Annex A, 3GPP TS 04.80), the whole message is probably incorrect. Let's drop such messages instead of silent truncation. Change-Id: I2a169b0b84aa26ea2521edd55ff005c27ae6d808
* gsm0480: copy the raw USSD data, its DCS and lengthVadim Yanitskiy2018-04-041-9/+17
| | | | | | | | | | | | | | | | | | As it was already documented before, the 'ss_request' struct has a rudiment of deprecated 'ussd_request' struct - the 'ussd_text' field. It represents the data either of an INVOKE component, either of a RETURN_RESULT component, encoded as ASCII in case if DCS is 0x0f (i.e. decoded by the code itself), otherwise raw bytes 'as is'. Previously, there was no possibility to distinguish between ASCII and raw bytes with different DCS. Moreover, the payload decoding is not desired in some cases. Let's introduce the new fields, which will carry the raw unmodified payload, its length and DCS (Data Coding Scheme). Change-Id: Ia193d175021e145bb3b131290231f307dbefc64a
* gsm0480: parse optional IEs for RELEASE COMPLETE messageVadim Yanitskiy2018-01-171-1/+5
| | | | | | | | According to GSM 04.80 section 2.5 "Release complete", a message of the mentioned type may contain optional IEs, such as Cause and Facility. Let's parse them. Change-Id: Ib8fc1f6bae472b0b264b6158f372b6cce255b222
* gsm0480: parse all SS info elements in a messageVadim Yanitskiy2018-01-171-1/+10
| | | | | | | Some SS messages (e.g. RELEASE COMPLETE) may contai multiple IEs (Information Elements). Let's parse them all. Change-Id: I20cc59c25fdbda176bcf76437174cda829518d60
* gsm0480: correct parse_ss_info_elements() declarationVadim Yanitskiy2018-01-171-1/+1
| | | | Change-Id: I64df293188908c7eb10a61941db76656340d3a8e
* gsm0480: refactor gsm0480_decode_ss_requestVadim Yanitskiy2018-01-171-7/+14
| | | | Change-Id: Iba734db97ab516f8fce816c4e4225b97b93619f1
* gsm0480: move SS request length check to parse_ss()Vadim Yanitskiy2018-01-171-12/+11
| | | | Change-Id: I8e7ce5bd97f3a8731924264c92afb9a7183937dc
* gsm0480: pass exact GSM 04.80 payload length to parse_ss()Vadim Yanitskiy2018-01-171-4/+4
| | | | Change-Id: I9608d4ad16d7581320615c140beaac36628c31a4
* gsm0480: add specification reference to SS message typeVadim Yanitskiy2018-01-171-0/+1
| | | | Change-Id: Iff0210e995053e270939a774db33f55b22545204
* gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATAVadim Yanitskiy2018-01-171-0/+5
| | | | Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
* gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQVadim Yanitskiy2018-01-171-0/+2
| | | | Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
* gsm0480: handle GSM0480_CTYPE_RETURN_RESULTVadim Yanitskiy2018-01-171-0/+82
| | | | Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
* gsm0480: parse GSM0480_MTYPE_FACILITY separatelyVadim Yanitskiy2018-01-171-1/+17
| | | | Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
* gsm0480: handle UnstructuredSS Request with DSC != 0x0FVadim Yanitskiy2018-01-171-0/+20
| | | | | | | | | | | According to GSM 04.08, 4.4.2 "ASN.1 data types": the USSD-DataCodingScheme shall indicate use of the default alphabet using the 0x0F value. Previously, the UnstructuredSS Request messages with not default alphabet were not being handled. Let's fix this. Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
* gsm0480: clean up the parse_process_uss_req() codeVadim Yanitskiy2018-01-171-19/+20
| | | | | | This change reduces the degree of code nesting... Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
* gsm0480: fix USSD OCTET STRING length confusionVadim Yanitskiy2018-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | According to the GSM 04.80 (version 5.0.0) specification Annex A "Expanded ASN.1 Module "SS-Protocol", the maximum size of a USSD OCTET STRING is 160 bytes. Thus according to ETSI TS 123 038 (version 10.0.0) specification 6.1.2.3 "USSD packing of 7 bit characters", in 160 octets, it's possible to pack (160 * 8) / 7 = 182.8, that is 182 characters. The remaining 6 bits are set to zero. This change defines both mentioned values: - GSM0480_USSD_OCTET_STRING_LEN 160 - GSM0480_USSD_7BIT_STRING_LEN 182 keeping the old MAX_LEN_USSD_STRING 'as is' due to compatibility reasons. Now the new value is used for ss_request structure, while old one is still used for deprecated ussd_request structure. Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e
* gsm0480: skip length check for 'RELEASE COMPLETE' messageSergey Kostanbaev2018-01-171-3/+10
| | | | | | | | According to GSM 04.80 Section 2.5 'Release complete' Table 2.5, the 'RELEASE COMPLETE' message payload is optional, so let's drop the length check in gsm0480_decode_ss_request() for this type. Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
* 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
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-2/+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
* gsm0480: add gsm0480_create_ussd_notify() and *_release_complete()Neels Hofmeyr2016-12-011-0/+29
| | | | | | | | | | | Add two functions to create USSD messages. Moves and generalizes code from openbsc. Pending: use the new functions in openbsc. It looks like _release_complete() should also set trans_id and direction flag; but since this is moving code from openbsc that is apparently working, just place a fixme comment and don't change the functionality. Change-Id: Ia80e32c7105359915bfad3cc5621a1c09caf20f0
* gsm0480: code dup: introduce and use gsm0480_l3hdr_push()Neels Hofmeyr2016-12-011-6/+14
| | | | | | | | Add function gsm0480_l3hdr_push() to push a struct gsm48_hdr to the start of a msgb. Use in gsm0480.c and gsm0411_utils.c. Further callers of the new function will follow in openbsc as well as another libosmocore patch for ussd. Change-Id: I54fce6053ab8362015686fe22dbcd38bf1366700
* fix USSD: SS message type mask should be 0x3f, not 0xbfNeels Hofmeyr2016-10-121-1/+1
| | | | | | | | | | | | | | See 04.80[1], section 3.4: the highest two bits are used as counter or ignored and do not contribute to the SS "Miscellaneous message group". Previous mask of 0xbf included the highest bit, fix to 0x3f. Observed a value of 0xbb that should mean 0x3b="Register" during testing of 3G USSD requests, which seem to be the first to send a nonzero highest bit to our code. The erratic mask of 0xbf lead to an unhandled message type of 0xbb. [1] 3GPP TS 24.080 version 7.2.0 Release 7 / ETSI TS 124 080 V7.2.0 (2006-09) Change-Id: I299001a9e36c16f55622a0acd5d4a55ca49d0055
* 04.08: add inline funcs for pdisc + msg type bitmasksNeels Hofmeyr2016-03-151-2/+2
| | | | | | | | | | | | | | | | Add inline functions for both release <= 98 and release >= 99 as well as a default define. Use the release 98 by default since the current code base uses the r98 bitmasks. These inline functions relieve callers of the decision on masking bits of the protocol discriminator and message type octets. Also add a define for the protocol discriminator extension to one octet length (GSM48_PDISC_EXTEND). Apply new pdisc function in gsm0480.c. [hfreyther: Make the hdr param const]
* Supplementary Services (de)activation, interrogation addedTobias Engel2015-01-011-25/+101
| | | | | | | | | | | | | These patches enhance the Supplementary Service (SS) processing from only being able to handle USSD to other SS, specifically activation, deactivation and interrogation of those SS. Registration is not yet implemented. include/osmocom/gsm/protocol/gsm_09_02.h has been added with needed values for SS. Modified by Harald Welte to keep the old ussd-only functiosn for API/ABI stability.
* ussd: Fix text of RELEASE COMPLETEAlexander Huemer2013-10-151-1/+1
| | | | | | Before the assigned value (0xFF) was truncated, reg->text[0] is of type char. A corresponding test for the same value in openbsc could only fail.
* sms: Added result buffer size parameter to 7bit conv funsJacob Erlbeck2013-08-121-7/+4
| | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* gsm: Revert the gsm_7bit_encode changes as they are wrongHolger Hans Peter Freyther2013-07-071-24/+9
| | | | | | | | | | | | | | | 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: Handle returned length by gsm_7bit_encode correctlyAndreas Eversberg2013-07-061-9/+24
|
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-5/+5
| | | | | | | | | | | | 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/+461
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>