diff options
| author | Sylvain Munaut <tnt@246tNt.com> | 2011-09-26 13:05:07 +0200 | 
|---|---|---|
| committer | Sylvain Munaut <tnt@246tNt.com> | 2011-09-26 13:05:07 +0200 | 
| commit | 15ae715b0d4b077890989ac0ca5d35c18e62cd42 (patch) | |
| tree | 9fd9166e44835c70bcd5c773f213e90c29ae2358 /src | |
| parent | aa244bfe63eb16db587869bb1cc0503d225939d7 (diff) | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/gsmtap_util.c | 25 | 
1 files changed, 21 insertions, 4 deletions
| diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 0e4d61e5..3fa9dd65 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -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)  { | 
