X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FAranea.pm;h=308160203fbad7651fc2c90c6cc1d181b33b98d9;hb=a12f9d08a1b1d51b9c07740b50b87f5090a59e78;hp=c68b211686b72b83bbd7ad18e7f4c82385de003d;hpb=9247dc52598db705b9cf6cbbec16c3919ac5e1d7;p=spider.git diff --git a/perl/Aranea.pm b/perl/Aranea.pm index c68b2116..30816020 100644 --- a/perl/Aranea.pm +++ b/perl/Aranea.pm @@ -25,12 +25,11 @@ use Script; use Verify; use DXDupe; use Thingy; +use RouteDB; use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /^\d+\.\d+(?:\.(\d+)\.(\d+))?$/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; + +main::mkver($VERSION = q$Revision$); use vars qw(@ISA $ntpflag $dupeage); @@ -153,9 +152,12 @@ sub disconnect my $call = $self->call; return if $self->{disconnecting}++; - + + my $thing = Thingy::Bye->new(origin=>$main::mycall, user=>$call); + $thing->process($self); + # get rid of any PC16/17/19 -# eph_del_regex("^PC1[679]*$call"); + DXProt::eph_del_regex("^PC1[679]*$call"); # do routing stuff, remove me from routing table my $node = Route::Node::get($call); @@ -166,7 +168,7 @@ sub disconnect # and all my ephemera as well for (@rout) { my $c = $_->call; -# eph_del_regex("^PC1[679].*$c"); + DXProt::eph_del_regex("^PC1[679].*$c"); } } @@ -198,6 +200,23 @@ sub disconnect # because it has to be used before a channel is fully initialised). # +sub formathead +{ + my $mycall = shift; + my $dts = shift; + my $hop = shift; + my $user = shift; + my $group = shift; + + my $s = "$mycall,$dts,$hop"; + $s .= ",$user" if $user; + if ($group) { + $s .= "," unless $user; + $s .= ",$group" if $group; + } + return $s; +} + sub genheader { my $mycall = shift; @@ -205,9 +224,7 @@ sub genheader my $from = shift; my $date = ((($dayno << 1) | $ntpflag) << 18) | ($main::systime % 86400); - my $r = "$mycall," . sprintf('%6X%04X,0', $date, $seqno); - $r .= ",$to" if $to; - $r .= ",$from" if $from; + my $r = formathead($mycall, sprintf('%6X%04X', $date, $seqno), 0, $from, $to); $seqno++; $seqno = 0 if $seqno > 0x0ffff; return $r; @@ -285,7 +302,7 @@ sub input my ($head, $data) = split /\|/, $line, 2; return unless $head && $data; - my ($origin, $dts, $hop, $group, $user) = split /,/, $head; + my ($origin, $dts, $hop, $user, $group) = split /,/, $head; return if DXDupe::check("Ara,$origin,$dts", $dupeage); my $err; $err .= "incomplete header," unless $origin && $dts && defined $hop; @@ -313,9 +330,7 @@ sub input $thing = $class->new(); # reconstitute the header but wth hop increased by one - $head = join(',', $origin, $dts, ++$hop); - $head .= ",$group" if $group; - $head .= ",$user" if $user; + $head = formathead($origin, $dts, ++$hop, $user, $group); $thing->{Aranea} = "$head|$data"; # store useful data @@ -325,16 +340,18 @@ sub input $thing->{touser} = $tus if $tus; $thing->{user} = $user if $user; $thing->{hopsaway} = $hop; - - for (split(/,/, $rdata)) { - if (/=/) { - my ($k,$v) = split /=/, $_, 2; - $thing->{$k} = tdecode($v); - } else { - $thing->{$_} = 1; + + if ($rdata) { + for (split(/,/, $rdata)) { + if (/=/) { + my ($k,$v) = split /=/, $_, 2; + $thing->{$k} = tdecode($v); + } else { + $thing->{$_} = 1; + } } } - + # post process the thing, this generally adds on semantic meaning # does parameter checking etc. It also adds / prepares the thingy so # this is compatible with older protocol and arranges data so