SYSLOG Write !,"IPNr : " Read IPNr Write !,"Comp.Naam : " Read CNaam Set Device=1000+$P(IPNr,".",4) Write !,"Device []="_Device Read K Set:K?4N Device=K Write !,"Pinned []=Pin, 1[]=No pin" Read Pin Write !,"Overzicht" Write !," IPNr=",IPNr Write !," Comp.Naam=",CNaam Write !," Device=",Device Write !," ",$S(Pin:"NIET GEPINNED",1:"WEL GEPINNED") Write !,"Uitvoeren []=uitvoeren" Read K Quit:K'="" Write !,"Building..." Do RemQSYS(Device,CNaam,IPNr) Do BldQSYS(Device,CNaam,IPNr) Do MASTER^cQ5 Do RemLog(Device,boot,cs) Do BldLog(Device,boot,cs,Pin) Quit AUTO(IONaam) New CNaam,IO,Device,Basis,Status,K If $G(IONaam)="" Set IONaam=$I Quit:$E(IONaam,1,5)'="|TNT|" Set CNaam=$ZCVT($P($E(IONaam,6,99),":",1),"U") ; de computer naam is gekend maar nakijken of het bijhorend IP-adres veranderd is If $D(^cQSYS(0,"FIXED","NBN",$P(CNaam,"."))) Do Quit . Set IP=$$GetIP(CNaam,1) . Set Device=^cQSYS(0,"FIXED","NBN",$P(CNaam,".")) . Do:$L(Device) RemQSYS(Device,CNaam,IP) . Do:$L(Device) BldQSYS(Device,CNaam,IP) ; de computer naam is niet gekend, maar wel het IP-adres (VPN gebruikers) Quit:$D(^cQSYS(0,"FIXED","IP",CNaam)) ; de computer naam of IPadres is niet gekend Set Status=$$SendMiniMail^vhLib($ZU(110)_"@VANHOECKE.BE",$LB("PV@VANHOECKE.BE","WRO@VANHOECKE.BE"),"Nieuwe telnet gebruiker "_CNaam,"$I = "_IONaam) If CNaam'?1.3N1"."1.3N1"."1.3N1"."1.3N Do . Set IP=$$GetIP(CNaam,1) Else Do . Set IP=CNaam . Set CNaam="" Quit:IP="" If (+$P(IP,".",1)'=192)||(+$P(IP,".",2)'=168) Quit ; Er wordt alleen gewerkt met 192.168.x.x Set Device=$$CalcDeviceID(IP) Do RemQSYS(Device,CNaam,IP) Do BldQSYS(Device,CNaam,IP) Do MASTER^cQ5 Do RemLog(Device,boot,cs) Do BldLog(Device,boot,cs,"") K ; alle locale variabelen worden verwijderd Quit CalcDeviceID(IP) If $P(IP,".",3)=1 Do ; Device afhankelijk van het IPAdres - subnet 192.168.1.x . Set Basis=1000 . Set Device=Basis+$P(IP,".",4) Else If $P(IP,".",3)=0 Do ; Device afhankelijk van het IPAdres - subnet 192.168.0.x . Set Basis=1500 . Set Device=Basis+$P(IP,".",4) Else If $P(IP,".",3)'>16 Do ; Device afhankelijk van het IPAdres - subnet 192.168.N.x met N van 2 tem 15 . Set Basis=1000+(1000*$P(IP,".",3)/2) . Set Device=Basis+$P(IP,".",4) Else Do ; Get eerste vrije nummer van de 9000 reeks . For Device=9000:1:9999 Quit:'$D(cQSYS(0,"DDB",Device)) . If Device>9990 Do . . Do CleanUp . . Set Device=$$CalcDeviceID(IP) Quit Device CleanUp ; opkuis van oude DeviceIDs in de 90000 range Set Device=89999 For Device=$O(^cQSYS(0,"TIME",Device)) Quit:Device="" Do . Quit:+^cQSYS(0,"TIME",Device)>($H-200) . Do RemQSYS(Device) ; verwijder oude devices MANUAL(CNaam,IP,Device) If $G(Device)="" Do . Set Device=$$CalcDeviceID(IP) Do RemQSYS(Device,CNaam,IP) Do BldQSYS(Device,CNaam,IP) Do MASTER^cQ5 Do RemLog(Device,boot,cs) Do BldLog(Device,boot,cs,"") Quit GetIP(Name,Ask) New Ok,FileName,IP New flagRead Set flagRead=0 // flagRead wordt gebruikt om nslookup te parse Set IP="" Set FileName="PING"_$J_$$UPTRIMAN^vhRtn1(Name) ; Set Exec="PING -a -n 1 "_Name_" > c:\"_FileName Set Exec="NSLOOKUP "_Name_" > c:\"_FileName // ping vervangen door nslookup s Ok=$ZF(-1,Exec) Set FileName=$$READ^vhDEV("c:\",FileName,"D`CBGetIPLine^"_$ZN,"M") Do DELFILE^vhDEV("c:\",FileName) Set:IP="" IP=$$GetIPByPing(Name) ; proberen via PING If IP="",$G(Ask) Do . Write $I,! . Read !,"Ingave IPNr (met ""."" gescheiden)",IP If IP'?1.3N1"."1.3N1"."1.3N1"."1.3N Do ; finale test . Set IP=$$GetIPByPing(Name) Kill flagRead Quit IP GetIPByPing(Name) Set Exec="PING -a -n 1 "_Name_" > c:\"_FileName s Ok=$ZF(-1,Exec) Set FileName=$$READ^vhDEV("c:\",FileName,"D`CBGetIPLine^"_$ZN,"M") Do DELFILE^vhDEV("c:\",FileName) Quit IP CBGetIPLineByPing ;ping ipv nslookup If Rec?1.E1"["1.3N1"."1.3N1"."1.3N1"."1.3N1"]"1.E Do . Set IP=$P($P(Rec,"[",2),"]",1) Quit CBGetIPLine(Rec) If Rec["Name" Set flagRead=1 If ( $G(flagRead) ) && ( Rec["Address" ) Set IP = $TR($P($P(Rec,":",2),",")," ","") Quit ; --- old : ping ipv nslookup ;If Rec?1.E1"["1.3N1"."1.3N1"."1.3N1"."1.3N1"]"1.E Do ;. Set IP=$P($P(Rec,"[",2),"]",1) ;Quit ; --- old : ping ipv nslookup BldLog(Device,boot,space,Pin) Set ^cLOG(boot,"DEV",Device)="MC" Set ^cLOG(boot,"QQM",Device,$ZU(5))="K\1\" Set ^cLOG(boot,"TERMINAL",Device)="D ^vhINITML" Set:$G(Pin) ^cLOG(boot,"PIN",Device)="" Set ^cLOG(space,"DEV",Device)="MC" Set ^cLOG(space,"TERMINAL",Device)="D ^vhINITML" ; Ook ADMIN2 (=HALUX) voor de FAX software e.a. Set ^cLOG("ADMIN2","DEV",Device)="MC" Set ^cLOG("ADMIN2","TERMINAL",Device)="D ^vhINITML" Quit RemLog(Device,boot,space) Kill ^cLog(boot,"QQM",Device) Kill ^cLog(boot,"DEV",Device) Kill ^cLog(boot,"TERMINAL",Device) Kill ^cLOG(boot,"PIN",Device) Kill ^cLog(space,"TERMINAL",Device) Kill ^cLog(space,"DEV",Device) Kill ^cLog("ADMIN2","TERMINAL",Device) Kill ^cLog("ADMIN2","DEV",Device) Kill ^cLOG("WACHTW","U",Device) Quit RemQSYS(Device,CNaam,IPNr) Kill ^cQSYS(0,"DDB",Device) Kill ^cQSYS(0,"TIME",Device) ; computer naam If $L($G(CNaam)) Do . Kill ^cQSYS(0,"FIXED","NBN",$P(CNaam,".")) Else Do . Set CNaam="" . For Set CNaam=$O(^cQSYS(0,"FIXED","NBN",CNaam)) Quit:CNaam="" Do . . Quit:^cQSYS(0,"FIXED","NBN",CNaam)'=Device . . Kill ^cQSYS(0,"FIXED","NBN",CNaam) ; ipaddress If $L($G(IPNr)) Do . Kill ^cQSYS(0,"FIXED","IP",IPNr) Else Do . Set IPNr="" . For Set IPNr=$O(^cQSYS(0,"FIXED","IP",IPNr)) Quit:IPNr="" Do . . Quit:^cQSYS(0,"FIXED","IP",IPNr)'=Device . . Kill ^cQSYS(0,"FIXED","IP",IPNr) Quit BldQSYS(Device,CNaam,IPNr) Set ^cQSYS(0,"DDB",Device)="TELN,"_IPNr_","_CNaam Set ^cQSYS(0,"TIME",Device)=$H Set:$L($G(CNaam)) ^cQSYS(0,"FIXED","NBN",$P(CNaam,"."))=Device Set:$L(IPNr) ^cQSYS(0,"FIXED","IP",IPNr)=Device Quit