summaryrefslogtreecommitdiffstats
path: root/src/gsm
Commit message (Collapse)AuthorAgeFilesLines
* ipa: place comment "IPA Multiplex" on ipa allocated msgbsNeels Hofmeyr2017-09-071-1/+1
| | | | | | | | | | libosmocore offers the ipa API as general IPA Multiplex, which is e.g. used for GSUP in osmo-msc. Looking at talloc reports, it is confusing to see "Abis/IP" as msgb comment, because osmo-msc does not have an Abis interface. Rename to "IPA Multiplex" as a more general description. Change-Id: I3714dd21707bec0c4bcd0871e6ee8ff32d56b125
* lapd_core: Fix crash in lapd_est_req() functionIvan Kluchnikov2017-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lapd_est_req() function could be called on uninitialized lapd link (before lapd_dl_init() and after lapd_dl_exit() functions) due to invalid usage on higher levels. In order to prevent using uninitialized lapd link, we should set LAPD_STATE_NULL state for lapd_datalink in lapd_dl_exit() function. So all messages for lapd_datalink in null state will be unhandled by lapd_recv_dlsap() function and lapd_est_req() function will not be called before lapd_dl_init() function where lapd link state is changed to idle. #0 0x00007f46ecd99aa5 in lapd_est_req (dp=<optimized out>, lctx=0x7f46ed80b8b8) at lapd_core.c:1769 #1 0x00007f46ecd9dda8 in rslms_rx_rll_est_req (msg=msg@entry=0x7f46eeab4940, dl=dl@entry=0x7f46ed80b888) at lapdm.c:845 #2 0x00007f46ecd9fc03 in rslms_rx_rll (lc=0x7f46ed80b398, msg=0x7f46eeab4940) at lapdm.c:1157 #3 lapdm_rslms_recvmsg (msg=0x7f46eeab4940, lc=0x7f46ed80b398) at lapdm.c:1223 #4 0x00007f46ed63773d in rsl_rx_rll (msg=<optimized out>, trx=<optimized out>) at rsl.c:2178 #5 down_rsl (trx=<optimized out>, msg=<optimized out>) at rsl.c:2541 #6 0x00007f46ed641529 in sign_link_cb (msg=<optimized out>) at abis.c:169 #7 0x00007f46ec54b111 in ipaccess_bts_read_cb (link=0x7f46eeab4940, msg=0x0) at input/ipaccess.c:807 #8 0x00007f46ec548a8e in ipa_client_read (link=0x7f46ee26ae30) at input/ipa.c:74 #9 ipa_client_fd_cb (ofd=<optimized out>, what=1) at input/ipa.c:137 #10 0x00007f46ecfc726f in osmo_fd_disp_fds (_eset=0x7ffe7a9fcd20, _wset=0x7ffe7a9fcca0, _rset=0x7ffe7a9fcc20) at select.c:167 #11 osmo_select_main (polling=polling@entry=0) at select.c:207 #12 0x00007f46ed63fc25 in bts_main (argc=5, argv=<optimized out>) at main.c:359 #13 0x00007f46ebd76f45 in __libc_start_main (main=0x7f46ed61b120 <main>, argc=5, argv=0x7ffe7a9fcf18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, #14 0x00007f46ed61b14e in _start () Related: OS#1982 Change-Id: I306dad9b78e3becaef14c5305ec25c312feefe3c
* umts aka: add sqn_ms out-param, print SQN.MS in osmo-auc-genNeels Hofmeyr2017-08-291-1/+2
| | | | | | | | | | | | | | | | When doing UMTS AKA with AUTS, it can be interesting to know the SQN.MS that was encoded in the AUTS. The only way to know this is to provide it as a separate out-parameter from milenage_gen_vec_auts(), because the SQN.MS from AUTS stored in umts.sqn is immediately modified non-trivially by milenage_gen_vec(). Add sqn_ms to struct osmo_sub_auth_data to retain SQN.MS even after a vector was generated. Use this to print out SQN.MS for 'osmo-auc-gen -3 -A'. Adjust test suite expectations. Related: OS#2464 Change-Id: I9fc05bbf169d06716f40b995154fd42a3f91bef3
* gsm0411_utils: GSM03.40 9.2.3.11 SCTS should be localKeith2017-08-171-1/+1
| | | | | | | | From GSM 03.40: "The Service-Centre-Time-Stamp, and any other times coded in this format that are defined in this specification, represent the time local to the sending entity." Change-Id: I4efdb1eaae43aced33961b64d4f14b0040321c10
* auth_milenage: Fix non-AUTS case with OPHarald Welte2017-08-161-12/+24
| | | | | | | | | We only implemented OPC generation from OP in the AUTS case, but not in the case of normal authentication vector generation. This never really was visible so far due to the fact that we use OPC at sysmocom, and never the shared OP value. Change-Id: Id3fa038dfc2ff1ba63616fa5e8eab0520481ff26
* Add osmo_gprs_{ul,dl}_block_size_{bits,bytes} functionsHarald Welte2017-08-092-0/+96
| | | | | | Those functions can be used to look up the size of (E)GPRS blocks. Change-Id: I05ff75ef7dfae639886bbd09fe35f03a8af9d988
* RSL: Add support for RSL_CHAN_OSMO_PDCH to rsl_dec_chan_nr()Harald Welte2017-07-301-0/+3
| | | | Change-Id: Icc772285636c06e1075a89809f0ac379d7a0002c
* LC15: add NM measurement type to standard attribute listMinh-Quang Nguyen2017-07-141-0/+1
| | | | Change-Id: I320b379429aaf0f7351aed5e4f72a481cc268c05
* LC15: Enable string for IPAC RSL direct retryMinh-Quang Nguyen2017-07-141-0/+1
| | | | Change-Id: I3e69fba0e21e181d28baee90e95f57216f2617af
* IPAC manufacture-defined measurement pre-processing definitionsMinh-Quang Nguyen2017-07-141-0/+5
| | | | Change-Id: Ie1853697f4cff5ff98654fa1cae6c68e28a0076b
* utils: add function gsm_fn_as_gsmtime_str()Philipp Maier2017-07-112-0/+12
| | | | | | | 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-102-0/+12
| | | | | | Used by osmo-bts, moved from osmo-bts l1sap.c:dump_gsmtime. Change-Id: Ib5452e2c20f53006c0f6d197fb055728947125d8
* gsup: Add encoding/decoding for the pdp charging characteristicsHolger Hans Peter Freyther2017-07-071-0/+20
| | | | | | | | These fields can be in the ISD and the PDP Context inofmration. Store pointers to this IE in both cases. It needs to be used by the SGSN when opening a PDP context. Change-Id: Iedc7c02adcf77ca5c9545119e19c968dfbbb3e6b
* abis_nm.c: Fix implicit enumeration type conversionPau Espin Pedrol2017-06-231-4/+4
| | | | | | | Fixes following warning message: abis_nm.c:101:2: warning: implicit conversion from enumeration type 'enum abis_nm_msgtype_bs11' to different enumeration type 'enum abis_nm_msgtype' [-Wenum-conversion] Change-Id: Icb0ed423febf1ceb6626e256d32011b4118fc527
* gsm0411_utils.c: Fix compilation warningsPau Espin Pedrol2017-06-231-2/+2
| | | | | | | | | | | gsm0411_utils.c:102:2: warning: #warning find a portable way to obtain timezone offset [-Wcpp] #warning find a portable way to obtain timezone offset gsm0411_utils.c: In function 'gsm338_get_sms_alphabet': gsm0411_utils.c:260:4: warning: large integer implicitly truncated to unsigned type [-Woverflow] return 0xffffffff; Change-Id: I1d6cb31f38721f79e2cf93f9b8e4776f3720aa07
* Fix warnings: tolower() and similar require ucharPau Espin Pedrol2017-06-231-1/+1
| | | | | | | | | | | | utils.c: In function 'osmo_str2lower': utils.c:277:3: warning: array subscript has type 'char' [-Wchar-subscripts] out[i] = tolower(in[i]); And according to man: If c is neither an unsigned char value nor EOF, the behavior of these func‐ tions is undefined. Change-Id: I3fed2ab6a4efba9f8a21fcf84a5b3a91e8df084f
* Fix compilation warnings: use correct log type for uint32_tPau Espin Pedrol2017-06-231-1/+2
| | | | Change-Id: Ic1e3255800999669ca9619bfceb4124c773eff2d
* fix map entry for gsm0808_speech_codec_from_chan_typeNeels Hofmeyr2017-06-231-1/+1
| | | | | | | | | | | Recent commit 884ba0f2bcaf385cabee0b4228a2598d61fa406b adds function gsm0808_chan_type_to_speech_codec() but adds a mismatching name in libosmogsm.map. openbsc.git's aoip branch can't build with this. This must have been an on-the-fly rename that wasn't properly tested. Always test your patches! Change-Id: I68feb14f7bcb2f62b89f9b2d8c085d6824b493bc
* fix map entry and .h declaration for gsm0808_chan_type_to_speech_codec()Neels Hofmeyr2017-06-231-1/+1
| | | | | | | | | | | | Recent commit 3149b0d076477303a38df735fe579b1b06ee17b2 adds function gsm0808_chan_type_to_speech_codec() but adds a completely mismatching name in libosmogsm.map, as well as a definition with a typo in the name. Fix the entry in libosmogsm.map. Add the missing 'c' in gsm0808_utils.h Change-Id: I5a621fa5ef6b632eabbe224f3dd383eacaffb695
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-2346-194/+193
| | | | | | | | | | | | | | | | | 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-2326-263/+263
| | | | | | | | | | 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
* comments: gsm0808_utils: mention various 3GPP specsPhilipp Maier2017-06-231-0/+5
| | | | | Tweaked-by: nhofmeyr Change-Id: I990dfe9eeaf96f377484b828143935240a937226
* gsm0808: fix length check of the element decoder functionsPhilipp Maier2017-06-231-6/+6
| | | | | | | | | | | | | | | The length check of the decoder functions is not entirely correct. The check also checks for values below zero, which does not make sense, since the length is encoded as uint8_t. For some elements a minimum length is known (in most cases this is 1), so checking for zero is sufficient but in some cases (e.g. channel type) the spec mentions a minimum and maximum length. This is now also reflected in the code. Tweaked-by: nhofmeyr Change-Id: I78bc887f68d1963d28c6fcd631ac20ccd893d6d6
* gsm0808: add function gsm0808_speech_codec_from_chan_type()Philipp Maier2017-06-222-0/+55
| | | | | | | | | | | | | | | | The contents of the speech codec element (struct gsm0808_speech_codec), that is also used in the speech codec list element (struct gsm0808_speech_codec_list) can be generated directly from the permitted speech parameter in the channel type field (struct gsm0808_channel_type) when full AoIP with compressed speech via RTP/UDP/IP is assumed and when the codec configuration on the air interface exactly matches the codec configuration on the IP backhaul. This patch adds a function that can be used as a helper to fill out spech codec fields by only giving a permitted speech parameter as input. Change-Id: I257c972e9fdf0dfe940a8d483447085bd62e50a2
* gsm0808: add function gsm0808_chan_type_to_speech_code()Philipp Maier2017-06-222-0/+38
| | | | | | | | | | | | The permitted speech field used in channel type element (struct gsm0808_channel_type) uses a different representation as the type field in the speech codec element (struct gsm0808_speech_codec) This patch adds a function to convert from permitted speech to speech codec type. Change-Id: Ib26a9c20864459b2baaa04f49b6e7902ba44b7cb
* gsm0808: fix AoIP speech codec element parser/generatorPhilipp Maier2017-06-221-18/+82
| | | | | | | | | | The implementation of the parser/generator for the speech codec information element slightly wrong, making it impossible to use it properly. (See also: 3GPP TS 48.008, 3.2.2.103) Change-Id: Idabb0f9620659557672e1c6b90c75481192e5c89
* gsm/gsm48.c: drop useless assignmentVadim Yanitskiy2017-06-131-1/+0
| | | | Change-Id: I96c1ba70e332199a4ca95e827a7562f953975af4
* update/extend doxygen documentationHarald Welte2017-06-1230-98/+663
| | | | | | | | | 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
* Update doxygen main page for libosmo{core,gsm,vty}Harald Welte2017-06-121-0/+13
| | | | | | | We should link to project homepage as well as put the library into the wider Osmocom context. Change-Id: I07ca57ecef0f36c87c9ebacc1e1507c217bdb25b
* Add header file with definitions for GSM TS 04.14 / 3GPP TS 44.014Harald Welte2017-06-123-1/+23
| | | | Change-Id: I1f4fc2761b55a4f83544c1c3793ab67fec9fc120
* Distinguish between unsupported and invalid MCSMax2017-05-241-53/+54
| | | | | | | | | | | | | | | | | | Previously MCS0 was incorrectly set for some of type1 header values while according to 3GPP TS 44.060 it can only be set for type3. Fix this: * use EGPRS_MCS* constants instead of magic values * do not set MCS0 for reserved bits values in EGPRS header type1 * return different error codes for invalid and unsupported MCS as well as for other decoding errors Note: there's no need to adjust tests because MCS0 decoding is not supported but it's better to explicitly distinguish between unsupported and invalid values nevertheless. Change-Id: Id665d5c0cf50efa18b1bcbf4f17359418a380f9e Related: OS#1524
* add libpseudotalloc as super-simplistic talloc replacementHarald Welte2017-05-171-0/+4
| | | | | | | | | | | In tightly embedded builds (--enable-embedded), we want the ability to replace talloc with a very simple heap allocator to avoid the complexity of talloc without modifying all our code that assumes talloc. This will break the hierarchical notion of the allocator, but libosmo{core,gsm,coding,codec} don't rely on that anyway. Change-Id: Ie341034076f242a813f081919dd09d845775ad35
* gsm/gsm0411_smr.c: strip unused variableVadim Yanitskiy2017-05-171-2/+1
| | | | Change-Id: I53f69913907588c45a9661c4e86e1bfb57a2418f
* gsm0808 + ipa: fix compilation on systems without sys/socket.hHarald Welte2017-05-152-3/+15
| | | | Change-Id: I60f5d4982cd96ab29f9924ec11b46bf56fbfc346
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-157-25/+22
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* Make EARFCN size calculation more robustMax2017-05-142-6/+22
| | | | | | | | | | | | | * add osmo_earfcn_bit_size_ext() function which allows to specify how many EARFCNs we should skip when estimating required bit size for SI2quater * make old osmo_earfcn_bit_size() into wrapper over newly added function and mark it as deprecated This is necessary to properly estimate necessary space for EARFCNs when they are spread over several SI2q messages with different index. Change-Id: I92e12e91605bdab9916a3f665705287572434f74 Related: RT#8792
* gsm_04_08: Add missing GSM cause valueDaniel Willmann2017-05-121-0/+3
| | | | | | | | | | | | Table 10.5.157 in 10.5.6.6 of 3GPP TS 04.08 is badly formatted. The first value 0x19 "LLC or SNDCP failure" is in the same line as the heading and has not been included in the struct_value so far. Table 10.5.157 in 10.5.6.6 of 3GPP TS 24.008 fixes this formatting issue and also defines two more values 0x08 and 0x18 which are now added to the struct value_string. Change-Id: I5bcc52f739ff0677011d024448afcc2a54869638
* doc: fix incorrect return value descriptionMax2017-05-101-1/+1
| | | | | Change-Id: Ieba009273f911bc4217122a6346220aeb29e8bc4 Related: OS#1614
* timer: add osmo_timer_setup()Pablo Neira Ayuso2017-05-093-8/+4
| | | | | | | | | | | | | | | Add a new function timer function to set up the timer, similar to what we have in the Linux kernel. This patch also converts existing opencoded timer setup in the libosmocore tree as initial client of this new function. This patch implicitly removes function callback passed by reference that defeat compile time type validation. Compile-tested only, but I ran make check that reports success when testing timer infrastructure. Change-Id: I2fa49972ecaab3748b25168b26d92034e9145666
* gsm0808: fix control flow issuePhilipp Maier2017-05-081-3/+2
| | | | | | | | | | | | | | | | | | Coverity Scan reported a control flow issue in line 206: CID 166898: Control flow issues (DEADCODE) The second branch of the if statement can not be reached. The purpose of the second if branch was to filter out zero length elements if the header states that it is a non extended speech codec type. This makes no sense, since the header needs at least one byte. This patch removes the second if branch, zero length elements are catched by the already existing zero length check at the beginning of the function Change-Id: I89751fc0d598734c64ef1fdced75b7c4fa77c616
* Add SW Description (de)marshallingMax2017-04-282-0/+160
| | | | | | | | | | | | | | | | * data structure representing 3GPP TS 52.021 §9.4.62 SW Description * function to serialize it into msgb * function to deserialize it from buffer * functions to extract/estimate buffer size for SW Description * test harness (partially taken from OpenBSC) There are several similar functions to deal with SW Description in OpenBSC, there's also need to use similar functionality in OsmoBTS. Hence it's better to put the code into common library with proper tests and documentation. Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd Related: OS#1614
* Uninitialized variable in ipa_ccm_make_id_resp_from_req()Harald Welte2017-04-271-0/+2
| | | | | | | | | | We are allocating a buffer on the stack without initializing it, and then passing it into ipa_ccm_make_id_resp(). There is no real danger from this, as the buffer is only uninitialized if num_ies is 0, but let's memset() it for good style Change-Id: If5761a47b8cba73ddcc02a88cfa5c87c1970c04e Fixes: coverity CID#167040
* fix spelling in API docu, command reply, logging, descriptionsThorsten Alteholz2017-04-232-2/+2
| | | | | | sections: ctrl, gb, gsm, vty Change-Id: Iac211b5cd8504da36b699777b95a2448dd7c3e70
* ipa: Introduce helpers to encode IPA CCM ID RESPONSEHarald Welte2017-04-152-1/+120
| | | | | | | | | | The ipa.c file already contained code to parse an ID RESPONSE into the 'struct ipaccess_unit', but it didn't so far contain code to put together an ID RESPONSE packet based on that structure. Let's change that with ipa_ccm_make_id_resp() and a helper wrapper ipa_ccm_make_id_resp_from_req(). Change-Id: Icbcd8827a75fd5f3393351c1ca372de85275ad35
* gsm0808: make gsm0808_create_reset_ack() accessiblePhilipp Maier2017-04-081-0/+1
| | | | | | | | | | | The create function to generate the RESET ACKNOWLEDGE message is not accessible from outside, as it does not appear in limosmogsm.map. It also has not testcase. This commit adds gsm0808_create_reset_ack() to the map file and also adds a testcase. Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
* gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier2017-04-082-0/+57
| | | | | | | | | | gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
* gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier2017-04-082-0/+53
| | | | | | | | | | gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
* gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier2017-04-082-0/+34
| | | | | | | | | | gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
* gsm0808: Add utils for Cell Identifier ListPhilipp Maier2017-04-082-0/+80
| | | | | | | | | | The planned support for true A over IP requires the encoding of the a Cell Identifier List element (see also BSS_MAP_MSG_PAGING). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I625245dd1dd396fc2bc189e8cd2c444a33042528
* gsm0808: Add utils for Encryption InformationPhilipp Maier2017-04-082-0/+73
| | | | | | | | | | The planned support for true A over IP requires the encoding of the an Encryption Information element (see also BSS_MAP_MSG_CIPHER_MODE_CMD). This commt adds encoding/decoding functionality and tests for the element mentioned above, however, it is not yet actively used. Change-Id: I8262050a9d9fd3f17462cfbb046c6e034dccc6fb