trx_interface: implement built-in timeslot filter

There is a dedicated block named 'Burst Timeslot Filter', which
could be used, but one doesn't expose the API to change the
timeslot index 'on fly'.

This change implements built-in timeslot filter in 'TRX Interface'
block, which will be used until the proper block expose API.
diff --git a/include/grgsm/trx_interface/trx.h b/include/grgsm/trx_interface/trx.h
index 7821389..997ef62 100644
--- a/include/grgsm/trx_interface/trx.h
+++ b/include/grgsm/trx_interface/trx.h
@@ -50,6 +50,10 @@
       static sptr make(
         const std::string &remote_addr,
         const std::string &base_port);
+
+      /* Expose internal timeslot filter API */
+      virtual void ts_filter_set_tn(int tn) = 0;
+      virtual int ts_filter_get_tn(void) = 0;
     };
 
   } // namespace grgsm
diff --git a/lib/trx_interface/trx_impl.cc b/lib/trx_interface/trx_impl.cc
index 8847278..2068da3 100644
--- a/lib/trx_interface/trx_impl.cc
+++ b/lib/trx_interface/trx_impl.cc
@@ -87,6 +87,9 @@
         // Bind DATA interface handler
         d_data_sock->udp_rx_handler = boost::bind(
           &trx_impl::handle_ul_burst, this, _1, _2);
+
+        // Init timeslot filter
+        d_ts_filter_tn = -1;
     }
 
     /*
@@ -100,6 +103,21 @@
     }
 
     /*
+     * Timeslot filter API (getter and setter)
+     */
+    void
+    trx_impl::ts_filter_set_tn(int tn)
+    {
+      d_ts_filter_tn = (tn >= 0 && tn <= 7) ? tn : -1;
+    }
+
+    int
+    trx_impl::ts_filter_get_tn(void)
+    {
+      return d_ts_filter_tn;
+    }
+
+    /*
      * Check if burst is a RACH burst
      */
     bool trx_impl::detect_rach(uint8_t *burst)
@@ -192,6 +210,10 @@
       // Compose a new UDP payload with burst
       burst_pack(msg, buf);
 
+      // Timeslot filter
+      if (d_ts_filter_tn != -1 && buf[0] != d_ts_filter_tn)
+        return;
+
       // Send a burst
       d_data_sock->udp_send(buf, 158);
     }
diff --git a/lib/trx_interface/trx_impl.h b/lib/trx_interface/trx_impl.h
index 65b4d97..19e4848 100644
--- a/lib/trx_interface/trx_impl.h
+++ b/lib/trx_interface/trx_impl.h
@@ -36,6 +36,7 @@
      private:
       udp_socket *d_data_sock;
       udp_socket *d_clck_sock;
+      int d_ts_filter_tn;
 
       bool detect_rach(uint8_t *burst);
       void clck_ind_send(uint32_t frame_nr);
@@ -45,6 +46,10 @@
       trx_impl(const std::string &remote_addr, int base_port);
       ~trx_impl();
 
+      /* Timeslot filter API */
+      void ts_filter_set_tn(int tn);
+      int ts_filter_get_tn(void);
+
       void handle_dl_burst(pmt::pmt_t msg);
       void handle_ul_burst(uint8_t *payload, size_t len);
     };