gsmtap: Send proper FN & TN

... and adapt gsm1_rx consequently

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2011-10-30 21:32:40 +01:00
parent 9d1af55983
commit a145d368a1
3 changed files with 15 additions and 6 deletions

View File

@ -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);
/*! }@ */

View File

@ -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;
}

View File

@ -28,6 +28,8 @@
#include <stdint.h>
#include <string.h>
#include <arpa/inet.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/gmr1/gsmtap.h>
@ -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;