aboutsummaryrefslogtreecommitdiffstats
path: root/src/ctl.c
AgeCommit message (Collapse)AuthorFilesLines
2023-07-18Check return code of fcntl() in several plaacesHarald Welte1-1/+12
Fixes: CID#307539, CID#307533 Change-Id: I46843174eb4699a59421dc3f3b900a3894c67081
2022-11-01ctl: Prevent clients from opening TS0Harald Welte1-1/+1
This doesn't work, as the mux_demux.c code doesn't pass the TS0 bitstream to users anyway. So let's reject clients attempting this. Change-Id: Idb2d20da7de72dad38ae2fccdd7630677d0f0cc8
2022-03-28OCTOI: initial support for E1oIP forwardingHarald Welte1-0/+3
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-01-09cosmetic: Adhere osmocom coding style in for-loopsHarald Welte1-1/+1
We either have to bring osmo-e1d in line with other osmocom projects, or we'd have to disable the linter in jenkins. Change-Id: I74ab20b22118d471dcdb60d1b9681ab62eb13d51
2022-01-09Fix a bunch of warning raised by the new build warning optionsSylvain Munaut1-4/+1
A lot of them are related to signedness or type range limitation. A lot are not actual issues and work find in practice, but a few lead to actual bad behavior. This makes all the conversion explicit to mark intent. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: I992b9bc51659e85966651b1146091501b8f149f5
2021-05-10ctl: properly set the timeslot mode in E1DP_CMD_TS_QUERYHarald Welte1-2/+16
Change-Id: Ie7bfec19e37f748d44f4a90d296ea232bbd76b12
2020-12-20Move e1d_find_intf + e1_intf_find_line to intf_line.cHarald Welte1-24/+0
Those are generic helper functions not really related to the ctl interface. Change-Id: Ibbda172aa425ca1e4702bacc7e595cd73a52929d
2020-09-20make sure a given timeslot can only be opened once (by default)Harald Welte1-2/+10
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-11src/ctl.c: Log NOTICE messages whenever client send unexpected requestsHarald Welte1-5/+16
Change-Id: Icd47de13ab84b89ce5fb21c24713bae760611d32
2020-07-22make RAW read buffer size configurable (instead of hard-coded 160)Harald Welte1-3/+6
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-22implement buffering to chunks in E1->application directionHarald Welte1-0/+15
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-20cosmetic: create HDLC specific sub-structure within e1_tsHarald Welte1-2/+2
This groups all HDLC-specific members together, in preparation of adding more fields for other modes. Change-Id: Ide0577c25836252862153b4f24da550bee013687
2020-07-15Add new E1DP_CMD_LINE_CONFIG for switching channelized/superchannelHarald Welte1-0/+64
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-14introduce concept of superchannel to data structuresHarald Welte1-1/+6
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-11Use SOCK_STREAM sockets for E1_TS_MODE_RAWHarald Welte1-1/+14
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-11print E1DP Mode as string, not in numeric formatHarald Welte1-1/+1
Change-Id: I4d221a45bdd5d85b3ab6eaa35d67683b50bea21f
2020-06-29Add virtual pair of E1 interfacesHarald Welte1-5/+5
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-29extend logging (log more noteworthy events)Harald Welte1-0/+6
Let's log some more events that might happen. Change-Id: I37fd290f0f0621fbf6e20e33fa709efc14df94c7
2020-06-29Export _e1d_ts_stop() function inside daemonHarald Welte1-3/+3
Change-Id: If3ceca05d4fdf1e33d926061f30fce6bfa8e0357
2020-06-29ctl.c: Fix off-by-one: FD=0 is a valid file descriptorHarald Welte1-1/+1
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-29VTY interface supportHarald Welte1-6/+6
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
2019-05-11Initial code importSylvain Munaut1-0/+340
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>