Commit Graph

49 Commits

Author SHA1 Message Date
Harald Welte c0f0007292 import oap message parsing / encoding from openbsc.git; AGPL->GPL
In the process, also:
* Change the license from AGPLv3 to GPLv2-or-later;
* correct spelling of 'sysmocom' to lowercase;
* add '2016' to the copyright;
* rename to osmo_*;
* add API docs;
* add logging category DLOAP: define id and add to internal_cat;
* redirect all oap.c logging to DLOAP.

A unit test will follow in a subsequent patch, since it needs a minor tweak for
decoding of boolean values.

The related openbsc change-id is I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf.

Tweaked-by: Neels Hofmeyr
Change-Id: If5099e60681a215e798b6675f21813f26769c253
2016-12-11 03:42:58 +01:00
Neels Hofmeyr bc1d758299 gsm0480: add gsm0480_create_ussd_notify() and *_release_complete()
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
2016-12-01 15:54:35 +00:00
Philipp Maier 72e43f02c3 gsm0408: Completing GSM 04.08 RR message types
- Add missing message types to be up to date with the
  latest specification release (3GPP TS 04.18)

- Add value strings to translate RR message type identifiers
  into human readable strings. (see gsm48_rr_msg_name() in
  gsm48.h

Change-Id: I3ceb070bf4dc8f5a071a5d43c6aa2d4e84c2dec6
2016-10-27 13:36:42 +02:00
Vadim Yanitskiy a6b5216ab4 utils/conv_gen.py: add EDGE MCS 1-9 definitions
Change-Id: Ie1452342f524a8b60f2babc07398a1d9c9e06aa3
2016-10-23 07:38:16 +00:00
Vadim Yanitskiy f3d38c4937 utils/conv_gen.py: add RACH, SCH and TCH/AHS definitions
Change-Id: I0ea7151f4e8119a8798a9e129b951559e56b0d93
2016-10-23 07:38:15 +00:00
Neels Hofmeyr 0318f6b6ca IuPS: add GMM Service Request related constants and value_str
Change-Id: Ie023fc78099932f95cc8f1b3a04fe25dfd14bc35
2016-08-29 13:56:17 +02:00
Tom Tsou 9a5bbf36b5 egprs: Add CPS tables from TS 04.60
Includes EGPRS coding and puncturing scheme (CPS) tables from 3GPP
TS 04.60. Currently osmo-bts-trx is the only user of CPS table
values, but this may change with gprsdecode and other utilities.

Change-Id: I09fe6514a0e2e51bb3206f8387633f7e0255345f
2016-07-25 18:33:26 +00:00
Neels Hofmeyr 47390764dd rsl: add rsl_act_type_name()
Change-Id: Ie90c76d8aef42d5e2c9be94f4b206d4994e305f8
2016-07-23 15:32:55 +02:00
Max f5f773f013 Add strings with GPRS GMM messages
Change-Id: I48477b733e2da72f59349c00554dd3e080c9f445
Related: OS#1582
2016-07-08 15:08:17 +00:00
Max fdca25dfb8 Add function to check GMM encryptability
Check if particular GMM message can be encrypted according to 3GPP TS
24.008 § 4.7.1.2

Related: OS#1582
Change-Id: I7ad0e03c2c738d174dd6bc3453f332eeb8da1e7d
2016-07-07 12:55:46 +00:00
Max 92ce39f3d1 Add missing osmo_c4 export
Change-Id: Iaf53b31b4fa3860301054e970907ada061360b28
Related: OS#1741
2016-07-07 13:00:43 +02:00
Max a337b9c37a Add function to check MS GEA capabilities
Add function which parses MS network capability IE value for bits
indicating support for particular version of GEA.

Change-Id: I785cef37dd272a2fab9b172f6e1392f865174e9a
Relates: OS#1582
2016-06-29 16:33:25 +00:00
Max b897c42993 Add strings for GPRS ciphers
Change-Id: I050bda5fb50aad42fe2d72de39f8256b4fb12fb2
Related: OS#1582
2016-06-29 16:32:27 +00:00
Neels Hofmeyr 0167e3f355 add rsl_or_ipac_msg_name() for both standard and ip.access msg types
Context: in osmo-bts, I want to look up an RSL message name in rsl_msgt_names
and fall back to rsl_ipac_msgt_names if not found, because the IPAC PDCH ACT
and DEACT messages are sent in a standard ABIS_RSL_MDISC_DED_CHAN.

Change-Id: Ic9ba721a1469cf51aed97ab0f44a7fe055c94b1f
Reviewed-on: https://gerrit.osmocom.org/231
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-06-13 17:46:48 +00:00
Max adef12a349 Add strings with PH primitive names
It's useful debugging helper while troubleshooting L1-related issues.

Change-Id: Id7a6d478fd725c51f54ad746bdf9b9095579ff77
Reviewed-on: https://gerrit.osmocom.org/117
Tested-by: Jenkins Builder
Reviewed-by: Max <msuraev@sysmocom.de>
Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-30 21:21:20 +00:00
Max 764b022fc6 Add function to make Uplink Measurement
It assembles RSL Uplink Measurement IE according to 3GPP TS 08.58
§9.3.25. The function is based on lchan_build_rsl_ul_meas() from OsmoBTS
but optionally includes DTX information.

Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e
Reviewed-on: https://gerrit.osmocom.org/44
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-17 16:10:31 +00:00
Max fe65fa7e36 Set DTX in Cell Options
* rename field of struct gsm48_cell_options to better match the spec
* add comments with spec references
* add function for setting DTX in cell options struct
* add necessary enum type

Change-Id: I5a8924f57669c951b2e51b663d95f1d360062a54
Reviewed-on: https://gerrit.osmocom.org/39
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Jenkins Builder
2016-05-12 15:56:39 +00:00
Harald Welte 3b6fb0880c import gprs_gsup_message.[ch] from openbsc as gsup.[ch]
Move those routines from OpenBSC to libosmogsm, so they can be
re-used from other programs.  I think it was a mistake to add them only
inside the openbsc repository in the first place.  We need to pay more
attention to this in the future.
2016-05-06 11:21:06 +02:00
Harald Welte fbd02fa8cc tlv: Import osmo_shift_* and osmo_match_shift_* from openbsc
These routines have nothing to do with specifically the BSC, so import
them to the TLV parser we keep in libosmogsm.
2016-05-05 18:49:27 +02:00
Harald Welte 64f38c0410 import gsm_04_08_gprs.[ch] from openbsc.git
The definitions in this header file (and associated strings in the
c file) are generic about the GPRS Layer3 signalling protocols, and
thus should be part of the library.
2016-05-05 18:49:27 +02:00
Harald Welte cd9cb90f45 auth_core: Add osmo_auth_3g_from_2g() to compute CK+IK from Kc
This function performs the C5+C4 conversion to derive UMTS key
material from a 2G-only subscriber.
2016-05-05 18:48:05 +02:00
Harald Welte 84da22f964 Add code generator for convolutional codes
Add python utility to generate .c code with convolutional
encoder/decoder based on polynomial description of the code. If argument
given it'll be interpreted as intended output directory, otherwise
current working directory is used.

Codes for *CCH, CS2/3 and TCH/AFS are generated. Corresponding manual
implementations are removed from tests. This introduce build-time
dependency on python.

The main work for this patch was generously contributed by Sylvain
Munaut.

Fixes: OS#1629
2016-04-29 13:17:22 +02:00
Max 8a5346ba2f Add function for appending range1024 to bitvec
Add convenience function to append range1024 encoded data (see 3GPP TS
44.018 Annex J) to a given bitvec.
2016-04-23 16:37:05 +02:00
Max bf990bb8fd Update internal GPRS cipher API
Update internal API (for GPRS cipher implementors): make it compliant
with ETSI TS 155.22. External API left untouched.
2016-04-22 15:09:27 +02:00
Max fbb8bfa514 Add function to get osmo_earfcn bit size
This function returns the number of bits necessary to pack osmo_earfcn
into Repeated E-UTRAN Neighbour Cells IE (3GPP TS 44.018 Table
10.5.2.33b.1).
2016-04-16 13:41:56 +02:00
Max fb348eeff2 Export names for gsm_chan_t and gsm48_chan_mode
This can be used with get_value_string() to improve debugging output.
2016-03-30 21:50:44 +02:00
Max 03309b57e8 Add basic EARFCN support
Add structure representing group of EARFCNs with common priority,
threshold etc.
Add functions to populate this structure.
2016-03-17 14:07:19 +01:00
Neels Hofmeyr bdccc1b144 gsm48: factor out MCC+MNC BCD parsing for re-use in UMTS
For 3G, I need a BCD composer/parser similar to gsm48_generate_lai()/
gsm48_decode_lai(). Those functions also handle a trivial extra
member (lac) which I don't need in this way for 3G.

So create new functions to take on the MCC+MNC BCD handling and call those
from gsm48_generate_lai() and gsm48_decode_lai(). In this way, the 3G code
in openbsc can use only the BCD functionality without code duplication.
2016-03-15 14:30:41 +01:00
Jacob Erlbeck 8114294bf2 gsm: Add APN conversion functions
These functions are currently part of openbsc but also needed by
other projects.

The function have been renamed as follows:

  gprs_apn_to_str -> osmo_apn_to_str
  gprs_str_to_apn -> osmo_apn_from_str

Sponsored-by: On-Waves ehf
2016-01-15 14:46:19 +01:00
Harald Welte fad5752ab5 RSL: Add enum + TLV definitions for ip.access style embedded IEs 2015-12-13 21:57:29 +01:00
Harald Welte 1a8c4e05fb Introduce gsm48_mi_type_name() function 2015-08-18 19:32:33 +02:00
Jacob Erlbeck 7f31c90b80 ipa: Add libosmogsm.map entry for ipa_ccm_idtag_parse_off
Addresses:
  CCLD     utils/utils_test
  utils_test.o: In function `test_idtag_parsing':
  git/libosmocore/tests/utils/utils_test.c:64: undefined reference to `ipa_ccm_idtag_parse_off'

Sponsored-by: On-Waves ehf
2015-06-04 08:52:36 +02:00
Harald Welte 908085ccbc Add APN utility function to libosmogsm
The current functions are used to 'qualify' an APN from the
user-supplied APN name (name identifier) towards the fully-qualified
APN name which is used in the .grps DNS zone.
2015-05-25 11:12:16 +08:00
Tobias Engel 419684e30c Supplementary Services (de)activation, interrogation added
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.
2015-01-01 14:19:17 +01:00
Harald Welte 783d073a37 add gsm0341_test to generate SMSCB hex strings
Those hex strings can then be copy+pasted into the OSmoNITB VTY
2014-12-29 17:09:11 +01:00
Harald Welte e391996947 ipa: rename functions for consistency
As we are breaking builds by moving functions from libosmo-abis to
libosmocore anyway, we might as well give functions more appropriate
names.  ipaccess is a company, while IPA is the multiplex protocol, and
CCM is the protocol used for establishing identities on the IPA
multiplex.
2014-08-20 23:16:36 +02:00
Harald Welte 8d5180e003 abis_nm: add abis_nm_msg_disc_names[] value_string 2014-08-17 19:36:26 +02:00
Harald Welte 604d552e49 abis_nm: introduce abis_nm_{osmo,ipa}_magic[]
... used to be oml_{osmo,ipa}_magic in osmo-bts
2014-08-17 18:42:58 +02:00
Harald Welte 5b5650f3de Fix introducing osmocom speficic OML attributes
Rename NM_ATT_O_REDUCEPOWER to NM_ATT_OSMO_REDUCEPOWER, which
makes it more clear that this is an osmcoom specific attribute.

Also, we cannot simply overload 0x01 as an already defined OML
attribute.  The problem is quite simple: When we use abis_nm_att_tlvdef
during the TLV parse, 0x01 will match to NM_ATT_ABIS_CHANNEL,
which is defined as { TLV_TYPE_FIXED, 3 }.

So instead, we need to introduce a new abis_nm_osmo_att_tlvdef[],
which has to be patched into abis_nm_att_tlvdef[] by the means of
tlv_def_patch(), exactly how we do it for bs-11 and nanobts specific
attributes.

I'm using 0xfe for the attribute, as 0xfe doesn't overlap with the IPA
specific attribues (and we might want to combine/merge the 12.21 plus
IPA plus osmocom spefici attributes)
2014-05-19 11:25:46 +02:00
Daniel Willmann 55405fb40b lapdm: Make lapdm_datalink_for_sapi public
This API allows you to get the lapdm_datalink for a SAPI. It's needed in
the lapdm_test, so make it public.
2014-03-26 13:52:27 +01:00
Jacob Erlbeck 1d7f3b5eb2 sms: Added result buffer size parameter to 7bit conv funs
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.
2013-08-12 17:22:27 +02:00
Andreas Eversberg 9597555a36 Add special 7-bit encoding and decoding functions for USSD coding
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>
2013-08-08 14:27:13 +02:00
Holger Hans Peter Freyther 6bfa7445fc encoding: Provide an overload for the gsm_7bit_encode and a simple test
This is required for encoding the SMS header using the alpha numeric
rules.

Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-08-08 14:25:09 +02:00
Sylvain Munaut 5572031749 gsm: Add method to find ARFCN based on frequency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-11 23:44:41 +01:00
Harald Welte 2fe684755a TLV: add new "vTvLV" type for GAN
This new TLV type is specific to TS 44.318.  Contrary to the TvLV type
of TS 08.16/08.18, it has an inverted meaning of the extension (0x80)
bit:
	* if the extension bit is not set, 1-byte length
	* if the extension bit is set, 2-byte length

Futhermore, it has support for variable-length tags, where the tag part
can be optionally two bytes in length.  As this esoteric option hasn't
been seen in the wild yet, we only add encoding support but skip
decoding for now.
2012-07-14 01:50:33 +02:00
Harald Welte e866473f2a add gsm48_decode_lai() to map file 2012-07-13 21:48:35 +02:00
Harald Welte c17f570538 ganc: add value_strings for GAN message type and protocol discriminator 2012-06-24 21:52:07 +02:00
Harald Welte df90aedcc7 libosmogsm: Add tvlv_att_def to exported symbols 2012-04-05 01:42:00 +02:00
Harald Welte 1c72bfb2cb libosmogsm: Introduce explicit list of exported symbols
There is now a "libosmogsm.map" file containing an explicit list of
to-be-exported symbols.  This should prevent us from leaking non-static
symbols into the global namespace.

A similar scheme should be adopted by all other osmocom libraries
2012-04-04 22:43:25 +02:00