now it is specified whether the packet is uplink or downlink

This commit is contained in:
Thomas Bertani 2012-09-01 16:15:01 +02:00
parent 871aec9332
commit 377cd66473
2 changed files with 3 additions and 6 deletions

2
README
View File

@ -1,6 +1,6 @@
* ot290-gsmtap
This is a command line utility which reads the trace frames sent by the Sagem OT-290 trough the serial line and forwards the GSM L2/L3 and GPRS RLC/MAC messages to a host as GSMTAP packets so that you can use Wireshark to analyze them.
This is a command line utility which reads the trace frames sent by the Sagem OT-290 trough the serial line and forwards the GSM/GPRS ones to the specified host as GSMTAP packets so that you can use Wireshark to analyze them.
In order for this tool to run, you have to set on the phone the Trace or Data/Trace mode (Main Menu -> Test Tool -> Info & Settings -> Serial links setup).

View File

@ -104,16 +104,13 @@ void testgsmtap(unsigned char *AppMsg, unsigned short AppMsgLength)
{
int format = (AppMsg[2] >> 1 & 0b1111);
length = AppMsg[3] << 8 | AppMsg[4];
/*int i = 0;
printf("* L%d format:%d, Length:%d, FreqBit:%d, U/D: %d, LayerMessageFrame: [", (AppMsg[1] == 0x00) ? 3 : 2, format, length, AppMsg[2] >> 5, (AppMsg[2] & 1));
for (i=0; i<length; i++) printf("%d, ", AppMsg[5+i]);
printf("\b\b]\n");*/
const size_t buf_len = sizeof(struct gsmtap_hdr) + length;
unsigned char buf[buf_len];
struct gsmtap_hdr *gh = (struct gsmtap_hdr *) buf;
memset(gh, 0, sizeof(*gh));
gh->version = GSMTAP_VERSION;
gh->hdr_len = sizeof(*gh)/4;
if ((AppMsg[2] & 1) == 1) gh->arfcn = htons(GSMTAP_ARFCN_F_UPLINK);
if ((format == 0) || (format == 2)) gh->type = GSMTAP_TYPE_UM_BURST;
else gh->type = GSMTAP_TYPE_UM;
gh->sub_type = GSMTAP_CHANNEL_UNKNOWN;
@ -214,5 +211,5 @@ int main(int argc, char **argv)
myreq[9] = 0; myreq[10] = 25; //LayerMessage-disable request
req(myreq, sizeof(myreq));
printf("[*] Checksum errors: %d/%d | Total errors: %d/%d\n", s.checksumErrors, s.packets, s.totalErrors, s.packets);
return 0;
return (s.totalErrors == 0) ? 0 : 1;
}