pespin has uploaded this change for review.

View Change

examples,tests: stream: use new osmo_stream_{cli,srv}_set_segmentation_cb2

The older API osmo_stream_{cli,srv}_set_segmentation_cb() is now
deprecated, use the newer one.

Change-Id: I5d6131c65ad6d47f1567dde498a0637c48a0fde9
---
M examples/ipa-stream-client.c
M examples/ipa-stream-server.c
M tests/stream/stream_test.c
3 files changed, 25 insertions(+), 6 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/82/39382/1
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index 2604266..9e27faa 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -142,6 +142,11 @@
return 0;
}

+static int cli_segmentation_cb2(struct osmo_stream_cli *cli, struct msgb *msg)
+{
+ return osmo_ipa_segmentation_cb(msg);
+}
+
static void *tall_test;

int main(int argc, char *argv[])
@@ -184,7 +189,7 @@
exit(EXIT_FAILURE);
}

- osmo_stream_cli_set_segmentation_cb(conn, osmo_ipa_segmentation_cb);
+ osmo_stream_cli_set_segmentation_cb2(conn, cli_segmentation_cb2);

LOGP(DIPATEST, LOGL_NOTICE, "Entering main loop\n");

diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index e87eab4..71f4c6d 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -69,6 +69,11 @@
return 0;
}

+static int srv_segmentation_cb2(struct osmo_stream_srv *conn, struct msgb *msg)
+{
+ return osmo_ipa_segmentation_cb(msg);
+}
+
static int accept_cb(struct osmo_stream_srv_link *srv, int fd)
{
if (conn != NULL) {
@@ -86,7 +91,7 @@
osmo_stream_srv_set_name(conn, "ipa_srv");
osmo_stream_srv_set_read_cb(conn, read_cb);
osmo_stream_srv_set_closed_cb(conn, close_cb);
- osmo_stream_srv_set_segmentation_cb(conn, osmo_ipa_segmentation_cb);
+ osmo_stream_srv_set_segmentation_cb2(conn, srv_segmentation_cb2);

return 0;
}
diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c
index f2f1d4f..4fae6de 100644
--- a/tests/stream/stream_test.c
+++ b/tests/stream/stream_test.c
@@ -140,6 +140,11 @@
return cli;
}

+static int cli_segmentation_cb2(struct osmo_stream_cli *cli, struct msgb *msg)
+{
+ return osmo_ipa_segmentation_cb(msg);
+}
+
/* Without explicit timeout set with osmo_stream_cli_set_reconnect_timeout() default value is used.
static struct osmo_stream_cli *init_client_reconnection_broken1(struct osmo_stream_cli *cli, bool autoreconnect)
{
@@ -337,6 +342,10 @@
return 0;
}

+static int srv_segmentation_cb2(struct osmo_stream_srv *conn, struct msgb *msg)
+{
+ return osmo_ipa_segmentation_cb(msg);
+}

static void test_recon(void *ctx, const char *host, unsigned port, unsigned steps, struct osmo_stream_srv_link *lnk,
bool autoreconnect)
@@ -568,7 +577,7 @@
fprintf(stderr, "Cannot open stream client\n");
return NULL;
}
- osmo_stream_cli_set_segmentation_cb(osc, osmo_ipa_segmentation_cb);
+ osmo_stream_cli_set_segmentation_cb2(osc, cli_segmentation_cb2);

return osc;
}
@@ -629,7 +638,7 @@
fprintf(stderr, "Error while creating connection\n");
return -1;
}
- osmo_stream_srv_set_segmentation_cb(oss, osmo_ipa_segmentation_cb);
+ osmo_stream_srv_set_segmentation_cb2(oss, srv_segmentation_cb2);
osmo_stream_srv_set_read_cb(oss, test_segm_ipa_stream_srv_srv_read_cb);
return 0;
}
@@ -785,7 +794,7 @@
fprintf(stderr, "Cannot allocate message\n");
return -ENOMEM;
}
- osmo_stream_srv_set_segmentation_cb(oss, osmo_ipa_segmentation_cb);
+ osmo_stream_srv_set_segmentation_cb2(oss, srv_segmentation_cb2);
osmo_stream_srv_set_read_cb(oss, test_segm_ipa_stream_cli_srv_read_cb);

/* Send 4 and 1/3 messages, as done analogously in test_segm_ipa_stream_srv_cli_connect_cb() */
@@ -851,7 +860,7 @@
osmo_stream_cli_set_port(osc, 1112);
osmo_stream_cli_set_read_cb2(osc, test_segm_ipa_stream_cli_cli_read_cb);
osmo_stream_cli_set_nodelay(osc, true);
- osmo_stream_cli_set_segmentation_cb(osc, osmo_ipa_segmentation_cb);
+ osmo_stream_cli_set_segmentation_cb2(osc, cli_segmentation_cb2);
if (osmo_stream_cli_open(osc) < 0) {
fprintf(stderr, "Cannot open stream client\n");
return NULL;

To view, visit change 39382. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I5d6131c65ad6d47f1567dde498a0637c48a0fde9
Gerrit-Change-Number: 39382
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>