summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso2011-06-23 13:36:34 +0200
committerPablo Neira Ayuso2011-06-23 13:36:34 +0200
commite009f4a009e028fbd041e8731e75c4c39d52cdd1 (patch)
tree5bf803bfe549537454aec326f17a802b7da45547
parentipaccess: remove dead code from ipaccess adriver (diff)
downloadlibosmo-abis-e009f4a009e028fbd041e8731e75c4c39d52cdd1.tar.gz
libosmo-abis-e009f4a009e028fbd041e8731e75c4c39d52cdd1.tar.xz
libosmo-abis-e009f4a009e028fbd041e8731e75c4c39d52cdd1.zip
ipa: extend ipa_*link_create() to take one generic data pointer
With this patch we can attach generic data to some IPA link. This will be useful for the IPA proxy support.
-rw-r--r--include/osmocom/abis/ipa.h6
-rw-r--r--src/input/hsl.c3
-rw-r--r--src/input/ipa.c8
-rw-r--r--src/input/ipaccess.c8
4 files changed, 16 insertions, 9 deletions
diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h
index 1a9e5d4..1ed4871 100644
--- a/include/osmocom/abis/ipa.h
+++ b/include/osmocom/abis/ipa.h
@@ -12,9 +12,10 @@ struct ipa_server_link {
const char *addr;
uint16_t port;
int (*accept_cb)(struct ipa_server_link *link, int fd);
+ void *data;
};
-struct ipa_server_link *ipa_server_link_create(void *ctx, struct e1inp_line *line, const char *addr, uint16_t port, int (*accept_cb)(struct ipa_server_link *link, int fd));
+struct ipa_server_link *ipa_server_link_create(void *ctx, struct e1inp_line *line, const char *addr, uint16_t port, int (*accept_cb)(struct ipa_server_link *link, int fd), void *data);
void ipa_server_link_destroy(struct ipa_server_link *link);
int ipa_server_link_open(struct ipa_server_link *link);
@@ -36,9 +37,10 @@ struct ipa_client_link {
const char *addr;
uint16_t port;
int (*cb)(struct ipa_client_link *link, struct msgb *msg);
+ void *data;
};
-struct ipa_client_link *ipa_client_link_create(void *ctx, struct e1inp_line *line, const char *addr, uint16_t port, int (*cb)(struct ipa_client_link *link, struct msgb *msgb));
+struct ipa_client_link *ipa_client_link_create(void *ctx, struct e1inp_line *line, const char *addr, uint16_t port, int (*cb)(struct ipa_client_link *link, struct msgb *msgb), void *data);
void ipa_client_link_destroy(struct ipa_client_link *link);
int ipa_client_link_open(struct ipa_client_link *link);
diff --git a/src/input/hsl.c b/src/input/hsl.c
index bc8fdb0..0b6b078 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -338,7 +338,8 @@ static int hsl_line_update(struct e1inp_line *line,
LOGP(DINP, LOGL_NOTICE, "enabling hsl BTS mode\n");
link = ipa_client_link_create(tall_hsl_ctx, line, addr,
- HSL_TCP_PORT, hsl_bts_process);
+ HSL_TCP_PORT, hsl_bts_process,
+ NULL);
if (link == NULL) {
LOGP(DINP, LOGL_ERROR, "cannot create BTS link: %s\n",
strerror(errno));
diff --git a/src/input/ipa.c b/src/input/ipa.c
index d99e310..bb32fe1 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -179,7 +179,8 @@ static void ipa_link_timer_cb(void *data);
struct ipa_client_link *
ipa_client_link_create(void *ctx, struct e1inp_line *line,
const char *addr, uint16_t port,
- int (*cb)(struct ipa_client_link *link, struct msgb *msgb))
+ int (*cb)(struct ipa_client_link *link,
+ struct msgb *msgb), void *data)
{
struct ipa_client_link *ipa_link;
@@ -197,6 +198,7 @@ ipa_client_link_create(void *ctx, struct e1inp_line *line,
ipa_link->port = port;
ipa_link->cb = cb;
ipa_link->line = line;
+ ipa_link->data = data;
return ipa_link;
}
@@ -265,7 +267,8 @@ int ipa_server_fd_cb(struct osmo_fd *ofd, unsigned int what)
struct ipa_server_link *
ipa_server_link_create(void *ctx, struct e1inp_line *line,
const char *addr, uint16_t port,
- int (*accept_cb)(struct ipa_server_link *link, int fd))
+ int (*accept_cb)(struct ipa_server_link *link, int fd),
+ void *data)
{
struct ipa_server_link *ipa_link;
@@ -280,6 +283,7 @@ ipa_server_link_create(void *ctx, struct e1inp_line *line,
ipa_link->port = port;
ipa_link->accept_cb = accept_cb;
ipa_link->line = line;
+ ipa_link->data = data;
return ipa_link;
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index a6d09b3..8ce10ab 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -459,7 +459,7 @@ static int ipaccess_line_update(struct e1inp_line *line,
oml_link = ipa_server_link_create(tall_ipa_ctx, line,
"0.0.0.0", IPA_TCP_PORT_OML,
- ipaccess_bsc_oml_cb);
+ ipaccess_bsc_oml_cb, NULL);
if (oml_link == NULL) {
LOGP(DINP, LOGL_ERROR, "cannot create OML "
"BSC link: %s\n", strerror(errno));
@@ -474,7 +474,7 @@ static int ipaccess_line_update(struct e1inp_line *line,
}
rsl_link = ipa_server_link_create(tall_ipa_ctx, line,
"0.0.0.0", IPA_TCP_PORT_RSL,
- ipaccess_bsc_rsl_cb);
+ ipaccess_bsc_rsl_cb, NULL);
if (rsl_link == NULL) {
LOGP(DINP, LOGL_ERROR, "cannot create RSL "
"BSC link: %s\n", strerror(errno));
@@ -497,7 +497,7 @@ static int ipaccess_line_update(struct e1inp_line *line,
link = ipa_client_link_create(tall_ipa_ctx, line,
addr, IPA_TCP_PORT_OML,
- ipaccess_bts_cb);
+ ipaccess_bts_cb, NULL);
if (link == NULL) {
LOGP(DINP, LOGL_ERROR, "cannot create OML "
"BTS link: %s\n", strerror(errno));
@@ -512,7 +512,7 @@ static int ipaccess_line_update(struct e1inp_line *line,
}
rsl_link = ipa_client_link_create(tall_ipa_ctx, line,
addr, IPA_TCP_PORT_RSL,
- ipaccess_bts_cb);
+ ipaccess_bts_cb, NULL);
if (rsl_link == NULL) {
LOGP(DINP, LOGL_ERROR, "cannot create RSL "
"BTS link: %s\n", strerror(errno));