X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=05111d40ba11e2456635fdbf14f4281782030365;hb=393e17fd3a08dd94596f1c02d4d20f6f9a44954f;hp=d8048ffbb6be6e98434d63f513a5512a49b491aa;hpb=5764cc1c0f79b56fdf5389d2b0dcb2ab7e54723d;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index d8048ffb..05111d40 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -44,10 +44,8 @@ use Thingy::T; use strict; 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($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restime $eph_pc34_restime $last_hour $last10 %eph %pings %rcmds $ann_to_talk @@ -533,7 +531,7 @@ sub handle_11 my @spot = Spot::prepare($_[1], $_[2], $d, $_[5], $_[6], $_[7]); - my $thing = Thingy::Dx->new(origin=>$main::mycall, group=>'DX'); + my $thing = Thingy::Dx->new(origin=>$main::mycall); $thing->from_DXProt(DXProt=>$line,spotdata=>\@spot); $thing->queue($self); @@ -707,6 +705,7 @@ sub handle_16 return; } + RouteDB::update($ncall, $origin); # do we believe this call? @@ -728,116 +727,39 @@ sub handle_16 # if there is a parent, proceed, otherwise if there is a latent PC19 in the PC19list, # fix it up in the routing tables and issue it forth before the PC16 - unless ($parent) { - my $nl = $pc19list{$ncall}; - - if ($nl && @_ > 3) { # 3 because of the hop count! - - # this is a new (remembered) node, now attach it to me if it isn't in filtered - # and we haven't disallowed it - my $user = DXUser->get_current($ncall); - if (!$user) { - $user = DXUser->new($ncall); - $user->sort('A'); - $user->priv(1); # I have relented and defaulted nodes - $user->lockout(1); - $user->homenode($ncall); - $user->node($ncall); - } + if ($parent) { - my $wantpc19 = $user->wantroutepc19; - if ($wantpc19 || !defined $wantpc19) { - my $new = Route->new($ncall); # throw away - if ($self->in_filter_route($new)) { - my @nrout; - for (@$nl) { - $parent = Route::Node::get($_->[0]); - $dxchan = $parent->dxchan if $parent; - if ($dxchan && $dxchan ne $self) { - dbg("PCPROT: PC19 from $origin trying to alter locally connected $ncall, ignored!") if isdbg('chanerr'); - $parent = undef; - } - if ($parent) { - my $r = $parent->add($ncall, $_->[1], $_->[2]); - push @nrout, $r unless @nrout; - } - } - $user->wantroutepc19(1) unless defined $wantpc19; # for now we work on the basis that pc16 = real route - $user->lastin($main::systime) unless DXChannel->get($ncall); - $user->put; - - # route the pc19 - this will cause 'stuttering PC19s' for a while - $self->route_pc19($origin, $line, @nrout) if @nrout ; - $parent = Route::Node::get($ncall); - unless ($parent) { - dbg("PCPROT: lost $ncall after sending PC19 for it?"); - return; - } - } else { - return; - } - delete $pc19list{$ncall}; - } - } else { - dbg("PCPROT: Node $ncall not in config") if isdbg('chanerr'); - return; - } - } else { - $dxchan = $parent->dxchan; if ($dxchan && $dxchan ne $self) { dbg("PCPROT: PC16 from $origin trying to alter locally connected $ncall, ignored!") if isdbg('chanerr'); return; } - # input filter if required - return unless $self->in_filter_route($parent); - } - - my $i; - my @rout; - for ($i = 2; $i < $#_; $i++) { - my ($call, $conf, $here) = $_[$i] =~ /^(\S+) (\S) (\d)/o; - next unless $call && $conf && defined $here && is_callsign($call); - next if $call eq $main::mycall; - - eph_del_regex("^PC17\\^$call\\^$ncall"); + + my $i; + my $rout; + for ($i = 2; $i < $#_; $i++) { + my ($call, $conf, $here) = $_[$i] =~ /^(\S+) (\S) (\d)/o; + next unless $call && $conf && defined $here && is_callsign($call); + next if $call eq $main::mycall; + + eph_del_regex("^PC17\\^$call\\^$ncall"); - $conf = $conf eq '*'; - - # reject this if we think it is a node already - my $r = Route::Node::get($call); - my $u = DXUser->get_current($call) unless $r; - if ($r || ($u && $u->is_node)) { - dbg("PCPROT: $call is a node") if isdbg('chanerr'); - next; + my $flags = $here ? 1 : 0; + $rout .= ":U$flags$call"; } - - $r = Route::User::get($call); - my $flags = Route::here($here)|Route::conf($conf); - - if ($r) { - my $au = $r->addparent($parent); - if ($r->flags != $flags) { - $r->flags($flags); - $au = $r; - } - push @rout, $r if $au; + + + if ($rout) { + my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call}); + $thing->from_DXProt(t=>'eau', d=>"N1$ncall$rout", DXProt=>$line); + $thing->queue($self); } else { - push @rout, $parent->add_user($call, $flags); + dbg("PCPROT: No usable users") if isdbg('chanerr'); } - - - # add this station to the user database, if required - $call =~ s/-\d+$//o; # remove ssid for users - my $user = DXUser->get_current($call); - $user = DXUser->new($call) if !$user; - $user->homenode($parent->call) if !$user->homenode; - $user->node($parent->call); - $user->lastin($main::systime) unless DXChannel->get($call); - $user->put; + } else { + dbg("PCPROT: no PC19 seen for $ncall" ) if isdbg('chanerr'); } - $self->route_pc16($origin, $line, $parent, @rout) if @rout; } # remove a user @@ -890,21 +812,15 @@ sub handle_17 return; } - # input filter if required and then remove user if present - if ($parent) { -# return unless $self->in_filter_route($parent); - $parent->del_user($uref) if $uref; - } else { - $parent = Route->new($ncall); # throw away - } - if (eph_dup($line)) { dbg("PCPROT: dup PC17 detected") if isdbg('chanerr'); return; } $uref = Route->new($ucall) unless $uref; # throw away - $self->route_pc17($origin, $line, $parent, $uref); + my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call}); + $thing->from_DXProt(t=>'edu', d=>"N1$ncall:U1$ucall", DXProt=>$line); + $thing->queue($self); } # link request