+23Aug04=======================================================================
+1. add the start of an alternative routing engine (RouteDB)
20Aug04=======================================================================
1. Added new protocol specification to techdoc
17Aug04=======================================================================
# can we see it? Is it a node?
my $noderef = Route::Node::get($call);
+$noderef = RouteDB::get($call) unless $noderef;
return (1, $self->msg('e7', $call)) unless $noderef;
return (1, $self->msg('e6')) unless @list;
+use RouteDB;
+
my $l;
foreach $l (@list) {
my $ref = Route::get($l);
} else {
push @out, $self->msg('e7', $l);
}
+ my @in = RouteDB::_sorted($l);
+ if (@in) {
+ push @out, "Learned Routes:";
+ for (@in) {
+ push @out, "$l via $_->{call} count: $_->{count} last heard: " . atime($_->{t});
+ }
+ }
}
return (1, @out);
}
# remember a route
- RouteDB::update($_[7], $self->{call});
+# RouteDB::update($_[7], $self->{call});
# RouteDB::update($_[6], $_[7]);
my @spot = Spot::prepare($_[1], $_[2], $d, $_[5], $_[6], $_[7]);
} elsif ($_[2] eq '*' || $_[2] eq $main::mycall) {
# remember a route
- RouteDB::update($_[5], $self->{call});
+# RouteDB::update($_[5], $self->{call});
# RouteDB::update($_[1], $_[5]);
# ignore something that looks like a chat line coming in with sysop
unless ($dxchan) {
my $rcall = RouteDB::get($call);
if ($rcall) {
- if ($rcall eq $self->{call}) {
+ if ($self && $rcall eq $self->{call}) {
dbg("PCPROT: Trying to route back to source, dropped") if isdbg('chanerr');
return;
}
- $dxchan = DXChannel->get($call);
- dbg("route: $call -> $dxchan->{call} using RouteDB" ) if isdbg('route') && $dxchan;
+ $dxchan = DXChannel->get($rcall);
+ dbg("route: $call -> $rcall using RouteDB" ) if isdbg('route') && $dxchan;
}
}
$default = 99; # the number of hops to use if we don't know
%valid = (
call => "0,Callsign",
- items => "0,Interfaces,parray",
+ item => "0,Interfaces,parray",
t => '0,Last Seen,atime',
hops => '0,Hops',
count => '0,Times Seen',
{
my $pkg = shift;
my $call = shift;
- return bless {call => $call, items => {}}, (ref $pkg || $pkg);
+ return bless {call => $call, list => {}}, (ref $pkg || $pkg);
}
# get the best one
} else {
$a->{hops} <=> $b->{hops};
}
- } values %{$ref->{items}};
+ } values %{$ref->{item}};
}
my $interface = shift;
my $hops = shift || $default;
my $ref = $list{$call} || RouteDB->new($call);
- my $iref = $ref->{list}->{$interface} ||= RouteDB::Item->new($call, $interface);
+ my $iref = $ref->{item}->{$interface} ||= RouteDB::Item->new($interface);
$iref->{count}++;
$iref->{hops} = $hops if $hops < $iref->{hops};
$iref->{t} = shift || $main::systime;
- $ref->{list}->{$interface} ||= $iref;
+ $ref->{item}->{$interface} ||= $iref;
+ $list{$call} ||= $ref;
}
sub delete
my $call = shift;
my $interface = shift;
my $ref = $list{$call};
- delete $ref->{list}->{$interface} if $ref;
+ delete $ref->{item}->{$interface} if $ref;
}
#