From 9b3a33cba9c7a72d53b5c1634666758a485f060c Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 21 Jun 2011 13:52:41 +0200 Subject: hsl: add support for BTS-mode This patch adds support for BTS-mode for the hsl input driver. --- src/input/hsl.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/input/hsl.c') diff --git a/src/input/hsl.c b/src/input/hsl.c index 3854b06..e6388c8 100644 --- a/src/input/hsl.c +++ b/src/input/hsl.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #define HSL_TCP_PORT 2500 @@ -308,8 +309,10 @@ static int hsl_line_update(struct e1inp_line *line, switch(role) { case E1INP_LINE_R_BSC: + LOGP(DINP, LOGL_NOTICE, "enabling hsl BSC mode\n"); + ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP, - "0.0.0.0", HSL_TCP_PORT, 1); + addr, HSL_TCP_PORT, OSMO_SOCK_F_BIND); if (ret < 0) return ret; @@ -323,9 +326,27 @@ static int hsl_line_update(struct e1inp_line *line, return ret; } break; - case E1INP_LINE_R_BTS: - /* XXX: not implemented yet. */ + case E1INP_LINE_R_BTS: { + struct ipa_link *link; + + LOGP(DINP, LOGL_NOTICE, "enabling hsl BTS mode\n"); + + link = ipa_client_link_create(tall_hsl_ctx, addr, HSL_TCP_PORT); + if (link == NULL) { + LOGP(DINP, LOGL_ERROR, "cannot create BTS link: %s\n", + strerror(errno)); + return -ENOMEM; + } + if (ipa_client_link_open(link) < 0) { + LOGP(DINP, LOGL_ERROR, "cannot open BTS link: %s\n", + strerror(errno)); + ipa_client_link_close(link); + ipa_client_link_destroy(link); + return -EIO; + } + ret = 0; break; + } default: break; } -- cgit v1.2.3-55-g7522