move stuff around and try to get pc59 handling/generation more correct
authorminima <minima>
Wed, 21 Jul 2004 13:21:35 +0000 (13:21 +0000)
committerminima <minima>
Wed, 21 Jul 2004 13:21:35 +0000 (13:21 +0000)
perl/DXProtHandler.pm
perl/DXProtout.pm
perl/Route.pm
perl/Route/Node.pm
perl/Route/User.pm

index 726c3447a03693412096cd720ff8cfc69f9262ab..9685243e5e6c7ca6cc5c57764a22f1fef272d5c7 100644 (file)
@@ -431,7 +431,7 @@ sub handle_16
                $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);
 }
                
@@ -488,7 +488,7 @@ sub handle_17
                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
@@ -516,7 +516,7 @@ sub handle_18
                $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}) ;
@@ -618,7 +618,7 @@ sub handle_19
        # 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);
        }
 }
                
@@ -684,7 +684,7 @@ sub handle_21
                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);
 }
                
 
index 4194d6c42089a4590311928125cefb367af8202f..840c4edec4f9b90213b7f970e3e1ff34e96cf663 100644 (file)
@@ -361,20 +361,29 @@ sub pc51
 }
 
 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
@@ -402,7 +411,7 @@ sub pc59
                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;
index 695eed8dffa05aea3e627b4a31c793060d6000f0..6c22e22fc19d805eeb4b4516f59dea1f731c6df0 100644 (file)
@@ -170,20 +170,6 @@ sub conf
        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
 {
@@ -191,16 +177,17 @@ 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') {
index f3072db121cb747b440c838244cc51025606cf3c..4e1692f13275792fa9a46e3b811aae4b76dbe0f1 100644 (file)
@@ -270,6 +270,24 @@ sub get_all
        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;
index d3cfb7d34abfec26b9f814a9141126665517e866..7bf19d44a5babf7c6d10a665fc0bb4e3cb0c35f8 100644 (file)
@@ -110,6 +110,17 @@ sub nodes
        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
 #