From a145d368a12bc43c705ce6f918e61fb2767ff8a5 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Sun, 30 Oct 2011 21:32:40 +0100 Subject: [PATCH] gsmtap: Send proper FN & TN ... and adapt gsm1_rx consequently Signed-off-by: Sylvain Munaut --- include/osmocom/gmr1/gsmtap.h | 4 +++- src/gmr1_rx.c | 8 ++++++-- src/gsmtap.c | 9 ++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/osmocom/gmr1/gsmtap.h b/include/osmocom/gmr1/gsmtap.h index 878b7d6..8dc86ec 100644 --- a/include/osmocom/gmr1/gsmtap.h +++ b/include/osmocom/gmr1/gsmtap.h @@ -36,7 +36,9 @@ struct msgb; #define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */ #define GSMTAP_GMR1_BCCH 0x01 -struct msgb *gmr1_gsmtap_makemsg(uint8_t chan_type, const uint8_t *l2, int len); +struct msgb *gmr1_gsmtap_makemsg( + uint8_t chan_type, uint32_t fn, uint8_t tn, + const uint8_t *l2, int len); /*! }@ */ diff --git a/src/gmr1_rx.c b/src/gmr1_rx.c index 7cbbdfd..6f586b2 100644 --- a/src/gmr1_rx.c +++ b/src/gmr1_rx.c @@ -365,7 +365,9 @@ rx_bcch(struct chan_desc *cd, float *energy) /* Send to GSMTap if correct */ if (!crc) - gsmtap_sendmsg(g_gti, gmr1_gsmtap_makemsg(GSMTAP_GMR1_BCCH, l2, 24)); + gsmtap_sendmsg(g_gti, gmr1_gsmtap_makemsg( + GSMTAP_GMR1_BCCH, + cd->fn, cd->sa_bcch_stn, l2, 24)); return 0; } @@ -407,7 +409,9 @@ rx_ccch(struct chan_desc *cd, float min_energy) /* Send to GSMTap if correct */ if (!crc) - gsmtap_sendmsg(g_gti, gmr1_gsmtap_makemsg(GSMTAP_GMR1_CCCH, l2, 24)); + gsmtap_sendmsg(g_gti, gmr1_gsmtap_makemsg( + GSMTAP_GMR1_CCCH, + cd->fn, cd->sa_bcch_stn, l2, 24)); return 0; } diff --git a/src/gsmtap.c b/src/gsmtap.c index 26f3bf4..d3aa6bf 100644 --- a/src/gsmtap.c +++ b/src/gsmtap.c @@ -28,6 +28,8 @@ #include #include +#include + #include #include #include @@ -39,7 +41,8 @@ * \param[in] len Length of the l2 data in bytes */ struct msgb * -gmr1_gsmtap_makemsg(uint8_t chan_type, const uint8_t *l2, int len) +gmr1_gsmtap_makemsg(uint8_t chan_type, uint32_t fn, uint8_t tn, + const uint8_t *l2, int len) { struct msgb *msg; struct gsmtap_hdr *gh; @@ -53,11 +56,11 @@ gmr1_gsmtap_makemsg(uint8_t chan_type, const uint8_t *l2, int len) gh->version = GSMTAP_VERSION; gh->hdr_len = sizeof(*gh)/4; gh->type = GSMTAP_TYPE_GMR1_UM; - gh->timeslot = 0; + gh->timeslot = tn; gh->sub_slot = 0; gh->snr_db = 0; gh->signal_dbm = 0; - gh->frame_number = 0; + gh->frame_number = htonl(fn); gh->sub_type = chan_type; gh->antenna_nr = 0;