aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm
AgeCommit message (Collapse)AuthorFilesLines
2018-06-02gsm0808: Add value_string for LCLS related IEsHarald Welte1-0/+15
Change-Id: I18d7a29496929c761aeaba9c0aee847befc13108
2018-05-31GSUP: introduce new messages for SS/USSD payloadsVadim Yanitskiy1-0/+11
In order to be able to transfer SS/USSD messages via GSUP, this change introduces the following new message types: - OSMO_GSUP_MSGT_PROC_SS_*, and the following new IE: - OSMO_GSUP_SS_INFO_IE which represents an ASN.1 encoded MAP payload coming to/from the mobile station 'as is', without any transcoding. Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532 Related: OS#1597
2018-05-31GSUP: implement TCAP-like session managementVadim Yanitskiy1-0/+21
Unlike TCAP/MAP, GSUP is just a transport layer without the dialogue/context. This prevents us from having session based communication, required e.g. for USSD. But we can emulate TCAP dialogue by adding additional IEs, which would allow to relate each message to a particular session. This change introduces the following IEs: - OSMO_GSUP_SESSION_ID_IE, - OSMO_GSUP_SESSION_STATE_IE, which optionally can be used to indicate that the message is related to a session with given ID, and to manage session state, i.e. initiate, continue, and finish. Change-Id: I1cee271fed0284a134ffed103c0d4bebbcfde2a8 Related: OS#1597
2018-05-30gsm0808: Add encoding functions for LCLS BSSMAP messagesHarald Welte1-0/+5
Change-Id: Ib83143e467df068b7d462a8e51d94b9d961ce18f
2018-05-30gsm_08_08.h: Add enum for LCLS config, control and statusHarald Welte1-0/+28
Change-Id: I775aba59942fb6f34fb31b71d2f0f2ac5c3ae831
2018-05-28Add enum gsm48_progress_descKeith1-0/+12
From GSM 04.08 Section 10.5.4.21 / Table 10.5.127 Change-Id: I6574e8808aaf39fad8026290aa2cc657734e18b5
2018-05-27add gsm0808_create_handover_request_ack()Neels Hofmeyr1-0/+4
Related: OS#2283 (inter-BSC Handover, BSC side, MT) Change-Id: I692292a06c7d66004404560dc4ed933ca9107f9b
2018-05-27add support for gsm0808 HANDOVER REQUIRED messageNeels Hofmeyr2-0/+59
Related: OS#2283 (inter-BSC Handover, BSC side, MO) Change-Id: Idb6dc3eab0282158a17091d97ed77c1e2e3eb3c2
2018-05-27add gsm0808_cell_id_to_list()Neels Hofmeyr1-0/+1
The idea is to be able to add a gsm0808_cell_id to a gsm0808_cell_id_list2: first convert it to a list, then re-use gsm0808_cell_id_list_add(). It will be used by osmo-bsc to manage neighbor-BSS cell identifiers from VTY. Change-Id: Ibf746ac60b1b1e920baf494b396658a5ceabd788
2018-05-26Add enum gsm48_cause_coding from GSM 04.08 Section 10.5.4.11Keith1-0/+8
Change-Id: I3d9c8e117ad19f70a3273650d7c0f8280d7bdb9a
2018-05-24mncc: properly export osmo_mncc_name()Harald Welte1-0/+5
For some strange reason, the osmo_mncc_name() inline function was not in the mncc.h header, but in the mncc.c file. Let's fix that. Change-Id: I2c3666510c981dffa4ba25bed517fd7ebd1250f5
2018-05-15fix spellingThorsten Alteholz1-2/+2
Change-Id: I3ac92217f83279d5f987ab34eb18b2e6cb1c7812
2018-05-08add gsm0808 channel enum to IE val conversion functionsNeels Hofmeyr1-0/+107
Add: - gsm0808_current_channel_type_1() - gsm0808_permitted_speech() - gsm0808_chosen_channel() - gsm0808_channel_type_name() gsm0808_permitted_speech() is moved from osmo-bsc's bssap_speech_from_lchan(); gsm0808_chosen_channel() is moved from osmo-bsc's lchan_to_chosen_channel(); Rationale: will be re-used by inter-BSC handover, makes sense to keep with the other gsm0808 utils. Related: OS#2283 (inter-BSC handover, BSC side) Change-Id: I8a3cc5d4548e9a78d945d54c69ccced251edcec9
2018-05-07define a constant for the max length of called party BCD IEStefan Sperling1-0/+1
According to TS 24.008 10.5.4.7 the called party BSC number IE has a maximum length of 43 octets. This length is assumed inside osmo-hlr with a magic number: uint8_t msisdn_enc[43]; /* TODO use constant; TS 24.008 10.5.4.7 */ This change makes libosmocore provide a constant which osmo-hlr can use. Change-Id: Ia0bf6ceadcac38a8c75d166402b54058e5c6c6d4
2018-04-23gsm_08_58.h: introduce RSL_IE_ERIC_PAGING_GROUPAlexander Couzens1-0/+1
Ericsson supports a RSL command to page and immediate assign as single command. For paging a MS the BTS must know the paging group. Change-Id: I9194500e307ad69f8da07510bc965a7a5cd82a2a
2018-04-21gsm_08_58.h: Add Ericsson vendor-specific RSL message typesPau Espin Pedrol1-0/+5
We are alredy doing the same way for ip.access and siemens ones, and this way we avoid using the hardcoded value in osmo-bsc. Change-Id: I7cb65f3ff1cfdbe4eee97b7545bcd13a38c72e25
2018-04-18add gsm0808_cell_{id,id_list}_name() and friendsNeels Hofmeyr2-1/+13
Provide comprehensive API to obtain string representations of Cell Identifiers and -Lists. Change gsm0808_test.c to use the new functions (which simplifies the output a bit), so that we don't duplicate printing code in gsm0808_test.c, and so that the not-so-trivial printing code is also tested. In gsm0808_test, also test gsm0808_cell_id_list_name_buf()'s return value and truncation behavior. The rationale for gsm0808_cell_id_list_name(), i.e. printing an entire list of cell identifiers, is that even though the maximum is 127 elements, a list of more than a few elements is hardly ever expected in practice (even more than one element isn't actually expected: either "entire BSS" or a single LAC). It is thus useful to log the entire list when it shows up in Paging and Handover. Change-Id: I9b2106805422f96c5cc96ebb9178451355582df3
2018-04-18tlv: add TLV_GET() and TLV_GET_MINLEN()Neels Hofmeyr1-0/+21
Rationale: so far we use code like if (TLVP_PRESENT(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS)) { val = TLVP_VAL(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS); len = TLVP_LEN(&tp, VERY_L0NG_ENUM_VALUE_NAME_TH4T_NEVER_EMDS); } This is a) very long and b) prone to picking the wrong name one of the three times, which would use the wrong length or val without necessarily being noticed. A safer and shorter, more readable pattern is: struct tlv_p_entry *e = TVLP_GET(&tp, VERY_LONG_ENUM_VALUE_NAME_THAT_NEVER_ENDS); if (!e) return -ENOENT; hexdump(e->val, e->len); Change-Id: I445de17fc2daa3ab051f5708dd0cc185b23dc048
2018-04-17protocol/gsm_04_08.h: drop incorrect GSM48_PDISC_USSDVadim Yanitskiy1-1/+0
According to the GSM TS 04.07, section 11.2.3.1.1 "Protocol discriminator", bits 1 to 4 of the first octet of a standard L3 message contain the protocol discriminator IE. Meanwhile, the GSM48_PDISC_USSD represents value 0x11, i.e. 0b10001, that requires 5 bits, and moreover it is not documented anywhere. Let's drop it. Change-Id: Ic4eb8a6db4ff1dfd535bd0c84e7acf1908422f64
2018-04-13add gsm0808_{enc,dec}_cell_idNeels Hofmeyr1-12/+21
Clarify semantics and micro-optimise for the case of single Cell Identifer IEs. Test in gsm0808_test.c So far we have gsm0808_enc_cell_id_list2(), but there also exist instances of single Cell Identifiers (3GPP TS 48.008 3.2.2.17). It is possible to decode the same using the cell identifier list API, but this forces the caller to also keep a full struct gsm0808_cell_id_list2 with all its 127 entries around. E.g. for handover, there are two Cell Identifiers (Serving and Target); I'd need two full cell id lists for each, and these would be dynamically allocated for each handover operation, whether it uses them or not. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I9f9c528965775698ab62ac386af0516192c4b0cc
2018-04-13add tlv_parse2(), capable of multiple instances of the same IENeels Hofmeyr1-0/+3
Allow passing multiple struct tlv_parsed in an array, to allow parsing as many repeated IEs as are expected by the caller. From tlv_parse(), call tlv_parse2() with dec_multiple = 1 to yield the previous behavior. tlv_parse() remains valid API. An example of multiple IEs is the BSSMAP Handover Request, containing Cell Identifier (Serving) and Cell Identifier (Target), both defined by 3GPP TS 48.008 3.2.2.17 with identical IE tags; both are mandatory. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: Id04008eaf0a1cafdbdc11b7efc556e3035b1c84d
2018-04-13add gsm0808_cell_id_list_add() to combine two cell identifier listsNeels Hofmeyr1-0/+1
This will be used by the upcoming neighbor_ident API in osmo-bsc, where the vty interface allows composing neihbor BSS cell identifier lists, and we want to allow adding individual items from individual user commands. It will also be useful to accumulate cell identifiers in case a subscriber sees multiple alternative cells from a neighboring BSS, and we want to pass these on to the MSC in a Handover Required. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I5781f5fa5339c92ab2e2620489b002829d206925
2018-04-13add osmo_cgi_name()Neels Hofmeyr1-0/+2
This will be used by cell idenitifier list code, like upcoming neighbor_ident VTY in osmo-bsc and regression tests. Change-Id: Iebc5cdf61b697b1603900993fc265af3eca0cedf
2018-04-10deprecate PLMN de-/coding functions incapable of 3-digit MNC with leading zerosNeels Hofmeyr2-7/+12
All our projects have seen patches to move to 3-digit MNC handling. Furthermore, since our builds no longer break from deprecation warnings, I shall no longer refrain from deprecating old API. Change-Id: I55dfaf7ce74870de44120b26c42d45bb7b184341
2018-04-09add gsm48_reject_value_namesNeels Hofmeyr1-0/+4
There seems to be quite some confusion / overlap between enum gsm48_reject_value, gsm48_gsm_cause and gsm48_gmm_cause. I tried to go with gsm48_gsm_cause_names[], but e.g. GSM48_REJECT_CONGESTION is not represented. Instead of attempting to mix/merge those enums, provide a separate value string array for enum gsm48_reject_value. This will be used by osmo-msc's libvlr (refactoring of FSM result handling), I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1. Change-Id: I6661f139e68a498fb1bef10c266c2f064b72774a
2018-04-04gsm0480: copy the raw USSD data, its DCS and lengthVadim Yanitskiy1-0/+12
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
2018-04-04gsm0480: document the 'ss_request' structureVadim Yanitskiy1-0/+31
Change-Id: I22144dd759e0c1bb1965574b7ddd676606e5d6b7
2018-03-29gsm0808: Add value strings for BSSMAP cause codesPhilipp Maier1-0/+1
libosmocore has no value strings for BSSMAP cause codes yet. - Add value strings for BSSMAP cause codes and a function to retrieve them Change-Id: I313dd8d7b06374e1e35ddc18b7a42562d9e25d45 Related: OS#1609
2018-03-23gsm_08_08: correct speech codec defaultsPhilipp Maier1-4/+4
The speech codec defaults are not correct. The defaults recommended in 3GPP TS 28.062, Table 7.11.3.1.3-2 are limited by 3GPP TS 48.008, Section 3.2.2.103. Some defaults are actually reserved for future use. Also the endianess of the 16 bit values is reversed. - correct values so that they match the specification - transmit bytes in the correct endianess Change-Id: I6c3a34d39a375d71c4128fd38f06629e8b98b100
2018-03-17abis_nm: Introduce abis_nm_dump_foh()Harald Welte1-5/+3
This is a more modern way of printing the Abis OML Formatted Object Header, without assuming that it would be used in a log statement or prescribing the log level to be used. Change-Id: I9b2c2afec28882b817d104d5b062651ade7aadd8
2018-03-13support for more cell ID list types in libosmocoreStefan Sperling4-4/+46
Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847
2018-03-05features: define osmo_bts_*_feature() as static inlinePhilipp Maier1-2/+2
The functions osmo_bts_set_feature() and osmo_bts_has_feature() are currently defined as inline. Since inline is a hinting, the compiler might choose not to inline the function. This eventually leads to linker problems because the function is then defined multiple times. - use "static inline" instead of "inline" only. This patch is a follow up patch to Change Id 680acae725b2b8dda2f239ff20073306fdfb3f6e Change-Id: Iddd97415a17b06b69f69ddca2e2e296eb2f23a89
2018-03-05gsm23003: add osmo_mcc_from_str()Neels Hofmeyr1-0/+11
I found myself often using osmo_mnc_from_str() to also decode an MCC and be strict about it, but each time I felt the need to comment like "using osmo_mnc_from_str() also for MCC". Rather formalize this properly. Use a static inline function, no need to add more symbols to libosmo-gsm. Change-Id: I020a4f11791c61742a3d795f782805f7b7e8733e
2018-03-02features: move bts feature related functionality to libosmocorePhilipp Maier1-0/+43
osmo-bsc and osmo-bts share enums and value strings to describe feature data that is exchanged via OML (manufacturer id) on startup. Also the functions to set and get the respecitive bits in the feature bitvectors are in osmo-bsc and osmo-bts. This is a code duplication and should be resolved. - add enum osmo_bts_features (replaces enum gsm_bts_features) - add osmo_bts_features_descs (replaces gsm_bts_features_descs) - add osmo_bts_set_feature (replaces gsm_btsmodel_set_feature) - add osmo_bts_has_feature (replaces gsm_btsmodel_has_feature) Change-Id: Id0c35aef11aa49aa40abe7deef1f9dbd12210776
2018-03-01introduce GSM_MCC_MNC_INVALIDNeels Hofmeyr1-0/+4
In some cases, we want to mark an unset MCC-MNC. Define uint16-max for this purpose. osmo-bsc code is already doing so with a -1 and using int data types, which will become inconvenient with the new API that handles MCC and MNC as uint16_t. Change-Id: Ieee7add0bd6d94cf84743a49794bbcd38561b72f
2018-02-28gsm: add osmo_mnc_from_str(), osmo_mnc_cmp(), osmo_plmn_cmp() for 3-digit MNCNeels Hofmeyr1-0/+5
osmo_mnc_from_str() preserves leading zeros in the string and is useful for VTY config parsing (osmo-bsc, osmo-msc, osmo-sgsn, osmo-pcu). osmo_{plmn,mnc}_cmp() takes care of the slight intricacy of ignoring the 3-digit flag if the MNC is anyway >99. Will be used by osmo-sgsn.git and osmo-bsc.git. (All current users just care about identical MNC, but a proper cmp doesn't hurt.) Change-Id: Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6
2018-02-28implement support for 3-digit MNC with leading zerosNeels Hofmeyr3-1/+23
Enable representing three-digit MNC with leading zeros. The MNCs 23 and 023 are actually different; so far we treated both as 23. Re-encode an incoming BCD or string of 023 as it were, i.e. not dropping the leading zero as 23. Break ABI compatibility by changing the size and ordering of structs gprs_ra_id, osmo_plmn_id, osmo_cell_global_id, ... by adding an mnc_3_digits flag. Change ordering in gprs_ra_id because the canonical oder is {Mobile Country Code, Mobile Network Code}, so have the mcc member first. ABI compatibility cannot be maintained for struct gprs_ra_id, since it is a direct member of structs bssgp_bvc_ctx and bssgp_paging_info, and even just adding a flag to the end would cause ABI changes of those structs. Similarly, osmo_plmn_id is a direct member of osmo_location_area_id, and so forth. Add new API to set and read this additional flag to preserve leading zeros: - osmo_plmn_to_bcd(), osmo_plmn_from_bcd() after gsm48_mcc_mnc_to_bcd() and gsm48_mcc_mnc_from_bcd(). - gsm48_decode_lai2(), gsm48_generate_lai2() after gsm48_decode_lai(), gsm48_generate_lai(). - gsm0808_create_layer3_2() after gsm0808_create_layer3() and gsm0808_create_layer3_aoip(). - various osmo_*_name() functions in gsm23003.h (osmo_rai_name() still in gsm48.h close to struct gprs_ra_id definition). The amount and duplication of these may seem a bit overboard, but IMO they do make sense in this way. Though most code will soon see patches unifying the data structures used, in some cases (vty, ctrl) they are required singled out. Without these functions, the formatting ("%0*u", mnc_3_digits ? 3 : 2, mnc) would be duplicated all over our diverse repositories. In various log output, include the leading MNC zeros. Mark one TODO in card_fs_sim.c, I am not sure how to communicate a leading zero to/from a SIM card FS. The focus here is on the core network / BSS. To indicate ABI incompatibility, bump libosmogsm and libosmogb LIBVERSIONs; adjust debian files accordingly. Implementation choices: - The default behavior upon zero-initialization will be the mnc_3_digits flag set to false, which yields exactly the previous behavior. - I decided against packing the mnc with the mnc_3_digits field into a sub-struct because it would immediately break all builds of dependent projects: it would require immediate merging of numerous patches in other repositories, and it would make compiling older code against a newer libosmocore unneccessarily hard. Change-Id: Id2240f7f518494c9df6c8bda52c0d5092f90f221
2018-02-27l1sap: Add fields for higher-precision timing offset valuesHarald Welte1-2/+8
So far, we used quarter-bits across the L1SAP between the hardware/PHY specific part of OsmoBTS and the common part. In order to increase the resolution, let's add fields/members for 1/256th bit. In order to keep ABI and API compatibility, we use a union around the old and new values, so old code will still compile + work withe new libosmocore. Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
2018-02-27l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-RACH.indHarald Welte1-0/+4
Let's extend PH-RACH.ind with some useful data across the L1SAP boundary. Change-Id: I9439810c3a3ad89ea0302753617b850749af887c Related: OS#3003
2018-02-22Revert "Add function to encode classmark"Harald Welte1-1/+0
This breaks all existing / older osmocom-bb builds, and hence cannot be accpeted. See also https://gerrit.osmocom.org/#/c/6679 Related: OS#2985 This reverts commit 3c38e60cd55814a7b4c34f22e0b2e6e671f883c4. Change-Id: Icfc52ca4e5cbe3a444d98037d27fa101e3614e06
2018-02-15Add function to encode classmarkMax1-0/+1
The code is based on Osmocom-BB implementation. Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
2018-02-15Add generic Mobile Identity encoderMax1-0/+1
Add generic function which allows caller to set Mobile Identity explicitly. This allows to use IMEI or IMEISV for example. Make gsm48_generate_mid_from_imsi() into wrapper around new function. Change-Id: Id79be7abfff75ecd0d248bbeed93e605abeec9b3
2018-02-13Add helper functions for ACC bit flags in rach control IE.Stefan Sperling1-2/+43
Add inline functions to manipulate and query ACC flag bits in the rach_control.t2 and rach_control.t3 octets. These function definitions also serve as documentation of the purpose of rach_control.t2/t3. Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163 Related: OS#2591
2018-02-09Add GSM 04.08 type-of-number / numbering-plan-id definitionsHarald Welte1-0/+22
Change-Id: Idd8d8a7a1c7f0b6cb9318e4f19ebadb415df2ed1
2018-02-05GSUP: change osmo_gsup_encode() return typeMax1-1/+1
* match return type of osmo_gsup_encode() with osmo_gsup_decode() to allow propagating error to caller * check return value of osmo_gsup_encode() in GSUP test * return errors instead of braking app with aseert Change-Id: Idaa1deecb6d9e15329bd51867b4f6a03357461f0 Related: OS#2864
2018-02-03gsm48_hdr_msg_type(): SS is in the same group as MM/CCHarald Welte1-1/+1
Change-Id: I1ddadeacced9650885f454b81f3f0df531ea1e5d
2018-02-03gsm48_hdr_msg_type[_r99]: Fix bit-masksHarald Welte1-2/+2
TS 24.007 is quite clear: The upper two bits of the message type octet are *not* part of the message type in any of the L3 protocols which implement sequence numbers. it doesn't matter if it's R98 or R99, or whether the sequence number is 1bit or 2bits wide. Related: OS#2908 Change-Id: Iec875a77f5458322dfbef174f5abfc0e8c09d464
2018-01-27gsm_04_08.h: Reduce T310 default to 30s.Harald Welte1-1/+1
3GPP doesn't specify a network-side T310 default, but waiting for 180s (3 minutes!) for the next message after CALL CONFIRMED is clearly way too long and will just use radio resources for no good reason. Change-Id: Ia52f9358bc86b23c72af9c80e2fff5cb0004b57a Related: OS#2884
2018-01-27gsm_04_08.h: Clearly annotate timers that don't have a 3GPP Default valueHarald Welte1-7/+7
Change-Id: I44fffaec1f7c0d819aa2ebc85e97f19581fc689c
2018-01-24SMS: Add value_string for TS 04.11 CP and RP stateHarald Welte2-0/+11
Change-Id: I1b2f6fc6f455b0ba2a5732c567a4867bca97c3b0