aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 13:04:39 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 13:04:39 +0200
commit8a8c47aaba37865a3696e3ffd4d96c8aa3b70be8 (patch)
treefaa75a9e4ea20d57365f6a0c84f68487e1bd62a1 /src
parent937ab515cb7e2374b92b380e2b3d69f548a6024d (diff)
osmux: use logging infrastructure
so far, printf was used instead.
Diffstat (limited to 'src')
-rw-r--r--src/osmux.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/osmux.c b/src/osmux.c
index 38859b3..8145905 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -15,6 +15,7 @@
#include <osmocom/core/timer.h>
#include <osmocom/core/select.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
#include <osmocom/netif/amr.h>
#include <osmocom/netif/rtp.h>
@@ -24,6 +25,9 @@
#define DEBUG_TIMING 1
+/* XXX: this needs to be defined in libosmocore */
+#define DOSMUX 0
+
#define OSMUX_BATCH_MAX 1480 /* XXX: MTU - iphdr (20 bytes) */
struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg)
@@ -36,7 +40,8 @@ struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg)
msgb_pull(msg, sizeof(struct osmux_hdr) +
osmo_amr_bytes(osmuxh->amr_cmr));
} else if (msg->len > 0) {
- printf("remaining %d bytes, broken osmuxhdr?\n", msg->len);
+ LOGP(DOSMUX, LOGL_ERROR,
+ "remaining %d bytes, broken osmuxhdr?\n", msg->len);
}
return osmuxh;
@@ -105,7 +110,7 @@ static int osmux_batch_has_room(int msg_len)
void osmux_xfrm_input_deliver(struct osmux_in_handle *h)
{
- printf("invoking delivery function\n");
+ LOGP(DOSMUX, LOGL_DEBUG, "invoking delivery function\n");
h->deliver(batch.msg);
msgb_free(batch.msg);
batch.msg = NULL;
@@ -116,7 +121,7 @@ static void osmux_batch_timer_expired(void *data)
{
struct osmux_in_handle *h = data;
- printf("batch timeout!\n");
+ LOGP(DOSMUX, LOGL_DEBUG, "received message from stream\n");
osmux_xfrm_input_deliver(h);
}
@@ -125,7 +130,7 @@ static struct msgb *osmux_batch_get(void)
if (batch.msg == NULL) {
batch.msg = msgb_alloc(OSMUX_BATCH_MAX, "OSMUX");
if (batch.msg == NULL) {
- fprintf(stderr, "Not enough memory\n");
+ LOGP(DOSMUX, LOGL_ERROR, "Not enough memory\n");
return NULL;
}
@@ -240,7 +245,8 @@ static void osmux_tx_cb(void *data)
gettimeofday(&now, NULL);
timersub(&now, &h->start, &diff);
- printf("difference %lu.%.6lu\n", diff.tv_sec, diff.tv_usec);
+ LOGP(DOSMUX, LOGL_DEBUG, "difference %lu.%.6lu\n",
+ diff.tv_sec, diff.tv_usec);
#endif
h->tx_cb(h->msg, h->data);