Commit Graph

17 Commits

Author SHA1 Message Date
Harald Welte 910c502bf6 ctl: properly set the timeslot mode in E1DP_CMD_TS_QUERY
Change-Id: Ie7bfec19e37f748d44f4a90d296ea232bbd76b12
2021-05-10 22:00:46 +02: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 9e137aff1d make sure a given timeslot can only be opened once (by default)
Align the behavior of osmo-e1d with that of DAHDI:  If a timeslot is
opened once, it cannot be opened again by anyone until it is closed
by the current owner.  This way we'd have the same failure semantics
in DAHDI vs. osmo-e1d, which is very useful in case of misconfiguration
when osmo-bsc + osmo-mgw would "fight" over a timeslot.

Add a osmo_e1dp_client_ts_open_force() function that allows to override
and get back the original behavior.

Closes: OS#4654
Change-Id: Ib25adf827ec41e74de15e0e4fdcfc9bcc9a32e58
2020-09-20 11:55:14 +02:00
Harald Welte d5ea3eb9c1 src/ctl.c: Log NOTICE messages whenever client send unexpected requests
Change-Id: Icd47de13ab84b89ce5fb21c24713bae760611d32
2020-09-11 12:56:18 +02:00
Harald Welte 569726a72f make RAW read buffer size configurable (instead of hard-coded 160)
When opening a timeslot, the client can now specify the (from
application perspective) timeslot read buffer size.  This breaks
ABI, but then we're still at a point where only prototype hardware
exists, so we can get away with it.

Change-Id: I6d603778cce14c5d72fe5f54904905ea7e66d7ff
2020-07-22 09:42:56 +02: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 5d5e47ff3b Add new E1DP_CMD_LINE_CONFIG for switching channelized/superchannel
This adds the related code to the server and client side of the CTL
interface to switch a line between CHANNELIZED and SUPERCHANNEL.

Change-Id: I765b5c3bc9e07b2353f8647e8260ff95df3727e6
2020-07-15 10:26:15 +00: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 73f248fd74 Use SOCK_STREAM sockets for E1_TS_MODE_RAW
SEQPACKET is great for preserving message boundaries on signaling
channels that use HDLC.  However, its semantics, particularly regarding
truncation, are sub-optimal for RAW slots containing raw user
bitstreams (typically TRAU frames or PCM audio data).

So let's use SOCK_STREAM for RAW and keep SEQPACKET for HDLCFCS.

Closes: OS#4663
Change-Id: I1767ceaa5d2a008db0009b8027667a71c0fdc0f1
2020-07-11 13:21:14 +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 bbd39359eb extend logging (log more noteworthy events)
Let's log some more events that might happen.

Change-Id: I37fd290f0f0621fbf6e20e33fa709efc14df94c7
2020-06-29 23:10:31 +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 8a9392ff44 ctl.c: Fix off-by-one: FD=0 is a valid file descriptor
It is possible that fd=0 (stdin) is closed in a daemon scenario, and
subsequently fd=0 is reused for other files/sockets.

Change-Id: Id8279f04373e891009224bab34a4d1d886520fea
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
Sylvain Munaut cf189940be Initial code import
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-05-11 22:31:12 +02:00