This commit is contained in:
Matthias Urlichs 1996-01-03 13:52:26 +01:00 committed by Harald Welte
parent b3ebfb62ea
commit 673bb12c8f
7 changed files with 84 additions and 31 deletions

5
DOKU
View File

@ -685,10 +685,13 @@ Alle Zeilentypen:
"ab" "cd" -> leere Menge "ab" "cd" -> leere Menge
"ab" "xay" -> "a" "ab" "xay" -> "a"
"ab" "+x" -> leere Menge "ab" "+x" -> leere Menge
"ab" "+bx" -> "b" "ab" "+bx" -> "ab+bx"
"ab" "+bx" "a" -> leere Menge "ab" "+bx" "a" -> leere Menge
Damit läßt sich sehr flexibel einstellen, wer auf welcher Leitung / Damit läßt sich sehr flexibel einstellen, wer auf welcher Leitung /
Nummer mit welchen Parametern anrufen kann. Nummer mit welchen Parametern anrufen kann.
Das Ganze ist noch optimierbar, aber ich bin zu faul...
insbesondere ist das obige "ab+bx" zu "ab" reduzierbar
(weil nur einer der hinter dem + angegebenen Flags gesetzt ist).
<Karte> ist der vierstellige Name der ISDN-Karte, der dieser beim Laden <Karte> ist der vierstellige Name der ISDN-Karte, der dieser beim Laden
des Treibers verpaßt wurde; üblich ist eine dreistellike Kennung des Treibers verpaßt wurde; üblich ist eine dreistellike Kennung
des Kartentyps und eine fortlaufende Numerierung. des Kartentyps und eine fortlaufende Numerierung.

6
README
View File

@ -4,6 +4,12 @@ Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
README.isdn in den Kernelsourcen. README.isdn in den Kernelsourcen.
*** 1996-01-03
Update 33. Timer wieder umgestellt. Testcode für automatische Anpassung des
Timeouts, noch nicht ausreichend getestet.
*** 1996-01-02 *** 1996-01-02
Update 32. WICHTIG UNBEDINGT INSTALLIEREN. Verbindungen werden nicht Update 32. WICHTIG UNBEDINGT INSTALLIEREN. Verbindungen werden nicht

View File

@ -250,7 +250,6 @@ read_file (FILE * ffile, char *errf)
c->arg[strlen(c->arg)-1] = '\0'; c->arg[strlen(c->arg)-1] = '\0';
if (isintime(c->arg) < 0) break; if (isintime(c->arg) < 0) break;
chkone(c); chkone(c);
do_subclass(c);
c->cclass = str_enter(c->cclass); c->cclass = str_enter(c->cclass);
c->arg = str_enter(c->arg); c->arg = str_enter(c->arg);
app (&cf_TM, c); app (&cf_TM, c);
@ -417,6 +416,7 @@ read_args (void *nix)
seqnum = 0; seqnum = 0;
for(conn=isdn4_conn; conn != NULL; conn = conn->next) { for(conn=isdn4_conn; conn != NULL; conn = conn->next) {
char *fp;
if((cg = conn->cg) == NULL) if((cg = conn->cg) == NULL)
continue; continue;
cg->dl = NULL; cg->dl = NULL;
@ -443,10 +443,12 @@ read_args (void *nix)
theclass = "*"; theclass = "*";
for(cft = cf_TM; cft != NULL; cft = cft->next) { for(cft = cf_TM; cft != NULL; cft = cft->next) {
if((nexttime = isintime(cft->arg)) > 0) { if((nexttime = isintime(cft->arg)) > 0) {
theclass = cft->arg; theclass = cft->cclass;
break; break;
} }
} }
do_run_now++;
run_now(NULL);
if((nexttime == 0) || (nexttime > 32767/HZ/60)) if((nexttime == 0) || (nexttime > 32767/HZ/60))
nexttime = 32767/HZ/60; nexttime = 32767/HZ/60;
@ -454,6 +456,17 @@ read_args (void *nix)
classtimer = classtimer =
#endif #endif
timeout(read_args_run,NULL,nexttime * 60 * HZ); timeout(read_args_run,NULL,nexttime * 60 * HZ);
conn = xmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
conn->causeInfo = "config files read";
conn->cause = ID_priv_Print;
conn->classname = theclass;
conn->next = isdn4_conn; isdn4_conn = conn;
dropconn(conn);
}
} }
/* Read all the files and kick off the programs. */ /* Read all the files and kick off the programs. */

View File

@ -81,6 +81,7 @@ pmatch1 (cf prot, conngrab *cgm)
car = wildmatch(cg->card, prot->card); if(car == NULL) return "5ERR Match CARD"; car = wildmatch(cg->card, prot->card); if(car == NULL) return "5ERR Match CARD";
cla =classmatch(cg->cclass, prot->cclass); if(cla == NULL) return "4ERR Match CLASS"; cla =classmatch(cg->cclass, prot->cclass); if(cla == NULL) return "4ERR Match CLASS";
sub = maskmatch(cg->mask, prot->mask); if(sub == 0) return "6ERR Match SUBCARD"; sub = maskmatch(cg->mask, prot->mask); if(sub == 0) return "6ERR Match SUBCARD";
if(!classmatch(cla,theclass)) return("2Not Now");
/* OK, that fits. Make a copy to assign the values to. */ /* OK, that fits. Make a copy to assign the values to. */
cg = newgrab(cg); cg = newgrab(cg);
@ -116,6 +117,7 @@ pmatch1 (cf prot, conngrab *cgm)
car = wildmatch(cg->card, prot->card); if(car==NULL) continue; car = wildmatch(cg->card, prot->card); if(car==NULL) continue;
cla =classmatch(cg->cclass, prot->cclass); if(cla==NULL) continue; cla =classmatch(cg->cclass, prot->cclass); if(cla==NULL) continue;
sub = maskmatch(cg->mask, prot->mask); if(sub==0) continue; sub = maskmatch(cg->mask, prot->mask); if(sub==0) continue;
if(!classmatch(cla,theclass)) continue;
} }
/* Now make another copy for the parameters. If they don't fit /* Now make another copy for the parameters. If they don't fit
we'll have to undo everything. This is stupid but there is no we'll have to undo everything. This is stupid but there is no
@ -495,6 +497,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
continue; continue;
if ((matsub = maskmatch (cg->mask, dl->mask)) == 0) if ((matsub = maskmatch (cg->mask, dl->mask)) == 0)
continue; continue;
if(!classmatch(matclass,theclass)) continue;
if(!(cg->flags & F_LEASED)) { /* ... and a working dial prefix. */ if(!(cg->flags & F_LEASED)) { /* ... and a working dial prefix. */
char *crd; char *crd;
ulong_t sub; ulong_t sub;
@ -555,6 +558,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
if((matcar = wildmatch(matcrd,d->card)) == NULL) continue; if((matcar = wildmatch(matcrd,d->card)) == NULL) continue;
if((matcla = classmatch(matclass,d->cclass)) == NULL) continue; if((matcla = classmatch(matclass,d->cclass)) == NULL) continue;
if((matsub = maskmatch(cg->mask,d->mask)) == 0) continue; if((matsub = maskmatch(cg->mask,d->mask)) == 0) continue;
if(!classmatch(matcla,theclass)) continue;
if(cg->d_level != d->num) { if(cg->d_level != d->num) {
if((cg->d_level < d->num) && (cg->d_nextlevel < d->num)) if((cg->d_level < d->num) && (cg->d_nextlevel < d->num))
cg->d_nextlevel = d->num; cg->d_nextlevel = d->num;
@ -683,7 +687,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
struct conninfo *conn; struct conninfo *conn;
int naconn = 0; int naconn = 0;
if(classmatch(cg->cclass,cl->cclass) == NULL) if(classmatch(theclass,classmatch(cg->cclass,cl->cclass)) == NULL)
continue; continue;
if(wildmatch(cg->card, cl->card) == NULL) if(wildmatch(cg->card, cl->card) == NULL)
continue; continue;
@ -706,7 +710,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
continue; continue;
if((sit = wildmatch(conn->cg->site, cl->site)) == NULL) if((sit = wildmatch(conn->cg->site, cl->site)) == NULL)
continue; continue;
if(classmatch(conn->cg->cclass, cl->cclass) == NULL) if(classmatch(theclass,classmatch(conn->cg->cclass, cl->cclass)) == NULL)
continue; continue;
if(maskmatch(conn->cg->mask,cl->mask) == 0) if(maskmatch(conn->cg->mask,cl->mask) == 0)
continue; continue;
@ -765,11 +769,6 @@ findit (conngrab *foo, int ignbusy)
if(cg == NULL) if(cg == NULL)
return "NoMemFoo"; return "NoMemFoo";
cg->cclass = classmatch(cg->cclass,theclass);
if(cg->cclass == NULL) {
dropgrab(cg);
return "0Not Now";
}
p = cg->par_in; p = cg->par_in;
if(p != NULL) { if(p != NULL) {

View File

@ -84,7 +84,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
if (!wildmatch (cg->protocol, prot->protocol)) continue; if (!wildmatch (cg->protocol, prot->protocol)) continue;
if (!wildmatch (cg->card, prot->card)) continue; if (!wildmatch (cg->card, prot->card)) continue;
if (!maskmatch (cg->mask, prot->mask)) continue; if (!maskmatch (cg->mask, prot->mask)) continue;
if (!classmatch (cg->cclass, prot->cclass)) continue; if (!classmatch(theclass,classmatch (cg->cclass, prot->cclass))) continue;
break; break;
} }
if (prot == NULL) if (prot == NULL)
@ -158,7 +158,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
if (!wildmatch (cg->protocol, cm->protocol)) continue; if (!wildmatch (cg->protocol, cm->protocol)) continue;
if (!wildmatch (cg->card, cm->card)) continue; if (!wildmatch (cg->card, cm->card)) continue;
if (!maskmatch (cg->mask, cm->mask)) continue; if (!maskmatch (cg->mask, cm->mask)) continue;
if (!classmatch (cg->cclass, cm->cclass)) continue; if (!classmatch(theclass, classmatch(cg->cclass, cm->cclass))) continue;
if (!wildmatch (sp1, cm->arg)) continue; if (!wildmatch (sp1, cm->arg)) continue;
mz = allocsb (strlen (cm->args), (streamchar *)cm->args); mz = allocsb (strlen (cm->args), (streamchar *)cm->args);
@ -1145,7 +1145,7 @@ run_rp(struct conninfo *conn, char what)
if((pro = wildmatch(conn->cg->protocol,cfr->protocol)) == NULL) continue; if((pro = wildmatch(conn->cg->protocol,cfr->protocol)) == NULL) continue;
if((car = wildmatch(conn->cg->card,cfr->card)) == NULL) continue; if((car = wildmatch(conn->cg->card,cfr->card)) == NULL) continue;
if((sub = maskmatch(conn->cg->mask,cfr->mask)) == 0) continue; if((sub = maskmatch(conn->cg->mask,cfr->mask)) == 0) continue;
if((cla = classmatch(conn->cg->cclass,cfr->cclass)) == NULL) continue; if((cla = classmatch(theclass,classmatch(conn->cg->cclass,cfr->cclass))) == NULL) continue;
if((ids = strchr(cfr->type,'/')) != NULL) if((ids = strchr(cfr->type,'/')) != NULL)
id = atoi(ids); id = atoi(ids);
@ -1225,7 +1225,7 @@ run_now(void *nix)
continue; continue;
if(strcmp(conn->cg->protocol,what->protocol)) if(strcmp(conn->cg->protocol,what->protocol))
continue; continue;
if(!classmatch(conn->cg->cclass,what->cclass)) if(!classmatch(theclass,classmatch(conn->cg->cclass,what->cclass)))
continue; continue;
break; break;
} }
@ -1285,6 +1285,26 @@ run_now(void *nix)
if(log_34 & 2) if(log_34 & 2)
printf("exist %s:%s\n",conn->cg->site,conn->cg->protocol); printf("exist %s:%s\n",conn->cg->site,conn->cg->protocol);
if(conn->cg != NULL && conn->minor != 0 && conn->pid != 0) { if(conn->cg != NULL && conn->minor != 0 && conn->pid != 0) {
if(conn->cg->cclass != NULL) {
char *newclass = classmatch(conn->cg->cclass, theclass);
if((newclass == NULL) && (conn->state >= c_going_up)) {
mblk_t *mb = allocb(80,BPRI_MED);
setconnstate(conn, c_down);
if(log_34 & 2)printf("DisM8 ");
if(mb != NULL) {
int xlen;
*mb->b_wptr++ = PREF_NOERR;
m_putid (mb, CMD_OFF);
m_putsx (mb, ARG_MINOR);
m_puti (mb, conn->minor);
xlen = mb->b_wptr - mb->b_rptr;
DUMPW (mb->b_rptr, xlen);
(void) strwrite (xs_mon, (uchar_t *) mb->b_rptr, xlen, 1);
freeb(mb);
}
}
}
if(conn->state >= c_going_up) if(conn->state >= c_going_up)
pushprot(conn->cg,conn->minor,conn->connref,PUSH_UPDATE); pushprot(conn->cg,conn->minor,conn->connref,PUSH_UPDATE);
else else

View File

@ -24,15 +24,15 @@
#ifdef KERNEL #ifdef KERNEL
#ifdef linux #ifdef linux
#include <linux/sched.h> #include <linux/sched.h>
#define TIME (jiffies/HZ) #define TIME jiffies
#else #else
extern struct timeval time; extern struct timeval time;
#define TIME time.tv_sec #define TIME (time.tv_sec*HZ + time.tv_usec/(1000000/HZ))
#endif #endif
#else #else
extern struct timeval Time; extern struct timeval Time;
#define TIME time.tv_sec #define TIME (time.tv_sec*HZ + time.tv_usec/(1000000/HZ))
#define time Time #define time Time
#endif #endif
@ -72,6 +72,7 @@ struct timer_ {
#define TIMER_INCOMING 040 #define TIMER_INCOMING 040
#define TIMER_IFDATA_IN 0100 #define TIMER_IFDATA_IN 0100
#define TIMER_IFDATA_OUT 0200 #define TIMER_IFDATA_OUT 0200
int lasttime;
int interval; int interval;
int pretime; int pretime;
int maxread, maxwrite; int maxread, maxwrite;
@ -129,7 +130,7 @@ timer_timeout(struct timer_ *tim)
#ifdef NEW_TIMEOUT #ifdef NEW_TIMEOUT
tim->timer = tim->timer =
#endif #endif
timeout((void *)timer_timeout,tim,tim->interval); timeout((void *)timer_timeout,tim,tim->interval-HZ);
} }
/* Streams code to close the driver. */ /* Streams code to close the driver. */
@ -174,6 +175,12 @@ timer_proto (queue_t * q, mblk_t * mp, char down)
default: default:
break; break;
case PROTO_TICK: case PROTO_TICK:
if(tim->lasttime && (tim->lasttime < TIME)) {
if(tim->interval > TIME - tim->lasttime) /* shorter! */
tim->interval = TIME - tim->lasttime;
/* if it gets longer we won't do a thing. */
}
tim->lasttime = TIME;
if(tim->flags & TIMER_TIMER) { if(tim->flags & TIMER_TIMER) {
#ifdef NEW_TIMEOUT #ifdef NEW_TIMEOUT
untimeout(tim->timer); untimeout(tim->timer);
@ -181,7 +188,10 @@ timer_proto (queue_t * q, mblk_t * mp, char down)
untimeout(timer_timeout,tim); untimeout(timer_timeout,tim);
#endif #endif
timer_timeout(tim); #ifdef NEW_TIMEOUT
tim->timer =
#endif
timeout((void *)timer_timeout,tim,tim->interval-HZ);
} }
break; break;
case PROTO_INCOMING: case PROTO_INCOMING:
@ -202,12 +212,13 @@ timer_proto (queue_t * q, mblk_t * mp, char down)
#ifdef NEW_TIMEOUT #ifdef NEW_TIMEOUT
tim->timer = tim->timer =
#endif #endif
timeout((void *)timer_timeout,tim,tim->pretime); timeout((void *)timer_timeout,tim,tim->pretime-HZ);
tim->flags |= TIMER_TIMER; tim->flags |= TIMER_TIMER;
break; break;
default: default:
break; break;
} }
tim->lasttime = 0;
break; break;
case PROTO_DISCONNECT: case PROTO_DISCONNECT:
case PROTO_INTERRUPT: case PROTO_INTERRUPT:
@ -275,6 +286,7 @@ timer_proto (queue_t * q, mblk_t * mp, char down)
if(z < 1 || z > 24*60*60) if(z < 1 || z > 24*60*60)
goto err; goto err;
tim->interval = z*HZ; tim->interval = z*HZ;
tim->lasttime = 0; /* for sync */
break; break;
case TIMER_PRETIME: case TIMER_PRETIME:
if ((error = m_geti (mp, &z)) != 0) if ((error = m_geti (mp, &z)) != 0)
@ -288,14 +300,14 @@ timer_proto (queue_t * q, mblk_t * mp, char down)
goto err; goto err;
if (z < 2 || z >= 7*24*60*60) if (z < 2 || z >= 7*24*60*60)
goto err; goto err;
tim->maxread = z; tim->maxread = z*HZ;
break; break;
case TIMER_WRITEMAX: case TIMER_WRITEMAX:
if ((error = m_geti (mp, &z)) != 0) if ((error = m_geti (mp, &z)) != 0)
goto err; goto err;
if (z < 2 || z >= 7*24*60*60) if (z < 2 || z >= 7*24*60*60)
goto err; goto err;
tim->maxwrite = z; tim->maxwrite = z*HZ;
break; break;
} }
} }

View File

@ -206,15 +206,15 @@ MP * * +I * - timer :tr 4 :tw 4 :ti 2 :to 3 :lo
# Grmbl. Innerdeutsch 9 Uhr, ausserhalb 8 Uhr, USA 14 Uhr. # Grmbl. Innerdeutsch 9 Uhr, ausserhalb 8 Uhr, USA 14 Uhr.
# a-e: deutsch; fg: Euro1, hi: USA # a-e: deutsch; fg: Euro1, hi: USA
TM +dgi Mo-Fr0500-0800 TM +dgi Wk0500-0800
TM +dfi Mo-Fr0800-0900 TM +dfi Wk0800-0900
TM +afi Mo-Fr0900-1200 TM +afi Wk0900-1200
TM +bfi Mo-Fr1200-1400 TM +bfi Wk1200-1400
TM +bfh Mo-Fr1400-1800 TM +bfh Wk1400-1800
TM +cgh Mo-Fr1800-2100 TM +cgh Wk1800-2100
TM +dgh Mo-Fr2100-0200 TM +dgh Wk2100-0200
TM +egh Mo-Fr0200-0300 TM +egh Wk0200-0300
TM +egi Mo-Fr0300-0500 TM +egi Wk0300-0500
TM +cgi SaSu0500-1400 TM +cgi SaSu0500-1400
TM +cgh SaSu1400-2100 TM +cgh SaSu1400-2100
TM +dgh SaSu2100-0200 TM +dgh SaSu2100-0200