--- /dev/null
+#
+# This module is part of the new protocal mode for a dx cluster
+#
+# This module handles the initialisation between two nodes
+#
+# Copyright (c) 2003 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+package QXI;
+
+use strict;
+
+use vars qw(@ISA $VERSION $BRANCH);
+@ISA = qw(QXProt);
+
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+
+sub handle
+{
+ my ($self, $to, $from, $msgid, $line) = @_;
+
+ my @f = split /\^/, $line;
+ if ($self->user->passphrase && @f > 3) {
+ my $inv = Verify->new($f[3]);
+ unless ($inv->verify($f[4], $main::me->user->passphrase, $main::mycall, $self->call)) {
+ $self->sendnow('D','Sorry...');
+ $self->disconnect;
+ }
+ $self->{verified} = 1;
+ } else {
+ $self->{verified} = 0;
+ }
+ if ($self->{outbound}) {
+ $self->send($self->QXI::gen);
+ }
+ if ($self->{sort} ne 'S' && $f[0] eq 'DXSpider') {
+ $self->{user}->{sort} = $self->{sort} = 'S';
+ $self->{user}->{priv} = $self->{priv} = 1 unless $self->{priv};
+ }
+ $self->{version} = $f[1];
+ $self->{build} = $f[2];
+ $self->state('init1');
+ $self->{lastping} = 0;
+}
+
+sub gen
+{
+ my $self = shift;
+ my @out = ('I', $self->call, "DXSpider", ($main::version + 53) * 100, $main::build);
+ if (my $pass = $self->user->passphrase) {
+ my $inp = Verify->new;
+ push @out, $inp->challenge, $inp->response($pass, $self->call, $main::mycall);
+ }
+ return $self->frame(@out);
+}
+
+1;
--- /dev/null
+#
+# This module is part of the new protocal mode for a dx cluster
+#
+# This module handles ping requests
+#
+# Copyright (c) 2003 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+package QXP;
+
+use strict;
+
+use vars qw(@ISA $VERSION $BRANCH);
+@ISA = qw(QXProt);
+
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+sub handle
+{
+ my ($self, $to, $from, $msgid, $line) = @_;
+
+ my @f = split /\^/, $line;
+
+ # is it for us?
+ if ($to eq $main::mycall) {
+ if ($f[0] == 1) {
+ $self->send(gen($self, $from, '0', $f[1], $f[2], $f[3]));
+ } else {
+ # it's a reply, look in the ping list for this one
+ $self->handlepingreply($from);
+ }
+ } else {
+
+ # route down an appropriate thingy
+ $self->route($to, $line);
+ }
+}
+
+sub gen
+{
+ my ($self, $to, $flag, $user, $secs, $usecs) = @_;
+ my @out = ('P', $to, $flag);
+ push @out, $user if defined $user;
+ push @out, $secs if defined $secs;
+ push @out, $usecs if defined $usecs;
+ return $self->frame(@out);
+}
+
+1;
--- /dev/null
+
+#
+# This module is part of the new protocal mode for a dx cluster
+#
+# This module handles the Routing message between nodes
+#
+# Copyright (c) 2003 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+package QXR;
+
+use strict;
+
+use vars qw(@ISA $VERSION $BRANCH);
+@ISA = qw(QXProt);
+
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+sub handle
+{
+ my ($self, $to, $from, $msgid, $line) = @_;
+
+ my @f = split /\^/, $line;
+
+}
+
+sub gen
+{
+ my $self = shift;
+ my @out = ('R', $self->call, "DXSpider", ($main::version + 53) * 100, $main::build);
+ if (my $pass = $self->user->passphrase) {
+ my $inp = Verify->new;
+ push @out, $inp->challenge, $inp->response($pass, $self->call, $main::mycall);
+ }
+ return $self->frame(@out);
+}
+
+1;
+
+sub gen2
+{
+ my $self = shift;
+
+ my $node = shift;
+ my $sort = shift;
+ my @out;
+ my $dxchan;
+
+ while (@_) {
+ my $str = '';
+ for (; @_ && length $str <= 230;) {
+ my $ref = shift;
+ my $call = $ref->call;
+ my $flag = 0;
+
+ $flag += 1 if $ref->here;
+ $flag += 2 if $ref->conf;
+ if ($ref->is_node) {
+ my $ping = int($ref->pingave * 10);
+ $str .= "^N$flag$call,$ping";
+ my $v = $ref->build || $ref->version;
+ $str .= ",$v" if defined $v;
+ } else {
+ $str .= "^U$flag$call";
+ }
+ }
+ push @out, $str if $str;
+ }
+ my $n = @out;
+ my $h = get_hops(90);
+ @out = map { sprintf "PC90^%s^%X^%s%d%s^%s^", $node->call, $main::systime, $sort, --$n, $_, $h } @out;
+ return @out;
+}