aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm
AgeCommit message (Collapse)AuthorFilesLines
3 dayscore/defs.h: introduce and use OSMO_DEPRECATED_OUTSIDEVadim Yanitskiy1-1/+2
The new OSMO_DEPRECATED_OUTSIDE macro is similar to the existing OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE, but allows to override the deprecation message. Let's use it to suspend deprecation warnings related to: - gsm48_decode_bcd_number(), - osmo_ecu_fr_conceal(), - osmo_ecu_fr_reset(), as they're intentionally used in scope of the library. Change-Id: I1b0eff1396776900c1286e41da3aee3ff78b326e
5 daysgsup: Introduce OSMO_GSUP_NUM_VECTORS_REQ_IEHarald Welte1-0/+1
This is a bit of a hack, as we want to maintain binary compatibility without breaking existing users of libosmocore. To do so, we use the 'num_auth_vectors' field in two ways now: * In the existing use case as part of SEND_AUTH_INFO_RESPONSE, it indicates the number of vectors stored in the 'auth_vectors' field * In the new use case as part of SEND_AUTH_INFO_REQUEST, it indicates the number of vectors actually requested by the MSC/SGSN/MME. Change-Id: Iaecc47280f8ce54f3e3a888c1cfc160735483d0f
2019-11-28add all missing OSMO_GSUP_TO_MSGT_*() macrosNeels Hofmeyr1-0/+3
OSMO_GSUP_TO_MSGT_RESULT() is needed by osmo-hlr for osmo_gsup_req. The others are added for completeness' sake. Related: I3a8dff3d4a1cbe10d6ab08257a0138d6b2a082d9 Change-Id: I6e38a3bb8447f8f212f8d6f5b10a5d0df59323d7
2019-11-27Introduce fields related to DTAP DLCIPau Espin Pedrol1-1/+28
Change-Id: Iec448af02d28e6c5c573e68a0b4a86067ec7e561
2019-11-24GSUP: rename E_ROUTING_ERROR to ROUTING_ERRORNeels Hofmeyr1-1/+3
GSUP routing was introduced when adding the E interface. Hence that was the first realm where routing errors could occur. I did notice back then that this message type was special: it does not convey a response to a particular message kind -- it does not make sense, for example, to return an Updating Location Error cause, and do that for all conceivable message types. Instead, this tells the sender that a deeper error exists, i.e. that the desired peer is completely gone and unreachable. I did not foresee though that for D-GSM, there would also be arbitrary GSUP proxy routing, and that this error is not limited to E interface semantics. From today's point of view, adding the "_E_" in the name was a mistake. Remove that "_E_" to yield OSMO_GSUP_MSGT_ROUTING_ERROR (with unchanged message type discriminator), but provide a #define linking the old name OSMO_GSUP_MSGT_E_ROUTING_ERROR to the new one. The only visible change should be that osmo_gsup_message_type_names[] now returns the new name without "_E_". I am not aware of any regression test fallout from that. Change-Id: Ic8e8bd11522d6c51ac7aaf946516cbce26bc6e1e
2019-11-04gsm: gsm_04_08.h: Allow accessing classmark2 as struct instead of uint32_tPau Espin Pedrol1-5/+28
New fields are put inside a union to keep backward compatibility with potential older users of the struct. Change-Id: I235635800c0de47b1e2b9ec9c7191418f6003554
2019-11-04gsm: gsm_utils: Fix return type of API ms_class_gmsk_dbm() and add unit testsPau Espin Pedrol1-2/+1
Only known user of API is in osmocom-bb and it compiles fine after the change. Related: OS#4244 Change-Id: Ia10345008b3aca50b30482ef3b852b03eca71995
2019-11-04gsm: Fix compilation error under some compilersPau Espin Pedrol2-2/+2
Some compilers don't like declaration of enums in header files like we do sometimes for structs: enum gsm_band; void foobar(enum gsm_band band); triggers: error: use of enum 'gsm_band' without previous declaration Fixes: b99f4ca2d8517d99cdf8aa183dbfda7b233bb781 Related: OS#4244 Change-Id: I6c2102c763f565bbe3c8dd7e5b4e04c4a45fff67
2019-11-03gsm_04_08.h: Introduce API osmo_gsm48_rfpowercap2powerclass()Pau Espin Pedrol1-1/+2
Related: OS#4244 Change-Id: I32e9cc1c2397b44f0d48db2acdf782a821365b63
2019-11-01cosmetic: gsm_04_08.h: Fix trailing whitespacePau Espin Pedrol1-3/+3
Change-Id: I4b34dbd5f0176d1d8aa8cc96f642ed35d4214b7e
2019-10-28gsm0508: add functions to calculate beginning of a blockPhilipp Maier1-0/+12
The calculation of the beginning of a block for TCH/F, TCH/H and FACCH can be challenging since those channels are affected by the diagonal interleaving of the TCH channels. However, GSM 05.02 Section 7 Table 1 of 5 specifies how the blocks are distributed over the TDMA frame interval. Lets add a mapping function that is based on that table Related: OS#3803 Change-Id: I3d71c66f8c401f5afbad9b1c86c24580dab9e0ce
2019-10-04API doc tweaks (mncc.h, gsm_08_08.h)Neels Hofmeyr2-5/+7
Change-Id: I9b4c7e737c83c65e358496e4540c14be5abc5474
2019-09-28gsup: add OSMO_GSUP_SUPPORTED_RAT_TYPES_IE and OSMO_GSUP_CURRENT_RAT_TYPE_IENeels Hofmeyr1-0/+7
OSMO_GSUP_SUPPORTED_RAT_TYPES_IE corresponds to the Supported RAT Types Indicator from 3GPP TS 29.002. See 8.1.2 MAP_UPDATE_LOCATION service, which indicates the capabilities of the MSC/VLR to the HLR. So far, have room for eight RAT types in the gsup_msg. That is an arbitrary random choice without any rationale. OSMO_GSUP_CURRENT_RAT_TYPE_IE is useful to communicate the currently used RAN / RAT type of the current subscriber during Location Updating Request. Change-Id: I93850710ab55a605bf61b95063a69682a2899bb1
2019-09-05Introduce BTS_FEAT_ETWS_PN for communicating ETWS PN capabilityHarald Welte1-0/+1
As 3GPP doesn't specify how the BSC shall communicate ETWS Primary Notifications over Abis/RSL, we have to use a vendor-specific RSL message for this. And in order to know if the peer supports this feature, we introduces BTS_FEAT_ETWS_PN. Change-Id: I89c24a81ada6627694a9632e87485a61cbd3e680 Related: OS#4046, OS#4047
2019-09-05gsm_08_58: Add vendor-specific Message Type for ETWS Primary WarningHarald Welte1-0/+2
Change-Id: I36fc2ffc22728887d1cb8768c7fcd9739a8ec0fc Related: OS#4046, OS#4047
2019-08-31cbsp: Fix endless loop iteration when decoding cell list IEsHarald Welte1-0/+1
The CBSP code assumed that gsm0808_decode_cell_id_u() would return the number of bytes it has consumed/parsed. But it actually always returns '0', whcih makes us run in an endless loop :( Change-Id: I5758af4ec11a827d4b888a3a16c4ec22de90a7d6
2019-08-23Cosmetic: l1sap.h: change /* !< to /*!<Oliver Smith1-5/+5
Change-Id: Icaec95a9c6105fd17bc1151fdc77394f4efd3b70
2019-07-26gsm/gsm48.h: drop meaningless 'const' from gsm48_mi_to_string()Vadim Yanitskiy1-2/+1
Change-Id: I5eb17edadf89ac47b4ca86c9e822037f7c0e518e
2019-07-20Add Cell Broadcast related definitions from 3GPP TS 23.041Harald Welte1-0/+89
Change-Id: I1e2c62cb9047648907c91b99f764f6caba8f4493
2019-07-20cbsp: Introduce osmo_cbsp_errstrHarald Welte1-0/+2
Rather than having the encoder/decoder library print some log messages in case of encoding/decoding errors, let's provide something akin to 'errno', but with a string instead of a numeric error code. The 'osmo_cbsp_errstr' global variable (if set) contains a human-readable string describing the most recent encoding/decoding error. It exists separately for each thread and hence can be used safely in multi-threaded environments. Change-Id: Id9a5a595a76ba278647aee9470ded213d8464103
2019-07-20CBSP (Cell Broadcast Service Protocol; 3GPP TS 48.049) supportHarald Welte2-0/+420
This introduces definitions as well as a parser+encoder for the Cell Broadcast Service Protocol (CBSP) as specified in 3GPP TS 48.049. CBSP is used on the interface between CBC and BSC. Related: OS#3537 Change-Id: I5b7ae08f67e415967b60ac4b824db9e22ca00935
2019-07-10libosmogsm/l1sap.h: extend ph_rach_ind_param with lqual_cbVadim Yanitskiy1-0/+1
The link quality, defined by C/I (Carrier-to-Interference) ratio, can be computed from the training sequence of each burst, where we can compare the "ideal" training sequence with the actual training sequence and then express that in cB (centiBels, dB * 10). By analogy with both RSSI and ToA, it can be used to filter out false-positive detections and ghost Access Bursts. Change-Id: Ie2a66ebd040b61d6daf49e04bf8a84d3d64764ee
2019-06-17add define for magic tmsi constantEric Wild1-0/+1
Change-Id: I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec
2019-06-12protocol/gsm_04_08.h: do not check if unsigned is positiveVadim Yanitskiy1-3/+3
Change-Id: I6b486b52a3733d5fd5e8ba18acbc9374e2e8bd7e
2019-06-05lapdm: Allow user to specify T200 values; Use correct N200 valuesHarald Welte1-3/+9
TS 04.06 specifies a N200 re-transmission counter that depends on the channel type, which we didn't care about at all so far. Let's have the caller tell us the channel type so we can internally look up the correct N200 value for it. At the same time, permit the user to specify T200 re-transmission timer values for each SAPI on both DCCH and ACCH, which is required at least in the BTS as per GSM TS 12.21. Also, extend the timer resolution of the API from seconds to milli-seconds, which is more applicable as particularly on the FACCH the recommended values are in the 200ms range. Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c Related: OS#3906 Related: OS#2294 Related: OS#4037
2019-06-04gsm0808_utils: Add gsm0808_decode_cell_id_u()Harald Welte1-0/+1
This function parses a single Cell ID list element into a 'union gsm0808_cell_id_u'. This function is going to be used by the upcoming CBSP support. Related: OS#3537 Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
2019-05-28rest_octets: Remove SI2ter + SI2bis encoders that don't do anythingHarald Welte1-2/+0
The library should either provide functions that implement encoding of those rest octets, or it shouldn't. Providing a function that doesn't do anything but pad the buffer is useless. Change-Id: Ie10684de6a6b2663e2a871fcdb2b275b6ad7a1e7
2019-05-28rest_octets: Implement actual SI6 rest octets encodingHarald Welte1-1/+38
There's very little sense behind introducing a function into libosmogsm which doesn't implement 90% of the spec. Let's allow the caller to provide the various optional bits of information to the encoder, rather than generating mostly static SI6 rest octets. Change-Id: Id75005a0c4a02ce7f809692d58b3bd226bc582b2
2019-05-28rest_octets: Add function to parse SI3 rest octetsHarald Welte1-0/+3
Change-Id: I690cf308311f910005a325d50f5d5d825678d2b2 Related: OS#3075 Related: OS#4023
2019-05-28rest_octets: Suffix encoder functiosn with _encodeHarald Welte1-10/+12
... otherwise it's not really clear what they do. Change-Id: I08e0ca9a8d13c7aa40b9d90f34f0e13adb87d4e0
2019-05-27oap_client: Fix license: GPLv2+ instead of AGPLv3+Harald Welte1-4/+5
libosmo{core,gsm,vty} code is GPLv2+. The OAP code originated in osmo-msc.git and was moved here without changing the license. That was a mistake, it always was meant to be under GPLv2-or-later after moving to libosmocore.git. Copyright is with sysmocom, so I as the managing director can approve the license change. Change-Id: I08311fa8214c15f8df8945b9894226608cf96f15
2019-05-27rsl: Add osmocom-specific extensions to RSL channel numbers for CBCHHarald Welte1-0/+4
We don't really *need* it in libosmocore as such, but the lack of having all osmocom extensions listed here lead to using overlapping definitions: 0x18 was used for dynamic PDCH on the Abis side, but also for CBCH on the L1SAP side. Let's list them all here to increase visibility in case anyone wants to extend this further... Related: OS#4027 Change-Id: I93e557358cf1c1b622f77f906959df7ca6d5cb12
2019-05-24protocol/gsm_12_21.h: fix copy-pasted struct descriptionVadim Yanitskiy1-1/+1
Change-Id: Ic6d32c886f6f8f859e382d48f9e1b509000db9ba
2019-05-19TLV: Add one-shot TLV encoderHarald Welte1-0/+6
So far, the TLV code contained two types of functions * tlp_parse() to parse all TLVs according to definition into tlvp_parsed * various helper functions to encode individual TLVs during message generation This patch implements the inverse of tlv_parse(): tlv_encode(), which takes a full 'struct tlv_pared' and encodes all IEs found in it. The order of IEs is in numerically ascending order of the tag. As many protocols have different IE/TLV ordering requirements, let's add a tlv_encode_ordered() function where the caller can specify the TLV ordering during the one-shot encode. Change-Id: I761a30bf20355a9f80a4a8e0c60b0b0f78515efe
2019-05-19Cosmetic: GSUP: fix too long comment lineOliver Smith1-2/+2
Change-Id: I60ba8fef8924e58bc73cff5c7ff77ebb76d8bfaa
2019-05-18Revert "Change GSM48_PDISC_* to enum type"Harald Welte1-20/+18
This reverts commit ece1d8509d5c5af7a60ab5e1a5dddade1b181dc9 which causes build failures due to compile warnings everywhere. Change-Id: Ic131439ea206a0b0f57968ef701667da73711b51
2019-05-17Change GSM48_PDISC_* to enum typeMax1-18/+20
An enum is more clear than an int and #defines for passing around, also in case you have a switch () statement, the compiler will issue warnings for unhandled cases. Change-Id: Icbbe8786a776081d7643193f154e6270224399e6
2019-05-15gsm_23_003: add GSM23003_MSISDN_{MIN,MAX}_DIGITSOliver Smith1-0/+3
Add the constant, so it can be used in create-subscriber-on-demand related patches. ITU-T Rec. E.164 6.1 states that maximum international number length should be 15. I did not find a source for a minimum length, but I've added the constant and set it to 1 for consistency (based on the existing osmo_msisdn_str_valid() function). Related: OS#2542 Change-Id: Idc74f4d94ad44b9fc1b6d43178f5f33d551ebfb1
2019-05-13gsm0808: Introduce Osmocom extensions to announce Osmux supportPau Espin Pedrol2-0/+5
IE GSM0808_IE_OSMO_OSMUX_SUPPORT (T, 1 byte) is sent in AoIP appended to BSSMAP RESET in order to announce the peer that its MGW supports handling Osmux streams upon call set up. IE GSM0808_IE_OSMO_OSMUX_CID (TV, T 1 byte & V 1 byte) is sent in AoIP during call set up: * MSC->BSC Assignment Request * BSC->MSC Assignemnt Complete The 1 byte value contains the local Osmux CID, aka the recvCID aka CID where the peer sending the Assign Req/Compl will look for Osmux frames on that call. Hence, the peer receiving this CID value must use it to send Osmux frames for that call. As a result, a given call leg BSC<->MSC can have one different Osmux CID per direction. For example: * MS => MGW_BSC ==CID 0==> MGW_MSC * MS <= MGW_BSC <=CID 1=== MGW_MSC This allows for setups with 256 call legs per BSC on scenarios where NAT is not a problem, where MSC can have a pool of 256 CID per MGW_BSC (or remote peer). Related: OS#2551 Change-Id: I28f83e2e32b9533c99e65ccc1562900ac2aec74e
2019-05-10gsm0808_utils: Introduce gsm0808_msgb_put_cell_id_u()Harald Welte1-0/+1
This function is doing the bulk work of encoding a given Cell ID List item. gsm0808_enc_cell_id_list2() is modified to be a wrapper / loop around the new function. The purpose of this is to expose Cell ID List Entry encoding so that the upcoming CBSP protocol encoder can re-use this code. Related: OS#3537 Change-Id: I6cc567798e20365e6587e6b2988e834306d8c80c
2019-05-10Add MO-FALLBACK-VALUE SGsAP IEOmar Ramadan1-0/+1
In testing against a particular EPC, the SGsAP-SERVICE-REQUEST can contain a MO fallback value TLV with T 0xF1 Change-Id: Ia2460af9673818d375e28c67f1631b5f7eacdaeb
2019-05-06Re-introduce declaration of gsm0808_create_handover_request_ack()Harald Welte1-0/+4
In Change-Id Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576, the old declaration of gsm0808_create_handover_request_ack() was accidentially removed from the gsm0808.h header file. The actual function itself (and the exported symbol) remained for backwards compatibility at runtime, but removing the declaration from the header file resulted in build failures across the board of all automatic tests. Let's re-introduce the old declaration. Change-Id: I9e96fa675fccca9ee9631caad7559dea3794d490
2019-05-05add gsm0808_create_handover_request_ack2 to add AoIP RTP addrNeels Hofmeyr1-3/+23
osmo-bsc so far omits the AoIP Transport Layer Address from its Handover Request Acknowledge message, which breaks inter-BSC Handover for AoIP. Allow fixing that. One quirk I really don't like about this: I would prefer to directly use struct sockaddr_storage as a member of the struct gsm0808_handover_request_ack. Even though struct sockaddr_storage appears in various function signatures, the gsm0808.c actually also gets built on embedded systems that lack arpa/inet.h (for me indicated by the ARM build job on jenkins). Compiling gsm0808.c works only because the actual coding of struct sockaddr_storage is implemented in gsm0808_util.c, which (apparently) does not get built on embedded and hence, even though there are undefined references to e.g. gsm0808_enc_aoip_trasp_addr() it works. Related: I4a5acdb2d4a0b947cc0c62067a67be88a3d467ff (osmo-bsc) Change-Id: Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576
2019-05-03add comment to gsm_mncc_bearer_cap.speech_verNeels Hofmeyr1-1/+1
Change-Id: Ib657b1eb55aab400f3682a89bbd428bdee02581c
2019-05-03add osmo_bssap_tlv_parse2() for multiple identical TNeels Hofmeyr1-0/+3
In BSSMAP messages, at least the Cell Identifier IE can appear more than once. We have tlv_parse2() which allows decoding into an array of tlv_parsed to cleanly handle multiple occurences. Hence add osmo_bssap_tlv_parse2() which supports multiple occurences. An alternative would be to directly call tlv_parse2() with gsm0808_att_tlvdef() when multiple T occurences are needed, and I'm not really sure why osmo_bssap_tlv_parse() exists in the first place. But because it does, add a similar definition that is capable of handling multiple IEs with identical Tag discriminator. Change-Id: Ib9a2095f7498dc2cda2a57154b2dbe4621df72f8
2019-05-03add gsm48_decode_bcd_number2() from osmo-mscNeels Hofmeyr1-1/+5
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
2019-05-03BSSMAP: add messages for inter-BSC and inter-MSC HandoverNeels Hofmeyr1-0/+66
Change-Id: I9dac375331f6bea744769e973725d58e35f87226
2019-05-02gsm/gsm_utils.h: fix argument type of gsm_chan_t_name()Vadim Yanitskiy1-1/+1
The actual value-string array 'gsm_chan_t_names' describes the enum values of 'gsm_chan_t', not 'gsm48_chan_mode'. Change-Id: Ifc2121b23fb8d07589cc5b7aa8fbf4e27eb6b72b Fixes: CID#188831, CID#188825
2019-04-26BSSMAP: tweaksNeels Hofmeyr1-2/+2
Change two instances of Speech Version values to enum gsm0808_permitted_speech. It is often not trivial to find the right values for a uint8_t member, giving the enum name makes it a lot easier/safer to use. In gsm0808_create_handover_required(), use msgb_tv_put() so that the enum's storage size doesn't matter. (Already used for handover_performed) Fix typo in doc of gsm0808_create_handover_required(). Change-Id: I6387836bab76e1fa42daa0f42ab94fc14b70b112
2019-04-26GSUP: add inter-MSC handover related msgs and IEsOliver Smith1-0/+66
Based on a draft created by Neels, which is the result of reading a MAP trace of two MSCs negotiating inter-MSC handovers, and of reading the TS 29.002, TS 29.010 and related specs: https://lists.osmocom.org/pipermail/openbsc/2019-January/012653.html I figured out that the "Handover Number" mentioned in the specifications is the same as the MSISDN IE that we already have, so we can use that instead of creating a new IE (example usage in tests/gsup/gsup_test.c). Create a new OSMO_GSUP_MSGT_E_ROUTING_ERROR message type, which the GSUP server uses to tell a client that its message could not be forwarded to the destination (see [1]). MAP has no related message. [1]: Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5 (osmo-hlr.git) Related: OS#3774 Change-Id: Ic00b0601eacff6d72927cea51767801142ee75db