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>
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 0e4d61e..3fa9dd6 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -102,7 +102,7 @@
  * 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 @@
 
 	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 @@
 	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 @@
 }
 
 /*! \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 @@
 	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 @@
 	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)
 {