racal2pcap: Correctly parse the TEI (to distinguish IXU from RRU)

This commit is contained in:
Harald Welte 2011-02-13 12:52:04 +01:00
parent 4db1be4e78
commit 60b67604f6
1 changed files with 8 additions and 2 deletions

View File

@ -51,9 +51,11 @@ sub hex2bin($)
return pack('H*', $hexstring);
}
my $tei;
my $sapi;
my $state = 0;
my $msg_hex = "";
my %ces_to_tei;
while (my $line = <STDIN>) {
chomp($line);
@ -69,7 +71,7 @@ while (my $line = <STDIN>) {
$downlink = 1;
}
my $llh = make_linux_lapd_hdr($downlink);
my $lh = make_lapd_hdr($sapi, $sapi, $downlink);
my $lh = make_lapd_hdr($sapi, $tei, $downlink);
my $msg = hex2bin($msg_hex);
write_pcap_pkt($llh . $lh . $msg);
@ -78,7 +80,11 @@ while (my $line = <STDIN>) {
}
}
if ($state == 0) {
if ($line =~ /^DL DATA INDICATION sapi = (\d+)/) {
if ($line =~ /^MDL_ASSIGN_REQUEST ces = (\d+),tei = (\d+)/) {
$ces_to_tei{$1} = $2;
}
if ($line =~ /^DL DATA INDICATION sapi = (\d+), ces = (\d+)/) {
$tei = $ces_to_tei{$2};
$sapi = $1;
$state = 1;
$msg_hex = "";