Commit Graph

279 Commits

Author SHA1 Message Date
Vadim Yanitskiy bb6df124d2 layer23: implement Rx/Tx API for GPRS related messages
Change-Id: I87950e893ef96ff8328f43f1548111aa9f66439b
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy b2dfbb8859 layer23/{mobile,modem}: fix segfault on VTY connection
It was a mistake to call vty_init(), passing it a pointer to the
vty_app_info structure allocated on the stack, because it gets
overwritten when the calling function _vty_init() returns.

Change-Id: I75843a964254243c70bedcf8ff97d854107ee21a
Fixes: 9feb5057 "layer23: refactor the application API concept"
2023-03-16 23:41:48 +00:00
Vadim Yanitskiy b29a26c620 modem: add test VTY command to send CHANNEL REQUEST
Do not call grr_tx_chan_req() unconditionally from grr_rx_bcch().
Add a special (hidden, expert mode) VTY command for that.

Change-Id: I049a8d7f58ae9703d06dff235973ba376702c873
Related: OS#5500
2023-03-16 13:46:53 +00:00
Pau Espin 1612c8f862 layer23: modem: Depend on libosmo-gprs-gmm
Related: OS#5501
Change-Id: I82a2b9c043eae42435ca781689fc3381e7a31bea
2023-03-15 15:38:54 +01:00
Vadim Yanitskiy 8240ef74fc modem: move GRR specific code into its own file
Change-Id: I25caa0bd01e3d090803512f5b13cad58439f44f8
Related: OS#5500
2023-03-14 15:06:26 +00:00
Vadim Yanitskiy 9feb5057da layer23: refactor the application API concept
With this set of changes we have a cleaner l23 app architecture:

* struct vty_app_info: all l23 applications must define this struct;
* struct vty_app_info: *cfg_supported() becomes a mask of L23_OPT_*;
* struct vty_app_info: explicitly set L23_OPT_* in all l23 apps;
* drop l23_app_info(), there can be only one vty_app_info per an app;

It's no more needed to obtain the vty_app_info by calling a function
and checking the returned value against NULL everywhere.  This kind
of information is rather static (not dynamically composed) and needs
not to be encapsulated into functions.

Change-Id: I89004cd5308927305f79b102f7b695709148df6d
2023-03-13 06:16:48 +07:00
Max 736438693e mobile: allow configuring local GSMTAP address
Change-Id: Ia1555db653cf0bb20af74617f33aad31c971bfdb
2023-03-08 17:47:04 +00:00
Oliver Smith 65957cf877 Run struct_endianness.py
Ensure there is no diff to prepare to run this in CI.

Related: OS#5884
Change-Id: I617c967c5f34c0be2cf6fd43ceb1af17897f2bf1
2023-02-20 11:18:43 +01:00
Pau Espin f1e99e59e2 layer23: Support configuring GSMTAP through VTY in l23 apps.
This allow all l23 apps supporting L23_OPT_VTY and L23_OPT_TAP to
dynamically configure gsmtap through a "gsmtap" VTY node:

gsmtap
 remote-host 127.0.0.1
 lchan sacch
 lchan lsacch
 lchan sacch/4
 lchan sacch/8
 lchan sacch/f
 lchan sacch/h
 lchan unknown
 lchan bcch
 lchan ccch
 lchan rach
 lchan agch
 lchan pch
 lchan sdcch
 lchan sdcch/4
 lchan sdcch/8
 lchan facch/f
 lchan facch/h
 lchan pacch
 lchan cbch
 lchan pdch
 lchan pttch
 lchan cbch
 lchan tch/f
 lchan tch/h
 category gprs dl-unknown
 category gprs dl-dummy
 category gprs dl-ctrl
 category gprs dl-data-gprs
 category gprs dl-data-egprs
 category gprs ul-unknown
 category gprs ul-dummy
 category gprs ul-ctrl
 category gprs ul-data-gprs
 category gprs ul-data-egprs

VTY cmd "lchan" enables/disables tapping on general channel types,
while "category" allows fine-grained selection of messages being
tapped within the enabled lchan which would tap those messages.

Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839
2023-02-02 18:18:21 +01:00
Pau Espin 738b65d240 layer23: Integreate mobile further into l23_app
Several functions and data structures in mobile app are refactored to
follow more closely the l23_app API and structures. These movements
allow starting to use already some shared infrastructure defined under
layer23/common.
This is not a full migration to l23_app, since mobile still keeps a
separate main() with a few extra code. This commit is rather a step
towards an eventual merge of mobile's main.cpp into
layer23/common/main.c

This is a preparation commit to later one adding gsmtap VTY configuration
to all l23 apps.

Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c
2023-01-31 11:59:08 +01:00
Pau Espin 60716bcfe6 modem: Initial integration of libosmo-gprs-rlcmac
This commit places code to forward unitdata LLC<->RLCMAC.

Depends: libosmo-gprs.git Change-Id I1870fa6a264612c5a669bfb832e6e8c0a892cb74
Related: OS#5500
Change-Id: I0e628d9ddaa5ad6a205f07746d4176d1b8df7eb0
2023-01-30 19:57:36 +00:00
Pau Espin 53996bb3d8 modem: Initial integration of libosmo-gprs-{llc,sndcp}
Change-Id: I820328009ccdd1f8112aeb163efa064ec1465d2a
2023-01-30 19:57:36 +00:00
Pau Espin 3da09d1f7e layer23: Initial integration of tun device
Use the new tundev API from libosmocore to create tun devices for each
configured (and enbled) APN.
No address nor routes are yet set on the tun devices because we still
lack GMM/SNDCP/LLC/RLCMAC layers to negotiate them.

A follow up patch will add some code to interact with the SNDCP layer.

Depends: libosmocore.git Change-Id I3463271666df1e85746fb7b06ec45a17024b8c53
Change-Id: I86cac406843157aa2e51727cf8ccac9804d7961d
2023-01-19 20:02:07 +01:00
Pau Espin 6327f40be6 layer23: Introduce APN VTY node
This commit adds an initial set of VTY commands to manage APN
configuration and set up, which is used by the modem app.

The sample modem.cfg file is updated to showcase how to configure APNs.
The app doesn't do anything with them yet. A follow up patch will add
code to create tun devices for each configured APN.

Change-Id: I7b4eaa0de428b418bb1d89bd544694e89beb3e6e
2023-01-19 19:12:09 +01:00
Pau Espin 50097dd4c0 layer23: Use shift operand to define bitmask values
Change-Id: I22e2f543c077a4df4623c5e3bd44f8f068596baf
2023-01-17 19:49:10 +01:00
Pau Espin 0621ff9cbd layer23: ms.h: Use enum type in ms->shutdown
Change-Id: I5456f7a8675e6ab620bc93b56e2c4ad22d3900e8
2023-01-17 18:16:34 +00:00
Pau Espin 3d3505b726 layer23: Let each app allocate its ms obj and start layer2 when needed
This allows apps to allocate the objects as they please: simple apps can
statically allocate it at startup. Others may want to allocate them
through VTY.
Some apps may also want to dynamically start and stop layer2.

Change-Id: I32f99df76a5513eff9df5489d28d60aedf96dec3
2023-01-17 18:16:34 +00:00
Pau Espin 8f59b1a0b9 layer23: Move layer2-socket VTY command to common/
This allows configuring layer2-socket for other apps than mobile, like
the "modem" one.

Change-Id: If7419f8fc54a54eed68a076968d93dba5ac977b7
2023-01-17 18:16:34 +00:00
Pau Espin 3b8d5bb26a layer23: Move '(no) shutdown' VTY code to common/vty.c
Change-Id: Ib5c9b6f3efa255d67980945db9f98dd8a112af0e
2023-01-17 18:16:34 +00:00
Pau Espin 0fe3f7d4e5 layer23: Move settings.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I0a741b2384195d512fdc49eda6762241f385b1f1
2023-01-16 13:34:31 +01:00
Pau Espin f15eeadb21 layer23: Move subscriber.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I3727e40bcc9a4ee93aaf2c4ced070cc789653e80
2023-01-16 13:34:31 +01:00
Pau Espin 2b03270b30 layer23: Move support.{c,h} under common/
Some of those can be reused by other apps (like modem).

Change-Id: I3c5af4db8e603aa004d0b6410b09b5143173b874
2023-01-16 13:34:31 +01:00
Pau Espin adb67e5106 layer23: Initial VTY framework to share VTY code between apps
A small layer23 framework is added which allows apps to easily share/reuse
VTY commands while giving some flexiblity to add new per-app
specific configs/cmds, since not all commands may be relevant for all
apps.

Some of the mobile app code is moved to common, and sample infra is
added to modem app.
Future commits will most probably keep moving more stuff mobile->common
and then reusing those in modem app, as found needed.

Change-Id: Iabfb3129199488d790b89884bc1e424f2aca696f
2023-01-16 13:34:28 +01:00
Pau Espin b54dbfcde9 mobile: settings.h: Add missing type forward declaration
Change-Id: Ibdfa905e2bd24f03d23ce114e969647b07a2009f
2023-01-16 10:31:01 +01:00
Pau Espin fb030a8897 layer23: Initialize osmocom_ms further in common code
Change-Id: Ic629cf229167ddd4c533a2abf1b82ad78d1144a9
2023-01-16 10:30:56 +01:00
Pau Espin 1953a21515 layer23: Move osmocom_ms to a separate file
This way we can extend its API and contents more easily,
and keep most of it together in one place.

Change-Id: Icb4891cc1e4a0ecb5f09cb8a84b0ebe1b91a46b8
2023-01-16 10:30:12 +01:00
Pau Espin ed9ae46f1d layer23: Add missing header dependencies to several files
Change-Id: I9819b12d1c24f6ee197daa887452b09418d689e8
2023-01-16 10:19:34 +01:00
Pau Espin cf2d8296bb cosmetic: layer23: Fix trailing whitespace
Change-Id: Ibc464923ac8add74b2b6d57d183fb307be650679
2023-01-16 10:19:34 +01:00
Pau Espin 463b3634ed layer23: misc/log.h: Fix missing pragma once
Change-Id: Ie57357224ba5ed2bf691e2912ede7ee19012b6dd
2023-01-16 10:19:34 +01:00
Pau Espin 1eb8614b9d layer23: common/sim.h: Fix missing pragma once
Change-Id: Icebe803c7896347915ed72b80d5504d15d717ef3
2023-01-16 10:19:34 +01:00
Pau Espin aef45d8008 cosmetic layer23/mobile/gsm322: Fix trailing whistespace
Change-Id: I32d28ac219d2a573a77a0041a774ca7427388fb0
2023-01-16 10:19:30 +01:00
Pau Espin 1412c49fed cosmetic: layer23/include/common/Makefile.am: Set one item per line
Change-Id: I2e385d403bd37ad9491fd421509fe7e4104225f9
2023-01-13 12:16:47 +01:00
Pau Espin 73abbc235e layer23: Add initial VTY support for l23_apps
Initial VTY "boilerplate" code for modem app is already added in
this commit as a showcase what's needed by an app to have the VTY
config file read and VTY interface initialized.

Change-Id: Ife3a3373e5a9c0c8e5959ac714e140e72d6c363a
2023-01-13 12:16:47 +01:00
Pau Espin 2b9191f08b layer23: Move extern declaration of l23_ctx to l23_app.h
This way all apps can access it.

Change-Id: I570d31cc4014b54b47b11a3a52791f62c999cad8
2023-01-13 12:16:47 +01:00
Pau Espin cd76fcc4ec layer23: Introduce l23_app_start() API step
This commit is a preparation towards having shared VTY infrastructure
for layer23 apps. Having 2 steps (first init(), then start()) allows
the apps easily struct allocation & initialization, and then start doing
work after VTY config has been read.

Change-Id: I1d232809764962f82fee86159bc61cdbc3eb3c48
2023-01-13 12:16:47 +01:00
Pau Espin 372f65d172 cosmetic: layer23: Drop unnecessary space before function pointer arguments
As requested by linter.

Change-Id: I87e1857722b9181d0187bdeabe3fa1f4e63463d0
2023-01-12 13:18:02 +00:00
Vadim Yanitskiy 413bcf8ef4 layer23/sysinfo: implement decoding of SI13 Rest Octets
Change-Id: Ia6ff7d4e37816c6321b54c1f7f8d7110e557f8c5
Related: SYS#5500
2023-01-07 01:42:28 +07:00
Vadim Yanitskiy 5d634b6118 gsmmap: move this utility to 'layer23/src/misc/'
What I find weird is that the gsmmap is using files from layer23,
and vice-versa cell_log from layer23 is using files from this
utility.  And somehow they are separate sub-projects.

I see no reason why gsmmap must be in its own sub-project.

Change-Id: I2bc9c8897f3c7ccf207be0146f7b55fc733a6abb
2023-01-03 02:43:57 +07:00
Vadim Yanitskiy 3432c6cfe0 layer23/sysinfo: update coding style, make pointers const
Change-Id: Ia518251eae1b45ad573d076d97cba83ed25ea9ea
Depends: libosmocore.git Ide9110b984d3302aec6b439c563eb10e2dcdec9e
2023-01-02 20:24:50 +07:00
Vadim Yanitskiy 12dd3af2a0 mobile: support RTP and TI specific TCH frame I/O formats
Change-Id: Ib41f8c39c82c243b62a76433f59a2b98e175f894
Related: OS#3400
2022-12-06 06:28:56 +07:00
Vadim Yanitskiy df7fa3e296 mobile: integrate GAPK based audio (voice) I/O support
This change introduces a new feature to the mobile application -
audio I/O support, which allows the user to speak right from the
host side running mobile through its ordinary mic and speakers.

The audio I/O is based on libosmogapk [1][2], which in its turn
uses the ALSA sound system for the playback and capture.  This
is a new optional dependency of mobile, which is automatically
picked up if available during the build configuration.  Whether
to depend on it or not can be controlled using '--with-gapk-io'.

The API offered by libosmogapk implies to use the processing chains,
which generally consist of a source block, several processing blocks,
and a sink block.  The mobile app implements the following chains:

  - 'pq_audio_source' (voice capture -> frame encoding),
  - 'pq_audio_sink' (frame decoding -> voice playback).

both taking/storing TCH frames from/to the following two buffers:

  - 'tch_fb_ul' - a buffer for to be played DL TCH frames,
  - 'tch_fb_dl' - a buffer for encoded UL TCH frames.

The buffers are served by a new function gapk_io_dequeue().

[1] https://gitea.osmocom.org/osmocom/gapk/
[1] https://osmocom.org/projects/gapk

Change-Id: Ib86b0746606c191573cc773f01172afbb52f33a9
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 100ec4ca6f mobile: rework gsm_recv_voice(), add AUDIO_IOH_MNCC_SOCK
Do not send voice frames to the external MNCC unconditionally.
Add a new I/O handler type for the external MNCC application.

Change-Id: I406b169963e6654110329d741728fa12c8c8eeec
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 290ea6b7fa mobile: add missing TCH MNCC messages and handle them
Change-Id: I28a1ae1ed504748c33c64c86ca7d57a94c7c7c6d
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 993d2ab501 mobile: split gsm_send_voice() -> gsm_send_voice_{msg,frame}()
This is needed to avoid sending voice frames to the L1PHY without
having to use MNCC specific struct gsm_data_frame.

Change-Id: I37241555cd648a8e2b57fa072c708f93cd1ba5a9
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy a3b86ad4dd mobile: voice.h: add missing forward declarations
Change-Id: I854abdcde5bc324f6d0cf309792b36fc64601070
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 7900ba1a13 mobile: voice.h: use '#pragma once' include guard
Change-Id: I024e13c0f66ae1e42b0c8e2ff77874fcb883e85a
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c1d3c01768 mobile: allow enabling/disabling handling of voice in the L1PHY
Some L1PHY targets (e.g. Calypso based Mot C1xx phones) have built in
microphone and speaker.  Some targets do not have them.  Currently we
unconditionally instruct the L1PHY to handle TCH frames internally.
Make this behavior configurable via the VTY interface.

Change-Id: I131f213ef7c2736f7310f0183b83f3bc3064cd98
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 8d875f3c3d mobile: add MNCC handler selection to settings
Since the mobile application is potentially able to maintain
multiple MS instances, it's better to have a possibility to
choose an MNCC (Call Control) handler per each MS separately.

This change removes the command-line option '-m', which was used
for enabling the external MNCC.  Now it's possible configure the
MNCC handler for each MS via the VTY interface and settings.

The following MNCC-handlers are available:

  - internal - built-in MNCC-handler (default);
  - external - external MNCC-handler via UNIX-socket (e.g. LCR);
  - dummy - dummy handler without CC support.

Change-Id: I2df91c7a79ba5c39bc6ceae900ef649129dd0346
Related: OS#3400
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy b76743df71 mobile: add MNCC socket path to settings
Previously the MNCC socket path was generated automatically,
using concatenation of the '/tmp/ms_mncc_' prefix and MS name.
Let's allow the user to specify this manually, keeping the same
naming generation method for default value.

Change-Id: I643356ac579bc5e765f668265ec803b22a73739c
Related: OS#3400
2022-11-27 06:12:38 +07:00
Pau Espin e9f24d734a host/layer23: Add modem app
This app will allow setting up a tun device to transmit/receive data
as a GPRS MS against a GSM network.

This is just the initial skeleton so that people can work on it further
in follow-up commits.

Related: OS#5503
Change-Id: I8a1121b3287da7d7330c30e3118affa8fd1da61b
2022-11-21 19:56:54 +01:00