pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-cbc/+/28299 )
Change subject: Rework cbsp_cbc_create() params
......................................................................
Rework cbsp_cbc_create() params
There's no need to pass the specific params. Let's simply get whatever
need from the global config in the function.
This makes it easier to extend it to more params if needed.
Also, when we add SBc-AP support, the params that have to be passed to
the counter part function are different, so let's simplify param
passing here.
While at it, rename also the callback function to contain "cbsp" on it,
since it is cbsp specific.
Change-Id: Ia2362757275e7cbce82b64c7c2a0798276d964c3
---
M src/cbc_main.c
M src/cbsp_server.c
M src/cbsp_server.h
M src/cbsp_server_fsm.c
4 files changed, 8 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/cbc_main.c b/src/cbc_main.c
index bf29a1a..140d047 100644
--- a/src/cbc_main.c
+++ b/src/cbc_main.c
@@ -244,8 +244,7 @@
exit(1);
}
- if (cbsp_cbc_create(tall_cbc_ctx, g_cbc->config.cbsp.local_host,
g_cbc->config.cbsp.local_port,
- &cbc_client_rx_cb) == NULL) {
+ if (cbsp_cbc_create(tall_cbc_ctx) == NULL) {
perror("Error binidng CBSP port\n");
exit(1);
}
diff --git a/src/cbsp_server.c b/src/cbsp_server.c
index 3aa6332..c3d7471 100644
--- a/src/cbsp_server.c
+++ b/src/cbsp_server.c
@@ -206,18 +206,18 @@
}
/* initialize the CBC-side CBSP server */
-struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx, const char *bind_ip, int bind_port,
- int (*rx_cb)(struct osmo_cbsp_cbc_client *client,
- struct osmo_cbsp_decoded *dec))
+struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx)
{
struct osmo_cbsp_cbc *cbc = talloc_zero(ctx, struct osmo_cbsp_cbc);
int rc;
+ char *bind_ip = g_cbc->config.cbsp.local_host;
+ int bind_port = g_cbc->config.cbsp.local_port;
if (bind_port == -1)
bind_port = CBSP_TCP_PORT;
OSMO_ASSERT(cbc);
- cbc->rx_cb = rx_cb;
+ cbc->rx_cb = cbsp_cbc_client_rx_cb;
INIT_LLIST_HEAD(&cbc->clients);
cbc->link = osmo_stream_srv_link_create(cbc);
osmo_stream_srv_link_set_data(cbc->link, cbc);
diff --git a/src/cbsp_server.h b/src/cbsp_server.h
index 8e91a53..21367c4 100644
--- a/src/cbsp_server.h
+++ b/src/cbsp_server.h
@@ -23,9 +23,7 @@
int (*rx_cb)(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec);
};
-struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx, const char *bind_ip, int bind_port,
- int (*rx_cb)(struct osmo_cbsp_cbc_client *client,
- struct osmo_cbsp_decoded *dec));
+struct osmo_cbsp_cbc *cbsp_cbc_create(void *ctx);
/* a single (remote) client connected to the (local) CBC server */
struct osmo_cbsp_cbc_client {
@@ -44,3 +42,4 @@
const char *cbsp_cbc_client_name(const struct osmo_cbsp_cbc_client *client);
void cbsp_cbc_client_tx(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded
*cbsp);
void cbsp_cbc_client_close(struct osmo_cbsp_cbc_client *client);
+int cbsp_cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded
*dec);
diff --git a/src/cbsp_server_fsm.c b/src/cbsp_server_fsm.c
index 8fc16a8..b99a80a 100644
--- a/src/cbsp_server_fsm.c
+++ b/src/cbsp_server_fsm.c
@@ -269,7 +269,7 @@
}
/* message was received from remote CBSP peer (BSC) */
-int cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded *dec)
+int cbsp_cbc_client_rx_cb(struct osmo_cbsp_cbc_client *client, struct osmo_cbsp_decoded
*dec)
{
struct cbc_message *smscb;
struct cbc_message_peer *mp;
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit
https://gerrit.osmocom.org/c/osmo-cbc/+/28299
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ia2362757275e7cbce82b64c7c2a0798276d964c3
Gerrit-Change-Number: 28299
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged