+26Nov00=======================================================================
+1. made it possible for sysop calls to be used on other nodes and still have
+anti loop checking on PC16/17.
+25Nov00=======================================================================
+1. -l <nnn> now works on C client
+2. -e toggles echo cancelling (normally on) on C client
20Nov00=======================================================================
1. added even more checking to PC16,17 and 39
19Nov00=======================================================================
# broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate};
}
- if ($field[2] eq $main::mycall || $field[2] eq $main::myalias || $field[1] eq $main::myalias || $field[1] eq $main::mycall) {
- dbg('chan', "LOOP: trying to connect myself!");
+ if ($field[1] eq $main::mycall || $field[2] eq $main::mycall) {
+ dbg('chan', "LOOP: trying to alter config on this node from outside!");
+ return;
+ }
+ if ($field[2] eq $main::myalias && DXChannel->get($field[1])) {
+ dbg('chan', "LOOP: trying to connect sysop from outside!");
return;
}
unless ($node) {
dbg('chan', "$field[2] no PC19 yet, autovivified as node");
# broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate};
}
- if ($field[2] eq $main::mycall || $field[2] eq $main::myalias || $field[1] eq $main::myalias || $field[1] eq $main::mycall) {
- dbg('chan', "LOOP: trying to disconnect me!");
+ if ($field[1] eq $main::mycall || $field[2] eq $main::mycall) {
+ dbg('chan', "LOOP: trying to alter config on this node from outside!");
+ return;
+ }
+ if ($field[1] eq $main::myalias && DXChannel->get($field[1])) {
+ dbg('chan', "LOOP: trying to disconnect sysop from outside!");
return;
}
unless ($node) {
* $Id$
*/
+#include <sys/types.h>
#include <stdio.h>
#include <sys/time.h>
-#include <sys/types.h>
+#include <sys/wait.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
char *connsort = "local"; /* the connection variety */
int state = 0; /* the current state of the connection */
int laststate = 0; /* the last state we were in */
+char echocancel = 1; /* echo cancelling */
reft echobase; /* the anti echo queue */
int maxecho = 5; /* the depth of the anti echo queue */
int echon; /* no of entries in the anti echo queue */
#define WAITLOGIN 1
#define WAITPASSWD 2
#define WAITINPUT 10
-
+#define DOCHAT 20
myregex_t iscallreg[] = { /* regexes to determine whether this is a reasonable callsign */
{
return 0;
}
+void reaper(int i)
+{
+ pid_t mypid;
+ while ((mypid = waitpid(-1, 0, WNOHANG)) > 0) {
+ ;
+ }
+}
+
/*
* higher level send and receive routines
*/
emp->size = size;
memcpy(emp->data, imp->data, size);
emp->inp = emp->data + size; /* just in case */
- chain_add(&echobase, emp);
- if (++echon > maxecho) {
- emp = cmsg_prev(&echobase);
- cmsg_free(emp);
+ if (echocancel) {
+ chain_add(&echobase, emp);
+ if (++echon > maxecho) {
+ emp = cmsg_prev(&echobase);
+ cmsg_free(emp);
+ }
}
/* queue it for sending */
dbg(DMSG, "MSG size: %d", mp->size);
/* check for echos */
- for (wmp = 0; wmp = chain_get_next(&echobase, wmp); ) {
- if (!memcmp(wmp->data, mp->data, wmp->size)) {
- cmsg_callback(mp, 0);
- return;
+ if (echocancel) {
+ for (wmp = 0; wmp = chain_get_next(&echobase, wmp); ) {
+ if (!memcmp(wmp->data, mp->data, wmp->size)) {
+ cmsg_callback(mp, 0);
+ return;
+ }
}
}
chgstate(CONNECTED);
send_file("connected");
+ break;
+
+ case DOCHAT:
+
+ break;
}
cmsg_callback(mp, 0);
{
int i, c, err = 0;
- while ((c = getopt(argc, argv, "h:p:x:")) > 0) {
+ while ((c = getopt(argc, argv, "eh:l:p:x:")) > 0) {
switch (c) {
+ case 'e':
+ echocancel ^= 1;
+ break;
case 'h':
node_addr = optarg;
break;
lerr:
if (err) {
- die("usage: client [-x n|-h<host>|-p<port>|-l<paclen>] <call>|login [local|telnet|ax25]");
+ die("usage: client [-e|-x n|-h<host>|-p<port>|-l<paclen>] <call>|login [local|telnet|ax25]");
}
if (optind < argc) {
#ifdef SIGPWR
signal(SIGPWR, terminate);
#endif
+ signal(SIGCLD, reaper);
+
/* init a few things */
chain_init(&echobase);