Commit Graph

51 Commits

Author SHA1 Message Date
Max 5207432780 LCLS: add gsm0808_create_ass2()
It allows setting additional assignment parameters explicitly.

Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba
Related: OS#2487
2018-12-14 13:15:39 +00:00
Philipp Maier 4f4905fac5 gsm0808: add encoder for cause codes and use it
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
2018-12-08 19:29:34 +00:00
Philipp Maier 225bdf4779 gsm0808: add message generator for BSSMAP HANDOVER PERFORMED
We currently have no generator function that can generate BSSMAP
HANDOVER PERFORMED messages. Lets add function for this.

Change-Id: I825106858bd89afc9837811b8fed2e8accc82441
Related: OS#3645
2018-12-03 13:54:31 +00:00
Max f69aa9cb6a Move BSSMAP_MSG_* defines to header file
This will be reused be several tests related to TS 48.008 and TS 29.205
in follow-up commits.

Change-Id: I4d8cc05b8df8e70c1f6257e53ae3acec7901681f
2018-11-30 17:45:57 +01:00
Max 49c06680e7 Update gsm0808_create_ass() doxygen
* 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
2018-11-22 12:54:52 +00:00
Max ed651d2485 Support cipher mode reject with extended cause
* 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
2018-11-19 05:52:28 +00:00
Max 961db7c270 Update GSM0808_LCLS enums
Add values indicating that LCLS control/config/status value has not been
received yet.

Change-Id: I52dc6a52f5ee043ed2c1625ffecfd495e3c746b1
Related: OS#2487
2018-11-18 20:20:48 +00:00
Max aa93463053 Update 3GPP TS 08.08 Cause handling
* 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
2018-11-18 20:14:06 +00:00
Max 2b4a67a412 Update cipher reject function
* add note about (yet) unsupported standard feature
* use enum constant instead of hex value

Change-Id: I5cc5fc1ae8d5474dbc8d3385a493adf6420a3c98
Related: OS#3187
2018-11-02 16:12:03 +01:00
Philipp Maier 1a146c89e2 gsm0808: cosmetic: rename parameter "reason" to "cause"
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
2018-10-30 09:36:49 +01:00
Philipp Maier b254daf64f gsm0808: fix doxygen apidoc
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
2018-10-30 09:34:57 +01:00
Neels Hofmeyr 2c79d55934 gsm0808: implement BSSMAP Classmark Request
Related: OS#3043
Change-Id: I4a2e1d3923e33912579c4180aa1ff8e8f5abb7e7
2018-09-13 14:27:26 +00:00
Stefan Sperling 3953f41bbd properly handle mandatory cli param of gsm0808_create_paging2
The cell identifier list parameter is mandatory. Document it as
such, and tweak code which treated it like an optional parameter.

No functional change. The existing code already asserts that
a non-NULL value is passed for this parameter.

Change-Id: I3716f9d5b210e0a7e6f45c9fe3fc34024e5234ad
Related: OS#3021
2018-08-29 07:38:11 +00:00
Neels Hofmeyr 43c266f6c6 gsm0808: inter-bsc HO messages: add missing BSSMAP header, x4
Change-Id: I9e128ba775227de5e4010f024338a78584f777ea
2018-08-28 19:41:06 +00:00
Pau Espin f2cda621c0 gsm0808: Add value_string for encryption algorithms
Change-Id: Iadf6460c438d02c53c2eaa9e42d51844ad28859a
2018-07-12 20:58:23 +02:00
Philipp Maier cdd05816da gsm_08_08: gsm0808_permitted_speech does not have value strings
enum gsm0808_permitted_speech does not have any value strings. Lets
add value strings to make debugging easier.

Change-Id: I5b5612a5df2758b0137a34c17f7c8c2b3f07c806
2018-07-12 18:18:39 +00:00
Neels Hofmeyr 60f3153125 add and tweak inter-BSC HO API
Add:
gsm0808_create_handover_detect()
gsm0808_create_handover_complete()
gsm0808_create_handover_failure()

To existing structs gsm0808_old_bss_to_new_bss_info and
gsm0808_handover_required, add a final 'more_items' flag that makes future
extensions API and ABI compatible.

Fix the msgb string for Handover Request Ack.

Extend some API doc comments.

Related: OS#2283 (inter-BSC Handover, BSC side, MT)
Change-Id: I03ee7ce840ecfa0b6a33358e7385528aabd4873f
2018-06-18 17:32:58 +00:00
Harald Welte ebd362dbd2 gsm0808: Add value_string for LCLS related IEs
Change-Id: I18d7a29496929c761aeaba9c0aee847befc13108
2018-06-02 14:44:09 +02:00
Harald Welte 64e807c4bc gsm0808: Add encoding functions for LCLS BSSMAP messages
Change-Id: Ib83143e467df068b7d462a8e51d94b9d961ce18f
2018-05-30 01:36:04 +02:00
Neels Hofmeyr b662b36da0 add gsm0808_create_handover_request_ack()
Related: OS#2283 (inter-BSC Handover, BSC side, MT)
Change-Id: I692292a06c7d66004404560dc4ed933ca9107f9b
2018-05-27 22:04:17 +02:00
Neels Hofmeyr 70aba3ffe2 add support for gsm0808 HANDOVER REQUIRED message
Related: OS#2283 (inter-BSC Handover, BSC side, MO)
Change-Id: Idb6dc3eab0282158a17091d97ed77c1e2e3eb3c2
2018-05-27 22:04:17 +02:00
Thorsten Alteholz 0062a5fbbf fix spelling
Change-Id: I3ac92217f83279d5f987ab34eb18b2e6cb1c7812
2018-05-15 20:57:56 +00:00
Neels Hofmeyr 4eeb808c43 avoid warning in gsm0808_create_layer3
Change-Id: Ie098af4fc9640240196eda10fd61edcb3a872455
2018-04-10 13:06:15 +02:00
Philipp Maier dbb7659208 gsm0808: Add value strings for BSSMAP cause codes
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-29 15:00:41 +02:00
Stefan Sperling 11a4d9dd91 support for more cell ID list types in libosmocore
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-13 14:28:15 +01:00
Neels Hofmeyr c4fce1425e implement support for 3-digit MNC with leading zeros
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-28 19:26:33 +01:00
Neels Hofmeyr ffad574a4b gsm: add gsm0808_speech_codec_type_names
Used for logging Speech Codec List entries in osmo-bsc, during handover
decision.

Change-Id: Ie6418d16db333188e9bcd2b32b7216f277ae8832
2018-01-12 05:34:05 +01:00
Harald Welte 62e40855c2 gsm0808_create_cipher_reject: Fix encoding of Cause IE
The Cause IE in the 08.08 CIPHER MODE REJECT is a normal TLV IE,
and not just a value.  Let's make sure we encode the cause value
properly.

Change-Id: I4f5b231edf6dcb0a9c2bbafb2a59f301f3b2402b
Closes: OS#2766
2017-12-17 20:51:48 +01:00
Harald Welte e08da97570 Fix/Update copyright notices; Add SPDX annotation
Let's fix some erroneous/accidential references to wrong license,
update copyright information where applicable and introduce a
SPDX-License-Identifier to all files.

Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-11-13 01:35:12 +09:00
Harald Welte 37b6165513 [doc] Properly define gsm0800 group and move all related files into it
Change-Id: I91920c69c86d6a1932172becacb76faff2d3eb1e
2017-10-17 07:53:02 +02:00
Neels Hofmeyr 17518fe393 doxygen: unify use of \file across the board
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
2017-06-23 00:18:23 +00:00
Neels Hofmeyr 87e4550585 doxygen: enable AUTOBRIEF, drop \brief
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
2017-06-23 00:18:22 +00:00
Harald Welte 96e2a00d7a update/extend doxygen documentation
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
2017-06-12 21:55:54 +00:00
Harald Welte 95871dadbd use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocore
This gets us one step closer to fixing the embedded build

Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
2017-05-15 13:42:03 +02:00
Philipp Maier c6144a2448 gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST
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
2017-04-08 07:44:47 +00:00
Philipp Maier 3d48ec06a9 gsm0808: Add create functions for BSS_MAP_MSG_PAGING
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
2017-04-08 07:44:46 +00:00
Philipp Maier b478dd38d2 gsm0808: Add create functions for CIPHER MODE COMMAND
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
2017-04-08 07:44:46 +00:00
Philipp Maier fa896abbb3 gsm0808: Add AoIP specific elements to gsm0808_create_... functions
the classic A implementation in libosmocore lacks support for AoIP
message elements. This patch adds support for AoIP by adding a set
of new gsm0808_create_..., which support the missing AoIP message
elements

Change-Id: I77f866abec1822d19871052f3c647ad782785b34
2017-04-08 07:44:45 +00:00
Neels Hofmeyr 90fdb08e3e fix: gsm0808.c: unterminated value_string array gsm0808_bssap_names
Change-Id: Ie38bae32372dc41e1902a8f6f0bc550ae515cfb8
2017-03-02 01:48:10 +00:00
Holger Hans Peter Freyther ca8dcb7bff gsm0808: Remove duplicate initialization
These types were compatible so simply remove one.

Fixes:
gsm0808.c:323:37: warning: initializer overrides prior initialization  CC       gsm0480.lo
 of this subobject
        CC       abis_nm.lo
[-Winitializer-overrides]
                [GSM0808_IE_LSA_INFORMATION]            = { TLV_TYPE_TLV },
                                                            ^~~~~~~~~~~~
gsm0808.c:316:36: note: previous initialization is here
                [GSM0808_IE_LSA_INFORMATION]    = { TLV_TYPE_TLV },
                                                    ^~~~~~~~~~~~
2015-03-18 21:54:37 +01:00
Holger Hans Peter Freyther 715e945055 gsm0808: Fix copy and paste pointed out by clang
The element following the identifier list was the
GSM0808_IE_LSA_INFORMATION. It is a TLV type as well
and the issue got introduced in
92107dfd3b.

Fixes:
gsm0808.c:316:40: warning: initializer overrides prior initialization of this subobject
      [-Winitializer-overrides]
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
                                                            ^~~~~~~~~~~~
gsm0808.c:315:40: note: previous initialization is here
                [GSM0808_IE_LSA_IDENTIFIER_LIST]        = { TLV_TYPE_TLV },
2014-08-21 14:19:37 +02:00
Harald Welte 92107dfd3b update TS 08.08 header + TLV definitions to TS 48.008 / 11.7.0
This adds support for A-over-IP and LCLS related message/IEI
definitions.

Old definitions are in decimal, which is very hard (at least for me)
to compare with the binary tables in the spec.  Hex is much easier
to manually compare for completeness/correctness.  I didn't touch
the existing definitions, but think they should move to hex, too.
2014-06-21 23:16:20 +02:00
Dmitri Soloviev 2909942a9f gsm0808.c: Add TLV definition for LAYER3_HEADER_INFORMATION
This is required for osmo-bsc to parse Alcatel S-12 CIPHER MODE COMMAND
in osmo-bsc.
2013-07-11 09:25:37 +02:00
Harald Welte a62fe31d69 introduce gsm0808_create_reset_ack() 2013-06-29 10:53:33 +02:00
Harald Welte 07b625dd2c GSM 08.08: change gsm0808_create_classmark_update() prototype
The caller explicitly specifies CM2 and CM3, rather than one blob
containing both.
2012-01-26 22:42:16 +01:00
Harald Welte 65c2d36005 GSM 08.08: Cleanup the code, remove lots of magic hard-coded numbers
Rather than manually hard-coding numbers and using byte-arrays, we use
the msgb_*_{push,put}() function family of libosmocore/libosmogsm.

This is currently untested.
2012-01-26 22:42:15 +01:00
Harald Welte f4d45ab021 gsm 08.08: use ANSI function definition with (void) 2011-07-16 12:13:00 +02:00
Harald Welte 0c83670a59 GSM 08.08: Fix generation of CIPHER MODE REJECT
The message has a total length of 4 octets, so don't allocate only 3 in the
msgb.
2011-07-12 00:02:27 +02:00
Harald Welte 9b837e6fda gsm 08.08: add value_strings and gsm0808_msg_name() function 2011-07-11 17:45:31 +02:00
Pablo Neira Ayuso 8341934844 include: reorganize headers file to include/osmocom/[gsm|core]
This patch moves all GSM-specific definitions to include/osmocom/gsm.
Moreover, the headers in include/osmocore/ have been moved to
include/osmocom/core.

This has been proposed by Harald Welte and Sylvain Munaunt.

Tested with `make distcheck'.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:09:28 +01:00