summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* GSUP: fix missing osmo_gsup_get_err_msg_type()sOliver Smith2018-12-211-0/+8
| | | | | | | | | | | Add missing mappings of request to error message types in osmo_gsup_get_error_msg_type(): * PROC_SS_REQUEST * MO_FORWARD_SM_REQUEST * MT_FORWARD_SM_REQUEST * READY_FOR_SM_REQUEST Change-Id: I801a0d6ffe09cfc75b77ab602bd25b3dc40f19c0
* Use define for key buffersMax2018-12-201-2/+2
| | | | | | Add corresponding spec. references and comments where appropriate. Change-Id: If5e2aad86eaecd8eada667b3488ba415d81c6312
* LCLC: fix doc to match type signatureMax2018-12-191-2/+1
| | | | Change-Id: I8f7b3dca080ef0e632d47a907154f8404b0ec523
* Fix typos in SS opcode namesMax2018-12-191-2/+2
| | | | Change-Id: I8fa1961c85b3fd714bc8df56fe4af6be4060c208
* add to osmo_sock_get_name*() APINeels Hofmeyr2018-12-191-17/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically, I am applying code review that I would have given had I not been on vacation when the last osmo_sock_get_name* stuff was merged. osmo_sock_get_name2() is so far a static internal function. However, it is nothing like osmo_sock_get_name(), so instead rename it to osmo_sock_get_ip_and_port(). Also make it public API, no need to hide it. I'm adding an "and" in the name to hopefully clarify: "ip_port" vs. "ip_and_port" -- there already are _get_X_ip_port() functions that only return the port string, despite "ip" in the name. Add new public osmo_sock_get_name2(), which is like osmo_sock_get_name(), except it uses a static string instead of talloc, and omits the braces. This is most convenient for log statement formats, avoiding dyn allocations. Add new osmo_sock_get_name_buf(), which is like osmo_sock_get_name2() but writes to a caller provided char buffer. Use osmo_sock_get_name_buf() in the implementation of osmo_sock_get_name(), but use another (non-static) local string buffer, because adding braces is too complex without talloc_snprintf(). Rationale: I want to improve the logging of socket errors, e.g. change DLMGCP ERROR Failed to read: 111/Connection refused (mgcp_client.c:720) to DLMGCP ERROR Failed to read: r=10.0.99.2:2427<->l=10.0.99.2:2728: 111='Connection refused' (mgcp_client.c:721) but it is just not handy to compose logging with the current API: - osmo_sock_get_name() requires a talloc_free(). - all the others require output buffers. - the only way to conveniently compose a logging string and, - notably, the only trivial way to skip the string composition if the logging level is currently muted, is to have a function that returns a static string: the new osmo_sock_get_name2(). - (I think the osmo_sock_get_{local,remote}_* convenience wrappers should never have been added, because they encourage the caller to invoke the same code twice, for IP addr and port, and throw away one half each time.) Related: Iae728192f499330d16836d9435648f6b8ed213b6 (osmo-mgw) Change-Id: I8ad89ac447c9c582742e70d082072bdd40a5a398
* GSUP/SMS: introduce READY-FOR-SM messageVadim Yanitskiy2018-12-181-0/+13
| | | | | | | | | | | | | | | According to 3GPP TS 29.002, section 12.4, MAP-READY-FOR-SM is used between the MSC and VLR as well as between the VLR and the HLR to indicate that a subscriber has memory available for SMS. This change replicates this service in GSUP as READY_FOR_SM_*. The only mandatory IE for this service (excluding Invoke ID) is 'Alert Reason' that is replicated by OSMO_GSUP_SM_ALERT_RSN_IE. Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3 Related Change-Id: (docs) I549b6c8840a1e86caac09e77fb8bc5042d939e62 Related Change-Id: (TTCN) If2256607527ecfcb10285583332fb8b0515d7c78 Related: OS#3587
* GSUP/SMS: introduce MO-/MT-FORWARD-SM messagesVadim Yanitskiy2018-12-184-2/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to 3GPP TS 29.002, there are two services: - MAP-MO-FORWARD-SHORT-MESSAGE (see 12.2), - MAP-MT-FORWARD-SHORT-MESSAGE (see 12.9), which are used to forward MO/MT short messages. This change replicates both services as GSUP messages: - OSMO_GSUP_MSGT_MO_FORWARD_SM_*, - OSMO_GSUP_MSGT_MT_FORWARD_SM_*. Please note, that only the 'must-have' IEs are introduced by this change, in particular the following: - OSMO_GSUP_SM_RP_MR_IE (see note below), - OSMO_GSUP_SM_RP_DA_IE (see 7.6.8.1), - OSMO_GSUP_SM_RP_OA_IE (see 7.6.8.2), - OSMO_GSUP_SM_RP_UI_IE (see 7.6.8.4), - OSMO_GSUP_SM_RP_MMS_IE (see 7.6.8.7), - OSMO_GSUP_SM_RP_CAUSE_IE (see GSM TS 04.11, 8.2.5.4), where both SM_RP_DA and SM_RP_OA IEs basically contain a single nested TV of the following format: - T: identity type (see 'osmo_gsup_sms_sm_rp_oda_t'), - V: encoded identity itself (optional). According to GSM TS 04.11, every single message on the SM-RL has an unique message reference (see 8.2.3), that is used to link an RP-ACK or RP-ERROR message to the associated (preceding) RP-DATA or RP-SMMA message transfer attempt. In case of TCAP/MAP, this message reference is being mapped to the Invoke ID. But since GSUP has no 'Invoke ID' IE, and it is not required for other applications (other than SMS), this change introduces a special 'SM_RP_MR' IE that doesn't exist in MAP. Change-Id: Ibe325c64ae2d6c626b232533bb4cbc65fc2b5d71 Related Change-Id: (docs) Ie0150756c33c1352bc4eb49421824542c711175c Related Change-Id: (TTCN) Ibf49474a81235096c032ea21f217170f523bd94e Related: OS#3587
* LCLS: add gsm0808_create_ass2()Max2018-12-142-6/+48
| | | | | | | It allows setting additional assignment parameters explicitly. Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba Related: OS#2487
* LCLS, TS 48.008: add GCR IE encoding/decodingMax2018-12-142-0/+37
| | | | | | | | * add functions to encode Global Call. Ref. from TS 29.205 as 3GPP TS 48.008 ยง3.2.2.115 information element * add corresponding tests Change-Id: I82ce0207dc8de50689a8806c6471ad7fbae6219d
* LCLS, TS 29.205: add GCR routinesMax2018-12-143-1/+97
| | | | | | | | Add functions to encode and decode Global Call Reference as per 3GPP TS 29.205 Table B 2.1.9.1 add corresponding tests. Change-Id: Iee95aa4e5c056645b6cb5667e4a067097d52dfbf Related: OS#2487
* 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
* msgb: add test helpersMax2018-12-121-0/+92
| | | | | | | | It's often handy to compare certain msgb layer to a given array and print the position where they differ. Add simple pretty-printer and corresponding L* wrappers. Change-Id: I3bc95f2f5ab6e3f4b502647fb3e0aaaf1f7c4cf5
* fix api doc for osmo_bcd2str()Neels Hofmeyr2018-12-111-1/+1
| | | | Change-Id: I504ea849fc9daeb34a1b3c5343371161deba743e
* gsm48_mi_to_string(): do not read from zero length input bufferNeels Hofmeyr2018-12-101-1/+1
| | | | Change-Id: I12cada7c2c5187146ca5a33d1ebfefb4cad65632
* gsm48_mi_to_string(): guard against zero length output bufferNeels Hofmeyr2018-12-101-5/+5
| | | | | | | | All successful cases already return from the switch(), so simply handle all errors below it by returning an empty string (if there is enough string buffer). Change-Id: I709ac3b9efb7b4258d8660715b10312e11b9b571
* gsm48_generate_mid(): mask out ODD flag from mi_typeNeels Hofmeyr2018-12-101-1/+1
| | | | | | | | For MI encoding, see 3GPP TS 24.008, 10.5.1.4 Mobile Identity. The 'odd' flag indicates whether the last BCD nibble is used. Of course that flag should be made sure to reflect the actual length. Change-Id: Id6e695ebf9f86b295eaa7e2c6228989256f37e68
* gsm48_mi_to_string: use osmo_bcd2str(), fix some corner casesNeels Hofmeyr2018-12-101-13/+12
| | | | | | | | | | | | | By using osmo_bcd2str(), ensure that the resulting string is always nul terminated, and always return strlen()+1 whether truncated or not. Still keep up the previous return value style, even if that isn't consistent at all. The difference between IMSI/IMEI and TMSI return values remains and is not part of this patch. Change-Id: I1b51b72a721e1cc9d69796b804ebda741ff0f36b
* add osmo_bcd2str()Neels Hofmeyr2018-12-101-0/+41
| | | | | | | | | | | | | | | | | | Add a standalone bcd-to-string conversion function with generic parameters. Add a regression test in utils_test.c. So far there is no single universal implementation that converts a BCD to a string. I could only find gsm48_mi_to_string(), which also interprets surrounding bytes, MI type and TMSI as non-BCD value. The idea is to use this function from gsm48_mi_to_string() and similar implementations in subsequent commits. Root cause: in osmo-msc, I want to have an alternative MI-to-string function for composing an FSM name, which needs the BCD part of gsm48_mi_to_string() but not the TMSI part. Change-Id: I86b09d37ceef33331c1a56046a5443127d6c6be0
* api doc: gsm48_mi_to_string(): warn of return value implementationNeels Hofmeyr2018-12-101-1/+4
| | | | Change-Id: If5e7abd15dddf39cdfad8071f4cd5ca8244eabe0
* gsm0808: add encoder for cause codes and use itPhilipp Maier2018-12-083-12/+43
| | | | | | | | | | | | | | | | At the moment the all gsm0808 cause codes are encoded directly using the tlv API directly to put a one byte TLV field. This works ok for most situations where the cause code consists of a single byte. However, gsm0808 specifies a two byte cause code model where cause codes may be extended up to two bytes. Instead of implementing the encoding over and over and again, let's rather have an encoder function we can call. - Add an encoder function that can generate single byte and extended cause codeds and makes the length decision automatically. - Use only this function to append cause codes Change-Id: I71d58fad89502a43532f60717ca022c15c73f8bb
* gsm29118: add generator functions for GSM29118 messagesPhilipp Maier2018-12-072-0/+290
| | | | | | | | | We already have some GSM29118 related definitions and functions in libosmocore. Lets also add some functions to generate GSM29118 messages (similar to those we have for GSM0808). Change-Id: Ic87f8a771b87b52215d0a7451b67794557b80b8a Related: OS#3615
* cosmetic apn: correct whitespace errorPhilipp Maier2018-12-071-1/+1
| | | | | | | there is a whitespace between the * and osmo_apn_to_str(). Lets remove this. Change-Id: I094e6eb08eacf2d6459c47a7370837601aa92925
* Add osmo_sockaddr_in_to_str_and_uint()Max2018-12-071-5/+20
| | | | | | | | | It's similar to osmo_sockaddr_to_str_and_uint() but does not require odd typecasting for AF_INET case. Make osmo_sockaddr_to_str_and_uint() into wrapper around new function and make sure to check for address family before typecasting. Also use proper return type. Change-Id: Ie384483124d407a960ab6732e6a7fd90554389d2
* Allow log_init() with NULL log_infoMax2018-12-061-10/+15
| | | | | | | | | Since we have library-internal categories we don't have to force application to supply its own categories. This is especially useful for testing code inside libosmocore which only use internal categories anyway. Change-Id: I42159780b57684bff225789f036f28a4b25fc7b8
* ctrl: use #define for TRAP idMax2018-12-031-1/+1
| | | | | | | We always use id = 0 when sending TRAP messages. Let's make this more obvious by introducing appropriate define. Change-Id: I33d7d4c6a1885a75a85d6f2f017430e0860b4126
* gsm0808: add message generator for BSSMAP HANDOVER PERFORMEDPhilipp Maier2018-12-032-0/+47
| | | | | | | | We currently have no generator function that can generate BSSMAP HANDOVER PERFORMED messages. Lets add function for this. Change-Id: I825106858bd89afc9837811b8fed2e8accc82441 Related: OS#3645
* configure.ac: check clock_gettime for glib < 2.17Alexander Couzens2018-12-031-1/+1
| | | | | | | glib < 2.17 doesn't support clock_gettime directly, it is available via librt. Change-Id: Ice853d85ffe859b1d4df48b91b050c24d85c861b
* Move BSSMAP_MSG_* defines to header fileMax2018-11-301-3/+0
| | | | | | | This will be reused be several tests related to TS 48.008 and TS 29.205 in follow-up commits. Change-Id: I4d8cc05b8df8e70c1f6257e53ae3acec7901681f
* ctrl: print textual error on IPA parsing failureMax2018-11-261-1/+1
| | | | Change-Id: I49bb613b416d549f554fd9d23cd37b63954324db
* Update gsm0808_create_ass() doxygenMax2018-11-221-2/+2
| | | | | | | | | | | * add spec reference * remove LCLS note: CI parameter is optional but have nothing to do with LCLS It's pretty hard to decipher from the spec what CI is useful for and we have not used it anyway so let's just keep it as "Optional" for now. Change-Id: I5552732afcec48047d993ae6ffb73a3e5d7c9202
* gsm: Deprecate buggy gsm_arfcn2band API and introduce gsm_arfcn2band_rcPau Espin Pedrol2018-11-202-23/+49
| | | | | | | | | | | | | | | | | | | 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
* document unblock-ack vs. signalling in gprs_ns_process_msg()Stefan Sperling2018-11-201-0/+6
| | | | | | | | | | | | | Since commit 797558ea1768e464f9559c5f7a4f3f4285c5de25 we send the NS_UNBLOCK_ACK message before dispatching the NS_UNBLOCK signal, instead of afterwards. Add comments which explain the intended order of events. Suggested-by: Pau Related: OS#2388 Change-Id: I4b93853c952a97302f8afc14f462f22c3e487564
* send NS_POUT_UNBLOCK_ACK before signalling S_NS_UNBLOCKStefan Sperling2018-11-191-1/+3
| | | | | | | | | | | | | | | | | | | | | In gprs_ns_process_msg(), we were dispatching the S_NS_UNBLOCK signal before sending out the NS_POUT_UNBLOCK_ACK message. Signal handlers might send messages to the other side, assuming that NS is now unblocked. However, since such messages will arrive before the UNBLOCK_ACK message the receiver might discard them. This problem has been observed with our TTCN3 BSSGP_Emulation as a peer to osmo-pcu. This patch makes TTCN3 PCU TC_paging() test pass regardless of whether the test or osmo-pcu is started first. Before this patch, this test would only pass if the test was started before osmo-pcu. A remaining problem is that the test does not yet keep passing reliably unless osmo-pcu is restarted between test runs. Change-Id: I3af54a14bb6bcfa167c9a9d9f67835e7f5b9f1bb Related: OS#2890 Related: OS#2388
* Support cipher mode reject with extended causeMax2018-11-193-0/+42
| | | | | | | | | | | | | * add function to generate cipher mode reject with extended (2-byte) Cause IE * add function to get (extended) Cause value * add corresponding (extended cause) test * update existing (non-extended cause) test * use enum as a parameter for existing non-extended version to make interface more unified Change-Id: Id5509b94a18180a44f45300caaa02b843c166fa3 Related: OS#3187
* 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
* gsm48: gsm48_decode_freq_list: Improve documentation of paramter fPau Espin Pedrol2018-11-181-1/+1
| | | | Change-Id: Id8e3afff737211ded3c5689f2c83b1a544b42f9d
* Update GSM0808_LCLS enumsMax2018-11-181-0/+3
| | | | | | | | Add values indicating that LCLS control/config/status value has not been received yet. Change-Id: I52dc6a52f5ee043ed2c1625ffecfd495e3c746b1 Related: OS#2487
* Update 3GPP TS 08.08 Cause handlingMax2018-11-182-6/+25
| | | | | | | | | | | | * add Class definitions * add helper to check for extended bit * add helper to get Cause's Class * use enum in gsm0808_cause_name() and gsm0808_create_cipher_reject() to avoid confusion between class and cause * update gsm0808_create_cipher_reject() comments Change-Id: I31b31dfc22eb4b6b07089e1255246ac458125340 Related: OS#3187
* fsm: fix apidoc of osmo_fsm_state_name()Philipp Maier2018-11-161-1/+1
| | | | | | | The api documentation of osmo_fsm_state_name() refers to an FSM instance, but it really means the state of an FSM. Change-Id: I88ddd6048426d380c49170e66f57b3843398c046
* gsm29118: add value strings for SGSAP IEIPhilipp Maier2018-11-162-0/+36
| | | | | | | | The value strings for the SGSAP IEI are missing, lets add a set of value strings and a function to retrieve them. Change-Id: I2787303174f74ffba86675bce2c12f680d8ea708 Related: OS#3615
* socket.c: fix IP and port buffer sizesOliver Smith2018-11-061-4/+4
| | | | | | | | Use INET6_ADDRSTRLEN (46) instead of 64 for IP address buffers, and 6 instead of 16 for port buffers (the highest possible port number is 65535). Change-Id: Ia25e2f3277ad2f60df31c08d12f42c1e6d2a14a6
* gsm48: correct apidoc for gsm48_generate_mid()Philipp Maier2018-11-021-0/+1
| | | | | | | The API documentation lacks the the description for the last parameter, lets add a description for it. Change-Id: Ibcd25d3a7ddd7075eb15daff6dba42236d14d945
* Update cipher reject functionMax2018-11-021-0/+1
| | | | | | | | * add note about (yet) unsupported standard feature * use enum constant instead of hex value Change-Id: I5cc5fc1ae8d5474dbc8d3385a493adf6420a3c98 Related: OS#3187
* gsm0808: cosmetic: rename parameter "reason" to "cause"Philipp Maier2018-10-301-3/+3
| | | | | | | | | The function that generates the clear command takes a parameter "reason", which is the cause code. Lets give it the name "cause" to have a coherent naming scheme that matches the other functions and the 3gpp specs. Change-Id: I7b6c15e8fa8db13deef5041095944ca1c58fb99f
* gsm0808: fix doxygen apidocPhilipp Maier2018-10-301-1/+1
| | | | | | | | The api documentation names a parametery by a different name than it is listed in the parameter list of the function. Lets make the apidoc coherent. Change-Id: Id21ed1e920fb64522a734f206efbe2871ec05b06
* make 'show rate-counters' show group indexStefan Sperling2018-10-291-1/+1
| | | | | | | | | | | | | | Show each rate counter group's index in the output of the 'show rate-counters' command, to provide some way of telling apart distinct instances of the same rate counter group. This is not a very user-friendly UI because these indices are generated internally by libosmocore and/or applications, so users cannot easily assign meaning to these indices. However, the current rate counter implementation doesn't allow for more. Change-Id: Ieb151239407e4b2f8859fefec8d0670f5ddf908a Related: OS#3674
* stop printing group description in vty_out_rate_ctr_group_fmt()Stefan Sperling2018-10-292-3/+1
| | | | | | | | | | | | | | When vty_out_rate_ctr_group_fmt() prints the description of a counter group, it assumes this description should appear at the beginning of a line. However, the caller might be printing counters in an indented context. So just let the caller worry about printing the group title if necessary (there is currently only one known caller, which is updated in this commit). Note that printing of the group title was an undocumented feature. Change-Id: I2c55cb54e8b7a7c8c6cf72f22287083767ed0201 Related: OS#2660
* gsm23003: Add MME domain name related helper functionsHarald Welte2018-10-282-0/+92
| | | | | | | osmo_gen_mme_group_domain(), osmo_gen_mme_group_domain() and osmo_gen_home_network_domain() Change-Id: Ia882d9db05ec0037e593aeebea21bc31adb680bb
* add osmo_sock_get_{local,remote}_ip{,_port}()Oliver Smith2018-10-261-25/+86
| | | | | | | | | | Return only the IP or port of either the local or remote connection, not the whole set of IP and port of both the local and remote connection like osmo_sock_get_name() does it. This is needed for OS#2841, where we only want to print the remote IP. Related: OS#2841 Change-Id: I6803c204771c59a2002bc6a0e6b79c83c35f87e1
* cosmetic: fix typo (soocket -> socket)Oliver Smith2018-10-251-1/+1
| | | | Change-Id: I2184bf12398902d933f3744bc094418cc6961e86