From 6c06ed486e67b3e36e9af4794d2eb84f59f249c4 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 19 Feb 2005 22:27:48 +0000 Subject: [PATCH] add some Hello and Bye add some pc16/17 --- cmd/show/425.pl | 13 +++++- data/bands.pl | 2 +- perl/Aranea.pm | 9 +++-- perl/DXChannel.pm | 6 +-- perl/DXCommandmode.pm | 15 ++++--- perl/DXProt.pm | 36 +++++++---------- perl/DXProtout.pm | 6 +-- perl/DXUser.pm | 6 +-- perl/Thingy.pm | 12 +++++- perl/Thingy/Bye.pm | 94 +++++++++++++++++++++++++++++++++++++++++++ perl/Thingy/Hello.pm | 8 ++-- 11 files changed, 157 insertions(+), 50 deletions(-) create mode 100644 perl/Thingy/Bye.pm diff --git a/cmd/show/425.pl b/cmd/show/425.pl index 9fb8d968..044950d0 100644 --- a/cmd/show/425.pl +++ b/cmd/show/425.pl @@ -14,9 +14,11 @@ my @out; return (1, $self->msg('e24')) unless $Internet::allow; return (1, "SHOW/425 , e.g. SH/425 3B9FR") unless @list; my $target = $Internet::http_proxy || $Internet::dx425_url || "www.ariscandicci.it"; +#my $target = $Internet::http_proxy || $Internet::dx425_url || "192.168.0.2"; my $port = $Internet::http_proxy_port || 80; my $url = ''; $url = 'http://' . ($Internet::dx425_url || 'www.ariscandicci.it'); # if $Internet::http_proxy; +#$url = 'http://' . ($Internet::dx425_url || '192.168.0.2'); # if $Internet::http_proxy; use Net::Telnet; @@ -31,16 +33,23 @@ foreach $l (@list) { if (!$t || $@) { push @out, $self->msg('e18', 'Open(425.org)'); } else { - my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l"; + my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l HTTP/1.0\n" + ."User-Agent:DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$l)\n\n"; dbg($s) if isdbg('425'); $t->print($s); Log('call', "$call: show/425 \U$l"); my $state = "blank"; + my $count = 1; +# push @out, $s; while (my $result = eval { $t->getline(Timeout => 30) } || $@) { dbg($result) if isdbg('425') && $result; - chomp $result; + ++$count; + if ($count > 10) + { + #chomp $result; push @out, $result; } + } $t->close; push @out, $self->msg('e3', 'Search(425.org)', uc $l) unless @out; } diff --git a/data/bands.pl b/data/bands.pl index 9d98a173..5fadf916 100644 --- a/data/bands.pl +++ b/data/bands.pl @@ -44,7 +44,7 @@ cw => [ 7000, 7034 ], data => [ 7035, 7044], rtty => [ 7035, 7044], - ssb => [ 7051, 7400 ] + ssb => [ 7045, 7400 ] }, 'Bands'), '30m' => bless( { band => [ 10100, 10150 ], diff --git a/perl/Aranea.pm b/perl/Aranea.pm index f4d9a1ec..ed1c99cd 100644 --- a/perl/Aranea.pm +++ b/perl/Aranea.pm @@ -152,9 +152,12 @@ sub disconnect my $call = $self->call; return if $self->{disconnecting}++; - + + my $thing = Thingy::Bye->new(origin=>$main::mycall, user=>$call); + $thing->process($self); + # get rid of any PC16/17/19 -# eph_del_regex("^PC1[679]*$call"); + eph_del_regex("^PC1[679]*$call"); # do routing stuff, remove me from routing table my $node = Route::Node::get($call); @@ -165,7 +168,7 @@ sub disconnect # and all my ephemera as well for (@rout) { my $c = $_->call; -# eph_del_regex("^PC1[679].*$c"); + eph_del_regex("^PC1[679].*$c"); } } diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index e2e3f0d2..90e19ef9 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -121,10 +121,8 @@ $count = 0; ); use vars qw($VERSION $BRANCH); -$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; + +main::mkver($VERSION = q$Revision$); # object destruction sub DESTROY diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 7371a869..f451a434 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -37,6 +37,8 @@ use DB_File; use VE7CC; use Thingy; use Thingy::Dx; +use Thingy::Hello; +use Thingy::Bye; use strict; use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount $msgpolltime); @@ -52,10 +54,8 @@ $msgpolltime = 3600; # the time between polls for new messages use vars qw($VERSION $BRANCH); -$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; + +main::mkver($VERSION = q$Revision$); # # obtain a new connection this is derived from dxchannel @@ -71,9 +71,11 @@ sub new my @rout = $main::routeroot->add_user($call, Route::here(1)); # ALWAYS output the user + my $thing = Thingy::Hello->new(user => $self->{call}); + $thing->broadcast($self); + my $ref = Route::User::get($call); $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref; - return $self; } @@ -542,6 +544,9 @@ sub disconnect # issue a pc17 to everybody interested $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref); + + my $thing = Thingy::Bye->new(user=>$call); + $thing->broadcast($self); } else { confess "trying to disconnect a non existant user $call"; } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 05111d40..0484d8fc 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -40,6 +40,8 @@ use Thingy::Dx; use Thingy::Rt; use Thingy::Ping; use Thingy::T; +use Thingy::Hello; +use Thingy::Bye; use strict; @@ -237,7 +239,9 @@ sub new my $pkg = shift; my $call = shift; $main::routeroot->add($call, '5000', Route::here(1)) if $call ne $main::mycall; - + my $thing = Thingy::Hello->new(user=>$call); + $thing->broadcast($self); + return $self; } @@ -533,7 +537,7 @@ sub handle_11 my $thing = Thingy::Dx->new(origin=>$main::mycall); $thing->from_DXProt(DXProt=>$line,spotdata=>\@spot); - $thing->queue($self); + $thing->process($self); # this goes after the input filtering, but before the add # so that if it is input filtered, it isn't added to the dup @@ -591,20 +595,6 @@ sub handle_11 } } } - - # local processing - my $r; - eval { - $r = Local::spot($self, @spot); - }; - # dbg("Local::spot1 error $@") if isdbg('local') if $@; - return if $r; - - # DON'T be silly and send on PC26s! - return if $pcno == 26; - - # send out the filtered spots -# send_dx_spot($self, $line, @spot) if @spot; } # announces @@ -746,14 +736,15 @@ sub handle_16 eph_del_regex("^PC17\\^$call\\^$ncall"); my $flags = $here ? 1 : 0; - $rout .= ":U$flags$call"; + $rout .= "$flags$call:"; } if ($rout) { + chop $rout; my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call}); - $thing->from_DXProt(t=>'eau', d=>"N1$ncall$rout", DXProt=>$line); - $thing->queue($self); + $thing->from_DXProt(t=>'au', $ncall eq $self->{call} ? () : ('n', "1$ncall"), u=>$rout, DXProt=>$line); + $thing->process($self); } else { dbg("PCPROT: No usable users") if isdbg('chanerr'); } @@ -819,8 +810,8 @@ sub handle_17 $uref = Route->new($ucall) unless $uref; # throw away my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call}); - $thing->from_DXProt(t=>'edu', d=>"N1$ncall:U1$ucall", DXProt=>$line); - $thing->queue($self); + $thing->from_DXProt(t=>'du', $ncall eq $self->{call} ? () : ('n', "1$ncall"), u=>"1$ucall", DXProt=>$line); + $thing->process($self); } # link request @@ -2217,6 +2208,9 @@ sub disconnect # broadcast to all other nodes that all the nodes connected to via me are gone unless ($pc39flag && $pc39flag == 2) { + my $thing = Thingy::Bye->new(user=>$call); + $thing->broadcast($self); + $self->route_pc21($main::mycall, undef, @rout) if @rout; } diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index 27b54700..0e12aa10 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -20,10 +20,8 @@ use DXDebug; use strict; use vars qw($VERSION $BRANCH); -$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; + +main::mkver($VERSION = q$Revision$); use vars qw($sentencelth); diff --git a/perl/DXUser.pm b/perl/DXUser.pm index d2a0a12a..a349f6ab 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -20,10 +20,8 @@ use LRU; use strict; use vars qw($VERSION $BRANCH); -$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; + +main::mkver($VERSION = q$Revision$); use vars qw(%u $dbm $filename %valid $lastoperinterval $lasttime $lru $lrusize $tooold $v3); diff --git a/perl/Thingy.pm b/perl/Thingy.pm index ed33fde0..522e4b13 100644 --- a/perl/Thingy.pm +++ b/perl/Thingy.pm @@ -96,11 +96,21 @@ sub queue push @queue, $thing; } +# # this is the main commutator loop. In due course it will -# become the *only* commutator loop +# become the *only* commutator loop, This can be called in one +# of two ways: either with 2 args or with none. +# +# The two arg form is an immediate "queue and handle" and does +# a full cycle, immediately +# sub process { my $thing; + if (@_ == 2) { + $thing = shift; + $thing->queue(shift); + } while (@queue) { $thing = shift @queue; my $dxchan = DXChannel->get($thing->{dxchan}); diff --git a/perl/Thingy/Bye.pm b/perl/Thingy/Bye.pm new file mode 100644 index 00000000..22b7d4c6 --- /dev/null +++ b/perl/Thingy/Bye.pm @@ -0,0 +1,94 @@ +# +# Bye Thingy handling +# +# $Id$ +# +# Copyright (c) 2005 Dirk Koopman G1TLH +# + +use strict; + +package Thingy::Bye; + +use vars qw($VERSION $BRANCH); +$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; + +use DXChannel; +use DXDebug; +use Verify; +use Thingy; + +use vars qw(@ISA); +@ISA = qw(Thingy); + +sub gen_Aranea +{ + my $thing = shift; + unless ($thing->{Aranea}) { + my $s = sprintf "%X", int(rand() * 100000000); + my $auth = Verify->new("DXSp,$main::mycall,$s"); + $thing->{Aranea} = Aranea::genmsg($thing, 'Bye', + 's'=>$s, + auth=>$auth->challenge($main::me->user->passphrase) + ); + } + return $thing->{Aranea}; +} + +sub handle +{ + my $thing = shift; + my $dxchan = shift; + + # verify authenticity + if ($dxchan->{call} eq $thing->{origin}) { + + # for directly connected calls +# if ($Thingy::Hello::verify_on_login) { +# my $pp = $dxchan->user->passphrase; +# unless ($pp) { +# dbglog('err', "Thingy::Bye::handle: verify on and $thing->{origin} has no passphrase"); +# return; +# } +# my $auth = Verify->new("DXSp,$thing->{origin},$thing->{s}"); +# unless ($auth->verify($thing->{auth}, $dxchan->user->passphrase)) { +# dbglog('err', "Thingy::Bye::handle: verify on and $thing->{origin} failed auth check"); +# return; +# } +# } + + my $int = $thing->{user} || $thing->{origin}; + RouteDB::delete_interface($int); + } else { + + # for otherwise connected calls, that come in relayed from other nodes + # note that we cannot do any connections at this point + my $nref = Route::Node::get($thing->{origin}); + if ($nref) { + if (my $user = $thing->{user}) { + my $ur = Route::get($user); + if ($ur) { + if ($ur->isa('Route::Node')) { + $nref->del($ur); + } elsif ($ur->isa('Route::User')) { + $nref->del_user($ur); + } + } + } + } + } + + + $thing->broadcast($dxchan); +} + +sub new +{ + my $pkg = shift; + my $thing = $pkg->SUPER::new(origin=>$main::mycall, @_); + return $thing; +} +1; diff --git a/perl/Thingy/Hello.pm b/perl/Thingy/Hello.pm index c098ca94..f2938c1f 100644 --- a/perl/Thingy/Hello.pm +++ b/perl/Thingy/Hello.pm @@ -11,10 +11,8 @@ use strict; package Thingy::Hello; use vars qw($VERSION $BRANCH); -$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; + +main::mkver($VERSION = q$Revision$); use DXChannel; use DXDebug; @@ -103,7 +101,7 @@ sub handle sub new { my $pkg = shift; - my $thing = $pkg->SUPER::new(origin=>$main::mycall); + my $thing = $pkg->SUPER::new(origin=>$main::mycall, @_); return $thing; } 1; -- 2.43.0