diff options
-rw-r--r-- | komponenten.pas | 96 | ||||
-rw-r--r-- | tests.konf | 8 | ||||
-rw-r--r-- | unit1.pas | 6 | ||||
-rw-r--r-- | watchdog.lps | 101 |
4 files changed, 83 insertions, 128 deletions
diff --git a/komponenten.pas b/komponenten.pas index 93f39f8..416f3d8 100644 --- a/komponenten.pas +++ b/komponenten.pas @@ -40,7 +40,7 @@ type procedure ausfuehren; virtual; abstract; end; - tTestAufgabe = class(tComponent) + tTestAufgabe = class private _thread: tAufgabenThread; function rStatus: byte; @@ -59,7 +59,7 @@ type write wOkIntervall; property fehlerIntervall: longint write wFehlerIntervall; - constructor create(aOwner: tComponent); override; + constructor create; destructor destroy; override; function bedingungErfuellt(vorgaben: array of boolean): boolean; function aktivieren(vorgaben: array of boolean): boolean; @@ -67,7 +67,7 @@ type procedure threadBeenden; end; - tTestIpThread = class(tAufgabenThread) + tIpThread = class(tAufgabenThread) private public werSollIchSein,geraet: string; @@ -79,7 +79,7 @@ type tTestIp = class(tTestAufgabe) private public - constructor create(aOwner: tComponent); override; + constructor create; function nimmParameter(s: string): boolean; override; end; @@ -94,12 +94,9 @@ type tTestPing = class(tTestAufgabe) private - procedure wWen(w: string); public function nimmParameter(s: string): boolean; override; - constructor create(aOwner: tComponent); override; - property wen: string - write wWen; + constructor create; end; (* TTestDnsLookup = class (TTestAufgabe) @@ -356,9 +353,9 @@ end; // tTestAufgabe **************************************************************** -constructor tTestAufgabe.create(aOwner: tComponent); +constructor tTestAufgabe.create; begin - inherited create(aOwner); + inherited create; setlength(bedingung,0); fehlerNachricht:='leer'; statusAenderung:=nil; @@ -459,7 +456,7 @@ end; // tTestIpThread *************************************************************** -constructor tTestIpThread.create(besitzer: tTestAufgabe); +constructor tIpThread.create(besitzer: tTestAufgabe); begin inherited create(besitzer); fillchar(werSollIchSein,sizeof(werSollIchSein),#0); @@ -468,14 +465,14 @@ begin setlength(geraet,0); end; -destructor tTestIpThread.destroy; +destructor tIpThread.destroy; begin setlength(werSollIchSein,0); setlength(geraet,0); inherited destroy; end; -procedure tTestIpThread.ausfuehren; +procedure tIpThread.ausfuehren; var ausgabe: string; argumente: array of string; @@ -493,14 +490,15 @@ begin end; delete(ausgabe,1,pos('inet',ausgabe)-1); status:=byte(pos('inet '+werSollIchSein+' ',ausgabe)=1); + setlength(argumente,0); end; // tTestIp ********************************************************************* -constructor tTestIp.create(aOwner: tComponent); +constructor tTestIp.create; begin - inherited create(aOwner); - _thread:=tTestIpThread.create(self); + inherited create; + _thread:=tIpThread.create(self); end; function tTestIp.nimmParameter(s: string): boolean; @@ -524,8 +522,8 @@ begin end; result:=length(s)=0; if result then begin - (_thread as tTestIpThread).werSollIchSein:=ip; - (_thread as tTestIpThread).geraet:=ger; + (_thread as tIpThread).werSollIchSein:=ip; + (_thread as tIpThread).geraet:=ger; end; end; @@ -553,70 +551,26 @@ begin setlength(argumente,2); argumente[0]:='-c1'; argumente[1]:=wen; - if (not runCommand('ping',argumente,ausgabe)) or (pos('inet',ausgabe)=0) then begin - status:=0; - setlength(argumente,0); - exit; - end; - delete(ausgabe,1,pos('inet',ausgabe)-1); - status:=byte(pos('inet '+werSollIchSein+' ',ausgabe)=1); + status:=byte(runCommand('ping',argumente,ausgabe)); + if status=1 then + status:=byte(pos('1 packets transmitted, 1 received, 0% packet loss, time',ausgabe)<>0); + setlength(argumente,0); end; // tTestPing ******************************************************************* -constructor tTestPing.create(aOwner: tComponent); -begin -end; - -procedure tTestPing.wWen(w: string); +constructor tTestPing.create; begin + inherited create; + _thread:=tPingThread.create(self); end; function tTestPing.nimmParameter(s: string): boolean; begin + (_thread as tPingThread).wen:=s; + result:=true; end; -// TTestPing ******************************************************************* - -procedure TTestPing.OnTimerProcedure(Sender: TObject); -begin - try - Pingsocket.Host:=wen; - Pingsocket.ReceiveTimeout:=5000; - Pingsocket.Ping; - except - Log('Ich bin aus dem try-except geflogen!'); - Status:=0; - end; -end; - -procedure TTestPing.OnIdIcmpClientReply(ASender: TComponent; const AReplyStatus: TReplyStatus); -begin - status:= - byte(AReplyStatus.ReplyStatusType = rsEcho); -end; - -constructor TTestPing.create(AOwner: TComponent); -begin - inherited create(AOwner); - PingSocket:=TIdIcmpClient.create(self); - PingSocket.OnReply:=OnIdIcmpClientReply; - InnerTimerProcedure:=OnTimerProcedure; - Zeitwarter.Enabled:=false; -end; - -destructor TTestPing.destroy; -begin - PingSocket.destroy; - inherited destroy; -end; - -function TTestping.nimmParameter(s: String): boolean; -begin - wen:=unescape(s); - PingSocket.Host:=wen; - result:=true; -end; (* // TTestDNSLookup ************************************************************** @@ -1,9 +1,9 @@ #was Bed. time;ok time;error msg. wen
ip 0_s 100 50 keine IP eno1:192.168.0.12/24
-ping 100 50 .9 (ping) 192.168.0.9
-ping 100 50 .13 (ping) 192.168.0.13
-(ping) 100 50 .15 (ping) 192.168.0.15
-(ping) 100 50 .18 (ping) 192.168.0.18
+ping 1_s 100 50 .9 (ping) 192.168.0.9
+ping 1_s 100 50 .13 (ping) 192.168.0.13
+(ping) 1_s 100 50 .15 (ping) 192.168.0.15
+(ping) 1_s 100 50 .18 (ping) 192.168.0.18
ping 0_1_& 600 50 google (ping) www.google.de
ping 0_1_& 600 50 eckner.net (ping) eckner.net
##ping 0_1_& 600 50 ... (ping) www.wieistmeineip.de
@@ -111,9 +111,9 @@ begin bol:=(leftStr(t,1)='(') and (rightStr(t,1)=')'); if bol then t:=copy(t,2,length(t)-2); - if t='ip' then pruefListe[length(pruefliste)-1]:=tTestIp.create(form1) -(* else if t='ping' then pruefListe[length(pruefListe)-1]:=TTestping.create(Form1) - else if t='dnslookup' then pruefListe[length(pruefListe)-1]:=TTestDNSLookup.create(Form1) + if t='ip' then pruefListe[length(pruefliste)-1]:=tTestIp.create + else if t='ping' then pruefListe[length(pruefListe)-1]:=tTestPing.create +(* else if t='dnslookup' then pruefListe[length(pruefListe)-1]:=TTestDNSLookup.create(Form1) else if t='ftpcmp' then pruefListe[length(pruefListe)-1]:=TFtpFileCompare.create(Form1) else if t='ftpdate' then pruefListe[length(pruefListe)-1]:=TFtpDate.create(Form1) else if t='httpcmp' then pruefListe[length(pruefListe)-1]:=THttpCompare.create(Form1) diff --git a/watchdog.lps b/watchdog.lps index d71e6ff..973a3e0 100644 --- a/watchdog.lps +++ b/watchdog.lps @@ -9,7 +9,7 @@ <IsPartOfProject Value="True"/> <EditorIndex Value="-1"/> <CursorPos X="12" Y="6"/> - <UsageCount Value="25"/> + <UsageCount Value="26"/> </Unit0> <Unit1> <Filename Value="unit1.pas"/> @@ -18,9 +18,9 @@ <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> <UnitName Value="Unit1"/> - <TopLine Value="47"/> - <CursorPos X="20" Y="69"/> - <UsageCount Value="25"/> + <TopLine Value="99"/> + <CursorPos Y="200"/> + <UsageCount Value="26"/> <Loaded Value="True"/> <LoadedDesigner Value="True"/> </Unit1> @@ -29,9 +29,10 @@ <IsPartOfProject Value="True"/> <IsVisibleTab Value="True"/> <EditorIndex Value="3"/> - <CursorPos Y="19"/> - <FoldState Value=" TKjI0w1 T3l30v917n"/> - <UsageCount Value="25"/> + <TopLine Value="504"/> + <CursorPos X="21" Y="558"/> + <FoldState Value=" TKjF0w1 T3l00v917 piaoU0O2\"/> + <UsageCount Value="26"/> <Loaded Value="True"/> </Unit2> <Unit3> @@ -46,14 +47,14 @@ <EditorIndex Value="2"/> <TopLine Value="153"/> <CursorPos Y="209"/> - <UsageCount Value="12"/> + <UsageCount Value="13"/> <Loaded Value="True"/> </Unit4> <Unit5> <Filename Value="tests.konf"/> <EditorIndex Value="1"/> - <CursorPos X="2" Y="9"/> - <UsageCount Value="11"/> + <CursorPos X="12" Y="8"/> + <UsageCount Value="12"/> <Loaded Value="True"/> <DefaultSyntaxHighlighter Value="None"/> </Unit5> @@ -61,122 +62,122 @@ <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="komponenten.pas"/> - <Caret Line="520" TopLine="482"/> + <Caret Line="35" TopLine="18"/> </Position1> <Position2> - <Filename Value="unit1.pas"/> - <Caret Line="129" TopLine="94"/> + <Filename Value="komponenten.pas"/> + <Caret Line="319" TopLine="239"/> </Position2> <Position3> <Filename Value="unit1.pas"/> - <Caret Line="97" TopLine="88"/> + <Caret Line="75" Column="85" TopLine="55"/> </Position3> <Position4> - <Filename Value="unit1.pas"/> - <Caret Line="98" TopLine="88"/> + <Filename Value="komponenten.pas"/> + <Caret Line="332" Column="21" TopLine="239"/> </Position4> <Position5> <Filename Value="komponenten.pas"/> - <Caret Line="445" Column="19" TopLine="428"/> + <Caret Line="240" Column="77" TopLine="85"/> </Position5> <Position6> <Filename Value="komponenten.pas"/> - <Caret Line="352" Column="23" TopLine="315"/> </Position6> <Position7> <Filename Value="komponenten.pas"/> - <Caret Line="390" TopLine="373"/> + <Caret Line="53" Column="23" TopLine="17"/> </Position7> <Position8> <Filename Value="komponenten.pas"/> - <Caret Line="399" TopLine="382"/> + <Caret Line="516" Column="50" TopLine="475"/> </Position8> <Position9> <Filename Value="komponenten.pas"/> - <Caret Line="400" TopLine="382"/> + <Caret Line="19"/> </Position9> <Position10> <Filename Value="komponenten.pas"/> - <Caret Line="401" TopLine="382"/> + <Caret Line="555" Column="53" TopLine="540"/> </Position10> <Position11> <Filename Value="komponenten.pas"/> - <Caret Line="402" TopLine="382"/> + <Caret Line="560" Column="26" TopLine="460"/> </Position11> <Position12> <Filename Value="komponenten.pas"/> - <Caret Line="413" TopLine="382"/> + <Caret Line="579" Column="21" TopLine="551"/> </Position12> <Position13> - <Filename Value="unit1.pas"/> - <Caret Line="190" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="83" TopLine="64"/> </Position13> <Position14> - <Filename Value="unit1.pas"/> - <Caret Line="191" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="568" Column="3" TopLine="557"/> </Position14> <Position15> - <Filename Value="unit1.pas"/> - <Caret Line="192" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="100" Column="23" TopLine="67"/> </Position15> <Position16> - <Filename Value="unit1.pas"/> - <Caret Line="194" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="62" Column="25" TopLine="40"/> </Position16> <Position17> - <Filename Value="unit1.pas"/> - <Caret Line="195" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="82" Column="25" TopLine="60"/> </Position17> <Position18> - <Filename Value="unit1.pas"/> - <Caret Line="196" TopLine="156"/> + <Filename Value="komponenten.pas"/> + <Caret Line="100" Column="25" TopLine="78"/> </Position18> <Position19> <Filename Value="komponenten.pas"/> - <Caret Line="486" Column="45" TopLine="466"/> + <Caret Line="359" TopLine="332"/> </Position19> <Position20> <Filename Value="komponenten.pas"/> - <Caret Line="51" Column="14" TopLine="36"/> + <Caret Line="568" Column="21" TopLine="478"/> </Position20> <Position21> <Filename Value="komponenten.pas"/> - <Caret Line="374" TopLine="352"/> + <Caret Line="85" Column="4" TopLine="49"/> </Position21> <Position22> <Filename Value="komponenten.pas"/> - <Caret Line="336" Column="49" TopLine="180"/> + <Caret Line="478" Column="12" TopLine="410"/> </Position22> <Position23> <Filename Value="komponenten.pas"/> - <Caret Line="35" TopLine="18"/> + <Caret Line="507" TopLine="478"/> </Position23> <Position24> <Filename Value="komponenten.pas"/> - <Caret Line="319" TopLine="239"/> + <Caret Line="568" Column="13" TopLine="542"/> </Position24> <Position25> - <Filename Value="unit1.pas"/> - <Caret Line="75" Column="85" TopLine="55"/> + <Filename Value="komponenten.pas"/> + <Caret Line="506" Column="58" TopLine="393"/> </Position25> <Position26> <Filename Value="komponenten.pas"/> - <Caret Line="332" Column="21" TopLine="239"/> + <Caret Line="100" TopLine="61"/> </Position26> <Position27> <Filename Value="komponenten.pas"/> - <Caret Line="240" Column="77" TopLine="85"/> + <Caret Line="568" TopLine="546"/> </Position27> <Position28> <Filename Value="komponenten.pas"/> + <Caret Line="574" TopLine="551"/> </Position28> <Position29> - <Filename Value="komponenten.pas"/> - <Caret Line="53" Column="23" TopLine="17"/> + <Filename Value="unit1.pas"/> + <Caret Line="69" Column="20" TopLine="47"/> </Position29> <Position30> - <Filename Value="komponenten.pas"/> - <Caret Line="516" Column="50" TopLine="475"/> + <Filename Value="unit1.pas"/> + <Caret Line="115" Column="67" TopLine="100"/> </Position30> </JumpHistory> </ProjectSession> |