$user->lastin($main::systime) unless DXChannel->get($call);
$user->put;
}
- $self->process_pc59($pcno, 'A', hexstamp(), $main::routeroot,
+ $self->process_pc59($pcno, 'A', hexstamp(), Route::Node::get($self->{call}),
$node, undef, @rout);
}
return;
}
- $self->process_pc59($pcno, 'D', hexstamp(), $main::routeroot, $node, undef, $uref);
+ $self->process_pc59($pcno, 'D', hexstamp(), Route::Node::get($self->{call}), $node, undef, $uref);
}
# link request
$self->version($_[2] / 100) if $_[2] && $_[2] =~ /^\d+$/;
$self->user->version($self->version);
}
- $self->newroute( $_[1] =~ /!NRt/ );
+ $self->newroute( $_[1] =~ /\!NRt/ );
# first clear out any nodes on this dxchannel
my $node = Route::Node::get($self->{call}) ;
# unshift in the route::node for this interface if isn't present
if (@rout) {
unshift @rout, $parent unless $rout[0]->call ne $self->{call};
- $self->process_pc59($pcno, 'A', hexstamp(), $main::routeroot, $parent, undef, @rout);
+ $self->process_pc59($pcno, 'A', hexstamp(), Route::Node::get($self->{call}), $parent, undef, @rout);
}
}
push @rout, $node;
}
- $self->process_pc59($pcno, 'D', hexstamp(), $main::routeroot, $parent, undef, @rout);
+ $self->process_pc59($pcno, 'D', hexstamp(), Route::Node::get($self->{call}), $parent, undef, @rout);
}
}
my $hexlasttime = 0;
-my $hexlastlet = '!';
+my $hexlastlet = 'A';
+my $hexoverflow = '';
sub hexstamp
{
my $t = shift || $main::systime;
- if ($hexlastlet gt '>' || $t ne $hexlasttime) {
+ if ($t ne $hexlasttime) {
$hexlasttime = $t;
- $hexlastlet = '!';
+ $hexoverflow = '';
+ $hexlastlet = 'A';
} else {
do {
$hexlastlet = chr(ord($hexlastlet) + 1);
+ if ($hexlastlet ge '~') {
+ $hexlastlet = 'A';
+ $hexoverflow ||= '@';
+ do {
+ $hexoverflow = chr(ord($hexoverflow) + 1);
+ } while ($hexoverflow eq '^');
+ }
} while ($hexlastlet eq '^');
}
- return sprintf "%s%08X", $hexlastlet, $hexlasttime;
+ return sprintf "%08X%s%s", $hexlasttime, $hexoverflow, $hexlastlet;
}
sub pc58
my $ref = $_;
my $call = $ref->call;
my $here = $ref->here;
- $s .= $ref->enc_pc59;
+ $s .= '^' . $ref->enc_pc59;
}
push @out, sprintf "$s^%s^", get_hops(59);
return @out;
return $r ? 1 : 0;
}
-#
-# pc59 entity encoding and decoding
-#
-sub enc_pc59
-{
- my $self = shift;
- my $sort = shift || 'N';
- my $out = "$sort$self->{flag}$self->{call}";
- if ($self->{build}) {
- $out .= "b$self->{build}";
- } elsif ($self->{version}) {
- $out .= "v$self->{version}";
- }
-}
sub dec_pc59
{
my $s = ref($node) ? shift : $node;
$node = undef;
- my ($sort, $here, $call) = unpack "A A A*", $s;
+ my ($sort, $here, $callstring) = unpack "A A A*", $s;
+ my ($call) = $callstring =~ /^([A-Z0-9\-]+)/;
return unless is_callsign($call);
return unless $here =~ /^[0123]$/;
return unless $sort =~ /^[NUE]$/;
if ($sort eq 'E' || $sort eq 'N') {
$node = Route::Node::get($call) || Route::Node->new($call);
- if ($s =~ /b([\d\.])/) {
+ if ($callstring =~ /b([\d\.])/) {
$node->{build} = $1;
}
- if ($s =~ /v([\d\.])/) {
+ if ($callstring =~ /v([\d\.])/) {
$node->{version} = $1;
}
} elsif ($sort eq 'U') {
return values %list;
}
+#
+# pc59 entity encoding and decoding
+#
+sub enc_pc59
+{
+ my $self = shift;
+ my $sort = shift || 'N';
+ my $out = "$sort$self->{flags}$self->{call}";
+ if ($sort eq 'N') {
+ if ($self->{build}) {
+ $out .= "b$self->{build}";
+ } elsif ($self->{version}) {
+ $out .= "v$self->{version}";
+ }
+ }
+ return $out;
+}
+
sub DESTROY
{
my $self = shift;
return @{$self->{nodes}};
}
+#
+# pc59 entity encoding and decoding
+#
+sub enc_pc59
+{
+ my $self = shift;
+ my $sort = shift || 'U';
+ my $out = "$sort$self->{flags}$self->{call}";
+ return $out;
+}
+
#
# generic AUTOLOAD for accessors
#