blob: 379cc5354d9c2a309597e03e6fc788623c6b1ee5 [file] [log] [blame]
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +02001/* OpenBSC Abis interface to E1 */
2
3/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
4 *
5 * All Rights Reserved
6 *
Harald Welte323d39d2017-11-13 01:09:21 +09007 * SPDX-License-Identifier: AGPL-3.0+
8 *
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +02009 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#include "internal.h"
Harald Welte3bc78852011-08-24 08:32:38 +020025#include "../config.h"
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020026
27#include <stdio.h>
28#include <unistd.h>
29#include <stdlib.h>
30#include <errno.h>
31#include <string.h>
32#include <time.h>
Holger Hans Peter Freyther25474582017-01-23 19:49:07 +010033#include <fcntl.h>
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020034#include <sys/socket.h>
35#include <sys/ioctl.h>
36#include <arpa/inet.h>
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020037
Harald Weltefd44a5f2011-08-21 00:48:54 +020038#include <osmocom/abis/lapd.h>
39
Harald Weltef2737fc2011-08-16 14:30:10 +020040#include <osmocom/core/linuxlist.h>
41#include <osmocom/core/talloc.h>
42#include <osmocom/core/rate_ctr.h>
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020043#include <osmocom/core/logging.h>
44#include <osmocom/core/signal.h>
Neels Hofmeyra160e4b2018-11-16 00:16:57 +010045#include <osmocom/core/endian.h>
Pablo Neira Ayuso177094b2011-06-07 12:21:51 +020046#include <osmocom/abis/e1_input.h>
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020047
48#define NUM_E1_TS 32
49
50static void *tall_e1inp_ctx;
51
52/* list of all E1 drivers */
53LLIST_HEAD(e1inp_driver_list);
54
55/* list of all E1 lines */
56LLIST_HEAD(e1inp_line_list);
57
58static void *tall_sigl_ctx;
59
Harald Weltef2737fc2011-08-16 14:30:10 +020060static const struct rate_ctr_desc e1inp_ctr_d[] = {
61 [E1I_CTR_HDLC_ABORT] = {
Pau Espin Pedrola2106842018-07-24 15:00:11 +020062 "hdlc:abort", "HDLC abort"
Harald Weltef2737fc2011-08-16 14:30:10 +020063 },
64 [E1I_CTR_HDLC_BADFCS] = {
Pau Espin Pedrola2106842018-07-24 15:00:11 +020065 "hdlc:bad_fcs", "HLDC Bad FCS"
Harald Weltef2737fc2011-08-16 14:30:10 +020066 },
67 [E1I_CTR_HDLC_OVERR] = {
Pau Espin Pedrola2106842018-07-24 15:00:11 +020068 "hdlc:overrun", "HDLC Overrun"
Harald Weltef2737fc2011-08-16 14:30:10 +020069 },
70 [E1I_CTR_ALARM] = {
Harald Weltedd0c2ef2011-08-11 12:54:07 +020071 "alarm", "Alarm"
Harald Weltef2737fc2011-08-16 14:30:10 +020072 },
73 [E1I_CTR_REMOVED] = {
Harald Weltedd0c2ef2011-08-11 12:54:07 +020074 "removed", "Line removed"
Harald Weltef2737fc2011-08-16 14:30:10 +020075 },
76};
77
78static const struct rate_ctr_group_desc e1inp_ctr_g_d = {
79 .group_name_prefix = "e1inp",
80 .group_description = "E1 Input subsystem",
81 .num_ctr = ARRAY_SIZE(e1inp_ctr_d),
82 .ctr_desc = e1inp_ctr_d,
83};
84
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020085/*
86 * pcap writing of the misdn load
87 * pcap format is from http://wiki.wireshark.org/Development/LibpcapFileFormat
88 */
89#define DLT_LINUX_LAPD 177
90#define PCAP_INPUT 0
91#define PCAP_OUTPUT 1
92
93struct pcap_hdr {
94 uint32_t magic_number;
95 uint16_t version_major;
96 uint16_t version_minor;
97 int32_t thiszone;
98 uint32_t sigfigs;
99 uint32_t snaplen;
100 uint32_t network;
101} __attribute__((packed));
102
103struct pcaprec_hdr {
104 uint32_t ts_sec;
105 uint32_t ts_usec;
106 uint32_t incl_len;
107 uint32_t orig_len;
108} __attribute__((packed));
109
110struct fake_linux_lapd_header {
111 uint16_t pkttype;
112 uint16_t hatype;
113 uint16_t halen;
114 uint64_t addr;
115 int16_t protocol;
116} __attribute__((packed));
117
118struct lapd_header {
Neels Hofmeyra160e4b2018-11-16 00:16:57 +0100119#if OSMO_IS_LITTLE_ENDIAN
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200120 uint8_t ea1 : 1;
121 uint8_t cr : 1;
122 uint8_t sapi : 6;
123 uint8_t ea2 : 1;
124 uint8_t tei : 7;
125 uint8_t control_foo; /* fake UM's ... */
Neels Hofmeyra160e4b2018-11-16 00:16:57 +0100126#elif OSMO_IS_BIG_ENDIAN
127/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
128 uint8_t sapi:6, cr:1, ea1:1;
129 uint8_t tei:7, ea2:1;
130 uint8_t control_foo;
131#endif
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200132} __attribute__((packed));
133
134osmo_static_assert(offsetof(struct fake_linux_lapd_header, hatype) == 2, hatype_offset);
135osmo_static_assert(offsetof(struct fake_linux_lapd_header, halen) == 4, halen_offset);
136osmo_static_assert(offsetof(struct fake_linux_lapd_header, addr) == 6, addr_offset);
137osmo_static_assert(offsetof(struct fake_linux_lapd_header, protocol) == 14, proto_offset);
138osmo_static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size);
139
140
141static int pcap_fd = -1;
142
Pablo Neira Ayuso2e11f5c2013-07-05 15:08:18 +0200143int e1_set_pcap_fd(int fd)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200144{
Sylvain Munaut4b45e9d2020-05-08 09:40:44 +0200145 const struct pcap_hdr header = {
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200146 .magic_number = 0xa1b2c3d4,
147 .version_major = 2,
148 .version_minor = 4,
149 .thiszone = 0,
150 .sigfigs = 0,
151 .snaplen = 65535,
152 .network = DLT_LINUX_LAPD,
153 };
Sylvain Munaut4b45e9d2020-05-08 09:40:44 +0200154 struct e1inp_line *line;
155 int i;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200156
Sylvain Munaut4b45e9d2020-05-08 09:40:44 +0200157 /* write header */
158 if (fd >= 0) {
159 int rc = write(fd, &header, sizeof(header));
160 if (rc < 0)
161 return rc;
162 }
163
164 /* update fd in all lines in our global list of e1 lines */
165 llist_for_each_entry(line, &e1inp_line_list, list) {
166 /* Set the PCAP file descriptor for all timeslots that have
167 * software LAPD instances, to ensure the osmo_lapd_pcap code is
168 * used to write PCAP files (if requested) */
169 for (i = 0; i < ARRAY_SIZE(line->ts); i++) {
170 struct e1inp_ts *e1i_ts = &line->ts[i];
171 if (e1i_ts->lapd)
172 e1i_ts->lapd->pcap_fd = fd;
173 }
174 }
175
176 /* close previous and update global */
177 if (pcap_fd >= 0)
178 close(pcap_fd);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200179 pcap_fd = fd;
Sylvain Munaut4b45e9d2020-05-08 09:40:44 +0200180
181 return 0;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200182}
183
184/* This currently only works for the D-Channel */
185static void write_pcap_packet(int direction, int sapi, int tei,
186 struct msgb *msg) {
187 if (pcap_fd < 0)
188 return;
189
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200190 time_t cur_time;
191 struct tm *tm;
192
193 struct fake_linux_lapd_header header = {
194 .pkttype = 4,
195 .hatype = 0,
196 .halen = 0,
197 .addr = direction == PCAP_OUTPUT ? 0x0 : 0x1,
198 .protocol = ntohs(48),
199 };
200
201 struct lapd_header lapd_header = {
202 .ea1 = 0,
203 .cr = direction == PCAP_OUTPUT ? 1 : 0,
204 .sapi = sapi & 0x3F,
205 .ea2 = 1,
206 .tei = tei & 0x7F,
207 .control_foo = 0x03 /* UI */,
208 };
209
210 struct pcaprec_hdr payload_header = {
211 .ts_sec = 0,
212 .ts_usec = 0,
213 .incl_len = msgb_l2len(msg) + sizeof(struct fake_linux_lapd_header)
214 + sizeof(struct lapd_header),
215 .orig_len = msgb_l2len(msg) + sizeof(struct fake_linux_lapd_header)
216 + sizeof(struct lapd_header),
217 };
218
219
220 cur_time = time(NULL);
221 tm = localtime(&cur_time);
222 payload_header.ts_sec = mktime(tm);
223
Harald Weltec9295ea2014-08-21 02:41:41 +0200224 write(pcap_fd, &payload_header, sizeof(payload_header));
225 write(pcap_fd, &header, sizeof(header));
226 write(pcap_fd, &lapd_header, sizeof(lapd_header));
227 write(pcap_fd, msg->l2h, msgb_l2len(msg));
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200228}
229
Harald Welte4ca5c532016-07-27 23:05:03 +0200230const struct value_string e1inp_sign_type_names[5] = {
231 { E1INP_SIGN_NONE, "None" },
232 { E1INP_SIGN_OML, "OML" },
233 { E1INP_SIGN_RSL, "RSL" },
234 { E1INP_SIGN_OSMO, "OSMO" },
235 { 0, NULL }
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200236};
Harald Welte4ca5c532016-07-27 23:05:03 +0200237
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200238const char *e1inp_signtype_name(enum e1inp_sign_type tp)
239{
Harald Welte4ca5c532016-07-27 23:05:03 +0200240 return get_value_string(e1inp_sign_type_names, tp);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200241}
242
Harald Welte7a228eb2016-07-28 11:09:31 +0200243const struct value_string e1inp_ts_type_names[6] = {
Harald Welte4ca5c532016-07-27 23:05:03 +0200244 { E1INP_TS_TYPE_NONE, "None" },
245 { E1INP_TS_TYPE_SIGN, "Signalling" },
246 { E1INP_TS_TYPE_TRAU, "TRAU" },
Harald Weltea0108e72016-07-27 21:44:50 +0200247 { E1INP_TS_TYPE_RAW, "RAW" },
Harald Welte7a228eb2016-07-28 11:09:31 +0200248 { E1INP_TS_TYPE_HDLC, "HDLC" },
Harald Welte4ca5c532016-07-27 23:05:03 +0200249 { 0, NULL }
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200250};
251
252const char *e1inp_tstype_name(enum e1inp_ts_type tp)
253{
Harald Welte4ca5c532016-07-27 23:05:03 +0200254 return get_value_string(e1inp_ts_type_names, tp);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200255}
256
Pablo Neira Ayuso96e72632011-06-26 19:08:05 +0200257int abis_sendmsg(struct msgb *msg)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200258{
259 struct e1inp_sign_link *sign_link = msg->dst;
260 struct e1inp_driver *e1inp_driver;
261 struct e1inp_ts *e1i_ts;
Alexander Couzens35daa672016-11-08 16:17:20 +0100262
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200263 msg->l2h = msg->data;
264
265 /* don't know how to route this message. */
266 if (sign_link == NULL) {
Harald Welte40b0e8c2011-07-21 16:57:34 +0200267 LOGP(DLINP, LOGL_ERROR, "abis_sendmsg: msg->dst == NULL: %s\n",
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200268 osmo_hexdump(msg->data, msg->len));
269 talloc_free(msg);
270 return -EINVAL;
271 }
272 e1i_ts = sign_link->ts;
273 if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
274 /* notify the driver we have something to write */
275 e1inp_driver = sign_link->ts->line->driver;
276 e1inp_driver->want_write(e1i_ts);
277 }
278 msgb_enqueue(&sign_link->tx_list, msg);
279
Harald Welte7f9d8512016-07-04 09:59:46 +0200280 /* we only need to write a 'Fake LAPD' packet here, if the
281 * underlying driver hides LAPD from us. If we use the
282 * libosmocore LAPD implementation, it will take care of writing
283 * the _actual_ LAPD packet */
284 if (!e1i_ts->lapd) {
285 write_pcap_packet(PCAP_OUTPUT, sign_link->sapi,
286 sign_link->tei, msg);
287 }
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200288
289 return 0;
290}
291
Pablo Neira Ayuso96e72632011-06-26 19:08:05 +0200292int abis_rsl_sendmsg(struct msgb *msg)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200293{
Pablo Neira Ayuso96e72632011-06-26 19:08:05 +0200294 return abis_sendmsg(msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200295}
296
297/* Timeslot */
298int e1inp_ts_config_trau(struct e1inp_ts *ts, struct e1inp_line *line,
Pablo Neira Ayuso211d2ca2011-06-07 17:15:10 +0200299 int (*trau_rcv_cb)(struct subch_demux *dmx, int ch,
300 uint8_t *data, int len, void *_priv))
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200301{
302 if (ts->type == E1INP_TS_TYPE_TRAU && ts->line && line)
303 return 0;
304
305 ts->type = E1INP_TS_TYPE_TRAU;
306 ts->line = line;
307
308 subchan_mux_init(&ts->trau.mux);
Pablo Neira Ayuso211d2ca2011-06-07 17:15:10 +0200309 ts->trau.demux.out_cb = trau_rcv_cb;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200310 ts->trau.demux.data = ts;
311 subch_demux_init(&ts->trau.demux);
312 return 0;
313}
314
315int e1inp_ts_config_sign(struct e1inp_ts *ts, struct e1inp_line *line)
316{
317 if (ts->type == E1INP_TS_TYPE_SIGN && ts->line && line)
318 return 0;
319
320 ts->type = E1INP_TS_TYPE_SIGN;
321 ts->line = line;
322
323 if (line && line->driver)
324 ts->sign.delay = line->driver->default_delay;
325 else
326 ts->sign.delay = 100000;
327 INIT_LLIST_HEAD(&ts->sign.sign_links);
328 return 0;
329}
330
Harald Weltea0108e72016-07-27 21:44:50 +0200331int e1inp_ts_config_raw(struct e1inp_ts *ts, struct e1inp_line *line,
332 void (*raw_recv_cb)(struct e1inp_ts *ts,
333 struct msgb *msg))
334{
335 if (ts->type == E1INP_TS_TYPE_RAW && ts->line && line)
336 return 0;
337
338 ts->type = E1INP_TS_TYPE_RAW;
339 ts->line = line;
340 ts->raw.recv_cb = raw_recv_cb;
341 INIT_LLIST_HEAD(&ts->raw.tx_queue);
342
343 return 0;
344}
345
Harald Welte7a228eb2016-07-28 11:09:31 +0200346int e1inp_ts_config_hdlc(struct e1inp_ts *ts, struct e1inp_line *line,
347 void (*hdlc_recv_cb)(struct e1inp_ts *ts,
348 struct msgb *msg))
349{
350 if (ts->type == E1INP_TS_TYPE_HDLC && ts->line && line)
351 return 0;
352
353 ts->type = E1INP_TS_TYPE_HDLC;
354 ts->line = line;
355 ts->hdlc.recv_cb = hdlc_recv_cb;
356 INIT_LLIST_HEAD(&ts->hdlc.tx_queue);
357
358 return 0;
359}
360
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200361struct e1inp_line *e1inp_line_find(uint8_t e1_nr)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200362{
363 struct e1inp_line *e1i_line;
364
365 /* iterate over global list of e1 lines */
366 llist_for_each_entry(e1i_line, &e1inp_line_list, list) {
367 if (e1i_line->num == e1_nr)
368 return e1i_line;
369 }
370 return NULL;
371}
372
373struct e1inp_line *
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200374e1inp_line_create(uint8_t e1_nr, const char *driver_name)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200375{
376 struct e1inp_driver *driver;
377 struct e1inp_line *line;
378 int i;
379
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200380 line = e1inp_line_find(e1_nr);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200381 if (line) {
Harald Welteb5af0992020-01-12 12:59:52 +0100382 LOGPIL(line, DLINP, LOGL_ERROR, "E1 Line %u already exists\n", e1_nr);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200383 return NULL;
384 }
385
386 driver = e1inp_driver_find(driver_name);
387 if (!driver) {
Harald Weltecc2241b2011-07-19 16:06:06 +0200388 LOGP(DLINP, LOGL_ERROR, "No such E1 driver '%s'\n",
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200389 driver_name);
390 return NULL;
391 }
392
393 line = talloc_zero(tall_e1inp_ctx, struct e1inp_line);
394 if (!line)
395 return NULL;
396
397 line->driver = driver;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200398 line->num = e1_nr;
Harald Weltef2737fc2011-08-16 14:30:10 +0200399
400 line->rate_ctr = rate_ctr_group_alloc(line, &e1inp_ctr_g_d, line->num);
Harald Welteff8eed22017-07-12 00:38:25 +0200401 if (!line->rate_ctr) {
Harald Welteb5af0992020-01-12 12:59:52 +0100402 LOGPIL(line, DLINP, LOGL_ERROR, "Cannot allocate counter group\n");
Harald Welteff8eed22017-07-12 00:38:25 +0200403 talloc_free(line);
404 return NULL;
405 }
Harald Weltef2737fc2011-08-16 14:30:10 +0200406
Harald Weltec2889512011-09-13 23:49:04 +0100407 line->num_ts = NUM_E1_TS;
408 for (i = 0; i < line->num_ts; i++) {
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200409 line->ts[i].num = i+1;
410 line->ts[i].line = line;
411 }
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200412 line->refcnt++;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200413 llist_add_tail(&line->list, &e1inp_line_list);
414
415 return line;
416}
417
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200418struct e1inp_line *
419e1inp_line_clone(void *ctx, struct e1inp_line *line)
420{
421 struct e1inp_line *clone;
422
423 /* clone virtual E1 line for this new OML link. */
424 clone = talloc_zero(ctx, struct e1inp_line);
425 if (clone == NULL)
426 return NULL;
427
428 memcpy(clone, line, sizeof(struct e1inp_line));
Stefan Sperlingb0162072018-05-22 18:19:00 +0200429
430 if (line->name) {
431 clone->name = talloc_strdup(clone, line->name);
432 OSMO_ASSERT(clone->name);
433 }
434 if (line->sock_path) {
435 clone->sock_path = talloc_strdup(clone, line->sock_path);
436 OSMO_ASSERT(clone->sock_path);
437 }
438
439 /*
440 * Rate counters and driver data are shared between clones. These are pointers
441 * to dynamic memory so we use reference counting to avoid a double-free (see OS#3137).
442 */
443 OSMO_ASSERT(line->rate_ctr);
444 clone->rate_ctr = talloc_reference(clone, line->rate_ctr);
445 if (line->driver_data)
446 clone->driver_data = talloc_reference(clone, line->driver_data);
447
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200448 clone->refcnt = 1;
449 return clone;
450}
451
452void e1inp_line_get(struct e1inp_line *line)
453{
Vadim Yanitskiyb43ce422019-12-02 01:49:43 +0700454 int old_refcnt = line->refcnt++;
455
Harald Welteb5af0992020-01-12 12:59:52 +0100456 LOGPIL(line, DLINP, LOGL_DEBUG, "Line '%s' (%p) reference count get: %d -> %d\n",
Vadim Yanitskiyb43ce422019-12-02 01:49:43 +0700457 line->name, line, old_refcnt, line->refcnt);
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200458}
459
460void e1inp_line_put(struct e1inp_line *line)
461{
Vadim Yanitskiyb43ce422019-12-02 01:49:43 +0700462 int old_refcnt = line->refcnt--;
463
Harald Welteb5af0992020-01-12 12:59:52 +0100464 LOGPIL(line, DLINP, LOGL_DEBUG, "Line '%s' (%p) reference count put: %d -> %d\n",
Vadim Yanitskiyb43ce422019-12-02 01:49:43 +0700465 line->name, line, old_refcnt, line->refcnt);
466
Stefan Sperlingb0162072018-05-22 18:19:00 +0200467 if (line->refcnt == 0) {
468 /* Remove our counter group from libosmocore's global counter
469 * list if we are freeing the last remaining talloc context.
470 * Otherwise we get a use-after-free when libosmocore's timer
471 * ticks again and attempts to update these counters (OS#3011).
472 *
473 * Note that talloc internally counts "secondary" references
474 * _in addition to_ the initial allocation context, so yes,
475 * we must check for *zero* remaining secondary contexts here. */
476 if (talloc_reference_count(line->rate_ctr) == 0) {
477 rate_ctr_group_free(line->rate_ctr);
478 } else {
479 /* We are not freeing the last talloc context.
480 * Instead of calling talloc_free(), unlink this 'line' pointer
481 * which serves as one of several talloc contexts for the rate
482 * counters and driver private state. */
483 talloc_unlink(line, line->rate_ctr);
484 if (line->driver_data)
485 talloc_unlink(line, line->driver_data);
486 }
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200487 talloc_free(line);
Stefan Sperlingb0162072018-05-22 18:19:00 +0200488 }
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200489}
490
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200491void
492e1inp_line_bind_ops(struct e1inp_line *line, const struct e1inp_line_ops *ops)
493{
494 line->ops = ops;
495}
496
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200497#if 0
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200498struct e1inp_line *e1inp_line_find_create(uint8_t e1_nr)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200499{
500 struct e1inp_line *line;
501 int i;
502
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200503 line = e1inp_line_find(e1_nr);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200504 if (line)
505 return line;
506
507 line = talloc_zero(tall_e1inp_ctx, struct e1inp_line);
508 if (!line)
509 return NULL;
510
511 line->num = e1_nr;
512 for (i = 0; i < NUM_E1_TS; i++) {
513 line->ts[i].num = i+1;
514 line->ts[i].line = line;
515 }
516 llist_add_tail(&line->list, &e1inp_line_list);
517
518 return line;
519}
520#endif
521
522static struct e1inp_ts *e1inp_ts_get(uint8_t e1_nr, uint8_t ts_nr)
523{
524 struct e1inp_line *e1i_line;
525
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200526 e1i_line = e1inp_line_find(e1_nr);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200527 if (!e1i_line)
528 return NULL;
529
530 return &e1i_line->ts[ts_nr-1];
531}
532
533struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr)
534{
535 struct e1inp_ts *e1i_ts = e1inp_ts_get(e1_nr, ts_nr);
536
537 if (!e1i_ts)
538 return NULL;
539
540 return &e1i_ts->trau.mux;
541}
542
543/* Signalling Link */
544
545struct e1inp_sign_link *e1inp_lookup_sign_link(struct e1inp_ts *e1i,
546 uint8_t tei, uint8_t sapi)
547{
548 struct e1inp_sign_link *link;
549
550 llist_for_each_entry(link, &e1i->sign.sign_links, list) {
551 if (link->sapi == sapi && link->tei == tei)
552 return link;
553 }
554
555 return NULL;
556}
557
558/* create a new signalling link in a E1 timeslot */
559
560struct e1inp_sign_link *
561e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type,
562 struct gsm_bts_trx *trx, uint8_t tei,
563 uint8_t sapi)
564{
565 struct e1inp_sign_link *link;
566
567 if (ts->type != E1INP_TS_TYPE_SIGN)
568 return NULL;
569
570 link = talloc_zero(tall_sigl_ctx, struct e1inp_sign_link);
571 if (!link)
572 return NULL;
573
574 link->ts = ts;
575 link->type = type;
576 INIT_LLIST_HEAD(&link->tx_list);
577 link->trx = trx;
578 link->tei = tei;
579 link->sapi = sapi;
580
581 llist_add_tail(&link->list, &ts->sign.sign_links);
582
583 return link;
584}
585
586void e1inp_sign_link_destroy(struct e1inp_sign_link *link)
587{
588 struct msgb *msg;
589
590 llist_del(&link->list);
591 while (!llist_empty(&link->tx_list)) {
592 msg = msgb_dequeue(&link->tx_list);
593 msgb_free(msg);
594 }
595
596 if (link->ts->type == E1INP_TS_TYPE_SIGN)
597 osmo_timer_del(&link->ts->sign.tx_timer);
598
Pablo Neira Ayusoc9c4fd32011-06-30 12:19:42 +0200599 if (link->ts->line->driver->close)
Pablo Neira Ayusoadd3ec82011-07-05 14:45:46 +0200600 link->ts->line->driver->close(link);
Pablo Neira Ayusoc9c4fd32011-06-30 12:19:42 +0200601
Pablo Neira Ayuso6cc3f922012-08-22 13:57:58 +0200602 e1inp_line_put(link->ts->line);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200603 talloc_free(link);
604}
605
606/* XXX */
607/* the E1 driver tells us he has received something on a TS */
608int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
609 uint8_t tei, uint8_t sapi)
610{
611 struct e1inp_sign_link *link;
612 int ret = 0;
613
614 switch (ts->type) {
615 case E1INP_TS_TYPE_SIGN:
Harald Welte7f9d8512016-07-04 09:59:46 +0200616 /* we only need to write a 'Fake LAPD' packet here, if
617 * the underlying driver hides LAPD from us. If we use
618 * the libosmocore LAPD implementation, it will take
619 * care of writing the _actual_ LAPD packet */
620 if (!ts->lapd)
621 write_pcap_packet(PCAP_INPUT, sapi, tei, msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200622 /* consult the list of signalling links */
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200623 link = e1inp_lookup_sign_link(ts, tei, sapi);
624 if (!link) {
Harald Welteb5af0992020-01-12 12:59:52 +0100625 LOGPITS(ts, DLMI, LOGL_ERROR, "didn't find signalling link for "
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200626 "tei %d, sapi %d\n", tei, sapi);
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200627 msgb_free(msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200628 return -EINVAL;
629 }
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200630 if (!ts->line->ops->sign_link) {
Harald Welteb5af0992020-01-12 12:59:52 +0100631 LOGPITS(ts, DLINP, LOGL_ERROR, "Fix your application, "
Pablo Neira Ayuso5a4b7c52011-06-07 14:07:48 +0200632 "no action set for signalling messages.\n");
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200633 msgb_free(msg);
Pablo Neira Ayuso5a4b7c52011-06-07 14:07:48 +0200634 return -ENOENT;
635 }
Pablo Neira Ayusodbd82fb2011-07-05 15:29:23 +0200636 msg->dst = link;
637 ts->line->ops->sign_link(msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200638 break;
639 case E1INP_TS_TYPE_TRAU:
Pablo Neira Ayuso211d2ca2011-06-07 17:15:10 +0200640 ret = subch_demux_in(&ts->trau.demux, msg->l2h, msgb_l2len(msg));
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200641 msgb_free(msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200642 break;
Harald Weltea0108e72016-07-27 21:44:50 +0200643 case E1INP_TS_TYPE_RAW:
644 ts->raw.recv_cb(ts, msg);
645 break;
Harald Welte7a228eb2016-07-28 11:09:31 +0200646 case E1INP_TS_TYPE_HDLC:
647 ts->hdlc.recv_cb(ts, msg);
648 break;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200649 default:
650 ret = -EINVAL;
Harald Welteb5af0992020-01-12 12:59:52 +0100651 LOGPITS(ts, DLMI, LOGL_ERROR, "unknown TS type %u\n", ts->type);
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200652 msgb_free(msg);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200653 break;
654 }
655
656 return ret;
657}
658
Harald Weltefd44a5f2011-08-21 00:48:54 +0200659/*! \brief Receive some data from the L1/HDLC into LAPD of a timeslot
660 * \param[in] e1i_ts E1 Timeslot data structure
661 * \param[in] msg Message buffer containing full LAPD message
662 *
663 * This is a wrapper around e1inp_rx_ts(), but feeding the incoming
664 * message first into our LAPD code. This allows a driver to read raw
665 * (HDLC decoded) data from the timeslot, instead of a LAPD stack
666 * present in any underlying driver.
667 */
668int e1inp_rx_ts_lapd(struct e1inp_ts *e1i_ts, struct msgb *msg)
669{
Harald Weltefd44a5f2011-08-21 00:48:54 +0200670 unsigned int sapi, tei;
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200671 int ret = 0, error = 0;
Harald Weltefd44a5f2011-08-21 00:48:54 +0200672
673 sapi = msg->data[0] >> 2;
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200674 if ((msg->data[0] & 0x1))
675 tei = 0;
676 else
677 tei = msg->data[1] >> 1;
Harald Weltefd44a5f2011-08-21 00:48:54 +0200678
Harald Welteb5af0992020-01-12 12:59:52 +0100679 LOGPITS(e1i_ts, DLMI, LOGL_DEBUG, "<= len = %d, sapi(%d) tei(%d)\n", msg->len, sapi, tei);
Harald Weltefd44a5f2011-08-21 00:48:54 +0200680
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200681 ret = lapd_receive(e1i_ts->lapd, msg, &error);
682 if (ret < 0) {
Harald Weltefd44a5f2011-08-21 00:48:54 +0200683 switch(error) {
684 case LAPD_ERR_UNKNOWN_TEI:
685 /* We don't know about this TEI, probably the BSC
686 * lost local states (it crashed or it was stopped),
687 * notify the driver to see if it can do anything to
688 * recover the existing signalling links with the BTS.
689 */
690 e1inp_event(e1i_ts, S_L_INP_TEI_UNKNOWN, tei, sapi);
691 return -EIO;
692 }
Harald Weltefd44a5f2011-08-21 00:48:54 +0200693 }
694
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200695 return 0;
696}
Harald Weltefd44a5f2011-08-21 00:48:54 +0200697
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200698void e1inp_dlsap_up(struct osmo_dlsap_prim *dp, uint8_t tei, uint8_t sapi,
699 void *rx_cbdata)
700{
701 struct e1inp_ts *e1i_ts = rx_cbdata;
702 struct msgb *msg = dp->oph.msg;
Harald Weltefd44a5f2011-08-21 00:48:54 +0200703
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200704 switch (dp->oph.primitive) {
705 case PRIM_DL_EST:
Harald Welteb5af0992020-01-12 12:59:52 +0100706 LOGPITS(e1i_ts, DLMI, LOGL_DEBUG, "DL_EST: sapi(%d) tei(%d)\n", sapi, tei);
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200707 e1inp_event(e1i_ts, S_L_INP_TEI_UP, tei, sapi);
Harald Weltefd44a5f2011-08-21 00:48:54 +0200708 break;
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200709 case PRIM_DL_REL:
Harald Welteb5af0992020-01-12 12:59:52 +0100710 LOGPITS(e1i_ts, DLMI, LOGL_DEBUG, "DL_REL: sapi(%d) tei(%d)\n", sapi, tei);
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200711 e1inp_event(e1i_ts, S_L_INP_TEI_DN, tei, sapi);
Harald Weltefd44a5f2011-08-21 00:48:54 +0200712 break;
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200713 case PRIM_DL_DATA:
714 case PRIM_DL_UNIT_DATA:
715 if (dp->oph.operation == PRIM_OP_INDICATION) {
716 msg->l2h = msg->l3h;
Harald Welteb5af0992020-01-12 12:59:52 +0100717 LOGPITS(e1i_ts, DLMI, LOGL_DEBUG, "RX: %s sapi=%d tei=%d\n",
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200718 osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)),
719 sapi, tei);
720 e1inp_rx_ts(e1i_ts, msg, tei, sapi);
721 return;
722 }
Harald Weltefd44a5f2011-08-21 00:48:54 +0200723 break;
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200724 case PRIM_MDL_ERROR:
Harald Welteb5af0992020-01-12 12:59:52 +0100725 LOGPITS(e1i_ts, DLMI, LOGL_DEBUG, "MDL_EERROR: cause(%d)\n", dp->u.error_ind.cause);
Harald Weltefd44a5f2011-08-21 00:48:54 +0200726 break;
727 default:
728 printf("ERROR: unknown prim\n");
729 break;
730 }
Andreas Eversberga7ff0012011-09-26 11:29:30 +0200731
732 msgb_free(msg);
733
734 return;
Harald Weltefd44a5f2011-08-21 00:48:54 +0200735}
736
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200737#define TSX_ALLOC_SIZE 4096
738
739/* called by driver if it wants to transmit on a given TS */
740struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
741 struct e1inp_sign_link **sign_link)
742{
743 struct e1inp_sign_link *link;
744 struct msgb *msg = NULL;
745 int len;
746
747 switch (e1i_ts->type) {
748 case E1INP_TS_TYPE_SIGN:
749 /* FIXME: implement this round robin */
750 llist_for_each_entry(link, &e1i_ts->sign.sign_links, list) {
751 msg = msgb_dequeue(&link->tx_list);
752 if (msg) {
753 if (sign_link)
754 *sign_link = link;
755 break;
756 }
757 }
758 break;
759 case E1INP_TS_TYPE_TRAU:
760 msg = msgb_alloc(TSX_ALLOC_SIZE, "TRAU_TX");
761 if (!msg)
762 return NULL;
763 len = subchan_mux_out(&e1i_ts->trau.mux, msg->data, 40);
Pablo Neira Ayuso33f71752013-07-05 15:44:12 +0200764 if (len != 40) {
Harald Welteb5af0992020-01-12 12:59:52 +0100765 LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "cannot transmit, failed to mux\n");
Pablo Neira Ayuso33f71752013-07-05 15:44:12 +0200766 msgb_free(msg);
767 return NULL;
768 }
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200769 msgb_put(msg, 40);
770 break;
Harald Weltea0108e72016-07-27 21:44:50 +0200771 case E1INP_TS_TYPE_RAW:
772 /* Get msgb from tx_queue */
773 msg = msgb_dequeue(&e1i_ts->raw.tx_queue);
774 break;
Harald Welte7a228eb2016-07-28 11:09:31 +0200775 case E1INP_TS_TYPE_HDLC:
776 /* Get msgb from tx_queue */
777 msg = msgb_dequeue(&e1i_ts->hdlc.tx_queue);
778 break;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200779 default:
Harald Welteb5af0992020-01-12 12:59:52 +0100780 LOGPITS(e1i_ts, DLMI, LOGL_ERROR, "unsupported E1 TS type %u\n", e1i_ts->type);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200781 return NULL;
782 }
783 return msg;
784}
785
Holger Hans Peter Freyther55467f02011-12-28 19:47:07 +0100786static int e1inp_int_snd_event(struct e1inp_ts *ts,
787 struct e1inp_sign_link *link, int evt)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200788{
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200789 struct input_signal_data isd;
Pablo Neira Ayuso31fe5f22011-08-09 23:15:38 +0200790 isd.line = ts->line;
Harald Weltef35d8892016-10-16 15:33:52 +0200791 isd.ts_nr = ts->num;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200792 isd.link_type = link->type;
793 isd.trx = link->trx;
Holger Hans Peter Freyther55467f02011-12-28 19:47:07 +0100794 isd.tei = link->tei;
795 isd.sapi = link->sapi;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200796
797 /* report further upwards */
Harald Weltecc2241b2011-07-19 16:06:06 +0200798 osmo_signal_dispatch(SS_L_INPUT, evt, &isd);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200799 return 0;
800}
801
Holger Hans Peter Freyther55467f02011-12-28 19:47:07 +0100802
803/* called by driver in case some kind of link state event */
804int e1inp_event(struct e1inp_ts *ts, int evt, uint8_t tei, uint8_t sapi)
805{
806 struct e1inp_sign_link *link;
807
808 link = e1inp_lookup_sign_link(ts, tei, sapi);
809 if (!link)
810 return -EINVAL;
811 return e1inp_int_snd_event(ts, link, evt);
812}
813
814void e1inp_close_socket(struct e1inp_ts *ts,
815 struct e1inp_sign_link *sign_link,
816 struct osmo_fd *bfd)
817{
818 e1inp_int_snd_event(ts, sign_link, S_L_INP_TEI_DN);
819 /* the first e1inp_sign_link_destroy call closes the socket. */
820 if (bfd->fd != -1) {
821 osmo_fd_unregister(bfd);
822 close(bfd->fd);
823 bfd->fd = -1;
824 }
825}
826
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200827/* register a driver with the E1 core */
828int e1inp_driver_register(struct e1inp_driver *drv)
829{
830 llist_add_tail(&drv->list, &e1inp_driver_list);
831 return 0;
832}
833
834struct e1inp_driver *e1inp_driver_find(const char *name)
835{
836 struct e1inp_driver *drv;
837
838 llist_for_each_entry(drv, &e1inp_driver_list, list) {
839 if (!strcasecmp(name, drv->name))
840 return drv;
841 }
842 return NULL;
843}
844
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200845int e1inp_line_update(struct e1inp_line *line)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200846{
847 struct input_signal_data isd;
Harald Welte7f9d8512016-07-04 09:59:46 +0200848 int i, rc;
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200849
Pablo Neira Ayuso3832c4f2011-07-07 17:47:26 +0200850 e1inp_line_get(line);
851
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200852 if (line->driver && line->ops && line->driver->line_update) {
Pablo Neira Ayuso4e862cb2011-08-19 18:43:38 +0200853 rc = line->driver->line_update(line);
Pablo Neira Ayusof163d232011-06-25 18:42:55 +0200854 } else
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200855 rc = 0;
856
Harald Welte7f9d8512016-07-04 09:59:46 +0200857 /* Set the PCAP file descriptor for all timeslots that have
858 * software LAPD instances, to ensure the osmo_lapd_pcap code is
859 * used to write PCAP files (if requested) */
860 for (i = 0; i < ARRAY_SIZE(line->ts); i++) {
861 struct e1inp_ts *e1i_ts = &line->ts[i];
862 if (e1i_ts->lapd)
863 e1i_ts->lapd->pcap_fd = pcap_fd;
864 }
865
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200866 /* Send a signal to anyone who is interested in new lines being
867 * configured */
868 memset(&isd, 0, sizeof(isd));
869 isd.line = line;
Pablo Neira Ayusode668912011-08-16 17:26:23 +0200870 osmo_signal_dispatch(SS_L_INPUT, S_L_INP_LINE_INIT, &isd);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200871
872 return rc;
873}
874
Pablo Neira Ayusoa20762a2011-07-02 19:01:58 +0200875static int e1i_sig_cb(unsigned int subsys, unsigned int signal,
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200876 void *handler_data, void *signal_data)
877{
Harald Weltecc2241b2011-07-19 16:06:06 +0200878 if (subsys != SS_L_GLOBAL ||
879 signal != S_L_GLOBAL_SHUTDOWN)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200880 return 0;
881
882 if (pcap_fd) {
883 close(pcap_fd);
884 pcap_fd = -1;
885 }
886
887 return 0;
888}
889
Harald Weltecac78fe2017-05-25 19:13:13 +0200890const struct value_string e1inp_signal_names[] = {
891 { S_L_INP_NONE, "NONE" },
892 { S_L_INP_TEI_UP, "TEI-UP" },
893 { S_L_INP_TEI_DN, "TEI-DOWN" },
894 { S_L_INP_TEI_UNKNOWN, "TEI-UNKNOWN" },
895 { S_L_INP_LINE_INIT, "LINE-INIT" },
896 { S_L_INP_LINE_ALARM, "LINE-ALARM" },
897 { S_L_INP_LINE_NOALARM, "LINE-NOALARM" },
898 { 0, NULL }
899};
900
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200901void e1inp_misdn_init(void);
902void e1inp_dahdi_init(void);
Harald Weltec6c70762019-05-12 21:54:59 +0200903void e1inp_e1d_init(void);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200904void e1inp_ipaccess_init(void);
Pablo Neira Ayuso7e0d0062011-08-19 11:36:15 +0200905void e1inp_rs232_init(void);
Alexander Couzensbeb10ef2016-11-01 22:05:13 +0100906void e1inp_unixsocket_init(void);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200907
908void e1inp_init(void)
909{
Pablo Neira Ayuso54b49792011-06-07 12:15:26 +0200910 tall_e1inp_ctx = talloc_named_const(libosmo_abis_ctx, 1, "e1inp");
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200911 tall_sigl_ctx = talloc_named_const(tall_e1inp_ctx, 1,
912 "e1inp_sign_link");
Harald Weltecc2241b2011-07-19 16:06:06 +0200913 osmo_signal_register_handler(SS_L_GLOBAL, e1i_sig_cb, NULL);
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200914
915 e1inp_misdn_init();
Harald Welte3bc78852011-08-24 08:32:38 +0200916#ifdef HAVE_DAHDI_USER_H
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200917 e1inp_dahdi_init();
Harald Welte3bc78852011-08-24 08:32:38 +0200918#endif
Harald Welte52b0d452019-05-12 21:54:26 +0200919#ifdef HAVE_E1D
Sylvain Munautb559a532019-05-09 11:14:26 +0200920 e1inp_e1d_init();
921#endif
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200922 e1inp_ipaccess_init();
Pablo Neira Ayuso7e0d0062011-08-19 11:36:15 +0200923 e1inp_rs232_init();
Alexander Couzensbeb10ef2016-11-01 22:05:13 +0100924 e1inp_unixsocket_init();
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200925}