$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;
+}
+
+sub delete_interface
+{
+ my $interface = shift;
+ foreach my $ref (values %list) {
+ delete $ref->{item}->{$interface};
+ }
}
#