use Route;
use Route::Node;
use Script;
-use Investigate;
use RouteDB;
return @rout;
}
+my $_last_time;
+my $_last_occurs;
+
+sub gen_pc9x_t
+{
+ if (!$_last_time || $_last_time != $main::systime) {
+ $_last_time = $main::systime;
+ $_last_occurs = 0;
+ return $_last_time;
+ } else {
+ $_last_occurs++;
+ return sprintf "$_last_time.%02d", $_last_occurs;
+ }
+}
+
+sub check_pc9x_t
+{
+ my $call = shift;
+ my $t = shift;
+ my $pc = shift;
+ my $create = shift;
+
+ my $parent = ref $call ? $call : Route::Node::get($call);
+ if ($parent) {
+ my $lastid = $parent->lastid->{$pc} || 0;
+ if ($lastid >= $t) {
+ dbg("PCPROT: dup / old id on $call <= $lastid, ignored") if isdbg('chanerr');
+ return;
+ }
+ } elsif ($create) {
+ $parent = Route::Node->new($call);
+ }
+ $parent->lastid->{$pc} = $t;
+
+ return $parent;
+}
+
# DXSpider routing entries
sub handle_92
{
return;
}
- my $parent = Route::Node::get($pcall);
- if ($parent) {
- my $lastid = $parent->lastid->{92} || 0;
- if ($lastid > $t) {
- dbg("PCPROT: dup / old id <= $lastid, ignored") if isdbg('chanerr');
- return;
- }
- } else {
- $parent = Route::Node->new($pcall);
- }
+ my $parent = check_pc9x_t($pcall, $t, 92, 1);
+
$parent->lastid->{92} = $t;
+ $parent->do_pc92(1);
if (@ent) {
+
+ # look at the first one which will always be a node of some sort
+ # and update any information that needs to be done.
my ($call, $is_node, $is_extnode, $here, $version, $build) = _decode_pc92_call($ent[0]);
- if ($call && $is_node && $call eq $pcall) {
- $parent->here(Route::here($here));
- $parent->version($version) if $version;
- $parent->build($build) if $build;
- } elsif ($is_extnode) {
- # reparent to external node (note that we must have received a 'C' or 'A' record
- # from the true parent node for this external before we get one for the this node
- unless ($parent = Route::Node::get($call)) {
- dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr');
- return;
+ if ($call && $is_node) {
+ if ($is_extnode) {
+ # reparent to external node (note that we must have received a 'C' or 'A' record
+ # from the true parent node for this external before we get one for the this node
+ unless ($parent = Route::Node::get($call)) {
+ dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr');
+ return;
+ }
+ my $parent = check_pc9x_t($call, $t, 92) || return;
}
} else {
dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr');
return;
}
+ $parent->here(Route::here($here));
+ $parent->version($version) if $version && $version > $parent->version;
+ $parent->build($build) if $build && $build > $parent->build;
shift @ent;
}
}
}
}
+
+1;
# spider route broadcasts
#
-my $_last_time;
-my $_last_occurs;
-
-sub _gen_time
-{
- if (!$_last_time || $_last_time != $main::systime) {
- $_last_time = $main::systime;
- $_last_occurs = 0;
- return $_last_time;
- } else {
- $_last_occurs++;
- return sprintf "$_last_time.%02d", $_last_occurs;
- }
-}
sub _gen_pc92
{
my $sort = shift;
-# my $ext = $sort eq 'C';
- my $ext = 1;
- my $s = "PC92^$main::mycall^" . _gen_time . "^$sort";
+ my $ext = shift;
+ my $s = "PC92^$main::mycall^" . gen_pc9x_t() . "^$sort";
for (@_) {
$s .= "^" . _encode_pc92_call($_, $ext);
}
# add a local one
sub pc92a
{
- return _gen_pc92('A', @_);
+ return _gen_pc92('A', 0, @_);
}
# delete a local one
sub pc92d
{
- return _gen_pc92('D', @_);
+ return _gen_pc92('D', 0, @_);
}
# send a config
sub pc92c
{
- return _gen_pc92('C', @_);
+ return _gen_pc92('C', 1, @_);
}
1;
handle_xml => '0,Using XML,yesno',
lastmsg => '0,Last Route Msg,atime',
lastid => '0,Last Route MsgID',
+ do_pc92 => '0,Uses pc92,yesno',
);
$filterdef = $Route::filterdef;