home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / PKTDRVR / PDCLK207.ZIP / PDCLKSET.DOC < prev    next >
Encoding:
Text File  |  1993-10-09  |  38.3 KB  |  739 lines

  1. ;*************************************************************************
  2. ;**                                    **
  3. ;**            PDCLKSET                    **
  4. ;**                                    **
  5. ;**                                    **
  6. ;**        Copyright (C) 1991 Jan.Engvald @ LDC.lu.se        **
  7. ;**                                    **
  8. ;** This program is free software; you can redistribute it and/or modify**
  9. ;** it under the terms of the GNU General Public License as published by**
  10. ;** the Free Software Foundation, version 1.                **
  11. ;**                                    **
  12. ;** This program is distributed in the hope that it will be useful,    **
  13. ;** but WITHOUT ANY WARRANTY; without even the implied warranty of    **
  14. ;** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    **
  15. ;** GNU General Public License for more details.            **
  16. ;**                                    **
  17. ;** You should have received a copy of the GNU General Public License    **
  18. ;** along with this program; if not, write to the Free Software     **
  19. ;** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        **
  20. ;**                                    **
  21. ;*************************************************************************
  22. ;**        USING PDCLKSET TO SET THE PC SOFTWARE CLOCK        **
  23. ;*************************************************************************
  24. ;**                                    **
  25. ;** PDCLKSET sets the time and date of the PC clock using a TIME server.**
  26. ;** To do so, the following information is required:            **
  27. ;**                                    **
  28. ;** - This clients unique IP number.                    **
  29. ;** - The IP number of an UDP/IP time server (most Unix systems).    **
  30. ;** - The time zone offset from UTC (GMT) at this place.        **
  31. ;** - If daylight saving (summer) time is used, which algorithm to use. **
  32. ;**                                    **
  33. ;** All the above info can be supplied as arguments to PDCLKSET. If any **
  34. ;** of the first three are missing, it will send a BOOTP request to try **
  35. ;** to find the missing info. If you are not using BOOTP you probably    **
  36. ;** must use gateway and mask arguments too. Except for client IP number**
  37. ;** and network mask, arguments to PDCLKSET override BOOTP info.    **
  38. ;** Using a BOOTP server is highly recommended, freeware code exists    **
  39. ;** for Unix systems and MSDOS PCs.                    **
  40. ;**                                    **
  41. ;** BOOTP can not supply which dst algorithm to use; also, zone offset    **
  42. ;** can't always be trusted. So, in practice, zone offset and dst algo- **
  43. ;** rithm (if applicable) are required arguments. On the other hand,    **
  44. ;** these parameters will stay the same all around the year, no need to **
  45. ;** change the setup.                            **
  46. ;**                                    **
  47. ;** If PDCLKSET finds more than one time server (sum of arguments and    **
  48. ;** BOOTP fields) and the first one does not answer, it will try the    **
  49. ;** other servers. The same applies for gateways.            **
  50. ;**                                    **
  51. ;** It is very hard to get accurate info on all the dst algorithms used **
  52. ;** all over the world, so the one you choose, you should test out. Use **
  53. ;** the alter argument to add or subtract time and days, and check that **
  54. ;** the dst switch occurs correctly. When using the alter argument, the **
  55. ;** date and time is displayed as usual, but the PC clock is not set.    **
  56. ;** If you find any errors, mail me the correct info to my mail address **
  57. ;** below. If you want to, you can customize your own dst algorithm,    **
  58. ;** see detailed info below.                        **
  59. ;**                                    **
  60. ;** PDCLKSET talks to the network card via a packet driver. If you have **
  61. ;** more than one packet driver, it will use the first one (lowest    **
  62. ;** packet interrupt number) unless you use the pktintno argument.    **
  63. ;** If you use a NDIS (LanManager) or ODI driver with your LAN card you    **
  64. ;** can still use PDCLKSET, just load DIS_PKT or ODIPKT on top of your    **
  65. ;** driver (available in pub/msdos/pktdrvr on many ftp archives).    **
  66. ;** I have only tested PDCLKSET with Ethernet or Ethernet simulating    **
  67. ;** packet drivers. I have one report that it works with S&K FDDI    **
  68. ;** interfaces, if so it should work for token ring too, but I've got    **
  69. ;** no confirmation on that.                        **
  70. ;**                                    **
  71. ;** Running through remote bridges or slip links may require longer    **
  72. ;** than default timeouts. Add the number of extra seconds you need    **
  73. ;** with the argument LongerTimeout= time.                **
  74. ;**                                    **
  75. ;** If you want to omit the "End of pdclkset..." msg, add Flag=128     **
  76. ;**                                    **
  77. ;** In AUTOEXEC.BAT you should first load the packet driver, then call    **
  78. ;** PDCLKSET. It is very small (14 kbyte) and executes fast, so you will**
  79. ;** not notice any delay. PDCLKSET is not memory resident and does not    **
  80. ;** use any CONFIG.SYS devices, so no memory is wasted. Use TERMIN.COM    **
  81. ;** if you want to unload the packet driver. See call syntax below.    **
  82. ;** Note: If you always log into a Novell server after a boot, you    **
  83. ;** don't need this program, the PC clock will be set from the server.    **
  84. ;** However, if you are the supervisor, use PDCLKSET+SRVTIME to set it    **
  85. ;** (available at msdos.ftp.sunet.se:pub/network/novelutl/srvtime).    **
  86. ;**                                    **
  87. ;*************************************************************************
  88. ;**        USING PDCLKSET TO SET A TIMEZONE VARIABLE        **
  89. ;*************************************************************************
  90. ;**                                    **
  91. ;** PDCLKSET can also assign the proper normal or dls timezone name to    **
  92. ;** an environment variable (TZ is used by most systems). Argument    **
  93. ;** "Zone= #" will assign numeric zones to TZ (like TZ=+0100). If you    **
  94. ;** want anything else, use the alternative syntax, e.g.        **
  95. ;** "Zone= tzone=MET,METDST" will set TZONE=MET or METDST.        **
  96. ;**                                    **
  97. ;*************************************************************************
  98. ;**        SYNTAX AND EXAMPLES FOR TIMESETTING            **
  99. ;*************************************************************************
  100. ;**                                    **
  101. ;**   (time is [- | +] [<hours>h] [<minutes>m] [<seconds>[s]] )     **
  102. ;**                                    **
  103. ;** pdclkset            (displays a usage message)    or    **
  104. ;**                                    **
  105. ;** pdclkset b[ootp]        (only if dst not used)    or        **
  106. ;**                                    **
  107. ;** pdclkset [o[ffset]=time]                        **
  108. ;**                                    **
  109. ;**         [d[aylightsave]=PAC | USA | CUB | CHIL | BRZ | GBR |    **
  110. ;**                 W_EU | M_EU | E_EU | LIBY | EGY | TURK |    **
  111. ;**                 ISR | IRAN | PRC | ROK | AUS | TASM |    **
  112. ;**                 NSW | LHI | NZE |                **
  113. ;**                 FrTime,FrWeekDay,FrDayOfYear,        **
  114. ;**                 ToTime,ToWday,ToDayOfYr,AddTime]        **
  115. ;**                                    **
  116. ;**         [z[onename]= # | varible=normalname,dlsname        **
  117. ;**                                    **
  118. ;**         [i[pnr]=n.n.n.n]  [t[imservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  119. ;**                                    **
  120. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  121. ;**                                    **
  122. ;**         [p[ktintno]=hexnr]  [a[lter]=days,time]  [f[lags]=flagnr]    **
  123. ;**                                    **
  124. ;**         [l[ongertimeout]=time]                    **
  125. ;**                                    **
  126. ;**                                    **
  127. ;** All arguments to pdclkset must be on the same line, no continuation.**
  128. ;** For arguments to BAT files, use ":" instead of "=" and ";" instead    **
  129. ;** of "," .                                **
  130. ;**                                    **
  131. ;** Valid flags for this mode:                        **
  132. ;**   128 = half quiet (skip the End of pdclkset line if no errors)    **
  133. ;**                                    **
  134. ;** Examples:                                **
  135. ;**                                    **
  136. ;** pdclkset o= -1h d=M_EU z=#     (my IP nr and timeserver(s) from BOOTP)**
  137. ;**                                    **
  138. ;** pdclkset offs=6h dst=USA zonename= tz=CST,CDT  (sets TZ=CST or CDT) **
  139. ;**                                    **
  140. ;** pdclkset o=8h  d=PAC  ip=123.45.6.7  ts=123.45.6.8    (BOOTP not used)**
  141. ;**                                    **
  142. ;** pdclkset o=-9h30m t=1.2.3.4 i=2.3.4.5 g=2.3.4.1 m=255.255.255.0    **
  143. ;**                                    **
  144. ;**                                    **
  145. ;** Part of an AUTOEXEC.BAT file may look like this:            **
  146. ;**                                    **
  147. ;**    \net\smc_wd -w 0x7c 3 0x280 0xd000    (install packet driver) **
  148. ;**    \net\winpkt 0x7c            (install winpkt driver) **
  149. ;**    \net\pdclkset o=-1h d=M_EU z=#        (set PC clock and TZ)    **
  150. ;**                                    **
  151. ;** If you don't want to keep the paket drivers in memory, add the    **
  152. ;** following line:                            **
  153. ;**                                    **
  154. ;**    \net\termin 0x7c            (remove packet drivers) **
  155. ;**                                    **
  156. ;** If you just need timesetting, use pdclksml instead of pdclkset.    **
  157. ;**                                    **
  158. ;*************************************************************************
  159. ;**        USING PDCLKSET FOR NETWORK TESTING (PING/ECHO)        **
  160. ;*************************************************************************
  161. ;**                                    **
  162. ;** There is also a buildt in ping client and server. If you just want    **
  163. ;** to enable the server, add a "flag=1" argument and the PDCLKSET    **
  164. ;** termination will be delayd and it responds to incoming pings until    **
  165. ;** you hit any key. If you want to send pings, use the echo argument.    **
  166. ;** When you then hit any key, it stops sending but still collects    **
  167. ;** responses. It terminates when hiting a second key (there may be a    **
  168. ;** delay to ensure all responses have arrived first). When pinging,    **
  169. ;** it displays real time statistics on delay and error rate (nice!).    **
  170. ;** PDCLKSET sets the hardware timer to enable millisecond accurate    **
  171. ;** timing; if your PC does not like this (e.g. SoftPC for Mac), add    **
  172. ;** argument "flag=16".                            **
  173. ;**                                    **
  174. ;** A typical ping call look like:                    **
  175. ;**                                    **
  176. ;**    pdclkset echo=ping.lu.se,34,256                 **
  177. ;**                                    **
  178. ;** The display will look like this:                    **
  179. ;**                                    **
  180. ;** Calling nameserver(s)... got reply in  115 ms.            **
  181. ;**                                    **
  182. ;** Ping with packet size 34 and interval   256 ms to 130.235.128.100:    **
  183. ;**                                    **
  184. ;** ------ Packets ------ | --- Delay ms --- |    Packet    | Load | Time    **
  185. ;** transmit receive diff | this min avg max |     loss    | kb/s |    s    **
  186. ;**     187     184    3.    87  27  36 517    1.6042 %     5       41    **
  187. ;**                                    **
  188. ;**                                    **
  189. ;** You can use IP packet sizes from 34 to 1500. If you use a        **
  190. ;** negative size, it will sweep packet sizes from 34 up to abs(size)    **
  191. ;** and unless you hit ESC at termination an error size distribution    **
  192. ;** table is displayd. You can then see if packets are lost randomly or **
  193. ;** in bursts or if there is a pattern, like odd or big sizes. (Only    **
  194. ;** sizes 34 and up are used, but the number of out of sequence packets    **
  195. ;** are indicated in the size 22 position, the number of repeated    **
  196. ;** packets in the size 24 position and the number of lost packets are    **
  197. ;** in the size 26 position.) Using the minsize parameter you can sweep    **
  198. ;** a certain range, e g echo=host,-1500,128,1,1,1400 will sweep from    **
  199. ;** size 1400 up to size 1500 bytes.                    **
  200. ;** While a few network errors only show up at a certain size, the    **
  201. ;** default 34-50 sweep is good in most cases and does not load links    **
  202. ;** unnecessarily. Sweeping is very effective for detecting queue    **
  203. ;** limits in routers and bridges, but then you should sweep up to at    **
  204. ;** least size 600 and with only a few milliseconds interval.        **
  205. ;**                                    **
  206. ;** The ping packet data is by default starting at 0x101 and incremented**
  207. ;** by one for each word in the packet. Using the optional data and inc **
  208. ;** fields you can fill with other values, like 0,0 or 0xffff,0 which    **
  209. ;** are useful for WAN modem link tests.                **
  210. ;**                                    **
  211. ;** Packets are transmitted at a constant rate depending on interval,    **
  212. ;** which can be from 0 and up to 28000. The interval unit is now 1.0    **
  213. ;** milliseconds (Note: ver 1.33 had 55 ms units!). To get a finer    **
  214. ;** interval grain, you may use a decimal point and one decimal digit.    **
  215. ;** This way you can get intervals from 0.0 up to 3500.0 ms, and the    **
  216. ;** inteval unit is rather close to 0.1 ms. As a safety for accidental    **
  217. ;** loading, if you wan't intervals less than 128 ms you must add a    **
  218. ;** Flag=1 argument. The default interval is 220 ms.            **
  219. ;**                                    **
  220. ;** When pinging in a wide area network environment, watch the load    **
  221. ;** figure not to overload slow links (showing the load caused by this    **
  222. ;** ping activity + server activity + broadcasts, and calibrated for    **
  223. ;** half duplex media such as Ethernet or LocalTalk). It requires just    **
  224. ;** a 20 MHz 386 to load an Ethernet to 9.9 Mb/s! The document        **
  225. ;** "Measured Capacity of an Ethernet: Myths and Reality" by Boggs,    **
  226. ;** Mogul and Kent, available at gatekeeper.dec.com in directory    **
  227. ;** pub/DEC/WRL/research-reports as file WRL-TR-88.4.ps.Z, is a good    **
  228. ;** source to read to understand how Ethernet behaves at such loads.    **
  229. ;**                                    **
  230. ;** The destination host must run IP and you can use its IP number or    **
  231. ;** its domain name if you have a name server.                **
  232. ;**                                    **
  233. ;** Diff is the difference between sent and received packets, and if    **
  234. ;** not zero either packets are lost or are in transit. If there are    **
  235. ;** network errors, watching how receive and diff increments tell you    **
  236. ;** how the errors are distributed in time (temporary total blocking or **
  237. ;** just random drops) down to tenths of a second (very useful!).    **
  238. ;** Blocking indicates serious errors, else it can be just high load.    **
  239. ;**                                    **
  240. ;** If there turns up a number between packets received and diff, it is **
  241. ;** the number of packets dropped due to no buffers available. This can    **
  242. ;** occur if the ping server is not as fast as the ping client and it    **
  243. ;** uses sub-millisecond intervals.                    **
  244. ;**                                    **
  245. ;** If there turns up an apostrophe, double music note or dot after the    **
  246. ;** diff value, it indicates that packets have returned out of sequence    **
  247. ;** (may occur if there are multiple routes to the destination), been    **
  248. ;** duplicated or lost, respectively. Apostrophe + dot combine to    **
  249. ;** exclamation mark. You can see the number of each error in the    **
  250. ;** size 22/24/26 error distribution.                    **
  251. ;**                                    **
  252. ;** The delay values are useful to characterize link loads. After a    **
  253. ;** while, the min value approaches the delay on an unloaded link. If    **
  254. ;** the average value is significantly higher, the link is loaded. If    **
  255. ;** the max value is significantly higher than the avg value, the load    **
  256. ;** is bursty. The "this" field shows the current delay.        **
  257. ;**                                    **
  258. ;** Packet loss is simply 100*diff/transmit, when you have stopped    **
  259. ;** pinging. During the pinging, however, there can be many packets in    **
  260. ;** transit giving a non-zero diff. So instead the packet loss is    **
  261. ;** computed using an intelligent algorithm that can compensate for    **
  262. ;** long turnaround delays and most out of sequence cases.        **
  263. ;**                                    **
  264. ;** If the host you are pinging don't drop packets (many do, a 386 with    **
  265. ;** PDCLKSET doesn't), the packet loss as a symptom of network health    **
  266. ;** is as follows:                            **
  267. ;**                                    **
  268. ;**   0.01 % or less  : your network is most probably healthy.         **
  269. ;**   0.01 % to 0.1 % : there are some minor faults but nobody will    **
  270. ;**            notice any delays.                **
  271. ;**   0.1 % to 1 %    : you will notice delays more or less often.    **
  272. ;**   1 % or more     : frequent delays, very annoying.         **
  273. ;**                                    **
  274. ;** Some packet drivers, like smc_wd.com, give 0.0000 % lost packets on    **
  275. ;** a healthy network. This enables you to trace beginning component    **
  276. ;** degradation (oxidizing contacts, drifting IC circuits, etc) long    **
  277. ;** before they cause any trouble to real traffic.            **
  278. ;**                                    **
  279. ;** The display is updated five times a second. To avoid unpleasant    **
  280. ;** value flickering, when a packet is just sent, diff is temporarily    **
  281. ;** one less than it should be. When a packet has arrived it is back to **
  282. ;** normal. All values (except the "this" and the load values) are    **
  283. ;** accumulated or averaged during the complete time since pdclkset was **
  284. ;** last started. The time field tells you this elapsed time.        **
  285. ;**                                    **
  286. ;** Using udpecho= instead of echo= will send UDP echo instead of icmp    **
  287. ;** echo (ping) packets. Add flag=64 if you want UDP discard packets,    **
  288. ;** useful for saturated bottleneck throughput measurements.        **
  289. ;**                                    **
  290. ;** Argument f=1 will continue sending despite some send errors.    **
  291. ;**                                    **
  292. ;** If you don't run a BOOTP server, the i= (and n=) arguments are    **
  293. ;** needed and also m= and g= if any traffic goes through a router.    **
  294. ;**                                    **
  295. ;**                                    **
  296. ;** Syntax:                                **
  297. ;**                                    **
  298. ;** pdclkset e[cho]= name | n.n.n.n [,size[,interval[,data,inc[,min]]]]    **
  299. ;**                                    **
  300. ;**         [i[pnr]=n.n.n.n]  [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  301. ;**                                    **
  302. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  303. ;**                                    **
  304. ;**         [p[ktintno]=hexnr]  [f[lags]=flagnr]            **
  305. ;**                                    **
  306. ;**         [l[ongertimeout]=time]                    **
  307. ;**                                    **
  308. ;**         u[dpecho]= name | n.n.n.n [,size[,intrvl[,data,inc[,min]]]]**
  309. ;**                                    **
  310. ;** Valid flags for server mode (no echo= or udpecho= argument):    **
  311. ;**    1 = Ping/Echo server (delay termination)            **
  312. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  313. ;**   128 = half quiet (skip the End of pdclkset line)            **
  314. ;**   512 = Stress the packet driver using upcall sends for ping serv    **
  315. ;**  4096 = Allow frame size up to 4096 (IP size 4082 bytes)        **
  316. ;**                                    **
  317. ;** Valid flags for client mode (echo= or udpecho= arguments):        **
  318. ;**    1 = Allow short (<128 ms) intervals; also continue despite errs **
  319. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  320. ;**   (32 = Use 0.1 ms interval unit instead of 1.0 ms)            **
  321. ;**    64 = For udpecho= argument, send discard instead of echo packets    **
  322. ;**   128 = half quiet (skip the End of pdclkset line)            **
  323. ;**   512 = Stress the packet driver using upcall sends for ping serv    **
  324. ;**  1024 = Stop if duplicated, lost or nonconsecutive packets seen    **
  325. ;**  4096 = Allow frame size up to 4096 (IP size 4082 bytes)        **
  326. ;**                                    **
  327. ;**                                    **
  328. ;** Examples:                                **
  329. ;**                                    **
  330. ;** pdclkset  echo= nic.ddn.mil (ping client, auxilary info from BOOTP) **
  331. ;**                                    **
  332. ;** pdclkset  e= 1.2.3.4  i= 2.3.4.5  g= 2.3.4.1  m= 255.255.255.0    **
  333. ;**                                    **
  334. ;** pdclkset  echo= host.on.this.net  ip= 111.22.33.4  ns= 111.22.33.5    **
  335. ;**                                    **
  336. ;** pdclkset  udpecho= ping.lu.se              (UDP echo client) **
  337. ;**                                    **
  338. ;** pdclkset  flags= 1                 (ping and UDP echo server) **
  339. ;**                                    **
  340. ;** pdclkset  flags= 1    ip= 2.3.4.5  g= 2.3.4.1  m= 255.255.255.0    **
  341. ;**                                    **
  342. ;*************************************************************************
  343. ;**        USING PDTBUILD TO GENERATE TABLES WITH ALL IP HOSTS    **
  344. ;*************************************************************************
  345. ;**                                    **
  346. ;** The PDTBUILD program, which is included in the ZIP package, looks    **
  347. ;** at all ARP broadcasts and generates a table with all the IP hosts    **
  348. ;** on this (sub)net. Each entry has IP number, Ethernet address and    **
  349. ;** host name, the latter which it asks a name server for. Two files    **
  350. ;** are generated, IPTBL.TXT and HWTBL.TXT, which are suitable as input **
  351. ;** to LANwatch or a LANalyzer or other monitors. It should preferably    **
  352. ;** be run for a complete day or longer. When started, if IPTBL.TXT    **
  353. ;** exists it will read it in and update with what it sees on the net.    **
  354. ;** It can handle up to 4094 hosts. Use BIGSORT for sorting (available    **
  355. ;** from oak.oakland.edu:pub/msdos/textutl)                **
  356. ;**                                    **
  357. ;** In the comment field, an A means authorative answer, N is non-    **
  358. ;** authorative answer from nameserver. 0 means host not registered    **
  359. ;** for reverse lookup (in-addr.arpa domain). - means name not found.    **
  360. ;** < and = denotes Ethernet duplicates for same IP address. >, = and + **
  361. ;** denotes IP duplicates for same Ethernetaddress (+ is used for a    **
  362. ;** gateway pdclkset know of). The last number on each line is how many **
  363. ;** ARP broadcasts we have seen from this address (so BIGSORT /R /+71    **
  364. ;** will sort the most used hosts first).                **
  365. ;**                                    **
  366. ;** You can speed up address collection by adding flag=8. This will    **
  367. ;** start ARP probing, a process that cycles through all IP addresses in**
  368. ;** the (sub)net and sends an ARP request for each address. The speed    **
  369. ;** is 9 ARP requests per second, slowing down to two per second when    **
  370. ;** nameserver requests are needed. It is rather successful in ignoring **
  371. ;** ARP replies from proxy ARP gateways (otherwise it would table a lot **
  372. ;** of fake hosts). Be careful with ARP probing, some programs (eg KA9Q    **
  373. ;** NET) may be hard to start when sprayed with ARP broadcasts.        **
  374. ;**                                    **
  375. ;** You can run echo (ping) in parallell with tablebuilding (and the    **
  376. ;** ARP probing), although the screen display is somewhat garbled. If    **
  377. ;** you don't ping, the display will show the accumulated number of ARP    **
  378. ;** broadcasts and the time of day; also the current ARP probe IP addr.    **
  379. ;**                                    **
  380. ;** If you don't run a BOOTP server, the i= and n= arguments are needed **
  381. ;** and also m= and g= if the nameserver is behind a router.        **
  382. ;**                                    **
  383. ;** The tblbuild code is a quick hack, undocumented, but works for me.    **
  384. ;** Pdtbuild includes all the functionality of pdclkset.        **
  385. ;**                                    **
  386. ;** Syntax:                                **
  387. ;**                                    **
  388. ;** pdtbuild f[lags]=flagnr                        **
  389. ;**                                    **
  390. ;**         [i[pnr]=n.n.n.n]  [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  391. ;**                                    **
  392. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  393. ;**                                    **
  394. ;**         [p[ktintno]=hexnr]     [l[ongertimeout]=time]            **
  395. ;**                                    **
  396. ;** Valid flags for table building mode:                **
  397. ;**    2 = Enable table building (required for this mode)        **
  398. ;**    4 = Use LANwatch table syntax instead of LANalyzer syntax    **
  399. ;**    8 = Use IP nr probing                        **
  400. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  401. ;**   128 = half quiet (skip the End of pdclkset line)            **
  402. ;**   256 = Write fixed length IP numbers (good for sorting)        **
  403. ;**                                    **
  404. ;**                                    **
  405. ;** Examples:                                **
  406. ;**                                    **
  407. ;** pdtbuild flags= 2  i=2.3.4.5  n=2.3.4.6   (LANalyzer table builder) **
  408. ;**                                    **
  409. ;** pdtbuild flags= 2  i=2.3.4.5  n=1.2.3.4  g=2.3.4.1    m=255.255.255.0 **
  410. ;**                                    **
  411. ;** pdtbuild flags= 2+4+256   (LANwatch table builder, sort compatible) **
  412. ;**                                    **
  413. ;** pdtbuild flags= 2+8           (table building with probing) **
  414. ;**                                    **
  415. ;*************************************************************************
  416. ;**        HISTORY                         **
  417. ;*************************************************************************
  418. ;**                                    **
  419. ;** Ver 0.85: Beta release.                        **
  420. ;**                                    **
  421. ;** Ver 1.02: First official release.                    **
  422. ;**          Removed 386-only instructions. Numerous minor changes.    **
  423. ;**          Corrected the Pacific daylight algorithm.         **
  424. ;**                                    **
  425. ;** Ver 1.10: Selected release with support for one gateway.        **
  426. ;**                                    **
  427. ;** Ver 1.27: Major rewrite of the UDP/IP library to make it mostly RFC **
  428. ;**          compliant. Multi gateway and multi timeserver support.    **
  429. ;**          Fixed hangs on argument syntax errors.            **
  430. ;**          Added comments and documentation to the code.        **
  431. ;**          Added ping server and client function.            **
  432. ;**                                    **
  433. ;** Ver 1.28: Added fragment reassembly.                **
  434. ;**          Added PDTBUILD application to automatically generate    **
  435. ;**          hardware and IP tables by watching network traffic.    **
  436. ;**                                    **
  437. ;** Ver 1.29: Added SQID (Source Quench Introduced Delay)        **
  438. ;**          All time compares changed to js/jns instead of jl/jge,    **
  439. ;**          avoiding wrong handling once every hour.            **
  440. ;**                                    **
  441. ;** Ver 1.30: Added timezone environment variable handling (SET TZ=...).**
  442. ;**          Timeserver not needed to ping or build tables.        **
  443. ;**                                    **
  444. ;** Ver 1.31: Ping delays now millisecond accurate.            **
  445. ;**                                    **
  446. ;** Ver 1.32: Corrected check on illegal ping packet size.        **
  447. ;**          Ping display cleaned up and overhead reduced.        **
  448. ;**          Corrected BufAlloc error when out of buffers.        **
  449. ;**                                    **
  450. ;** Ver 1.33: Fixed PDTBUILD error when not tablebuilding. Ping     **
  451. ;**          enhancements: Time server not needed, added elapsed ping    **
  452. ;**          time field, send error messages displayed.        **
  453. ;**                                    **
  454. ;** Ver 1.34: Made a table for arg decode. Negative ping size will now    **
  455. ;**          sweep from 28 up to abs(size). Also odd sizes work.    **
  456. ;**          Added code in AdjTo16bits to avoid divide overflow.    **
  457. ;**                                    **
  458. ;** Ver 1.35: Made performance improvements. A 386SX with 16-bit WD    **
  459. ;**          card can now handle 2000 pkts/s short packets (send +    **
  460. ;**          receive) or load to 7 Mb/s (long packets). Echo interval    **
  461. ;**          is now in units of milliseconds (actually 0.858 ms)    **
  462. ;**          instead of 55 ms ticks. Added traffic load field in the    **
  463. ;**          display. Added several debug checks.            **
  464. ;**                                    **
  465. ;** Ver 1.36: Made documentation changes for the above new features.    **
  466. ;**                                    **
  467. ;** Ver 1.37: Added domain name resolver for ping. Corrected a bug in    **
  468. ;**          fragment reassembly. Changed length input to SendUdpPkt.    **
  469. ;**          Found bug preventing inactivity timeout for remote hosts. **
  470. ;**                                    **
  471. ;** Ver 1.38: TblBuild redesigned to be able to detect both IP and    **
  472. ;**          hardware address duplicates. Corrected a bug when out of    **
  473. ;**          buffers trying to send unreachables.            **
  474. ;**                                    **
  475. ;** Ver 1.39: TblBuild enhanced with an active probe function to speed    **
  476. ;**          up address collection.                    **
  477. ;**                                    **
  478. ;** Ver 1.40: udpecho= will send udp echo instead of icmp echo packets. **
  479. ;**          Flag=1 will continue sending despite of send errors.    **
  480. ;**          Fixed bug limiting pdtbuild to 2047 hosts, now 4094.    **
  481. ;**          Added test on no nameserver when nameservers needed.    **
  482. ;**          Fixed sometimes inaccurate "active this run" in pdtbuild. **
  483. ;**                                    **
  484. ;** Ver 1.41: Added LongerTimeout= argument to run on slow links.    **
  485. ;**                                    **
  486. ;** Ver 1.42: Fixed IS_386 wrongly set for 8088/8086 (bug introduced in **
  487. ;**          ver 1.35 caused hangs or bad checksum on PC XTs).     **
  488. ;**                                    **
  489. ;** Ver 1.43: Try to handle the case with high speed CPUs overflowing    **
  490. ;**          some network cards or packet drivers.            **
  491. ;**                                    **
  492. ;** Ver 1.44: Show in front of diff the packets dropped due to no bufs. **
  493. ;**          Server mode now displays packets and load statistics.    **
  494. ;**          With flag=32 the interval is in units of 0.1 ms.        **
  495. ;**          With flag=64 udp= will send discard packets.        **
  496. ;**                                    **
  497. ;** Ver 1.45: Fixed display of junk characters if the time server IP    **
  498. ;**          had all 12 digits in the "Clock set to ..." message.    **
  499. ;**                                    **
  500. ;** Ver 1.46: Added Flag=128 to suppress "End of pdclkset" message.    **
  501. ;**                                    **
  502. ;** Ver 1.50: Enhanced Flag= documentation. Flag=256 zero fills IP    **
  503. ;**          numbers to fixed length suitable for sorting. Nicer    **
  504. ;**          display when tablebuilding. The tables now shows the    **
  505. ;**          number of ARP requests from each host so you can sort on    **
  506. ;**          the most important hosts. Subdirectory for source code.    **
  507. ;**                                    **
  508. ;** Ver 1.51: Increased stacksize to fix some pdtbuild hangs, also    **
  509. ;**          always check stack overflow. Make ";" equivalent to ","    **
  510. ;**          (useful for BAT-file arguments, ":" is equiv to "=").    ** 
  511. ;**          Flag=512 will cause sends during packet driver upcalls    **
  512. ;**          in server mode (to see if the driver can handle it).    **
  513. ;**                                    **
  514. ;** Ver 1.52: Count the number of out of sequence, repeated or lost    **
  515. ;**          packets. Flag=1024: stop sending after above errors.    **
  516. ;**          Change size default to -50, giving a 34-50 size sweep.    **
  517. ;**                                    **
  518. ;** Ver 1.53: Fixed so that undefined send errors dont print garbage.    **
  519. ;**                                    **
  520. ;** Ver 2.00: Increased number of full size buffers from 27 do 300+ by    **
  521. ;**          converting all the code to use far addresses for buffers.    **
  522. ;**          The above change needed for ping servers on a VERY loaded    **
  523. ;**          network, where I've now seen up to 160 buffers in the    **
  524. ;**          send queue waiting for collisions to finnish. Packet loss    **
  525. ;**          computed differently during pinging to give a more stable    **
  526. ;**          value at long delays. Ping throughput up by 10 - 20 % by    **
  527. ;**          removing instructions and change register usage and    **
  528. ;**          enhance the checksum routine. Lots of small changes. The    **
  529. ;**          code change may have introduced bugs. There is definitely    **
  530. ;**          one in tablebuilding. Flag=4096 enables IP sizes up to    **
  531. ;**          4082 (for Token Ring). Fixed a bug that gave a not    **
  532. ;**          completely correct port or protocol unreachable packet.    **
  533. ;**          Added a min-size parameter for size sweeping.        **
  534. ;**          Added a lot of useful debug code.                **
  535. ;**                                    **
  536. ;** ver 2.01: Found the tablebuilding bug. The source code restructured    **
  537. ;**          to appear in a more logical order. DOS interrupt bottle-    **
  538. ;**          necks replaced, giving a 40 % throughput increase! The    **
  539. ;**          code is now 100% MAC hardware address length independent.    **
  540. ;**          Interval may now have a decimal point and digit. Added    **
  541. ;**          special handling for true SLIP and Token Ring (untested,    **
  542. ;**          no source routing). Moved the EchoDisplay calls to    **
  543. ;**          Somethig2Do, giving a more stable and accurate load    **
  544. ;**          figure. Source quench code now use millisecond instead of    **
  545. ;**          tick resolution, giving a more even load.            **
  546. ;**                                    **
  547. ;** ver 2.02: Made documentation changes for the above 2.x features.    **
  548. ;**                                    **
  549. ;** ver 2.03: Fixed server mode bug causing divide overflow or hangs.    **
  550. ;**                                    **
  551. ;** ver 2.04: Changed default echo interval to equal display interval,    **
  552. ;**          giving better display rythm. Echo interval algorithm    **
  553. ;**          changed to be more accurate and CPU speed independent.     **
  554. ;**          Fixed tablebuild bug causing display not always updated.    **
  555. ;**                                    **
  556. ;** ver 2.05: Changed buffer allocation to leave room for COMMAND.COM    **
  557. ;**          so you can recall the previous command with the F3 key.    **
  558. ;**                                    **
  559. ;** ver 2.06: Fixed a hang that could occur after a long while running    **
  560. ;**          ping client or server.                    **
  561. ;**                                    **
  562. ;** ver 2.07: Ping display line was not advanced after other print.    **
  563. ;**                                    **
  564. ;*************************************************************************
  565. ;**        ACKNOWLEDGMENTS                     **
  566. ;*************************************************************************
  567. ;**                                    **
  568. ;** The checksum routine used is a modified NCSA Telnet version.    **
  569. ;** The dst algorithm was modelled after PCIP SETCLOCK (thanks Drew!),    **
  570. ;** but enhanced to use parameters from a table.            **
  571. ;** The dst algorithm table was derived from a comp.sources.unix 1989    **
  572. ;** posting by ado@ncifcrf.gov of localtime.c and related routines    **
  573. ;** and tables, and a later update (very useful data, thanks!).     **
  574. ;** The master environment is found using Pat's code.            **
  575. ;** The millisecond timer is based on code from Dean Pentcheff.     **
  576. ;** The DateTimeCalc routine is my own invention.            **
  577. ;** The packet driver interface routines were copied from the Crynwr    **
  578. ;** packet driver distribution, without which this project would not    **
  579. ;** have been possible (thanks Russ!).                    **
  580. ;**                                    **
  581. ;** The small UDP/IP library was written by me, and can probably be    **
  582. ;** used in other small assembler applications. It is now fully RFC    **
  583. ;** compliant, except for a few small cases mentioned in the code. It    **
  584. ;** DOES handle IP type of service, fragment reassembly, source quench    **
  585. ;** throttling, sending port and protocol unreachables, multiple    **
  586. ;** default gateways, etc.                        **
  587. ;**                                    **
  588. ;*************************************************************************
  589. ;**        WHERE TO GET IT FROM                    **
  590. ;*************************************************************************
  591. ;**                                    **
  592. ;** Current version of PDCLKSET can be obtained by anonymous FTP from    **
  593. ;** ftp.lu.se:/pub/network/pdclkset/pdclkxxx.zip or from        **
  594. ;** msdos.ftp.sunet.se:pub/network/pdclkset/pdclkxxx.zip or from Novell **
  595. ;** server LUSTORFS/ARC:PUB\NETWORK\PDCLKSET\PDCLKxxx.ZIP        **
  596. ;** (Netware access only in Lund and around).                **
  597. ;** Major releases will also be available on the Simtel20 archive and    **
  598. ;** its mirror sites (like oak.oakland.edu, wuarchive.wustl.edu and    **
  599. ;** ftp.funet.fi) in the msdos.pktdrvr directory.            **
  600. ;**                                    **
  601. ;*                                     *
  602. ;* Jan Engvald, Lund University Computing Center             *
  603. ;* ____________________________________________________________________  *
  604. ;*   Address: Box 783            E-mail: Jan.Engvald@ldc.lu.se     *
  605. ;*          S-220 07 LUND    Earn/Bitnet: xjeldc@seldc52         *
  606. ;*          SWEDEN          (Span/Hepnet: Sweden::Gemini::xjeldc)     *
  607. ;*    Office: Soelvegatan 18        VAXPSI: psi%2403732202020::xjeldc     *
  608. ;* Telephone: +46 46 107458        (X.400: C=se; A=""; P=Sunet; O=lu;     *
  609. ;*   Telefax: +46 46 138225            OU=ldc; S=Engvald; G=Jan)     *
  610. ;*     Telex: 33533 LUNIVER S                         *
  611. ;*                                     *
  612. ;*************************************************************************
  613.  
  614. ; Note: If you want to assemble this code yourself, you need Turbo ASM 
  615. ; (at least MASM 5.1 does not like comments on structure calls!).
  616. ; Also, some files from the Crynwr packet driver collection are needed.
  617.  
  618. ;************************************************************************
  619. ;*        Compile time constants                    *
  620. ;************************************************************************
  621.  
  622.         .lfcond  
  623. PRGVERSION    equ    ' v2.07'
  624. TBLBUILD     equ     0
  625. PINGCLIENT     equ     1
  626. ; DEBUG values above 5 degrade throughput a lot.
  627. DEBUG         equ     0
  628.  
  629. MN        equ    60            ; seconds in a minute
  630. HR        equ    60*MN            ; seconds in an hour
  631.  
  632. SUN        equ    0            ; Sunday
  633. SAT        equ    6            ; Saturday
  634. DAT        equ    0ffh            ; Specific date follows
  635.  
  636. FEB2W        equ    31+2*7                ; Feb 2nd week
  637. MAR1W        equ    31+28+1*7            ; Mar 1st week
  638. MAR2W        equ    31+28+2*7            ; Mar 2nd week
  639. MAR3W        equ    31+28+3*7            ; Mar 2rd week
  640. MARLW        equ    31+28+31            ; Mar last week
  641. APR01        equ    31+28+31+1            ; Apr 1
  642. APR03        equ    31+28+31+3            ; Apr 3
  643. APR07        equ    31+28+31+7            ; Apr 7
  644. APR1W        equ    31+28+31+1*7            ; Apr 1st week
  645. APR2W        equ    31+28+31+2*7            ; Apr 2nd week
  646. APR14        equ    31+28+31+14            ; Apr 14
  647. APR18        equ    31+28+31+18            ; Apr 18
  648. APRNL        equ    31+28+31+30-7            ; Apr next last week
  649. APR23        equ    31+28+31+23            ; Apr 23
  650. APR26        equ    31+28+31+26            ; Apr 26
  651. MAY01        equ    31+28+31+30+1            ; May 1
  652. MAY2W        equ    31+28+31+30+2*7         ; May 2nd week
  653. AUG28        equ    31+28+31+30+31+30+31+28     ; Aug 28
  654. SEP01        equ    31+28+31+30+31+30+31+31+1    ; Sep 1
  655. SEP08        equ    31+28+31+30+31+30+31+31+8    ; Sep 8
  656. SEP12        equ    31+28+31+30+31+30+31+31+12    ; Sep 12
  657. SEP2W        equ    31+28+31+30+31+30+31+31+2*7    ; Sep 2nd week
  658. SEP17        equ    31+28+31+30+31+30+31+31+17    ; Sep 17
  659. SEP20        equ    31+28+31+30+31+30+31+31+20    ; Sep 20
  660. SEP3W        equ    31+28+31+30+31+30+31+31+3*7    ; Sep 3rd week
  661. SEP30        equ    31+28+31+30+31+30+31+31+30    ; Sep 30
  662. SEPLW        equ    31+28+31+30+31+30+31+31+30    ; Sep last week
  663. OCT01        equ    31+28+31+30+31+30+31+31+30+1    ; Oct 1
  664. OCT2W        equ    31+28+31+30+31+30+31+31+30+2*7    ; Oct 2nd week
  665. OCT24        equ    31+28+31+30+31+30+31+31+30+24    ; Oct 18 - 24
  666. OCT4W        equ    31+28+31+30+31+30+31+31+30+4*7    ; Oct 4th week
  667. OCT29        equ    31+28+31+30+31+30+31+31+30+29    ; Oct 23 - 29
  668. OCTLW        equ    31+28+31+30+31+30+31+31+30+31        ; Oct last week
  669. NOV13        equ    31+28+31+30+31+30+31+31+30+31+13    ; Nov 5 - 13
  670.  
  671. AlgE        struc
  672. AlgName     db    "EUR "            ;; Name of dst algorithm
  673. AlgFromTime    dw    2*HR            ;; local standard time dst start
  674. AlgFromWeekDay    dw    SUN            ;; weekday dst start
  675. AlgFromWeek    dw    MARLW            ;; last day-of-year dst start
  676. AlgUntilTime    dw    2*HR            ;; local standard time dst end
  677. AlgUntilWeekDay dw    SUN            ;; weekday dst end
  678. AlgUntilWeek    dw    SEPLW            ;; last day-of-year dst end
  679. AlgAddAmount    dw    1*HR            ;; dst advance amount
  680. AlgEntryLen    equ    $-AlgName
  681. AlgE        ends
  682.  
  683. AlgData     struc
  684. AUSA AlgE <"USA ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; USA Canada Mexico
  685. ACub AlgE <"CUB ", 0*HR,SUN,MAY2W,-1*HR,SUN,OCT2W, HR>  ;; Cuba
  686. AChl AlgE <"CHIL", 0*HR,SUN,OCT2W,-1*HR,SUN,MAR2W, HR>  ;; Chile
  687. ABrz AlgE <"BRZ ", 2*HR,SAT,OCT4W, 1*HR,SAT,FEB2W, HR>  ;; Brazil
  688. AGBR AlgE <"GBR ", 1*HR,SUN,MARLW, 1*HR,SUN,OCT29, HR>  ;; United Kingdom
  689. AWEu AlgE <"W_EU", 1*HR,SUN,MARLW, 1*HR,SUN,SEPLW, HR>  ;; West Europe
  690. AMEu AlgE <"M_EU", 2*HR,SUN,MARLW, 2*HR,SUN,SEPLW, HR>  ;; Central Europe + SU
  691. AEEu AlgE <"E_EU", 3*HR,SUN,MARLW, 3*HR,SUN,SEPLW, HR>  ;; East Europe
  692. ALby AlgE <"LIBY", 2*HR,DAT,APR01, 1*HR,DAT,SEP30, HR>  ;; Libya
  693. AEgy AlgE <"EGY ", 2*HR,DAT,MAY01, 1*HR,DAT,OCT01, HR>  ;; Egypt
  694. ATur AlgE <"TURK", 1*HR,SUN,MARLW, 0*HR,SUN,SEPLW, HR>  ;; Turkey
  695. AIra AlgE <"IRAN", 2*HR,SUN,MARLW, 1*HR,SUN,SEP3W, HR>  ;; Iran
  696. APRC AlgE <"PRC ", 2*HR,SUN,APR2W, 2*HR,SUN,SEP2W, HR>  ;; People Rep of China
  697. AROK AlgE <"ROK ", 2*HR,SUN,MAY2W, 2*HR,SUN,OCT2W, HR>  ;; Rep of Korea
  698. AAus AlgE <"AUS ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR3W, HR>  ;; South Australia
  699. ATas AlgE <"TASM", 2*HR,SUN,OCT24, 2*HR,SUN,MAR3W, HR>  ;; Tasmania
  700. ANSW AlgE <"NSW ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>  ;; New South Wales
  701. ALHI AlgE <"LHI ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, 30*MN> ;; LHI (Australia) 
  702. ANZe AlgE <"NZE ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>  ;; New Zealand
  703.  
  704. ; All entries below this line are indexed by year modulo 4
  705.  
  706. APa0 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,NOV13, HR>  ;; Pacific presidential
  707. APa1 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  708. APa2 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  709. APa3 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  710.  
  711. ; All entries above this line are cyclic and will last forever
  712. ; All entries below this line are non-cyclic, they only last 4 years
  713.  
  714. AIs0 AlgE <"ISR ", 0*HR,DAT,APR14,-1*HR,DAT,SEP08, HR>  ;; Israel 1996
  715. AIs1 AlgE <"ISR ", 0*HR,DAT,APR18,-1*HR,DAT,SEP12, HR>  ;; Israel 1993
  716. AIs2 AlgE <"ISR ", 0*HR,DAT,APR03,-1*HR,DAT,AUG28, HR>  ;; Israel 1994
  717. AIs3 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>  ;; Israel 1995
  718.  
  719. if 0    ; as years go by, replace entries above from below with same label
  720. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY04,-1*HR,DAT,SEP28, HR>  ;; Israel 1997
  721. AIs2 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>  ;; Israel 1998
  722. AIs3 AlgE <"ISR ", 0*HR,DAT,APR11,-1*HR,DAT,SEP05, HR>  ;; Israel 1999
  723. AIs0 AlgE <"ISR ", 0*HR,DAT,APR30,-1*HR,DAT,SEP24, HR>  ;; Israel 2000
  724. AIs1 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>  ;; Israel 2001
  725. AIs2 AlgE <"ISR ", 0*HR,DAT,APR07,-1*HR,DAT,SEP01, HR>  ;; Israel 2002
  726. AIs3 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>  ;; Israel 2003
  727. AIs0 AlgE <"ISR ", 0*HR,DAT,APR18,-1*HR,DAT,SEP12, HR>  ;; Israel 2004
  728. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY01,-1*HR,DAT,SEP25, HR>  ;; Israel 2005
  729. AIs2 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>  ;; Israel 2006
  730. AIs3 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>  ;; Israel 2007
  731. AIs0 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>  ;; Israel 2008
  732. AIs1 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>  ;; Israel 2009
  733. endif
  734. AlgData         ends
  735.  
  736. WARNYEAR        equ     1997                    ; acyclic data invalid year
  737.  
  738. ;************************************************************************
  739.