3 # This module impliments the protocal mode for a dx cluster
5 # Copyright (c) 1998 Dirk Koopman G1TLH
31 use Time::HiRes qw(gettimeofday tv_interval);
36 use vars qw($me $pc11_max_age $pc23_max_age
37 $last_hour %pings %rcmds
38 %nodehops $baddx $badspotter $badnode $censorpc
39 $allowzero $decode_dk0wcy $send_opernam @checklist);
41 $me = undef; # the channel id for this cluster
42 $pc11_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc11
43 $pc23_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc23
45 $last_hour = time; # last time I did an hourly periodic update
46 %pings = (); # outstanding ping requests outbound
47 %rcmds = (); # outstanding rcmd requests outbound
48 %nodehops = (); # node specific hop control
49 $censorpc = 1; # Do a BadWords::check on text fields and reject things
50 # loads of 'bad things'
51 $baddx = new DXHash "baddx";
52 $badspotter = new DXHash "badspotter";
53 $badnode = new DXHash "badnode";
57 [ qw(c c m bp bc c) ], # pc10
58 [ qw(f m d t m c c h) ], # pc11
59 [ qw(c bc m bp bm p h) ], # pc12
63 undef , # pc16 has to be validated manually
66 undef , # pc19 has to be validated manually
67 undef , # pc20 no validation
69 undef , # pc22 no validation
70 [ qw(d n n n n m c c h) ], # pc23
72 [ qw(c c n n) ], # pc25
73 [ qw(f m d t m c c bc) ], # pc26
74 [ qw(d n n n n m c c bc) ], # pc27
75 [ qw(c c m c d t p m bp n p bp bc) ], # pc28
76 [ qw(c c n m) ], # pc29
84 [ qw(c c n m) ], # pc37
85 undef, # pc38 not interested
87 [ qw(c c m p n) ], # pc40
88 [ qw(c n m h) ], # pc41
90 undef, # pc43 don't handle it
91 [ qw(c c n m m c) ], # pc44
92 [ qw(c c n m) ], # pc45
120 [ qw(d n n n n n n m m m c c h) ], # pc73
131 [ qw(c c c m) ], # pc84
132 [ qw(c c c m) ], # pc85
135 # use the entry in the check list to check the field list presented
136 # return OK if line NOT in check list (for now)
141 return 0 if $n < 0 || $n > @checklist;
142 my $ref = $checklist[$n];
143 return 0 unless ref $ref;
146 shift; # not interested in the first field
147 for ($i = 0; $i < @$ref; $i++) {
148 my ($blank, $act) = $$ref[$i] =~ /^(b?)(\w)$/;
149 return 0 unless $act;
150 next if $blank && $_[$i] =~ /^[ \*]$/;
152 return $i+1 unless is_callsign($_[$i]);
153 } elsif ($act eq 'm') {
154 return $i+1 unless is_pctext($_[$i]);
155 } elsif ($act eq 'p') {
156 return $i+1 unless is_pcflag($_[$i]);
157 } elsif ($act eq 'f') {
158 return $i+1 unless is_freq($_[$i]);
159 } elsif ($act eq 'n') {
160 return $i+1 unless $_[$i] =~ /^[\d ]+$/;
161 } elsif ($act eq 'h') {
162 return $i+1 unless $_[$i] =~ /^H\d\d?$/;
163 } elsif ($act eq 'd') {
164 return $i+1 unless $_[$i] =~ /^\s*\d+-\w\w\w-[12][90]\d\d$/;
165 } elsif ($act eq 't') {
166 return $i+1 unless $_[$i] =~ /^[012]\d[012345]\dZ$/;
174 my $user = DXUser->get($main::mycall);
175 $DXProt::myprot_version += $main::version*100;
176 $me = DXProt->new($main::mycall, 0, $user);
178 $me->{state} = "indifferent";
179 do "$main::data/hop_table.pl" if -e "$main::data/hop_table.pl";
181 $me->{sort} = 'S'; # S for spider
185 # obtain a new connection this is derived from dxchannel
190 my $self = DXChannel::alloc(@_);
194 # this is how a pc connection starts (for an incoming connection)
195 # issue a PC38 followed by a PC18, then wait for a PC20 (remembering
196 # all the crap that comes between).
199 my ($self, $line, $sort) = @_;
200 my $call = $self->{call};
201 my $user = $self->{user};
203 # remember type of connection
204 $self->{consort} = $line;
205 $self->{outbound} = $sort eq 'O';
206 $self->{priv} = $user->priv || 1; # other clusters can always be 'normal' users
207 $self->{lang} = $user->lang || 'en';
208 $self->{isolate} = $user->{isolate};
209 $self->{consort} = $line; # save the connection type
212 # get the output filters
213 $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0);
214 $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0);
215 $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0);
216 $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ;
219 # get the INPUT filters (these only pertain to Clusters)
220 $self->{inspotsfilter} = Filter::read_in('spots', $call, 1) || Filter::read_in('spots', 'node_default', 1);
221 $self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1);
222 $self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1);
223 $self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1);
225 # set unbuffered and no echo
226 $self->send_now('B',"0");
227 $self->send_now('E',"0");
229 # ping neighbour node stuff
230 my $ping = $user->pingint;
231 $ping = 5*60 unless defined $ping;
232 $self->{pingint} = $ping;
233 $self->{nopings} = $user->nopings || 2;
234 $self->{pingtime} = [ ];
235 $self->{pingave} = 0;
237 # send initialisation string
238 unless ($self->{outbound}) {
240 $self->{lastping} = $main::systime;
242 $self->{lastping} = $main::systime + ($self->pingint / 2);
244 $self->state('init');
245 $self->{pc50_t} = $main::systime;
247 # send info to all logged in thingies
248 $self->tell_login('loginn');
250 Log('DXProt', "$call connected");
254 # This is the normal pcxx despatcher
258 my ($self, $line) = @_;
259 my @field = split /\^/, $line;
260 return unless @field;
262 pop @field if $field[-1] eq '~';
264 # print join(',', @field), "\n";
266 # ignore any lines that don't start with PC
267 return if !$field[0] =~ /^PC/;
270 my ($pcno) = $field[0] =~ /^PC(\d\d)/; # just get the number
272 return if $pcno < 10 || $pcno > 99;
274 # check for and dump bad protocol messages
275 my $n = check($pcno, @field);
277 dbg('chan', "PCPROT: bad field $n, dumped (" . parray($checklist[$pcno-10]) . ")");
284 $pcr = Local::pcprot($self, $pcno, @field);
286 # dbg('local', "Local::pcprot error $@") if $@;
290 if ($pcno == 10) { # incoming talk
292 # will we allow it at all?
295 if (@bad = BadWords::check($field[3])) {
296 dbg('chan', "PCPROT: Bad words: @bad, dropped" );
301 # is it for me or one of mine?
302 my ($to, $via, $call, $dxchan);
303 if ($field[5] gt ' ') {
304 $call = $via = $field[2];
307 $call = $to = $field[2];
309 $dxchan = DXChannel->get($call);
310 if ($dxchan && $dxchan->is_user) {
311 $field[3] =~ s/\%5E/^/g;
312 $dxchan->talk($field[1], $to, $via, $field[3]);
314 $self->route($field[2], $line); # relay it on its way
319 if ($pcno == 11 || $pcno == 26) { # dx spot
321 # route 'foreign' pc26s
323 if ($field[7] ne $main::mycall) {
324 $self->route($field[7], $line);
329 # if this is a 'nodx' node then ignore it
330 if ($badnode->in($field[7])) {
331 dbg('chan', "PCPROT: Bad Node, dropped");
335 # if this is a 'bad spotter' user then ignore it
336 if ($badspotter->in($field[6])) {
337 dbg('chan', "PCPROT: Bad Spotter, dropped");
341 # convert the date to a unix date
342 my $d = cltounix($field[3], $field[4]);
343 # bang out (and don't pass on) if date is invalid or the spot is too old (or too young)
344 if (!$d || ($pcno == 11 && ($d < $main::systime - $pc11_max_age || $d > $main::systime + 900))) {
345 dbg('chan', "PCPROT: Spot ignored, invalid date or out of range ($field[3] $field[4])\n");
350 if ($baddx->in($field[2])) {
351 dbg('chan', "PCPROT: Bad DX spot, ignored");
356 $field[5] =~ s/^\s+//; # take any leading blanks off
357 $field[2] = unpad($field[2]); # take off leading and trailing blanks from spotted callsign
358 if ($field[2] =~ /BUST\w*$/) {
359 dbg('chan', "PCPROT: useless 'BUSTED' spot");
362 if (Spot::dup($field[1], $field[2], $d, $field[5])) {
363 dbg('chan', "PCPROT: Duplicate Spot ignored\n");
368 if (@bad = BadWords::check($field[5])) {
369 dbg('chan', "PCPROT: Bad words: @bad, dropped" );
374 my @spot = Spot::prepare($field[1], $field[2], $d, $field[5], $field[6], $field[7]);
375 # global spot filtering on INPUT
376 if ($self->{inspotsfilter}) {
377 my ($filter, $hops) = $self->{inspotsfilter}->it(@spot);
379 dbg('chan', "PCPROT: Rejected by filter");
388 # @spot at this point contains:-
389 # freq, spotted call, time, text, spotter, spotted cc, spotters cc, orig node
390 # then spotted itu, spotted cq, spotters itu, spotters cq
391 # you should be able to route on any of these
394 # fix up qra locators of known users
395 my $user = DXUser->get_current($spot[4]);
397 my $qra = $user->qra;
398 unless ($qra && DXBearing::is_qra($qra)) {
399 my $lat = $user->lat;
400 my $long = $user->long;
401 if (defined $lat && defined $long) {
402 $user->qra(DXBearing::lltoqra($lat, $long));
407 # send a remote command to a distant cluster if it is visible and there is no
408 # qra locator and we havn't done it for a month.
410 unless ($user->qra) {
412 my $to = $user->homenode;
413 my $last = $user->lastoper || 0;
414 if ($send_opernam && $main::systime > $last + $DXUser::lastoperinterval && $to && ($node = DXCluster->get_exact($to)) ) {
415 my $cmd = "forward/opernam $spot[4]";
416 # send the rcmd but we aren't interested in the replies...
417 if ($node && $node->dxchan && $node->dxchan->is_clx) {
418 route(undef, $to, pc84($main::mycall, $to, $main::mycall, $cmd));
420 route(undef, $to, pc34($main::mycall, $to, $cmd));
422 if ($to ne $field[7]) {
424 $node = DXCluster->get_exact($to);
425 if ($node && $node->dxchan && $node->dxchan->is_clx) {
426 route(undef, $to, pc84($main::mycall, $to, $main::mycall, $cmd));
428 route(undef, $to, pc34($main::mycall, $to, $cmd));
431 $user->lastoper($main::systime);
440 $r = Local::spot($self, @spot);
442 # dbg('local', "Local::spot1 error $@") if $@;
445 # DON'T be silly and send on PC26s!
446 return if $pcno == 26;
448 # send out the filtered spots
449 send_dx_spot($self, $line, @spot) if @spot;
453 if ($pcno == 12) { # announces
454 # announce duplicate checking
455 $field[3] =~ s/^\s+//; # remove leading blanks
456 if (AnnTalk::dup($field[1], $field[2], $field[3])) {
457 dbg('chan', "PCPROT: Duplicate Announce ignored");
463 if (@bad = BadWords::check($field[3])) {
464 dbg('chan', "PCPROT: Bad words: @bad, dropped" );
469 if ($field[2] eq '*' || $field[2] eq $main::mycall) {
471 # global ann filtering on INPUT
472 if ($self->{inannfilter}) {
473 my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
474 my @dxcc = Prefix::extract($field[1]);
476 $ann_dxcc = $dxcc[1]->dxcc;
477 $ann_itu = $dxcc[1]->itu;
478 $ann_cq = $dxcc[1]->cq();
480 @dxcc = Prefix::extract($field[5]);
482 $org_dxcc = $dxcc[1]->dxcc;
483 $org_itu = $dxcc[1]->itu;
484 $org_cq = $dxcc[1]->cq();
486 my ($filter, $hops) = $self->{inannfilter}->it(@field[1..6], $self->{call},
487 $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
489 dbg('chan', "PCPROT: Rejected by filter");
495 $self->send_announce($line, @field[1..6]);
497 $self->route($field[2], $line);
513 if ($pcno == 16) { # add a user
514 my $node = DXCluster->get_exact($field[1]);
516 if (!$node && ($dxchan = DXChannel->get($field[1]))) {
517 # add it to the node table if it isn't present and it's
519 $node = DXNode->new($dxchan, $field[1], 0, 1, 5400);
520 dbg('chan', "PCPROT: $field[1] no PC19 yet, autovivified as node");
521 # broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate};
524 if ($field[1] eq $main::mycall || $field[2] eq $main::mycall) {
525 dbg('chan', "PCPROT: trying to alter config on this node from outside!");
528 if ($field[2] eq $main::myalias && DXChannel->get($field[1])) {
529 dbg('chan', "PCPROT: trying to connect sysop from outside!");
533 dbg('chan', "PCPROT: Node $field[1] not in config");
536 unless ($node->isa('DXNode')) {
537 dbg('chan', "PCPROT: $field[1] is not a node");
540 if ($node->dxchan != $self) {
541 dbg('chan', "PCPROT: $field[1] came in on wrong channel");
544 if (($dxchan = DXChannel->get($field[1])) && $dxchan != $self) {
545 dbg('chan', "PCPROT: $field[1] connected locally");
550 for ($i = 2; $i < $#field; $i++) {
551 my ($call, $confmode, $here) = $field[$i] =~ /^(\S+) (\S) (\d)/o;
552 next unless $call && $confmode && defined $here && is_callsign($call);
553 my $ref = DXCluster->get_exact($call);
555 if ($ref->isa('DXNode')) {
556 dbg('chan', "PCPROT: $call is a node");
559 my $rcall = $ref->mynode->call;
560 dbg('chan', "PCPROT: already have $call on $rcall");
564 $confmode = $confmode eq '*';
565 DXNodeuser->new($self, $node, $call, $confmode, $here);
567 # add this station to the user database, if required
568 $call =~ s/-\d+$//o; # remove ssid for users
569 my $user = DXUser->get_current($call);
570 $user = DXUser->new($call) if !$user;
571 $user->homenode($node->call) if !$user->homenode;
572 $user->node($node->call);
573 $user->lastin($main::systime) unless DXChannel->get($call);
577 # queue up any messages (look for privates only)
578 DXMsg::queue_msg(1) if $self->state eq 'normal';
579 # broadcast_route($line, $self, $field[1]);
584 if ($pcno == 17) { # remove a user
585 my $node = DXCluster->get_exact($field[2]);
587 if (!$node && ($dxchan = DXChannel->get($field[2]))) {
588 # add it to the node table if it isn't present and it's
590 $node = DXNode->new($dxchan, $field[2], 0, 1, 5400);
591 dbg('chan', "PCPROT: $field[2] no PC19 yet, autovivified as node");
592 # broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate};
594 if ($field[1] eq $main::mycall || $field[2] eq $main::mycall) {
595 dbg('chan', "PCPROT: trying to alter config on this node from outside!");
598 if ($field[1] eq $main::myalias && DXChannel->get($field[1])) {
599 dbg('chan', "PCPROT: trying to disconnect sysop from outside!");
603 dbg('chan', "PCPROT: Node $field[2] not in config");
606 unless ($node->isa('DXNode')) {
607 dbg('chan', "PCPROT: $field[2] is not a node");
610 if ($node->dxchan != $self) {
611 dbg('chan', "PCPROT: $field[2] came in on wrong channel");
614 if ($dxchan = DXChannel->get($field[1])) {
615 dbg('chan', "PCPROT: $field[1] connected locally");
618 my $ref = DXCluster->get_exact($field[1]);
620 if ($ref->mynode != $node) {
621 dbg('chan', "PCPROT: $field[1] came in from wrong node $field[2]");
626 dbg('chan', "PCPROT: $field[1] not known" );
629 # broadcast_route($line, $self, $field[2]);
634 if ($pcno == 18) { # link request
635 $self->state('init');
637 # first clear out any nodes on this dxchannel
638 my @gonenodes = map { $_->dxchan == $self ? $_ : () } DXNode::get_all();
639 foreach my $node (@gonenodes) {
640 next if $node->dxchan == $DXProt::me;
641 broadcast_ak1a(pc21($node->call, 'Gone, re-init') , $self) unless $self->{isolate};
644 $self->send_local_config();
646 return; # we don't pass these on
649 if ($pcno == 19) { # incoming cluster list
651 my $newline = "PC19^";
652 for ($i = 1; $i < $#field-1; $i += 4) {
653 my $here = $field[$i];
654 my $call = uc $field[$i+1];
655 my $confmode = $field[$i+2];
656 my $ver = $field[$i+3];
657 next unless defined $here && defined $confmode && is_callsign($call);
659 $ver = 5400 if !$ver && $allowzero;
661 # now check the call over
662 my $node = DXCluster->get_exact($call);
665 if (($dxchan = DXChannel->get($call)) && $dxchan != $self) {
666 dbg('chan', "PCPROT: $call connected locally");
668 if ($node->dxchan != $self) {
669 dbg('chan', "PCPROT: $call come in on wrong channel");
672 my $rcall = $node->mynode->call;
673 dbg('chan', "PCPROT: already have $call on $rcall");
677 # check for sane parameters
678 next if $ver < 5000; # only works with version 5 software
679 next if length $call < 3; # min 3 letter callsigns
681 # add it to the nodes table and outgoing line
682 $newline .= "$here^$call^$confmode^$ver^";
683 DXNode->new($self, $call, $confmode, $here, $ver);
685 # unbusy and stop and outgoing mail (ie if somehow we receive another PC19 without a disconnect)
686 my $mref = DXMsg::get_busy($call);
687 $mref->stop_msg($call) if $mref;
689 # add this station to the user database, if required (don't remove SSID from nodes)
690 my $user = DXUser->get_current($call);
692 $user = DXUser->new($call);
694 $user->priv(1); # I have relented and defaulted nodes
695 $self->{priv} = 1; # to user RCMDs allowed
696 $user->homenode($call);
699 $user->lastin($main::systime) unless DXChannel->get($call);
703 return if $newline eq "PC19^";
706 $newline .= get_hops(19) . "^";
711 if ($pcno == 20) { # send local configuration
712 $self->send_local_config();
714 $self->state('normal');
718 if ($pcno == 21) { # delete a cluster from the list
719 my $call = uc $field[1];
720 if ($call ne $main::mycall) { # don't allow malicious buggers to disconnect me!
721 my $node = DXCluster->get_exact($call);
723 unless ($node->isa('DXNode')) {
724 dbg('chan', "PCPROT: $call is not a node");
727 if ($call eq $self->{call}) {
728 dbg('chan', "PCPROT: Trying to disconnect myself with PC21");
731 if ($node->dxchan != $self) {
732 dbg('chan', "PCPROT: $call come in on wrong channel");
736 if ($dxchan = DXChannel->get($call)) {
737 dbg('chan', "PCPROT: $call connected locally");
742 dbg('chan', "PCPROT: $call not in table, dropped");
746 dbg('chan', "PCPROT: I WILL _NOT_ be disconnected!");
749 # broadcast_route($line, $self, $call);
755 $self->state('normal');
759 if ($pcno == 23 || $pcno == 27) { # WWV info
761 # route 'foreign' pc27s
763 if ($field[8] ne $main::mycall) {
764 $self->route($field[8], $line);
770 my $d = cltounix($field[1], sprintf("%02d18Z", $field[2]));
771 my $sfi = unpad($field[3]);
772 my $k = unpad($field[4]);
773 my $i = unpad($field[5]);
774 my ($r) = $field[6] =~ /R=(\d+)/;
776 if (($pcno == 23 && $d < $main::systime - $pc23_max_age) || $d > $main::systime + 1500 || $field[2] < 0 || $field[2] > 23) {
777 dbg('chan', "PCPROT: WWV Date ($field[1] $field[2]) out of range");
780 if (Geomag::dup($d,$sfi,$k,$i,$field[6])) {
781 dbg('chan', "PCPROT: Dup WWV Spot ignored\n");
784 $field[7] =~ s/-\d+$//o; # remove spotter's ssid
786 my $wwv = Geomag::update($d, $field[2], $sfi, $k, $i, @field[6..8], $r);
790 $rep = Local::wwv($self, $field[1], $field[2], $sfi, $k, $i, @field[6..8], $r);
792 # dbg('local', "Local::wwv2 error $@") if $@;
795 # DON'T be silly and send on PC27s!
796 return if $pcno == 27;
798 # broadcast to the eager world
799 send_wwv_spot($self, $line, $d, $field[2], $sfi, $k, $i, @field[6..8]);
803 if ($pcno == 24) { # set here status
804 my $call = uc $field[1];
805 my $ref = DXCluster->get_exact($call);
806 $ref->here($field[2]) if $ref;
810 if ($pcno == 25) { # merge request
811 if ($field[1] ne $main::mycall) {
812 $self->route($field[1], $line);
815 if ($field[2] eq $main::mycall) {
816 dbg('chan', "PCPROT: Trying to merge to myself, ignored");
820 Log('DXProt', "Merge request for $field[3] spots and $field[4] WWV from $field[1]");
824 my @in = reverse Spot::search(1, undef, undef, 0, $field[3]);
827 $self->send(pc26(@{$in}[0..4], $field[2]));
833 my @in = reverse Geomag::search(0, $field[4], time, 1);
836 $self->send(pc27(@{$in}[0..5], $field[2]));
842 if (($pcno >= 28 && $pcno <= 33) || $pcno == 40 || $pcno == 42 || $pcno == 49) { # mail/file handling
843 if ($pcno == 49 || $field[1] eq $main::mycall) {
844 DXMsg::process($self, $line);
846 $self->route($field[1], $line) unless $self->is_clx;
851 if ($pcno == 34 || $pcno == 36) { # remote commands (incoming)
852 if ($field[1] eq $main::mycall) {
853 my $ref = DXUser->get_current($field[2]);
854 my $cref = DXCluster->get($field[2]);
855 Log('rcmd', 'in', $ref->{priv}, $field[2], $field[3]);
856 unless (!$cref || !$ref || $cref->mynode->call ne $ref->homenode) { # not allowed to relay RCMDS!
857 if ($ref->{priv}) { # you have to have SOME privilege, the commands have further filtering
858 $self->{remotecmd} = 1; # for the benefit of any command that needs to know
859 my $oldpriv = $self->{priv};
860 $self->{priv} = $ref->{priv}; # assume the user's privilege level
861 my @in = (DXCommandmode::run_cmd($self, $field[3]));
862 $self->{priv} = $oldpriv;
865 $self->send(pc35($main::mycall, $field[2], "$main::mycall:$_"));
866 Log('rcmd', 'out', $field[2], $_);
868 delete $self->{remotecmd};
870 $self->send(pc35($main::mycall, $field[2], "$main::mycall:sorry...!"));
873 $self->send(pc35($main::mycall, $field[2], "$main::mycall:your attempt is logged, Tut tut tut...!"));
876 my $ref = DXUser->get_current($field[1]);
877 if ($ref && $ref->is_clx) {
878 $self->route($field[1], pc84($field[2], $field[1], $field[2], $field[3]));
880 $self->route($field[1], $line);
886 if ($pcno == 35) { # remote command replies
887 if ($field[1] eq $main::mycall) {
888 my $s = $rcmds{$field[2]};
890 my $dxchan = DXChannel->get($s->{call});
891 $dxchan->send($field[3]) if $dxchan;
892 delete $rcmds{$field[2]} if !$dxchan;
894 # send unsolicited ones to the sysop
895 my $dxchan = DXChannel->get($main::myalias);
896 $dxchan->send($field[3]) if $dxchan;
899 my $ref = DXUser->get_current($field[1]);
900 if ($ref && $ref->is_clx) {
901 $self->route($field[1], pc85($field[2], $field[1], $field[2], $field[3]));
903 $self->route($field[1], $line);
909 # for pc 37 see 44 onwards
911 if ($pcno == 38) { # node connected list from neighbour
915 if ($pcno == 39) { # incoming disconnect
916 if ($field[1] eq $self->{call}) {
917 $self->disconnect(1);
919 dbg('chan', "PCPROT: came in on wrong channel");
924 if ($pcno == 41) { # user info
925 # add this station to the user database, if required
926 my $user = DXUser->get_current($field[1]);
927 $user = DXUser->new($field[1]) if !$user;
929 if ($field[2] == 1) {
930 $user->name($field[3]);
931 } elsif ($field[2] == 2) {
932 $user->qth($field[3]);
933 } elsif ($field[2] == 3) {
934 my ($lat, $long) = DXBearing::stoll($field[3]);
937 $user->qra(DXBearing::lltoqra($lat, $long)) unless $user->qra && DXBearing::is_qra($user->qra);
938 } elsif ($field[2] == 4) {
939 $user->homenode($field[3]);
941 $user->lastoper($main::systime); # to cut down on excessive for/opers being generated
948 if ($pcno == 37 || $pcno == 44 || $pcno == 45 || $pcno == 46 || $pcno == 47 || $pcno == 48) {
949 DXDb::process($self, $line);
953 if ($pcno == 50) { # keep alive/user list
954 my $node = DXCluster->get_exact($field[1]);
956 return unless $node->isa('DXNode');
957 return unless $node->dxchan == $self;
958 $node->update_users($field[2]);
963 if ($pcno == 51) { # incoming ping requests/answers
966 if ($field[1] eq $main::mycall) {
967 my $flag = $field[3];
969 $self->send(pc51($field[2], $field[1], '0'));
971 # it's a reply, look in the ping list for this one
972 my $ref = $pings{$field[2]};
974 my $tochan = DXChannel->get($field[2]);
977 my $dxchan = DXChannel->get($r->{call});
979 my $t = tv_interval($r->{t}, [ gettimeofday ]);
980 if ($dxchan->is_user) {
981 my $s = sprintf "%.2f", $t;
982 my $ave = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t;
983 $dxchan->send($dxchan->msg('pingi', $field[2], $s, $ave))
984 } elsif ($dxchan->is_node) {
986 $tochan->{nopings} = $tochan->user->nopings || 2; # pump up the timer
987 push @{$tochan->{pingtime}}, $t;
988 shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6;
990 for (@{$tochan->{pingtime}}) {
993 $tochan->{pingave} = $st / @{$tochan->{pingtime}};
1000 # route down an appropriate thingy
1001 $self->route($field[1], $line);
1006 if ($pcno == 75) { # dunno but route it
1007 if ($field[1] ne $main::mycall) {
1008 $self->route($field[1], $line);
1013 if ($pcno == 73) { # WCY broadcasts
1016 my $d = cltounix($field[1], sprintf("%02d18Z", $field[2]));
1017 if (($pcno == 23 && $d < $main::systime - $pc23_max_age) || $d > $main::systime + 1500 || $field[2] < 0 || $field[2] > 23) {
1018 dbg('chan', "PCPROT: WCY Date ($field[1] $field[2]) out of range");
1021 @field = map { unpad($_) } @field;
1022 if (WCY::dup($d,@field[3..7])) {
1023 dbg('chan', "PCPROT: Dup WCY Spot ignored\n");
1027 my $wcy = WCY::update($d, @field[2..12]);
1031 $rep = Local::wwv($self, @field[1..12]);
1033 # dbg('local', "Local::wcy error $@") if $@;
1036 # broadcast to the eager world
1037 send_wcy_spot($self, $line, $d, @field[2..12]);
1041 if ($pcno == 84) { # remote commands (incoming)
1042 if ($field[1] eq $main::mycall) {
1043 my $ref = DXUser->get_current($field[2]);
1044 my $cref = DXCluster->get($field[2]);
1045 Log('rcmd', 'in', $ref->{priv}, $field[2], $field[4]);
1046 unless ($field[4] =~ /rcmd/i || !$cref || !$ref || $cref->mynode->call ne $ref->homenode) { # not allowed to relay RCMDS!
1047 if ($ref->{priv}) { # you have to have SOME privilege, the commands have further filtering
1048 $self->{remotecmd} = 1; # for the benefit of any command that needs to know
1049 my $oldpriv = $self->{priv};
1050 $self->{priv} = $ref->{priv}; # assume the user's privilege level
1051 my @in = (DXCommandmode::run_cmd($self, $field[4]));
1052 $self->{priv} = $oldpriv;
1055 $self->send(pc85($main::mycall, $field[2], $field[3], "$main::mycall:$_"));
1056 Log('rcmd', 'out', $field[2], $_);
1058 delete $self->{remotecmd};
1060 $self->send(pc85($main::mycall, $field[2], $field[3], "$main::mycall:sorry...!"));
1063 $self->send(pc85($main::mycall, $field[2], $field[3],"$main::mycall:your attempt is logged, Tut tut tut...!"));
1066 my $ref = DXUser->get_current($field[1]);
1067 if ($ref && $ref->is_clx) {
1068 $self->route($field[1], $line);
1070 $self->route($field[1], pc34($field[2], $field[1], $field[4]));
1076 if ($pcno == 85) { # remote command replies
1077 if ($field[1] eq $main::mycall) {
1078 my $dxchan = DXChannel->get($field[3]);
1080 $dxchan->send($field[4]);
1082 my $s = $rcmds{$field[2]};
1084 $dxchan = DXChannel->get($s->{call});
1085 $dxchan->send($field[4]) if $dxchan;
1086 delete $rcmds{$field[2]} if !$dxchan;
1088 # send unsolicited ones to the sysop
1089 my $dxchan = DXChannel->get($main::myalias);
1090 $dxchan->send($field[4]) if $dxchan;
1094 my $ref = DXUser->get_current($field[1]);
1095 if ($ref && $ref->is_clx) {
1096 $self->route($field[1], $line);
1098 $self->route($field[1], pc35($field[2], $field[1], $field[4]));
1105 # if get here then rebroadcast the thing with its Hop count decremented (if
1106 # there is one). If it has a hop count and it decrements to zero then don't
1109 # NOTE - don't arrive here UNLESS YOU WANT this lump of protocol to be
1113 unless ($self->{isolate}) {
1114 broadcast_ak1a($line, $self); # send it to everyone but me
1119 # This is called from inside the main cluster processing loop and is used
1120 # for despatching commands that are doing some long processing job
1125 my @dxchan = DXChannel->get_all();
1128 foreach $dxchan (@dxchan) {
1129 next unless $dxchan->is_node();
1130 next if $dxchan == $me;
1132 # send a pc50 out on this channel
1133 if ($t >= $dxchan->{pc50_t} + $DXProt::pc50_interval) {
1134 $dxchan->send(pc50(scalar DXChannel::get_all_users));
1135 $dxchan->{pc50_t} = $t;
1138 # send a ping out on this channel
1139 if ($dxchan->{pingint} && $t >= $dxchan->{pingint} + $dxchan->{lastping}) {
1140 if ($dxchan->{nopings} <= 0) {
1141 $dxchan->disconnect;
1143 addping($main::mycall, $dxchan->call);
1144 $dxchan->{nopings} -= 1;
1145 $dxchan->{lastping} = $t;
1153 if ($main::systime - 3600 > $last_hour) {
1157 $last_hour = $main::systime;
1162 # finish up a pc context
1166 # some active measures
1172 my @dxchan = DXChannel::get_all_nodes();
1175 # send it if it isn't the except list and isn't isolated and still has a hop count
1176 # taking into account filtering and so on
1177 foreach $dxchan (@dxchan) {
1179 my ($filter, $hops);
1181 if ($dxchan->{routefilter}) {
1182 ($filter, $hops) = $dxchan->{routefilter}->it($self->{call}, @_);
1183 next unless $filter;
1185 next if $dxchan == $self;
1188 $routeit =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
1190 $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1191 next unless $routeit;
1194 $dxchan->send($routeit) if $routeit;
1196 $dxchan->send($routeit) unless $dxchan->{isolate} || $self->{isolate};
1205 my @dxchan = DXChannel->get_all();
1208 # send it if it isn't the except list and isn't isolated and still has a hop count
1209 # taking into account filtering and so on
1210 foreach $dxchan (@dxchan) {
1212 my ($filter, $hops);
1214 if ($dxchan->{spotsfilter}) {
1215 ($filter, $hops) = $dxchan->{spotsfilter}->it(@_, $self->{call} );
1216 next unless $filter;
1219 if ($dxchan->is_node) {
1220 next if $dxchan == $self;
1223 $routeit =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
1225 $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1226 next unless $routeit;
1229 $dxchan->send($routeit) if $routeit;
1231 $dxchan->send($routeit) unless $dxchan->{isolate} || $self->{isolate};
1233 } elsif ($dxchan->is_user && $dxchan->{dx}) {
1234 my $buf = Spot::formatb($dxchan->{user}->wantgrid, $_[0], $_[1], $_[2], $_[3], $_[4]);
1235 $buf .= "\a\a" if $dxchan->{beep};
1237 if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') {
1238 $dxchan->send($buf);
1240 $dxchan->delay($buf);
1250 my @dxchan = DXChannel->get_all();
1252 my ($wwv_dxcc, $wwv_itu, $wwv_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
1253 my @dxcc = Prefix::extract($_[7]);
1255 $wwv_dxcc = $dxcc[1]->dxcc;
1256 $wwv_itu = $dxcc[1]->itu;
1257 $wwv_cq = $dxcc[1]->cq;
1259 @dxcc = Prefix::extract($_[8]);
1261 $org_dxcc = $dxcc[1]->dxcc;
1262 $org_itu = $dxcc[1]->itu;
1263 $org_cq = $dxcc[1]->cq;
1266 # send it if it isn't the except list and isn't isolated and still has a hop count
1267 # taking into account filtering and so on
1268 foreach $dxchan (@dxchan) {
1270 my ($filter, $hops);
1272 if ($dxchan->{wwvfilter}) {
1273 ($filter, $hops) = $dxchan->{wwvfilter}->it(@_, $self->{call}, $wwv_dxcc, $wwv_itu, $wwv_cq, $org_dxcc, $org_itu, $org_cq);
1274 next unless $filter;
1276 if ($dxchan->is_node) {
1277 next if $dxchan == $self;
1280 $routeit =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
1282 $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1283 next unless $routeit;
1286 $dxchan->send($routeit) if $routeit;
1288 $dxchan->send($routeit) unless $dxchan->{isolate} || $self->{isolate};
1291 } elsif ($dxchan->is_user && $dxchan->{wwv}) {
1292 my $buf = "WWV de $_[6] <$_[1]>: SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
1293 $buf .= "\a\a" if $dxchan->{beep};
1294 if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') {
1295 $dxchan->send($buf);
1297 $dxchan->delay($buf);
1307 my @dxchan = DXChannel->get_all();
1309 my ($wcy_dxcc, $wcy_itu, $wcy_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
1310 my @dxcc = Prefix::extract($_[11]);
1312 $wcy_dxcc = $dxcc[1]->dxcc;
1313 $wcy_itu = $dxcc[1]->itu;
1314 $wcy_cq = $dxcc[1]->cq;
1316 @dxcc = Prefix::extract($_[12]);
1318 $org_dxcc = $dxcc[1]->dxcc;
1319 $org_itu = $dxcc[1]->itu;
1320 $org_cq = $dxcc[1]->cq;
1323 # send it if it isn't the except list and isn't isolated and still has a hop count
1324 # taking into account filtering and so on
1325 foreach $dxchan (@dxchan) {
1327 my ($filter, $hops);
1329 if ($dxchan->{wcyfilter}) {
1330 ($filter, $hops) = $dxchan->{wcyfilter}->it(@_, $self->{call}, $wcy_dxcc, $wcy_itu, $wcy_cq, $org_dxcc, $org_itu, $org_cq);
1331 next unless $filter;
1333 if ($dxchan->is_clx || $dxchan->is_spider || $dxchan->is_dxnet) {
1334 next if $dxchan == $self;
1337 $routeit =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
1339 $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1340 next unless $routeit;
1343 $dxchan->send($routeit) if $routeit;
1345 $dxchan->send($routeit) unless $dxchan->{isolate} || $self->{isolate};
1347 } elsif ($dxchan->is_user && $dxchan->{wcy}) {
1348 my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
1349 $buf .= "\a\a" if $dxchan->{beep};
1350 if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') {
1351 $dxchan->send($buf);
1353 $dxchan->delay($buf);
1364 my @dxchan = DXChannel->get_all();
1366 my $text = unpad($_[2]);
1370 if ($_[3] eq '*') { # sysops
1372 } elsif ($_[3] gt ' ') { # speciality list handling
1373 my ($name) = split /\./, $_[3];
1374 $target = "$name"; # put the rest in later (if bothered)
1381 $target = "ALL" if !$target;
1383 Log('ann', $target, $_[0], $text);
1385 # obtain country codes etc
1386 my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
1387 my @dxcc = Prefix::extract($_[0]);
1389 $ann_dxcc = $dxcc[1]->dxcc;
1390 $ann_itu = $dxcc[1]->itu;
1391 $ann_cq = $dxcc[1]->cq;
1393 @dxcc = Prefix::extract($_[4]);
1395 $org_dxcc = $dxcc[1]->dxcc;
1396 $org_itu = $dxcc[1]->itu;
1397 $org_cq = $dxcc[1]->cq;
1400 # send it if it isn't the except list and isn't isolated and still has a hop count
1401 # taking into account filtering and so on
1402 foreach $dxchan (@dxchan) {
1404 my ($filter, $hops);
1406 if ($dxchan->{annfilter}) {
1407 ($filter, $hops) = $dxchan->{annfilter}->it(@_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
1408 next unless $filter;
1410 if ($dxchan->is_node && $_[1] ne $main::mycall) { # i.e not specifically routed to me
1411 next if $dxchan == $self;
1414 $routeit =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
1416 $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1417 next unless $routeit;
1420 $dxchan->send($routeit) if $routeit;
1422 $dxchan->send($routeit) unless $dxchan->{isolate} || $self->{isolate};
1425 } elsif ($dxchan->is_user) {
1426 unless ($dxchan->{ann}) {
1427 next if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
1429 next if $target eq 'SYSOP' && $dxchan->{priv} < 5;
1430 my $buf = "$to$target de $_[0]: $text";
1432 $buf .= "\a\a" if $dxchan->{beep};
1433 if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') {
1434 $dxchan->send($buf);
1436 $dxchan->delay($buf);
1442 sub send_local_config
1451 if ($self->{isolate}) {
1452 @localnodes = (DXCluster->get_exact($main::mycall));
1454 # create a list of all the nodes that are not connected to this connection
1455 # and are not themselves isolated, this to make sure that isolated nodes
1456 # don't appear outside of this node
1457 @nodes = DXNode::get_all();
1458 @nodes = grep { $_->{call} ne $main::mycall } @nodes;
1459 @nodes = grep { $_->dxchan != $self } @nodes if @nodes;
1460 @nodes = grep { !$_->dxchan->{isolate} } @nodes if @nodes;
1461 @localnodes = grep { $_->dxchan->{call} eq $_->{call} } @nodes if @nodes;
1462 unshift @localnodes, DXCluster->get_exact($main::mycall);
1463 @remotenodes = grep { $_->dxchan->{call} ne $_->{call} } @nodes if @nodes;
1466 my @s = $me->pc19(@localnodes, @remotenodes);
1468 my $routeit = adjust_hops($self, $_);
1469 $self->send($routeit) if $routeit;
1472 # get all the users connected on the above nodes and send them out
1473 foreach $n (@localnodes, @remotenodes) {
1474 my @users = values %{$n->list};
1475 my @s = pc16($n, @users);
1477 my $routeit = adjust_hops($self, $_);
1478 $self->send($routeit) if $routeit;
1484 # route a message down an appropriate interface for a callsign
1486 # is called route(to, pcline);
1490 my ($self, $call, $line) = @_;
1492 if (ref $self && $call eq $self->{call}) {
1493 dbg('chan', "PCPROT: Trying to route back to source, dropped");
1497 # always send it down the local interface if available
1498 my $dxchan = DXChannel->get($call);
1500 my $cl = DXCluster->get_exact($call);
1501 $dxchan = $cl->dxchan if $cl;
1503 if (ref $self && $dxchan eq $self) {
1504 dbg('chan', "PCPROT: Trying to route back to source, dropped");
1510 my $routeit = adjust_hops($dxchan, $line); # adjust its hop count by node name
1512 $dxchan->send($routeit);
1515 dbg('chan', "PCPROT: No route available, dropped");
1519 # broadcast a message to all clusters taking into account isolation
1520 # [except those mentioned after buffer]
1523 my $s = shift; # the line to be rebroadcast
1524 my @except = @_; # to all channels EXCEPT these (dxchannel refs)
1525 my @dxchan = DXChannel::get_all_nodes();
1528 # send it if it isn't the except list and isn't isolated and still has a hop count
1529 foreach $dxchan (@dxchan) {
1530 next if grep $dxchan == $_, @except;
1531 next if $dxchan == $me;
1533 my $routeit = adjust_hops($dxchan, $s); # adjust its hop count by node name
1534 $dxchan->send($routeit) unless $dxchan->{isolate} || !$routeit;
1538 # broadcast a message to all clusters ignoring isolation
1539 # [except those mentioned after buffer]
1540 sub broadcast_all_ak1a
1542 my $s = shift; # the line to be rebroadcast
1543 my @except = @_; # to all channels EXCEPT these (dxchannel refs)
1544 my @dxchan = DXChannel::get_all_nodes();
1547 # send it if it isn't the except list and isn't isolated and still has a hop count
1548 foreach $dxchan (@dxchan) {
1549 next if grep $dxchan == $_, @except;
1550 next if $dxchan == $me;
1552 my $routeit = adjust_hops($dxchan, $s); # adjust its hop count by node name
1553 $dxchan->send($routeit);
1557 # broadcast to all users
1558 # storing the spot or whatever until it is in a state to receive it
1561 my $s = shift; # the line to be rebroadcast
1562 my $sort = shift; # the type of transmission
1563 my $fref = shift; # a reference to an object to filter on
1564 my @except = @_; # to all channels EXCEPT these (dxchannel refs)
1565 my @dxchan = DXChannel::get_all_users();
1569 foreach $dxchan (@dxchan) {
1570 next if grep $dxchan == $_, @except;
1573 broadcast_list($s, $sort, $fref, @out);
1576 # broadcast to a list of users
1584 foreach $dxchan (@_) {
1586 next if $dxchan == $me;
1588 if ($sort eq 'dx') {
1589 next unless $dxchan->{dx};
1590 ($filter) = $dxchan->{spotsfilter}->it(@{$fref}) if ref $fref;
1591 next unless $filter;
1593 next if $sort eq 'ann' && !$dxchan->{ann};
1594 next if $sort eq 'wwv' && !$dxchan->{wwv};
1595 next if $sort eq 'wcy' && !$dxchan->{wcy};
1596 next if $sort eq 'wx' && !$dxchan->{wx};
1598 $s =~ s/\a//og unless $dxchan->{beep};
1600 if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') {
1610 # obtain the hops from the list for this callsign and pc no
1616 my $hops = $DXProt::hopcount{$pcno};
1617 $hops = $DXProt::def_hopcount if !$hops;
1622 # adjust the hop count on a per node basis using the user loadable
1623 # hop table if available or else decrement an existing one
1630 my $call = $self->{call};
1633 if (($hops) = $s =~ /\^H(\d+)\^~?$/o) {
1634 my ($pcno) = $s =~ /^PC(\d\d)/o;
1635 confess "$call called adjust_hops with '$s'" unless $pcno;
1636 my $ref = $nodehops{$call} if %nodehops;
1638 my $newhops = $ref->{$pcno};
1639 return "" if defined $newhops && $newhops == 0;
1640 $newhops = $ref->{default} unless $newhops;
1641 return "" if defined $newhops && $newhops == 0;
1642 $newhops = $hops if !$newhops;
1643 $s =~ s/\^H(\d+)(\^~?)$/\^H$newhops$2/ if $newhops;
1645 # simply decrement it
1647 return "" if !$hops;
1648 $s =~ s/\^H(\d+)(\^~?)$/\^H$hops$2/ if $hops;
1660 return $self->msg('lh1') unless -e "$main::data/hop_table.pl";
1661 do "$main::data/hop_table.pl";
1667 # add a ping request to the ping queues
1670 my ($from, $to) = @_;
1671 my $ref = $pings{$to} || [];
1674 $r->{t} = [ gettimeofday ];
1675 route(undef, $to, pc51($to, $main::mycall, 1));
1680 # add a rcmd request to the rcmd queues
1683 my ($self, $to, $cmd) = @_;
1686 $r->{call} = $self->{call};
1687 $r->{t} = $main::systime;
1691 my $ref = DXCluster->get_exact($to);
1692 if ($ref && $ref->dxchan && $ref->dxchan->is_clx) {
1693 route(undef, $to, pc84($main::mycall, $to, $self->{call}, $cmd));
1695 route(undef, $to, pc34($main::mycall, $to, $cmd));
1702 my $pc39flag = shift;
1703 my $call = $self->call;
1705 unless ($pc39flag && $pc39flag == 1) {
1706 $self->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', "System Op")));
1709 # unbusy and stop and outgoing mail
1710 my $mref = DXMsg::get_busy($call);
1711 $mref->stop_msg($call) if $mref;
1713 # create a list of all the nodes that have gone and delete them from the table
1715 foreach my $node (grep { $_->dxchancall eq $call } DXNode::get_all) {
1716 next if $node->call eq $call;
1717 next if $node->call eq $main::mycall;
1718 push @nodes, $node->call;
1722 # broadcast to all other nodes that all the nodes connected to via me are gone
1723 unless ($pc39flag && $pc39flag == 2) {
1724 unless ($self->{isolate}) {
1727 broadcast_ak1a(pc21($_, 'Gone.'), $self);
1732 # remove this node from the tables
1733 my $node = DXCluster->get_exact($call);
1734 $node->del if $node;
1736 # remove outstanding pings
1737 delete $pings{$call};
1739 # I was the last node visited
1740 $self->user->node($main::mycall);
1742 # send info to all logged in thingies
1743 $self->tell_login('logoutn');
1745 Log('DXProt', $call . " Disconnected");
1747 $self->SUPER::disconnect;
1752 # send a talk message to this thingy
1756 my ($self, $from, $to, $via, $line) = @_;
1758 $line =~ s/\^/\\5E/g; # remove any ^ characters
1759 $self->send(DXProt::pc10($from, $to, $via, $line));
1760 Log('talk', $self->call, $from, $via?$via:$main::mycall, $line);