From 900d1c1c9e67b89b570de201fea4d237e17d05f5 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Feb 2008 16:52:34 +0000 Subject: major bugfixes in gsmdecode (fragmented packets) --- gsmdecode/src/gsmdecode.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gsmdecode/src/gsmdecode.c') diff --git a/gsmdecode/src/gsmdecode.c b/gsmdecode/src/gsmdecode.c index a2456d3..04d30ab 100644 --- a/gsmdecode/src/gsmdecode.c +++ b/gsmdecode/src/gsmdecode.c @@ -28,6 +28,7 @@ struct _ch_info unsigned char flags; int logical; int physical; + int direction; int fn; unsigned char data[23]; int data_len; @@ -120,6 +121,13 @@ xml_in(struct _ch_info *chinfo, unsigned char *str) xml_get_int(&chinfo->logical, str, (const unsigned char *)"logicalchannel"); // fprintf(stderr, "logical %u\n", chinfo->logical); + if (strstr((char *)str, "direction=\"up\"") != NULL) + { + chinfo->direction = 1; + } else if (strstr((char *)str, "direction=\"down\"") != NULL) { + chinfo->direction = 0; + } + /* Last see if there is a data="..." section. if so convert it into * binary and prefix it with pseudo length and up/down indicator * if required @@ -258,16 +266,19 @@ main(int argc, char *argv[]) if (chi.data_len <= 0) continue; if ((chi.logical == 112) || (chi.logical == 176) || (chi.logical == 128)) - l2_data_out_B(0, chi.data, chi.data_len); - else + { + l2_data_out_B(0, chi.data, chi.data_len, chi.logical, chi.direction); + } else { l2_data_out_Bbis(0, chi.data, chi.data_len); + } + memset(buf, 0, sizeof buf); continue; } memset(bin, 0, sizeof bin); len = hex2bin(bin, buf); if (opt.format == MSG_FORMAT_B) - l2_data_out_B(0, bin, len); + l2_data_out_B(0, bin, len, chi.logical, chi.direction); else l2_data_out_Bbis(0, bin, len); } -- cgit v1.2.3