aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ipa-stream-server.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-08-19 19:49:07 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2012-08-19 20:14:25 +0200
commit9ae91e594c129ddffaf3217da5834bf6d7d822f0 (patch)
tree01f4fe75ef0ade5731f3bbd8d84aa24c2f168b92 /examples/ipa-stream-server.c
parent7a3e8d01f54e68997c22036b1291f7f90a018def (diff)
ipa: add osmo_ipa_process_msg and remove osmo_ipa_recv_msg
This patch removes osmo_ipa_recv_msg, it performs two syscall invocations and it's stream generic. Now we use the specific receival function we want to use (no matter if stream or datagram based) and then we call osmo_ipa_process_msg to check that the IPA message correct.
Diffstat (limited to 'examples/ipa-stream-server.c')
-rw-r--r--examples/ipa-stream-server.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index 69e0280..c370d5f 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -46,7 +46,6 @@ void sighandler(int foo)
int read_cb(struct osmo_stream_srv *conn)
{
struct msgb *msg;
- struct osmo_fd *ofd = osmo_stream_srv_get_ofd(conn);
LOGP(DSTREAMTEST, LOGL_DEBUG, "received message from stream\n");
@@ -55,12 +54,18 @@ int read_cb(struct osmo_stream_srv *conn)
LOGP(DSTREAMTEST, LOGL_ERROR, "cannot allocate message\n");
return 0;
}
- if (osmo_ipa_msg_recv(ofd->fd, msg) <= 0) {
+ if (osmo_stream_srv_recv(conn, msg) <= 0) {
LOGP(DSTREAMTEST, LOGL_ERROR, "cannot receive message\n");
osmo_stream_srv_destroy(conn);
msgb_free(msg);
return 0;
}
+ if (osmo_ipa_process_msg(msg) < 0) {
+ LOGP(DSTREAMTEST, LOGL_ERROR, "Bad IPA message\n");
+ msgb_free(msg);
+ return 0;
+ }
+
osmo_stream_srv_send(conn, msg);
return 0;
}