Added tx bursts preprocessing block
diff --git a/grc/gsm_block_tree.xml b/grc/gsm_block_tree.xml
index 225c28f..dd971ab 100644
--- a/grc/gsm_block_tree.xml
+++ b/grc/gsm_block_tree.xml
@@ -26,6 +26,7 @@
       <block>gsm_txtime_bursts_tagger</block>
       <block>gsm_txtime_setter</block>
       <block>gsm_gmsk_mod</block>
+      <block>gsm_preprocess_tx_burst</block>
     </cat>
     <cat>
       <name>Logical channels demapping</name>
diff --git a/grc/transmitter/CMakeLists.txt b/grc/transmitter/CMakeLists.txt
index e512d10..0905e19 100644
--- a/grc/transmitter/CMakeLists.txt
+++ b/grc/transmitter/CMakeLists.txt
@@ -20,5 +20,6 @@
 install(FILES
     gsm_gmsk_mod.xml
     gsm_txtime_bursts_tagger.xml 
-    gsm_txtime_setter.xml DESTINATION share/gnuradio/grc/blocks
+    gsm_txtime_setter.xml 
+    preprocess_tx_burst.xml DESTINATION share/gnuradio/grc/blocks
 )
diff --git a/grc/transmitter/preprocess_tx_burst.xml b/grc/transmitter/preprocess_tx_burst.xml
new file mode 100644
index 0000000..70b447e
--- /dev/null
+++ b/grc/transmitter/preprocess_tx_burst.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<block>
+  <name>Preprocess Tx burst</name>
+  <key>gsm_preprocess_tx_burst</key>
+  <import>import grgsm</import>
+  <make>grgsm.preprocess_tx_burst()</make>
+
+  <sink>
+    <name>bursts_in</name>
+    <type>message</type>
+    <optional>1</optional>
+  </sink>
+
+  <source>
+    <name>bursts_out</name>
+    <type>message</type>
+    <optional>1</optional>
+  </source>
+</block>
diff --git a/include/grgsm/transmitter/CMakeLists.txt b/include/grgsm/transmitter/CMakeLists.txt
index 78aad43..29ccc4b 100644
--- a/include/grgsm/transmitter/CMakeLists.txt
+++ b/include/grgsm/transmitter/CMakeLists.txt
@@ -21,5 +21,7 @@
 # Install public header files
 ########################################################################
 install(FILES
-    txtime_setter.h DESTINATION include/grgsm/transmitter
+    txtime_setter.h 
+    preprocess_tx_burst.h
+    DESTINATION include/grgsm/transmitter
 )
diff --git a/include/grgsm/transmitter/preprocess_tx_burst.h b/include/grgsm/transmitter/preprocess_tx_burst.h
new file mode 100644
index 0000000..2a07dd5
--- /dev/null
+++ b/include/grgsm/transmitter/preprocess_tx_burst.h
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+
+#ifndef INCLUDED_GSM_PREPROCESS_TX_BURST_H
+#define INCLUDED_GSM_PREPROCESS_TX_BURST_H
+
+#include <grgsm/api.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+  namespace gsm {
+
+    /*!
+     * \brief A block that does preprocessing tasks before sending bursts to modulator.
+     * \ingroup gsm
+     *
+     * Currently it removes GSMTAP header from a burst and puts it in first part of PDU
+     * pair and removes tailing zeros from Access Bursts coming from TRX interface.
+     */
+    class GRGSM_API preprocess_tx_burst : virtual public gr::block
+    {
+     public:
+      typedef boost::shared_ptr<preprocess_tx_burst> sptr;
+
+      /*!
+       * \brief Return a shared_ptr to a new instance of gsm::preprocess_tx_burst.
+       *
+       * To avoid accidental use of raw pointers, gsm::preprocess_tx_burst's
+       * constructor is in a private implementation
+       * class. gsm::preprocess_tx_burst::make is the public interface for
+       * creating new instances.
+       */
+      static sptr make();
+    };
+
+  } // namespace gsm
+} // namespace gr
+
+#endif /* INCLUDED_GSM_PREPROCESS_TX_BURST_H */
+
diff --git a/lib/transmitter/CMakeLists.txt b/lib/transmitter/CMakeLists.txt
index 31658fd..c61654a 100644
--- a/lib/transmitter/CMakeLists.txt
+++ b/lib/transmitter/CMakeLists.txt
@@ -19,4 +19,5 @@
 
 add_sources(
    txtime_setter_impl.cc
+   preprocess_tx_burst_impl.cc
 )
diff --git a/lib/transmitter/preprocess_tx_burst_impl.cc b/lib/transmitter/preprocess_tx_burst_impl.cc
new file mode 100644
index 0000000..5d3ae9a
--- /dev/null
+++ b/lib/transmitter/preprocess_tx_burst_impl.cc
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include <grgsm/gsmtap.h>
+#include <grgsm/gsm_constants.h>
+#include "preprocess_tx_burst_impl.h"
+
+namespace gr {
+  namespace gsm {
+
+    preprocess_tx_burst::sptr
+    preprocess_tx_burst::make()
+    {
+      return gnuradio::get_initial_sptr
+        (new preprocess_tx_burst_impl());
+    }
+
+    /*
+     * The private constructor
+     */
+    preprocess_tx_burst_impl::preprocess_tx_burst_impl()
+      : gr::block("preprocess_tx_burst",
+              gr::io_signature::make(0, 0, 0),
+              gr::io_signature::make(0, 0, 0))
+    {
+        message_port_register_in(pmt::intern("bursts_in"));
+        message_port_register_out(pmt::intern("bursts_out"));
+
+        set_msg_handler(pmt::intern("bursts_in"),  boost::bind(&preprocess_tx_burst_impl::process_burst,   this, _1));
+    }
+
+    /*
+     * Our virtual destructor.
+     */
+    preprocess_tx_burst_impl::~preprocess_tx_burst_impl()
+    {
+    }
+    
+    void preprocess_tx_burst_impl::process_burst(pmt::pmt_t burst)
+    {
+        int8_t * header_bits = (int8_t *)(pmt::blob_data(pmt::cdr(burst)));
+        int8_t * burst_bits = (int8_t *)(pmt::blob_data(pmt::cdr(burst)))+sizeof(gsmtap_hdr);
+
+        pmt::pmt_t header_bits_pmt = pmt::make_blob(header_bits,sizeof(gsmtap_hdr));
+        
+        size_t burst_size = pmt::blob_length(pmt::cdr(burst))-sizeof(gsmtap_hdr);
+        if(((gsmtap_hdr*)header_bits)->sub_type == GSMTAP_BURST_ACCESS){ //cut unneeded bits from the end of access bursts
+          burst_size = ACCESS_BURST_SIZE; 
+        } 
+        pmt::pmt_t burst_bits_pmt = pmt::make_blob(burst_bits, burst_size);
+        
+        pmt::pmt_t pdu_first_part = pmt::car(burst);
+//        pmt::pmt_t new_pdu_first_part = pmt::dict_add( pdu_first_part, pmt::intern("gsmtap_header"), header_bits_pmt );
+        pmt::pmt_t new_pdu_first_part = pdu_first_part;
+        
+        pmt::pmt_t new_msg = pmt::cons(new_pdu_first_part, burst_bits_pmt);
+        message_port_pub(pmt::intern("bursts_out"), new_msg);
+    }
+  } /* namespace gsm */
+} /* namespace gr */
+
diff --git a/lib/transmitter/preprocess_tx_burst_impl.h b/lib/transmitter/preprocess_tx_burst_impl.h
new file mode 100644
index 0000000..27fc508
--- /dev/null
+++ b/lib/transmitter/preprocess_tx_burst_impl.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifndef INCLUDED_GSM_PREPROCESS_TX_BURST_IMPL_H
+#define INCLUDED_GSM_PREPROCESS_TX_BURST_IMPL_H
+
+#include <grgsm/transmitter/preprocess_tx_burst.h>
+#include <grgsm/misc_utils/time_spec.h>
+#include <grgsm/misc_utils/fn_time.h>
+
+namespace gr {
+  namespace gsm {
+
+    class preprocess_tx_burst_impl : public preprocess_tx_burst
+    {
+     private:
+      void process_burst(pmt::pmt_t burst);
+      
+     public:
+      preprocess_tx_burst_impl();
+      ~preprocess_tx_burst_impl();
+    };
+
+  } // namespace gsm
+} // namespace gr
+
+#endif /* INCLUDED_GSM_PREPROCESS_TX_BURST_IMPL_H */
+
diff --git a/swig/grgsm_swig.i b/swig/grgsm_swig.i
index 26b6a6d..65c48be 100644
--- a/swig/grgsm_swig.i
+++ b/swig/grgsm_swig.i
@@ -71,6 +71,7 @@
 //#include "grgsm/misc_utils/time_spec.h"
 #include "grgsm/misc_utils/fn_time.h"
 #include "grgsm/transmitter/txtime_setter.h"
+#include "grgsm/transmitter/preprocess_tx_burst.h"
 #include "grgsm/misc_utils/trx_burst_if.h"
 %}
 
@@ -182,3 +183,5 @@
 
 %include "grgsm/transmitter/txtime_setter.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, txtime_setter);
+%include "grgsm/transmitter/preprocess_tx_burst.h"
+GR_SWIG_BLOCK_MAGIC2(gsm, preprocess_tx_burst);