e1input: add address as parameter to e1inp_line_update(...)
This patch adds a new parameter to e1inp_line_update that allows to
specific the address for A-bis over IP BSC/BTS.
diff --git a/src/input/dahdi.c b/src/input/dahdi.c
index 8e5e635..bf73f97 100644
--- a/src/input/dahdi.c
+++ b/src/input/dahdi.c
@@ -367,8 +367,8 @@
return rc;
}
-static int
-dahdi_e1_line_update(struct e1inp_line *line, enum e1inp_line_role role);
+static int dahdi_e1_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr);
struct e1inp_driver dahdi_driver = {
.name = "dahdi",
@@ -477,8 +477,8 @@
return 0;
}
-static int
-dahdi_e1_line_update(struct e1inp_line *line, enum e1inp_line_role role)
+static int dahdi_e1_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, void *data)
{
if (line->driver != &dahdi_driver)
return -EINVAL;
diff --git a/src/input/hsl.c b/src/input/hsl.c
index f00338f..3854b06 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -242,7 +242,8 @@
return rc;
}
-static int hsl_line_update(struct e1inp_line *line, enum e1inp_line_role role);
+static int hsl_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr);
struct e1inp_driver hsl_driver = {
.name = "hsl",
@@ -300,8 +301,8 @@
return ret;
}
-static int
-hsl_line_update(struct e1inp_line *line, enum e1inp_line_role role)
+static int hsl_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr)
{
int ret = -ENOENT;
diff --git a/src/input/ipa.c b/src/input/ipa.c
index 6f9639f..3f37d47 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -176,7 +176,7 @@
static void ipa_link_timer_cb(void *data);
-struct ipa_link *ipa_client_link_create(void *ctx)
+struct ipa_link *ipa_client_link_create(void *ctx, const char *addr)
{
struct ipa_link *ipa_link;
@@ -190,6 +190,7 @@
ipa_link->state = IPA_LINK_STATE_CONNECTING;
ipa_link->timer.cb = ipa_link_timer_cb;
ipa_link->timer.data = ipa_link;
+ ipa_link->addr = talloc_strdup(ipa_link, addr);
return ipa_link;
}
@@ -204,7 +205,7 @@
int ret;
ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
- "127.0.0.1", IPA_TCP_PORT_OML,
+ link->addr, IPA_TCP_PORT_OML,
OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK);
if (ret < 0) {
if (errno != EINPROGRESS)
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 4a86300..18e30dc 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -378,8 +378,8 @@
return rc;
}
-static int
-ipaccess_line_update(struct e1inp_line *line, enum e1inp_line_role role);
+static int ipaccess_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr);
struct e1inp_driver ipaccess_driver = {
.name = "ipa",
@@ -479,8 +479,8 @@
return 0;
}
-static int
-ipaccess_line_update(struct e1inp_line *line, enum e1inp_line_role role)
+static int ipaccess_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr)
{
int ret = -ENOENT;
@@ -490,8 +490,7 @@
/* Listen for OML connections */
ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
- "0.0.0.0", IPA_TCP_PORT_OML,
- OSMO_SOCK_F_BIND);
+ addr, IPA_TCP_PORT_OML, OSMO_SOCK_F_BIND);
if (ret < 0)
return ret;
@@ -506,8 +505,7 @@
}
/* Listen for RSL connections */
ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
- "0.0.0.0", IPA_TCP_PORT_RSL,
- OSMO_SOCK_F_BIND);
+ addr, IPA_TCP_PORT_RSL, OSMO_SOCK_F_BIND);
if (ret < 0)
return ret;
@@ -526,7 +524,7 @@
LOGP(DINP, LOGL_NOTICE, "enabling ipaccess BTS mode\n");
- link = ipa_client_link_create(tall_ipa_ctx);
+ link = ipa_client_link_create(tall_ipa_ctx, addr);
if (link == NULL) {
perror("ipa_client_link_create: ");
return -ENOMEM;
diff --git a/src/input/misdn.c b/src/input/misdn.c
index 4bc2e4b..3ccfc4d 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -384,8 +384,8 @@
return ret;
}
-static int
-mi_e1_line_update(struct e1inp_line *line, enum e1inp_line_role role);
+static int mi_e1_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr);
struct e1inp_driver misdn_driver = {
.name = "misdn",
@@ -483,8 +483,8 @@
return 0;
}
-static int
-mi_e1_line_update(struct e1inp_line *line, enum e1inp_line_role role)
+static int mi_e1_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr)
{
struct mISDN_devinfo devinfo;
int sk, ret, cnt;