aboutsummaryrefslogtreecommitdiffstats
path: root/lib/demapping
diff options
context:
space:
mode:
authoriZsh <izsh@fail0verflow.com>2015-08-16 14:42:18 +0200
committeriZsh <izsh@fail0verflow.com>2015-08-16 14:52:01 +0200
commit6698793a241a3acfa2c2193ba363f5041b4ec22b (patch)
treea793bddd91b710644a0aba0526f017a6125fe249 /lib/demapping
parentb9d8ce37900b1043e35bd2ea4eca1e69b3a44602 (diff)
Fix issue #112 (copy messages instead of modifying the input msg)
Diffstat (limited to 'lib/demapping')
-rw-r--r--lib/demapping/tch_f_chans_demapper_impl.cc28
-rw-r--r--lib/demapping/universal_ctrl_chans_demapper_impl.cc15
2 files changed, 30 insertions, 13 deletions
diff --git a/lib/demapping/tch_f_chans_demapper_impl.cc b/lib/demapping/tch_f_chans_demapper_impl.cc
index cc24b9e..a54ed3f 100644
--- a/lib/demapping/tch_f_chans_demapper_impl.cc
+++ b/lib/demapping/tch_f_chans_demapper_impl.cc
@@ -29,6 +29,8 @@
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
+#define BURST_SIZE 148
+
namespace gr {
namespace gsm {
@@ -80,12 +82,20 @@ namespace gr {
int8_t * burst_bits = (int8_t *)(pmt::blob_data(header_plus_burst))+sizeof(gsmtap_hdr);
if(header->timeslot == d_timeslot){
- header->sub_type = GSMTAP_CHANNEL_TCH_F;
+ int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE];
+ gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg;
+ memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE);
+ new_hdr->sub_type = GSMTAP_CHANNEL_TCH_F;
if (fn_mod13 == 12)
- {
header->sub_type = GSMTAP_CHANNEL_ACCH|GSMTAP_CHANNEL_TCH_F;
+ pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE);
+ pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
+
+
+ if (fn_mod13 == 12)
+ {
// position of SACCH burst based on timeslot
// see specification gsm 05.02
uint32_t index;
@@ -104,7 +114,7 @@ namespace gr {
if (is_sacch)
{
- d_bursts_sacch[index] = msg;
+ d_bursts_sacch[index] = msg_out;
d_frame_numbers_sacch[index] = frame_nr;
if (index == 3)
@@ -135,8 +145,8 @@ namespace gr {
if (fn_mod13 <= 3)
{
// add to b1 and b3
- d_bursts[0][fn_mod13] = msg;
- d_bursts[2][fn_mod13 + 4] = msg;
+ d_bursts[0][fn_mod13] = msg_out;
+ d_bursts[2][fn_mod13 + 4] = msg_out;
// set framenumber
d_frame_numbers[0][fn_mod13] = frame_nr;
@@ -145,8 +155,8 @@ namespace gr {
else if (fn_mod13 >= 4 && fn_mod13 <= 7)
{
// add to b1 and b2
- d_bursts[0][fn_mod13] = msg;
- d_bursts[1][fn_mod13 - 4] = msg;
+ d_bursts[0][fn_mod13] = msg_out;
+ d_bursts[1][fn_mod13 - 4] = msg_out;
// set framenumber
d_frame_numbers[0][fn_mod13] = frame_nr;
@@ -155,8 +165,8 @@ namespace gr {
else if (fn_mod13 >= 8 && fn_mod13 <= 11)
{
// add to b2 and b3
- d_bursts[1][fn_mod13 - 4] = msg;
- d_bursts[2][fn_mod13 - 8] = msg;
+ d_bursts[1][fn_mod13 - 4] = msg_out;
+ d_bursts[2][fn_mod13 - 8] = msg_out;
// set framenumber
d_frame_numbers[1][fn_mod13 - 4] = frame_nr;
diff --git a/lib/demapping/universal_ctrl_chans_demapper_impl.cc b/lib/demapping/universal_ctrl_chans_demapper_impl.cc
index 8a6bfb5..c711928 100644
--- a/lib/demapping/universal_ctrl_chans_demapper_impl.cc
+++ b/lib/demapping/universal_ctrl_chans_demapper_impl.cc
@@ -30,6 +30,8 @@
#include <grgsm/gsmtap.h>
#include <set>
+#define BURST_SIZE 148
+
namespace gr {
namespace gsm {
@@ -140,7 +142,7 @@ namespace gr {
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
-
+
uint32_t frame_nr = be32toh(header->frame_number);
uint32_t fn_mod51 = frame_nr % 51;
uint32_t fn51_start = d_starts_fn_mod51[fn_mod51];
@@ -148,14 +150,19 @@ namespace gr {
uint32_t ch_type = d_channel_types[fn_mod51];
if(header->timeslot==d_timeslot){
- header->sub_type = ch_type;
- header->sub_slot = d_subslots[fn_mod51 + (51 * (frame_nr % 2))];
+ int8_t new_msg[sizeof(gsmtap_hdr)+BURST_SIZE];
+ gsmtap_hdr * new_hdr = (gsmtap_hdr*)new_msg;
+ memcpy(new_msg, header, sizeof(gsmtap_hdr)+BURST_SIZE);
+ new_hdr->sub_type = ch_type;
+ new_hdr->sub_slot = d_subslots[fn_mod51 + (51 * (frame_nr % 2))];
+ pmt::pmt_t msg_binary_blob = pmt::make_blob(new_msg,sizeof(gsmtap_hdr)+BURST_SIZE);
+ pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
if(fn_mod51>=fn51_start && fn_mod51<=fn51_stop)
{
uint32_t ii = fn_mod51 - fn51_start;
d_frame_numbers[ii] = frame_nr;
- d_bursts[ii] = msg;
+ d_bursts[ii] = msg_out;
}
if(fn_mod51==fn51_stop)