mirror of https://gerrit.osmocom.org/libosmocore
gsmtap: Add a _ex version of gsmtap_{makemsg,send} to specify content type
From: iZsh <izsh@fail0verflow.com> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
aa244bfe63
commit
15ae715b0d
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id);
|
uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t rsl_link_id);
|
||||||
|
|
||||||
|
struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
|
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||||
|
uint8_t snr, const uint8_t *data, unsigned int len);
|
||||||
|
|
||||||
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||||
uint8_t snr, const uint8_t *data, unsigned int len);
|
uint8_t snr, const uint8_t *data, unsigned int len);
|
||||||
|
@ -40,6 +44,11 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti);
|
||||||
|
|
||||||
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg);
|
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg);
|
||||||
|
|
||||||
|
int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts,
|
||||||
|
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||||
|
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||||
|
unsigned int len);
|
||||||
|
|
||||||
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||||
|
|
|
@ -102,7 +102,7 @@ uint8_t chantype_rsl2gsmtap(uint8_t rsl_chantype, uint8_t link_id)
|
||||||
* This function will allocate a new msgb and fill it with a GSMTAP
|
* This function will allocate a new msgb and fill it with a GSMTAP
|
||||||
* header containing the information
|
* header containing the information
|
||||||
*/
|
*/
|
||||||
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
struct msgb *gsmtap_makemsg_ex(uint8_t type, uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||||
uint8_t snr, const uint8_t *data, unsigned int len)
|
uint8_t snr, const uint8_t *data, unsigned int len)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
|
|
||||||
gh->version = GSMTAP_VERSION;
|
gh->version = GSMTAP_VERSION;
|
||||||
gh->hdr_len = sizeof(*gh)/4;
|
gh->hdr_len = sizeof(*gh)/4;
|
||||||
gh->type = GSMTAP_TYPE_UM;
|
gh->type = type;
|
||||||
gh->timeslot = ts;
|
gh->timeslot = ts;
|
||||||
gh->sub_slot = ss;
|
gh->sub_slot = ss;
|
||||||
gh->arfcn = htons(arfcn);
|
gh->arfcn = htons(arfcn);
|
||||||
|
@ -134,6 +134,14 @@ struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
||||||
|
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||||
|
uint8_t snr, const uint8_t *data, unsigned int len)
|
||||||
|
{
|
||||||
|
return gsmtap_makemsg_ex(GSMTAP_TYPE_UM, arfcn, ts, chan_type,
|
||||||
|
ss, fn, signal_dbm, snr, data, len);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -209,7 +217,7 @@ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief receive a message from L1/L2 and put it in GSMTAP */
|
/*! \brief receive a message from L1/L2 and put it in GSMTAP */
|
||||||
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
int gsmtap_send_ex(struct gsmtap_inst *gti, uint8_t type, uint16_t arfcn, uint8_t ts,
|
||||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||||
unsigned int len)
|
unsigned int len)
|
||||||
|
@ -219,7 +227,7 @@ int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||||
if (!gti)
|
if (!gti)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
msg = gsmtap_makemsg(arfcn, ts, chan_type, ss, fn, signal_dbm,
|
msg = gsmtap_makemsg_ex(type, arfcn, ts, chan_type, ss, fn, signal_dbm,
|
||||||
snr, data, len);
|
snr, data, len);
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -227,6 +235,15 @@ int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||||
return gsmtap_sendmsg(gti, msg);
|
return gsmtap_sendmsg(gti, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
||||||
|
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||||
|
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||||
|
unsigned int len)
|
||||||
|
{
|
||||||
|
return gsmtap_send_ex(gti, GSMTAP_TYPE_UM, arfcn, ts, chan_type, ss, fn,
|
||||||
|
signal_dbm, snr, data, len);
|
||||||
|
}
|
||||||
|
|
||||||
/* Callback from select layer if we can write to the socket */
|
/* Callback from select layer if we can write to the socket */
|
||||||
static int gsmtap_wq_w_cb(struct osmo_fd *ofd, struct msgb *msg)
|
static int gsmtap_wq_w_cb(struct osmo_fd *ofd, struct msgb *msg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue