X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=inline;f=perl%2FAGWMsg.pm;h=5e1c05e048b406a9f2140e4d6bb07bed11fbdcd7;hb=942cdc8c6434db4e2cf77b43ec26c0059768f853;hp=d6828812f2f31dbd2684b3143db3575bbae39647;hpb=e8fe72d833414c4bb7f017ed0b62167aa5ac593d;p=spider.git diff --git a/perl/AGWMsg.pm b/perl/AGWMsg.pm index d6828812..5e1c05e0 100644 --- a/perl/AGWMsg.pm +++ b/perl/AGWMsg.pm @@ -268,6 +268,8 @@ sub _decode $data = '' unless defined $data; if ($sort eq 'D') { + + # incoming data my $d = unpack "Z*", $data; $d =~ s/\cM\cJ?$//; $d =~ s/^\cJ//; @@ -295,6 +297,8 @@ sub _decode dbg("AGW error Unsolicited Data!"); } } elsif ($sort eq 'I' || $sort eq 'S' || $sort eq 'U' || $sort eq 'M' || $sort eq 'T') { + + # incoming monitoring my $d = unpack "Z*", $data; $d =~ s/^\cJ//; $d =~ s/\cM\cJ?$//; @@ -305,6 +309,8 @@ sub _decode dbg("AGW Monitor port: $port \"$_\"") if isdbg('agw'); } } elsif ($sort eq 'C') { + + # incoming connection my $d = unpack "Z*", $data; $d =~ s/\cM\cJ?$//; dbg("AGW Connect port: $port pid: $pid '$from'->'$to' \"$d\"") if isdbg('agw'); @@ -327,19 +333,15 @@ sub _decode $conn->{incoming} = 1; $conn->{agwcall} = $call; $circuit{$call} = $conn; - if ($call =~ /^(\w+)-(\d\d?)$/) { - my $c = $1; - my $s = $2; - $s = 15 - $s; - if ($s <= 8 && $s > 0) { - $call = "${c}-${s}"; - } else { - $call = $c; - } + if (my ($c, $s) = $call =~ /^(\w+)-(\d\d?)$/) { + $s = 15 - $s if $s > 8; + $call = $s > 0 ? "${c}-${s}" : $c; } $conn->to_connected($call, 'A', $conn->{csort} = 'ax25'); } } elsif ($sort eq 'd') { + + # incoming disconnection my $d = unpack "Z*", $data; $d =~ s/\cM\cJ?$//; dbg("AGW '$from'->'$to' port: $port Disconnected ($d)") if isdbg('agw'); @@ -349,30 +351,42 @@ sub _decode $conn->in_disconnect; } } elsif ($sort eq 'y') { + + # outstanding frames statistics (unconnected) my ($frames) = unpack "V", $data; dbg("AGW Frames Outstanding on port $port = $frames") if isdbg('agwpollans'); my $conn = _find($from); $conn->{oframes} = $frames if $conn; } elsif ($sort eq 'Y') { + + # outstanding frames statistics (connected) my ($frames) = unpack "V", $data; dbg("AGW Frames Outstanding on circuit '$from'->'$to' = $frames") if isdbg('agw'); my $conn = _find($from eq $main::mycall ? $to : $from); $conn->{oframes} = $frames if $conn; } elsif ($sort eq 'H') { + + # heard stations unless ($from =~ /^\s+$/) { my $d = unpack "Z*", $data; $d =~ s/\cM\cJ?$//; dbg("AGW Heard port: $port \"$d\"") if isdbg('agw'); } } elsif ($sort eq 'X') { + + # registration reply my ($r) = unpack "C", $data; $r = $r ? "Successful" : "Failed"; dbg("AGW Register $from $r"); finish() unless $r; } elsif ($sort eq 'R') { + + # version string my ($major, $minor) = unpack "v x2 v x2", $data; dbg("AGW Version $major.$minor") if isdbg('agw'); } elsif ($sort eq 'G') { + + # list of ports my @ports = split /;/, $data; $noports = shift @ports || '0'; dbg("AGW $noports Ports available") if isdbg('agw'); @@ -386,6 +400,8 @@ sub _decode _sendf('g', undef, undef, $i); } } else { + + # some other frame my $d = unpack "Z*", $data; dbg("AGW decode $sort port: $port pid: $pid '$from'->'$to' length: $len \"$d\"") if isdbg('agw'); }