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);
|
||||
|
||||
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,
|
||||
uint8_t ss, uint32_t fn, int8_t signal_dbm,
|
||||
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_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,
|
||||
uint8_t chan_type, uint8_t ss, uint32_t fn,
|
||||
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
|
||||
* 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 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->hdr_len = sizeof(*gh)/4;
|
||||
gh->type = GSMTAP_TYPE_UM;
|
||||
gh->type = type;
|
||||
gh->timeslot = ts;
|
||||
gh->sub_slot = ss;
|
||||
gh->arfcn = htons(arfcn);
|
||||
|
@ -134,6 +134,14 @@ struct msgb *gsmtap_makemsg(uint16_t arfcn, uint8_t ts, uint8_t chan_type,
|
|||
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
|
||||
|
||||
#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 */
|
||||
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,
|
||||
int8_t signal_dbm, uint8_t snr, const uint8_t *data,
|
||||
unsigned int len)
|
||||
|
@ -219,7 +227,7 @@ int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
|||
if (!gti)
|
||||
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);
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
@ -227,6 +235,15 @@ int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
|
|||
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 */
|
||||
static int gsmtap_wq_w_cb(struct osmo_fd *ofd, struct msgb *msg)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue