Commit Graph

26 Commits

Author SHA1 Message Date
Harald Welte e324507676 OCTOI: initial support for E1oIP forwarding
This introduces initial support for operation as OCTOI (Osmocom
Community TDMoIP) server and client operation.

Various features are still absent (user authentication, support for
re-ordered packets), but this version is already able to provide
services to clients with dynamic IP addresses as well as servers.

The bulk of the OCTOI / E1oIP code is implemented as a shared library,
to facilitate the development of other servers and clients in the
future, and also to minimize the impact on the existing osmo-e1d code
base.

More information is available at https://osmocom.org/projects/octoi/wiki

Change-Id: I05f5ff697ca8f7dccdcf89660f12089babfcc92e
2022-03-28 12:26:09 +02:00
Harald Welte 42c443f42d e1d.h: add #pragma once
all other header files already have it in place.

Change-Id: Ia7a7856563c2c9d422b73fdc431e0ea4d456f9aa
2022-03-28 12:13:08 +02:00
Harald Welte f5362e9217 Allow configuration of interfaces/lines via VTY
So far, osmo-e1d automatically opened all compatible icE1usb devices
and all E1 lines on those interfaces.  Let's allow for 'interface' and
'line' configuration in the VTY.  USB devices can be identified by
their serial number string.

If a given device (== E1 interface)  has a VTY configuration, then only
those E1 lines with VTY configuration opened.

For each Line (icE1usb or vpair), the mode (channelized/superchannel)
can also be set via VTY.

Change-Id: I89b57b688b68901f87d9683ab9294772ee747d77
Closes: OS#5400
2022-02-01 17:17:31 +00:00
Harald Welte ef69fd1a63 e1_{intf,line}_new: Allow caller to specify the numeric identifier
This will be used by the upcoming VTY interface changes.

Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df
2022-01-31 19:51:14 +01:00
Sylvain Munaut 3729f8f90e mux_demux: In RAW mode, fill with dummy until first TX
Until the remote side sends the first byte, we send fill
data since it can take it some time after the mode change
and the file descriptor is open for data to show up.

Previously due to a bug, the warning about short read was
not printed, but now that it's fixed, you get a bunch of
fairly "useless" warning at the beginning of the timeslot.

This fixes that since reported data by _e1_tx_raw is "faked"
until the pipe is active. (Fill data is actually added upstream)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iaa6268e9b4a7bce5ea3027a29c48c147499373be
2022-01-09 15:09:11 +01:00
Harald Welte 8ddb22f8c6 e1d: Add watchdog timer to detect dead lines / USB devices
We just found a bug in icE1usb (likely firmware) which was hard to find
as there was zero notification from osmo-e1d that it actually never
received any data from the icE1usb hardware/firmware anymore.

Change-Id: Id22e4110b9067f50b1818eb12295b2d4eb9cdc12
2021-12-31 17:20:32 +01:00
Harald Welte 50b121cfc4 Introduce a #define for the maximum HDLC buffer size (264)
The purpose of turning the magic number into a #define is to allow
clients to use it.

Change-Id: I9281a4cd85d79823d06860ffaaa09b6d67bc0de3
2021-12-31 16:47:12 +01:00
Pau Espin 6a3a2aa9a7 Use new stat item/ctr getter APIs
Change-Id: Ib1bf9a6e5d2743522f888e7ef4815283b82ef809
2021-06-04 18:05:25 +02:00
Harald Welte 1e30f0dab7 Add new "osmo-e1gen" program.
osmo-e1gen is a program that re-uses large parts of osmo-e1d, but whose
main purpose is to generate a variety of error conditions in order to
test a remote E1 implementation.

Instead of using the automatisms of the icE1usb transmit IP core, it
switches it to transparent mode and uses a host-software based E1 framer
"osmo_e1f", over which we have more control than the firmware.

Change-Id: I53a86d6730eb76a9cff9eb3f4786139015c91230
2021-01-05 23:46:05 +01:00
Harald Welte 31ac0bea55 Evaluate received E and A bits in TS0
Related: OS#4917
Change-Id: I7e1c919518b3418e973b7ae5bedd5a6dd1c2adec
2021-01-05 23:46:02 +01:00
Harald Welte 868c94b704 vty: export vty_e1d + move e1d_vty_node to header file
This will be required by osmo-e1gen

Change-Id: I5be0278bc07aadd154fc54a74b08fc7e3b5d6483
2020-12-20 11:46:19 +01:00
Harald Welte e07bbb5037 Move e1d_find_intf + e1_intf_find_line to intf_line.c
Those are generic helper functions not really related to the ctl
interface.

Change-Id: Ibbda172aa425ca1e4702bacc7e595cd73a52929d
2020-12-20 11:46:19 +01:00
Harald Welte 8f3064a2c8 Add per-line rate counter group to count various errors
Change-Id: I766b717843d7cd8ac00d4ce18c38773ac50ec3e6
2020-12-20 11:45:44 +01:00
Harald Welte ba6336c675 vpair: fix writing config file with vpairs configured
prior to this patch, the configured vpair interfaces would not
be saved to the config file on 'write file'.

Change-Id: Iff6551318534a3717c374060082147f17b925a21
2020-12-19 18:27:37 +01:00
Harald Welte f99270acf7 implement buffering to chunks in E1->application direction
Existing applications (such as those written for DAHDI) expect to
be reading data in buffer/chunk sizes.  For example OsmoNITB: It
doesn't want to execute an expensive read/recv syscall to receive 11
bytes, if it needs at least 160 bytes.

Change-Id: I807671bc6f2acaef740ce215b8d8abcb5dce2640
2020-07-22 09:40:41 +02:00
Harald Welte 77683c810d cosmetic: create HDLC specific sub-structure within e1_ts
This groups all HDLC-specific members together, in preparation
of adding more fields for other modes.

Change-Id: Ide0577c25836252862153b4f24da550bee013687
2020-07-20 22:37:10 +02:00
Harald Welte 17c80e1f55 actually implement the superchannel mode
In superchannel mode, all 31 TS are grouped together.

There is no way to enable it yet, see next patch.

Change-Id: Id340b1925471f427deb6cda7eb54e80dfc71faec
2020-07-14 14:40:10 +02:00
Harald Welte 6473bf0fe0 introduce concept of superchannel to data structures
We treat the superchannel as an extra, separate timeslot.  Initially
I thought of simply re-using TS1, but keeping the superchannel
separate ensures that it doesn't inherit any state (like half-sent
HDLC frames) from another timeslot when we switch between the modes
at runtime.

Change-Id: I0aacf251e155de2bb6ad03ffc4181067b22f1c90
2020-07-14 14:40:09 +02:00
Harald Welte 9fbd4e819e print E1DP Mode as string, not in numeric format
Change-Id: I4d221a45bdd5d85b3ab6eaa35d67683b50bea21f
2020-07-11 13:20:13 +02:00
Harald Welte 27b271729f Add virtual pair of E1 interfaces
The idea is to generate a pair of virtual E1 interfaces (each with
identical number of lines), where each line A:n is connected to line B:n
of the pair and vice-versa.

This allows to test E1 using applications back to back against each
other, without any physical E1 circuits in between.

Change-Id: If42c959556b17d543762546eb45dd69d25f715f2
2020-06-29 23:10:33 +02:00
Harald Welte 0f41cb0e06 add e1_line_destroy() / e1_intf_destroy() functions
Change-Id: I5425d22288d7239063d621bddfe81e9cf21f1a5b
2020-06-29 22:12:42 +02:00
Harald Welte 65b22c0b75 Export _e1d_ts_stop() function inside daemon
Change-Id: If3ceca05d4fdf1e33d926061f30fce6bfa8e0357
2020-06-29 22:12:42 +02:00
Harald Welte 9bedf75f2b introduce notion of 'driver'
Change-Id: Ic168e25f2622b397bac2c133ec35f4a0a38f859b
2020-06-29 22:12:42 +02:00
Harald Welte 9144ba0373 VTY interface support
Let's add a VTY interface on TCP port 4269.  The purpose is - for now -
not for configuration storage, but for state introspection.

Change-Id: I47b6e4efaad52e68e2b50a7993076f3706f86628
2020-06-29 22:12:42 +02:00
Harald Welte 7f08470706 remove code not specific to USB from usb.c to intf_line.c
Change-Id: I7d4d4ab39cb3e7e6a7eb8e738a367122eb3fbee2
2020-06-29 17:19:13 +02:00
Sylvain Munaut cf189940be Initial code import
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-05-11 22:31:12 +02:00