From d75c648871d1cae1d2cf4f74f60eaf07fb97ba73 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 15 May 2014 13:00:30 +0200 Subject: abis: Separate initialization from connect for Abis Initialize the libosmo-abis VTY nodes more early so we can parse the config file that was created by "write". Introduce abis_init to initialize the libosmo-abis and modify abis_open to re-use an existing line. Update the comments. This has only been tried with the sysmobts-remote on x86. A TCP connection is opened toward the configured BSC. Fixes: SYS#285 --- src/common/abis.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/common/abis.c') diff --git a/src/common/abis.c b/src/common/abis.c index fa1a565f..da03402b 100644 --- a/src/common/abis.c +++ b/src/common/abis.c @@ -222,14 +222,8 @@ static struct e1inp_line_ops line_ops = { .sign_link = sign_link_cb, }; -/* UGLY: we assume this function is only called once as it does some - * global initialization as well as the actual opening of the A-bis link - * */ -struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host, - const char *model_name) +void abis_init(struct gsm_bts *bts) { - struct e1inp_line *line; - g_bts = bts; oml_init(); @@ -237,6 +231,12 @@ struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host, libosmo_abis_init(NULL); osmo_signal_register_handler(SS_L_INPUT, &inp_s_cbfn, bts); +} + +struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host, + const char *model_name) +{ + struct e1inp_line *line; /* patch in various data from VTY and othe sources */ line_ops.cfg.ipa.addr = dst_host; @@ -248,15 +248,14 @@ struct e1inp_line *abis_open(struct gsm_bts *bts, const char *dst_host, bts_dev_info.unit_name = bts->description; bts_dev_info.location2 = model_name; - line = e1inp_line_create(0, "ipa"); + line = e1inp_line_find(0); + if (!line) + line = e1inp_line_create(0, "ipa"); if (!line) return NULL; e1inp_line_bind_ops(line, &line_ops); - /* This is what currently starts both the outbound OML and RSL - * connections, which is wrong. - * FIXME: It should only start OML and wait for the RLS IP - * address to be set as part of the TRX attributes */ + /* This will open the OML connection now */ if (e1inp_line_update(line) < 0) return NULL; -- cgit v1.2.3