From 42581829ec2a79ef82c813b8212da76f514aa4f4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 8 Aug 2009 16:12:58 +0200 Subject: the actual config file code (not just config files) this was missing from commit a08a9acdb6bff0ee4fdf0f58b78b6525017a1f9f --- openbsc/src/e1_input.c | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'openbsc/src/e1_input.c') diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c index 7531755c2..4bc15e5f7 100644 --- a/openbsc/src/e1_input.c +++ b/openbsc/src/e1_input.c @@ -289,6 +289,9 @@ int _abis_nm_sendmsg(struct msgb *msg) int e1inp_ts_config(struct e1inp_ts *ts, struct e1inp_line *line, enum e1inp_ts_type type) { + if (ts->type == type && ts->line && line) + return 0; + ts->type = type; ts->line = line; @@ -322,6 +325,29 @@ static struct e1inp_line *e1inp_line_get(u_int8_t e1_nr) return NULL; } +struct e1inp_line *e1inp_line_get_create(u_int8_t e1_nr) +{ + struct e1inp_line *line; + int i; + + line = e1inp_line_get(e1_nr); + if (line) + return line; + + line = talloc_zero(tall_bsc_ctx, struct e1inp_line); + if (!line) + return NULL; + + line->num = e1_nr; + for (i = 0; i < NUM_E1_TS; i++) { + line->ts[i].num = i+1; + line->ts[i].line = line; + } + llist_add_tail(&line->list, &e1inp_line_list); + + return line; +} + static struct e1inp_ts *e1inp_ts_get(u_int8_t e1_nr, u_int8_t ts_nr) { struct e1inp_line *e1i_line; @@ -386,6 +412,12 @@ e1inp_sign_link_create(struct e1inp_ts *ts, enum e1inp_sign_type type, return link; } +void e1inp_sign_link_destroy(struct e1inp_sign_link *link) +{ + llist_del(&link->list); + talloc_free(link); +} + /* the E1 driver tells us he has received something on a TS */ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg, u_int8_t tei, u_int8_t sapi) @@ -399,7 +431,7 @@ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg, write_pcap_packet(PCAP_INPUT, sapi, tei, msg); link = e1inp_lookup_sign_link(ts, tei, sapi); if (!link) { - fprintf(stderr, "didn't find singalling link for " + fprintf(stderr, "didn't find signalling link for " "tei %d, sapi %d\n", tei, sapi); return -EINVAL; } @@ -487,19 +519,9 @@ int e1inp_driver_register(struct e1inp_driver *drv) return 0; } -/* register a line with the E1 core */ -int e1inp_line_register(struct e1inp_line *line) +int e1inp_line_update(struct e1inp_line *line) { - int i; - - for (i = 0; i < NUM_E1_TS; i++) { - line->ts[i].num = i+1; - line->ts[i].line = line; - } - - llist_add_tail(&line->list, &e1inp_line_list); - - return 0; + return mi_e1_line_update(line); } static __attribute__((constructor)) void on_dso_load_e1_inp(void) -- cgit v1.2.3