X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=9c7064d21cdfd3a0d943eb970b3a0bdf87423ab0;hb=211b54d504170a8c9dad2bf25b9ed686d5eeac11;hp=60e0391f2e34e7e3bb73a061e40b7d0b274a9ea6;hpb=dd0ddcd3ae2d605a2a1f549da0263fa99c44f92d;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 60e0391f..9c7064d2 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -70,7 +70,7 @@ $baddxfn = "$main::data/baddx.pl"; [ qw(c c n n) ], # pc25 [ qw(f m d t m c c bc) ], # pc26 [ qw(d n n n n m c c bc) ], # pc27 - [ qw(c c c c d t p m bp n p bp bc) ], # pc28 + [ qw(c c c m d t p m bp n p bp bc) ], # pc28 [ qw(c c n m) ], # pc29 [ qw(c c n) ], # pc30 [ qw(c c n) ], # pc31 @@ -178,15 +178,6 @@ sub init confess $@ if $@; $me->{sort} = 'S'; # S for spider - # now prime the spot and wwv duplicates file with data -# my @today = Julian::unixtoj(time); -# for (Spot::readfile(@today), Spot::readfile(Julian::sub(@today, 1))) { -# Spot::dup(@{$_}[0..3]); -# } -# for (Geomag::readfile(time)) { -# Geomag::dup(@{$_}[1..5]); -# } - # load the baddx file do "$baddxfn" if -e "$baddxfn"; print "$@\n" if $@; @@ -220,11 +211,18 @@ sub start $self->{consort} = $line; # save the connection type $self->{here} = 1; + # get the output filters + $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0); + $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0); + $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0); + $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ; + + # get the INPUT filters (these only pertain to Clusters) - $self->{inspotfilter} = Filter::read_in('spots', $call, 1); - $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1); - $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1); - $self->{inannfilter} = Filter::read_in('ann', $call, 1); + $self->{inspotsfilter} = Filter::read_in('spots', $call, 1) || Filter::read_in('spots', 'node_default', 1); + $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1); + $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1); + $self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1); # set unbuffered and no echo $self->send_now('B',"0"); @@ -455,7 +453,21 @@ sub normal # global ann filtering on INPUT if ($self->{inannfilter}) { - my ($filter, $hops) = Filter::it($self->{inannfilter}, @field[1..6], $self->{call} ); + my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0); + my @dxcc = Prefix::extract($field[1]); + if (@dxcc > 0) { + $ann_dxcc = $dxcc[1]->dxcc; + $ann_itu = $dxcc[1]->itu; + $ann_cq = $dxcc[1]->cq(); + } + @dxcc = Prefix::extract($field[5]); + if (@dxcc > 0) { + $org_dxcc = $dxcc[1]->dxcc; + $org_itu = $dxcc[1]->itu; + $org_cq = $dxcc[1]->cq(); + } + my ($filter, $hops) = $self->{inannfilter}->it(@field[1..6], $self->{call}, + $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq); unless ($filter) { dbg('chan', "Rejected by filter"); return; @@ -1126,8 +1138,8 @@ sub send_dx_spot my $routeit; my ($filter, $hops); - if ($dxchan->{spotfilter}) { - ($filter, $hops) = Filter::it($dxchan->{spotfilter}, @_, $self->{call} ); + if ($dxchan->{spotsfilter}) { + ($filter, $hops) = $dxchan->{spotsfilter}->it(@_, $self->{call} ); next unless $filter; } @@ -1172,7 +1184,7 @@ sub send_wwv_spot my ($filter, $hops); if ($dxchan->{wwvfilter}) { - ($filter, $hops) = Filter::it($dxchan->{wwvfilter}, @_, $self->{call} ); + ($filter, $hops) = $dxchan->{wwvfilter}->it(@_, $self->{call} ); next unless $filter; } if ($dxchan->is_node) { @@ -1216,7 +1228,7 @@ sub send_wcy_spot my ($filter, $hops); if ($dxchan->{wcyfilter}) { - ($filter, $hops) = Filter::it($dxchan->{wcyfilter}, @_, $self->{call} ); + ($filter, $hops) = $dxchan->{wcyfilter}->it(@_, $self->{call} ); next unless $filter; } if ($dxchan->is_clx || $dxchan->is_spider) { @@ -1278,7 +1290,20 @@ sub send_announce my ($filter, $hops); if ($dxchan->{annfilter}) { - ($filter, $hops) = Filter::it($dxchan->{annfilter}, @_, $self->{call} ); + my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0); + my @dxcc = Prefix::extract($_[1]); + if (@dxcc > 0) { + $ann_dxcc = $dxcc[1]->dxcc; + $ann_itu = $dxcc[1]->itu; + $ann_cq = $dxcc[1]->cq; + } + @dxcc = Prefix::extract($_[5]); + if (@dxcc > 0) { + $org_dxcc = $dxcc[1]->dxcc; + $org_itu = $dxcc[1]->itu; + $org_cq = $dxcc[1]->cq; + } + ($filter, $hops) = $dxchan->{annfilter}->it(@_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq); next unless $filter; } if ($dxchan->is_node && $_[1] ne $main::mycall) { # i.e not specifically routed to me @@ -1362,19 +1387,22 @@ sub send_local_config sub route { my ($self, $call, $line) = @_; - my $cl = DXCluster->get_exact($call); - if ($cl) { # don't route it back down itself - if (ref $self && $call eq $self->{call}) { - dbg('chan', "Trying to route back to source, dropped"); - return; - } - my $hops; - my $dxchan = $cl->{dxchan}; - if ($dxchan) { - my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name - if ($routeit) { - $dxchan->send($routeit) if $dxchan; - } + + if (ref $self && $call eq $self->{call}) { + dbg('chan', "Trying to route back to source, dropped"); + return; + } + + # always send it down the local interface if available + my $dxchan = DXChannel->get($call); + unless ($dxchan) { + my $cl = DXCluster->get_exact($call); + $dxchan = $cl->dxchan if $cl; + } + if ($dxchan) { + my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name + if ($routeit) { + $dxchan->send($routeit); } } } @@ -1445,7 +1473,7 @@ sub broadcast_list if ($sort eq 'dx') { next unless $dxchan->{dx}; - ($filter) = Filter::it($dxchan->{spotfilter}, @{$fref}) if ref $fref; + ($filter) = $dxchan->{spotsfilter}->it(@{$fref}) if ref $fref; next unless $filter; } next if $sort eq 'ann' && !$dxchan->{ann};