Commit Graph

19 Commits

Author SHA1 Message Date
Vadim Yanitskiy 0042b254ff isdn/v110_ta: avoid redundant .status_update_cb() calls
Let's be smarter and call the status update callback iff the V.24
flagmask was actually changed.

Change-Id: I9626d3e737d4e072fa163115c4cdf9ee6ee0968e
Related: OS#4396
2024-01-25 09:09:24 +00:00
Vadim Yanitskiy 06922fad6c isdn: add a lookup table with E1/E2/E3 bits from Table 5/V.110
Let's make those E1/E2/E3 bit combinations publicly available in
form of a lookup table (key is enum osmo_v100_sync_ra1_rate).
Add convenience macros for setting and comparing these bits.
This lookup table will be used by osmocom-bb.git.

Change-Id: I6d2f8e250df31c233a2741163113dc07515409ae
Related: OS#4396
2024-01-16 20:04:00 +07:00
Vadim Yanitskiy 85554db38d isdn: initial implementation of the V.110 TA
ITU-T recommendation V.110 defines Terminal Adaptor (TA) functions
for the connection of Terminal Equipment (TE) having standard V-series
interfaces to the ISDN.  This patch brings "software" implementation
of the TA to libosmoisdn.

The primary user for this soft-TA is the mobile-side implementation
of CSD (Circuit Switched Data) in osmocom-bb.  CSD is heavily based
on V.110, which is not surprising given that GSM is a "wireless ISDN".
Nevertheless, this code will likely also be useful in the context
of retro-networking.

Similarly to the existing V.110 code in libosmoisdn, the present
implementation aims to be functional and correct, rather than
efficient in any way.  It also has several limitations, which are
not critical for the CSD use case, but eventually may be a problem
for other use cases in the context of retro-networking.

Therefore, the V.110 TA API should be considered _unstable_,
and may be subject to change in the future.

  +-------+      +------+   B-channel   +------+      +-------+
  |  TE1  |------|  TA  |~~~~~~~~~~~~~~~|  TA  |------|  TE2  |
  +-------+      +------+               +------+      +-------+

TE (also known as DTE) is basically a computer, having a V-series
(usually RS-232) connection to TA (also known as DCE).  The TA acts
like a regular analog modem, except that it is not performing any
kind of modulation or demodulation itself.

The TE-TA interface is implemented by the user supplied callback
functions, configured during the allocation of a TA instance:

* .rx_cb() - receive call-back of the application,
* .tx_cb() - transmit call-back of the application,
* .status_update_cb() - status line update call-back.

In addition to that, the application (TE) can interact with the
V.24 status lines (circuits) using the following API:

* osmo_v110_ta_{get,set}_status(),
* osmo_v110_ta_{get,set}_circuit().

The Rx and Tx between TE and TA is always driven by the TA itself,
as a result of an interaction with the lower layer implementing
the B-channel interface.  There is currently no buffering and thus
no way for TE to initiate transmission or pull data on its own.

The TA-TA (B-channel) interface is implemented by the following
functions, which are meant to be called by the lower layer
transmitting and receiving V.110 frames over certain medium:

* osmo_v110_ta_frame_in() - indicate a received V.110 frame,
* osmo_v110_ta_frame_out() - pull a V.110 frame for transmission,
* osmo_v110_ta_[de]sync_ind() - indicate a synchronization event.

The lower layer is responsible for finding the synchronization
pattern (if needed), aligning to the frame boundaries, and doing
the V.110 frame coding.

The D-channel signalling is behind the scope of this module.

Initial (Work-in-Progress) implementation by Harald Welte,
completed and co-authored by Vadim Yanitskiy.

Change-Id: I5716bd6fd0201ee7a7a29e72f775972cd374082f
Related: OS#4396
2024-01-09 13:11:04 +00:00
Andreas Eversberg 6cc5301e4c LAPD: Indicate sequence error after indicating received data
First indicated the received data in an I frame, if possible. Then
indicate the sequence error using MDL-ERROR-INDICATION. This way the
data is delivered before the error is handled by BSC.

Also there is no reason to indicate sequence error on supervisory
frames.

See §8.7.4 of 3GPP TS 44.006.

Related: OS#5968
Change-Id: I535c18018bf0df4124a5e9618238028fa31be289
2023-11-27 16:25:53 +00:00
Andreas Eversberg bd2b897b72 LAPDm: Add a flag to enable suppression of subsequent REJ frame
This behaviour was default in earlier versions of LAPDm/LAPD. Because it
is only required for osmocom-bb, a flag is added to enable it there.

Related: OS#5969
Change-Id: I93994dbbd1fc2c9edb8f3015c6b18ecd0fce0565
2023-11-27 16:25:53 +00:00
Andreas Eversberg 49b7087360 LAPD: Add support for RTS based polling and T200
The T200 timer is started when the current frame is polled at
PH-READY-TO-SEND event.

A flag is used to enable this feature. The user of LAPD core must track
frame numbers to check the timeout condition. Then it must call the
external timeout function.

Related: OS#4074
Change-Id: Ib961b5a44911b99b0487641533301749c0286995
2023-11-27 16:25:53 +00:00
Andreas Eversberg 1bb0b99552 LAPD: Always update N(R) in pending TX frames if V(R) is incremented
The outcome of the update function is still used to indicate if an RR
frame must be sent or not. Only if there is no I frame in the TX queue,
RR frame must be sent.

Related: OS#4074
Change-Id: I71676c709878105bfd18b9370fecc61b92796a6f
2023-11-15 21:28:22 +00:00
Andreas Eversberg 913a783ff2 LAPD: Flush TX queue, if remote peer enters busy condition or rejects
In case of a busy condition or a reject (sequence error) from the remove
peer, the messages in the TX queue are obsolete and will be flushed.

Related: OS#4074
Change-Id: Iaaf9aaabb958ef889e252ddd0026ff82cfac981f
2023-11-15 21:28:22 +00:00
Andreas Eversberg cc63aae030 LAPD: Prepare lapd_send_i() for RTS support
When RTS is used, lapd_send_i() is called very frequently. (for every
PH-READY-TO-SEND primitive) The logging output can be suppressed in this
case.

As there is no complete lctx (lapd context) when calling lapd_send_i()
at RTS, take the stored lctx.

Related: OS#4074
Change-Id: I3109b7aa15c0f75f4a7458fc1c5d0ce633100f76
2023-11-15 21:28:22 +00:00
Andreas Eversberg 676b361fa7 LAPDm: Correctly count expiry of T200 during estabishment/release
After T200 expires N200+1 times, the link establishment or relase
fails. The counting must be performed prior check.

Related: OS#5970
Change-Id: Icf44e26420fc91312e7c8972a2f3ed475e42fc48
2023-10-23 09:07:28 +00:00
Pau Espin aca2c724ae Bump version: 1.8.0.252-13c29 → 1.9.0
Change-Id: I6f8eccbccb73c6c094f13f2d4bdee931cf5b9010
2023-09-12 13:15:54 +02:00
Vadim Yanitskiy 39469b9fcb isdn: mux_timeslot_provide_bits(): remove unused 'count'
Change-Id: Id2c6d05c56424fa79ade84a29b8b70293dc690e4
2023-07-28 04:58:07 +07:00
Vadim Yanitskiy 25127fb749 isdn: fix identical operands in v110_adapt_IR8000_to_2400()
Change-Id: I7df8b214e813cbd14726d5043f666547353e2947
Fixes: CID#310966
2023-03-17 17:08:23 +07:00
Harald Welte 065dab866e isdn: Add V.110 encoder/decoder
V.110 defines a B-channel protocol for transmission of synchronous and
asynchronous serial data of V-series interfaces via terminal adapters
over ISDN.

Let's add (unoptimized but easy to debug) functions for encoding and
decoding of V.110 frames for various bit-rates.

Related: OS#1572
Change-Id: I1b5fd3847d3bfb0a0f763e0574893962ec699680
2023-03-08 20:43:15 +01:00
Harald Welte c9527763c2 Makefile.am: Make libraries depend on .map files
Without this, an update to the .map file doesn't re-trigger a re-link of
the library.

Change-Id: If0ea6f41730a28b04562d45efa6ca376abaf3f6b
2023-03-06 17:07:48 +00:00
Vadim Yanitskiy 64277a0217 doxygen: fix various typos in commands \param and \returns
Change-Id: If87cec3739449c6a54e24fb2cb81e746d8244da2
2023-02-28 18:48:56 +00:00
Philipp Maier 54e1782e71 i460_mux: make osmo_i460_subchan_count public
There may be situations where we must check if there are still I.460
subchannels active, so lets make the function osmo_i460_subchan_count
public

Change-Id: I0454ffe5809f21504c1e263a781c06596d452d4b
Related: OS#5198
2023-02-18 08:38:00 +00:00
Philipp Maier 8930911c00 i460_mux.c fix apidoc
Change-Id: Ib701e3f8f4261087c2fd2719a52e4d785db11ddc
2023-02-16 16:39:37 +00:00
Harald Welte d55a209d1c create libosmoisdn sub-library
There are some parts of libosmogsm which are not really GSM specific,
but rather ISDN bits that were inherited by GSM.  This includes the
I.460 multiplex as well as the core LAPD protocol.

Let's move those bits to its own libosmoisdn library, before we add
more ISDN specific bits to the wrong place.

Backwards-compatibility is created by making libosmogsm depend on
libosmoisdn, and by providing wrapper include files for source
compatibility.

Change-Id: Ib1a6c762322fd5047be3188b1df22408ef06aa50
2023-01-21 22:41:57 +01:00