summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso2011-06-21 12:22:49 +0200
committerPablo Neira Ayuso2011-06-21 12:22:49 +0200
commitc00ee7399d06ecaee66795e56e546cef89768cb2 (patch)
tree9992cc8848cd53a339e91b98187ac2a65aba9ecc
parentinput: ipaccess: add preliminary BTS-side for A-bis over IP (diff)
downloadlibosmo-abis-c00ee7399d06ecaee66795e56e546cef89768cb2.tar.gz
libosmo-abis-c00ee7399d06ecaee66795e56e546cef89768cb2.tar.xz
libosmo-abis-c00ee7399d06ecaee66795e56e546cef89768cb2.zip
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.
-rw-r--r--include/osmocom/abis/e1_input.h4
-rw-r--r--include/osmocom/abis/ipa.h4
-rw-r--r--src/e1_input.c5
-rw-r--r--src/input/dahdi.c8
-rw-r--r--src/input/hsl.c7
-rw-r--r--src/input/ipa.c5
-rw-r--r--src/input/ipaccess.c16
-rw-r--r--src/input/misdn.c8
-rw-r--r--tests/e1inp_ipa_bsc_test.c2
-rw-r--r--tests/e1inp_ipa_bts_test.c2
10 files changed, 31 insertions, 30 deletions
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index c401baa..c52e441 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -115,7 +115,7 @@ struct e1inp_driver {
struct llist_head list;
const char *name;
int (*want_write)(struct e1inp_ts *ts);
- int (*line_update)(struct e1inp_line *line, enum e1inp_line_role role);
+ int (*line_update)(struct e1inp_line *line, enum e1inp_line_role role, const char *addr);
int default_delay;
};
@@ -206,7 +206,7 @@ void e1_set_pcap_fd(int fd);
struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
-int e1inp_line_update(struct e1inp_line *line, enum e1inp_line_role role);
+int e1inp_line_update(struct e1inp_line *line, enum e1inp_line_role role, const char *addr);
struct gsm_network;
int ipaccess_setup(struct gsm_network *gsmnet);
diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h
index de1d70f..83e4472 100644
--- a/include/osmocom/abis/ipa.h
+++ b/include/osmocom/abis/ipa.h
@@ -17,11 +17,11 @@ struct ipa_link {
struct llist_head tx_queue;
struct osmo_timer_list timer;
enum ipa_link_state state;
- struct sockaddr_in addr;
+ const char *addr;
int (*process)(struct ipa_link *link, struct msgb *msg);
};
-struct ipa_link *ipa_client_link_create(void *ctx);
+struct ipa_link *ipa_client_link_create(void *ctx, const char *addr);
void ipa_client_link_destroy(struct ipa_link *link);
int ipa_client_link_open(struct ipa_link *link);
diff --git a/src/e1_input.c b/src/e1_input.c
index 3453ad0..1781f18 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -560,7 +560,8 @@ struct e1inp_driver *e1inp_driver_find(const char *name)
return NULL;
}
-int e1inp_line_update(struct e1inp_line *line, enum e1inp_line_role role)
+int e1inp_line_update(struct e1inp_line *line,
+ enum e1inp_line_role role, const char *addr)
{
struct input_signal_data isd;
int rc;
@@ -570,7 +571,7 @@ int e1inp_line_update(struct e1inp_line *line, enum e1inp_line_role role)
return 0;
if (line->driver && line->driver->line_update)
- rc = line->driver->line_update(line, role);
+ rc = line->driver->line_update(line, role, addr);
else
rc = 0;
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 @@ static int dahdi_fd_cb(struct osmo_fd *bfd, unsigned int what)
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 @@ static int dahdi_e1_setup(struct e1inp_line *line)
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 @@ static int hsl_fd_cb(struct osmo_fd *bfd, unsigned int what)
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 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
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 @@ int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what)
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 @@ struct ipa_link *ipa_client_link_create(void *ctx)
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 ipa_client_link_open(struct ipa_link *link)
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 @@ static int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what)
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 @@ static int rsl_listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
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 @@ ipaccess_line_update(struct e1inp_line *line, enum e1inp_line_role role)
/* 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 @@ ipaccess_line_update(struct e1inp_line *line, enum e1inp_line_role role)
}
/* 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 @@ ipaccess_line_update(struct e1inp_line *line, enum e1inp_line_role role)
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 @@ static int activate_bchan(struct e1inp_line *line, int ts, int act)
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 @@ static int mi_e1_setup(struct e1inp_line *line, int release_l2)
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;
diff --git a/tests/e1inp_ipa_bsc_test.c b/tests/e1inp_ipa_bsc_test.c
index 6c1cacc..3dfbc54 100644
--- a/tests/e1inp_ipa_bsc_test.c
+++ b/tests/e1inp_ipa_bsc_test.c
@@ -76,7 +76,7 @@ int main(void)
* it explains how this is done with ISDN.
*/
- if (e1inp_line_update(line, E1INP_LINE_R_BSC) < 0) {
+ if (e1inp_line_update(line, E1INP_LINE_R_BSC, "0.0.0.0") < 0) {
LOGP(DBSCTEST, LOGL_ERROR, "problem creating E1 line\n");
exit(EXIT_FAILURE);
}
diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c
index bf6cf16..6f4ceaa 100644
--- a/tests/e1inp_ipa_bts_test.c
+++ b/tests/e1inp_ipa_bts_test.c
@@ -76,7 +76,7 @@ int main(void)
* it explains how this is done with ISDN.
*/
- if (e1inp_line_update(line, E1INP_LINE_R_BTS) < 0) {
+ if (e1inp_line_update(line, E1INP_LINE_R_BTS, "127.0.0.1") < 0) {
LOGP(DBTSTEST, LOGL_ERROR, "problem enabling E1 line\n");
exit(EXIT_FAILURE);
}