home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / PKTDRVR / PDTST217.ZIP / PDTSTNET.DOC < prev    next >
Encoding:
Text File  |  1994-04-07  |  45.5 KB  |  888 lines

  1. ;*************************************************************************
  2. ;**                                    **
  3. ;**            PDCLKSET and PDTSTNET                **
  4. ;**                                    **
  5. ;**                                    **
  6. ;**        Copyright (C) 1991-94 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 110 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 (actually the diff value after compensating for repeated    **
  260. ;** packets). During the pinging, however, there can be many packets in    **
  261. ;** transit giving a non-zero diff. So instead the packet loss is    **
  262. ;** computed using an intelligent algorithm that can compensate for    **
  263. ;** long turnaround delays and most out of sequence and repeat cases.    **
  264. ;**                                    **
  265. ;** If the host you are pinging don't drop packets (many do, a 386 with    **
  266. ;** PDCLKSET doesn't), the packet loss as a symptom of network health    **
  267. ;** is as follows:                            **
  268. ;**                                    **
  269. ;**   0.01 % or less  : your network is most probably healthy.         **
  270. ;**   0.01 % to 0.1 % : there are some minor faults but nobody will    **
  271. ;**            notice any delays.                **
  272. ;**   0.1 % to 1 %    : you will notice delays more or less often.    **
  273. ;**   1 % or more     : frequent delays, very annoying.         **
  274. ;**                                    **
  275. ;** Some packet drivers, like smc_wd.com, give 0.0000 % lost packets on    **
  276. ;** a healthy network. This enables you to trace beginning component    **
  277. ;** degradation (oxidizing contacts, drifting IC circuits, etc) long    **
  278. ;** before they cause any trouble to real traffic.            **
  279. ;**                                    **
  280. ;** The display is updated nine times a second. To avoid unpleasant    **
  281. ;** value flickering, when a packet is just sent, diff is temporarily    **
  282. ;** one less than it should be. When a packet has arrived it is back to **
  283. ;** normal. All values (except the "this" and the load values) are    **
  284. ;** accumulated or averaged during the complete time since pdclkset was **
  285. ;** last started. The time field tells you this elapsed time.        **
  286. ;**                                    **
  287. ;** Using udpecho= instead of echo= will send UDP echo instead of icmp    **
  288. ;** echo (ping) packets. Add flag=64 if you want UDP discard packets,    **
  289. ;** useful for saturated bottleneck throughput measurements.        **
  290. ;**                                    **
  291. ;** Argument f=1 will continue sending despite some send errors.    **
  292. ;**                                    **
  293. ;** If you don't run a BOOTP server, the i= (and n=) arguments are    **
  294. ;** needed and also m= and g= if any traffic goes through a router.    **
  295. ;**                                    **
  296. ;**                                    **
  297. ;** Syntax:                                **
  298. ;**                                    **
  299. ;** pdclkset e[cho]= name | n.n.n.n [,size[,interval[,data,inc[,min]]]]    **
  300. ;**                                    **
  301. ;**         [i[pnr]=n.n.n.n]  [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  302. ;**                                    **
  303. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  304. ;**                                    **
  305. ;**         [p[ktintno]=hexnr]  [f[lags]=flagnr]            **
  306. ;**                                    **
  307. ;**         [l[ongertimeout]=time]                    **
  308. ;**                                    **
  309. ;**         u[dpecho]= name | n.n.n.n [,size[,intrvl[,data,inc[,min]]]]**
  310. ;**                                    **
  311. ;** Valid flags for server mode (no echo/udpecho/hopcheck argument):    **
  312. ;**    1 = Ping/Echo server (delay termination)            **
  313. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  314. ;**   128 = half quiet (skip the End of pdclkset line)            **
  315. ;**   512 = Stress the packet driver using upcall sends for ping serv    **
  316. ;**  4096 = Allow frame size up to 4096 (IP size 4082 bytes)        **
  317. ;**                                    **
  318. ;** Valid flags for client mode (echo or udpecho arguments):        **
  319. ;**    1 = Allow short (<110 ms) intervals; also continue despite errs **
  320. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  321. ;**   (32 = Use 0.1 ms interval unit instead of 1.0 ms)            **
  322. ;**    64 = For udpecho= argument, send discard instead of echo packets    **
  323. ;**   128 = half quiet (skip the End of pdclkset line)            **
  324. ;**   512 = Stress the packet driver using upcall sends for ping serv    **
  325. ;**  1024 = Stop if duplicated, lost or nonconsecutive packets seen    **
  326. ;**  4096 = Allow frame size up to 4096 (IP size 4082 bytes)        **
  327. ;**                                    **
  328. ;**                                    **
  329. ;** Examples:                                **
  330. ;**                                    **
  331. ;** pdclkset  echo= nic.ddn.mil (ping client, auxilary info from BOOTP) **
  332. ;**                                    **
  333. ;** pdclkset  e= 1.2.3.4  i= 2.3.4.5  g= 2.3.4.1  m= 255.255.255.0    **
  334. ;**                                    **
  335. ;** pdclkset  echo= host.on.this.net  ip= 111.22.33.4  ns= 111.22.33.5    **
  336. ;**                                    **
  337. ;** pdclkset  udpecho= ping.lu.se              (UDP echo client) **
  338. ;**                                    **
  339. ;** pdclkset  flags= 1                 (ping and UDP echo server) **
  340. ;**                                    **
  341. ;** pdclkset  flags= 1    ip= 2.3.4.5  g= 2.3.4.1  m= 255.255.255.0    **
  342. ;**                                    **
  343. ;*************************************************************************
  344. ;**        USING PDTSTNET FOR HOP CHECKING (TRACE ROUTE)        **
  345. ;*************************************************************************
  346. ;**                                    **
  347. ;** The PDTSTNET program, which is included in the ZIP package, can    **
  348. ;** be used to trace the route to a destination. It is an asynchronous    **
  349. ;** implementation, meaning that new packets are sent without waiting    **
  350. ;** for previous ones to return. This shortens the trace time a lot,    **
  351. ;** particulary for long distance targets or if the lines have a high    **
  352. ;** packet loss rate. The trace time is actually independent of the    **
  353. ;** packet loss rate. Also, if one or more nameservers don't respond    **
  354. ;** within a reasonable time, you can terminate by pressing any key and    **
  355. ;** still get a good trace view. PDTSTNET is probably the fastest trace    **
  356. ;** route routine available on any platform.                **
  357. ;**                                    **
  358. ;** To ensure that all routers in the path are detected, even with high    **
  359. ;** packet loss rate, the complete path is traced three times. There is    **
  360. ;** a one second delay between each trace phase; this is because some    **
  361. ;** routers don't respond (with ICMP ttl exceeded) more than once a    **
  362. ;** second. The packet size is incremented by one byte for each phase    **
  363. ;** to detect some size dependent router bugs. If you don't need all    **
  364. ;** three phases, just press a key and it will stop sending packets.    **
  365. ;**                                    **
  366. ;** If the trace display data has more lines than fits the screen, you    **
  367. ;** can use the up and down arrow keys to scroll the data.        **
  368. ;**                                    **
  369. ;**                                    **
  370. ;** A typical hop check call look like:                    **
  371. ;**                                    **
  372. ;**    pdtstnet hop=ftp.lu.se                         **
  373. ;**                                    **
  374. ;** If you don't run a BOOTP server, the i=, m=, g= and n= arguments    **
  375. ;** are    also needed.                            **
  376. ;**                                    **
  377. ;** The display will look like this:                    **
  378. ;**                                    **
  379. ;** Calling nameserver(s)... got reply in  195 ms.            **
  380. ;**                                    **
  381. ;** Trace with packet size 34<50 and interval 110 ms to 130.235.132.90:    **
  382. ;**                                    **
  383. ;**  0:    0     0     0  194.47.24.14    my.comp.ut.er            **
  384. ;**  1:    3     2     2  194.47.24.1     my.gate.way            **
  385. ;**    ...                                **
  386. ;** 17:  156p  153p  162p 130.235.132.90  nomina.lu.se            **
  387. ;**                                    **
  388. ;**                                    **
  389. ;** On each line, the first value is the hop count. The next three    **
  390. ;** values are the round trip delay in ms. Next is the IP nr and name    **
  391. ;** of the router at that hop count distance. If the packets can use    **
  392. ;** multiple paths, you may see several routers at a certain distance.    **
  393. ;** A few routers don't respond at all, some don't respond to odd size    **
  394. ;** packets.                                **
  395. ;**                                    **
  396. ;** The letters following the delay figures on the last line tell the    **
  397. ;** type of response. A "p" means port unreachable; this is what you    **
  398. ;** should expect. "P" means protocol unreachable. Both of these means    **
  399. ;** you have reached the destination OK. "H" is host unreachable and    **
  400. ;** "N" is net unreachable. "F" means fragmenting needed to continue    **
  401. ;** (but this is prohibited by PDTSTNET to be able to detect packet    **
  402. ;** size bottlenecks). Any other response will show a "?".        **
  403. ;**                                    **
  404. ;** Some hosts don't return a consistent remaining ttl value; most    **
  405. ;** cases are taken care of by PDTSTNET, but some times there may    **
  406. ;** appear extra lines beyond the destination.                **
  407. ;**                                    **
  408. ;** The hopcheck function will not work on older pre-AT machines.    **
  409. ;**                                    **
  410. ;** Pdtstnet includes all the functionality of pdclkset.        **
  411. ;**                                    **
  412. ;**                                    **
  413. ;** Hop check syntax (actually very similar to the ping syntax above):    **
  414. ;**                                    **
  415. ;** pdtstnet h[opcheck]= name | n.n.n.n                    **
  416. ;**                   [,size[,interval[,data,inc[,minsize[,maxhops]]]]]    **
  417. ;**                                    **
  418. ;**         [i[pnr]=n.n.n.n]  [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  419. ;**                                    **
  420. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  421. ;**                                    **
  422. ;**         [p[ktintno]=hexnr]  [f[lags]=flagnr]            **
  423. ;**                                    **
  424. ;**         [l[ongertimeout]=time]                    **
  425. ;**                                    **
  426. ;** Valid flags for hop check mode:                    **
  427. ;**    1 = Allow short (<110 ms) intervals                **
  428. ;**    64 = Utilize protocol unreachable instead of port unreachable    **
  429. ;**   128 = half quiet (skip the End of pdtstnet line)            **
  430. ;**  4096 = Allow frame size up to 4096 (IP size 4082 bytes)        **
  431. ;**                                    **
  432. ;**                                    **
  433. ;** Examples:                                **
  434. ;**                                    **
  435. ;** pdtstnet  hopcheck = oak.oakland.edu      (network info from BOOTP) **
  436. ;**                                    **
  437. ;** pdtstnet  h=1.2.3.4 i=2.3.4.5 n=2.3.4.3 g=2.3.4.1 m=255.255.255.0    **
  438. ;**                                    **
  439. ;** pdtstnet  hop= host.on.this.net  ip= 111.22.33.4  ns= 111.22.33.5    **
  440. ;**                                    **
  441. ;** pdtstnet  h=wsmr-gw2.army.mil,1100 (test how far size 1100 will go)    **
  442. ;**                                    **
  443. ;** pdtstnet  h= ftp.lu.se,34,9  f=1    (speeding up: 9 ms interval)    **
  444. ;**                                    **
  445. ;*************************************************************************
  446. ;**        USING PDTSTNET TO GENERATE TABLES WITH ALL IP HOSTS    **
  447. ;*************************************************************************
  448. ;**                                    **
  449. ;** The PDTSTNET program can also be in tablebuilding mode and look    **
  450. ;** at all ARP broadcasts and generate a table with all the IP hosts    **
  451. ;** on this (sub)net. Each entry has IP number, Ethernet address and    **
  452. ;** host name, the latter which it asks a name server for. Two files    **
  453. ;** are generated, IPTBL.TXT and HWTBL.TXT, which are suitable as input **
  454. ;** to LANwatch or a LANalyzer or other monitors. It should preferably    **
  455. ;** be run for a complete day or longer. When started, if IPTBL.TXT    **
  456. ;** exists it will read it in and update with what it sees on the net.    **
  457. ;** It can handle up to 4094 hosts. Use BIGSORT for sorting (available    **
  458. ;** from oak.oakland.edu:pub/msdos/textutl)                **
  459. ;**                                    **
  460. ;** In the comment field, an A means authorative answer, N is non-    **
  461. ;** authorative answer from nameserver. 0 means host not registered    **
  462. ;** for reverse lookup (in-addr.arpa domain). - means name not found.    **
  463. ;** < and = denotes Ethernet duplicates for same IP address. >, = and + **
  464. ;** denotes IP duplicates for same Ethernetaddress (+ is used for a    **
  465. ;** gateway pdtstnet know of). The last number on each line is how many **
  466. ;** ARP broadcasts we have seen from this address (so BIGSORT /R /+71    **
  467. ;** will sort the most used hosts first).                **
  468. ;**                                    **
  469. ;** You can speed up address collection by adding flag=8. This will    **
  470. ;** start ARP probing, a process that cycles through all IP addresses in**
  471. ;** the (sub)net and sends an ARP request for each address. The speed    **
  472. ;** is 9 ARP requests per second, slowing down to two per second when    **
  473. ;** nameserver requests are needed. It is rather successful in ignoring **
  474. ;** ARP replies from proxy ARP gateways (otherwise it would table a lot **
  475. ;** of fake hosts). Be careful with ARP probing, some programs (eg KA9Q    **
  476. ;** NET) may be hard to start when sprayed with ARP broadcasts.        **
  477. ;**                                    **
  478. ;** You can run echo (ping) in parallell with tablebuilding (and the    **
  479. ;** ARP probing), although the screen display is somewhat garbled. If    **
  480. ;** you don't ping, the display will show the accumulated number of ARP    **
  481. ;** broadcasts and the time of day; also the current ARP probe IP addr.    **
  482. ;**                                    **
  483. ;** If you don't run a BOOTP server, the i= and n= arguments are needed **
  484. ;** and also m= and g= if the nameserver is behind a router.        **
  485. ;**                                    **
  486. ;** The tblbuild code is a quick hack, undocumented, but works for me.    **
  487. ;**                                    **
  488. ;** Syntax:                                **
  489. ;**                                    **
  490. ;** pdtstnet f[lags]=flagnr                        **
  491. ;**                                    **
  492. ;**         [i[pnr]=n.n.n.n]  [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  493. ;**                                    **
  494. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  495. ;**                                    **
  496. ;**         [p[ktintno]=hexnr]     [l[ongertimeout]=time]            **
  497. ;**                                    **
  498. ;** Valid flags for table building mode:                **
  499. ;**    2 = Enable table building (required for this mode)        **
  500. ;**    4 = Use LANwatch table syntax instead of LANalyzer syntax    **
  501. ;**    8 = Use IP nr probing                        **
  502. ;**    16 = Not enough IBM compatible PC, use DOS interrupts        **
  503. ;**   128 = half quiet (skip the End of pdtstnet line)            **
  504. ;**   256 = Write fixed length IP numbers (good for sorting)        **
  505. ;**                                    **
  506. ;**                                    **
  507. ;** Examples:                                **
  508. ;**                                    **
  509. ;** pdtstnet flags= 2  i=2.3.4.5  n=2.3.4.6   (LANalyzer table builder) **
  510. ;**                                    **
  511. ;** pdtstnet flags= 2  i=2.3.4.5  n=1.2.3.4  g=2.3.4.1    m=255.255.255.0 **
  512. ;**                                    **
  513. ;** pdtstnet flags= 2+4+256   (LANwatch table builder, sort compatible) **
  514. ;**                                    **
  515. ;** pdtstnet flags= 2+8           (table building with probing) **
  516. ;**                                    **
  517. ;*************************************************************************
  518. ;**        HISTORY                         **
  519. ;*************************************************************************
  520. ;**                                    **
  521. ;** Ver 0.85: Beta release.                        **
  522. ;**                                    **
  523. ;** Ver 1.02: First official release.                    **
  524. ;**          Removed 386-only instructions. Numerous minor changes.    **
  525. ;**          Corrected the Pacific daylight algorithm.         **
  526. ;**                                    **
  527. ;** Ver 1.10: Selected release with support for one gateway.        **
  528. ;**                                    **
  529. ;** Ver 1.27: Major rewrite of the UDP/IP library to make it mostly RFC **
  530. ;**          compliant. Multi gateway and multi timeserver support.    **
  531. ;**          Fixed hangs on argument syntax errors.            **
  532. ;**          Added comments and documentation to the code.        **
  533. ;**          Added ping server and client function.            **
  534. ;**                                    **
  535. ;** Ver 1.28: Added fragment reassembly.                **
  536. ;**          Added PDTBUILD application to automatically generate    **
  537. ;**          hardware and IP tables by watching network traffic.    **
  538. ;**                                    **
  539. ;** Ver 1.29: Added SQID (Source Quench Introduced Delay)        **
  540. ;**          All time compares changed to js/jns instead of jl/jge,    **
  541. ;**          avoiding wrong handling once every hour.            **
  542. ;**                                    **
  543. ;** Ver 1.30: Added timezone environment variable handling (SET TZ=...).**
  544. ;**          Timeserver not needed to ping or build tables.        **
  545. ;**                                    **
  546. ;** Ver 1.31: Ping delays now millisecond accurate.            **
  547. ;**                                    **
  548. ;** Ver 1.32: Corrected check on illegal ping packet size.        **
  549. ;**          Ping display cleaned up and overhead reduced.        **
  550. ;**          Corrected BufAlloc error when out of buffers.        **
  551. ;**                                    **
  552. ;** Ver 1.33: Fixed PDTBUILD error when not tablebuilding. Ping     **
  553. ;**          enhancements: Time server not needed, added elapsed ping    **
  554. ;**          time field, send error messages displayed.        **
  555. ;**                                    **
  556. ;** Ver 1.34: Made a table for arg decode. Negative ping size will now    **
  557. ;**          sweep from 28 up to abs(size). Also odd sizes work.    **
  558. ;**          Added code in AdjTo16bits to avoid divide overflow.    **
  559. ;**                                    **
  560. ;** Ver 1.35: Made performance improvements. A 386SX with 16-bit WD    **
  561. ;**          card can now handle 2000 pkts/s short packets (send +    **
  562. ;**          receive) or load to 7 Mb/s (long packets). Echo interval    **
  563. ;**          is now in units of milliseconds (actually 0.858 ms)    **
  564. ;**          instead of 55 ms ticks. Added traffic load field in the    **
  565. ;**          display. Added several debug checks.            **
  566. ;**                                    **
  567. ;** Ver 1.36: Made documentation changes for the above new features.    **
  568. ;**                                    **
  569. ;** Ver 1.37: Added domain name resolver for ping. Corrected a bug in    **
  570. ;**          fragment reassembly. Changed length input to SendUdpPkt.    **
  571. ;**          Found bug preventing inactivity timeout for remote hosts. **
  572. ;**                                    **
  573. ;** Ver 1.38: TblBuild redesigned to be able to detect both IP and    **
  574. ;**          hardware address duplicates. Corrected a bug when out of    **
  575. ;**          buffers trying to send unreachables.            **
  576. ;**                                    **
  577. ;** Ver 1.39: TblBuild enhanced with an active probe function to speed    **
  578. ;**          up address collection.                    **
  579. ;**                                    **
  580. ;** Ver 1.40: udpecho= will send udp echo instead of icmp echo packets. **
  581. ;**          Flag=1 will continue sending despite of send errors.    **
  582. ;**          Fixed bug limiting pdtbuild to 2047 hosts, now 4094.    **
  583. ;**          Added test on no nameserver when nameservers needed.    **
  584. ;**          Fixed sometimes inaccurate "active this run" in pdtbuild. **
  585. ;**                                    **
  586. ;** Ver 1.41: Added LongerTimeout= argument to run on slow links.    **
  587. ;**                                    **
  588. ;** Ver 1.42: Fixed IS_386 wrongly set for 8088/8086 (bug introduced in **
  589. ;**          ver 1.35 caused hangs or bad checksum on PC XTs).     **
  590. ;**                                    **
  591. ;** Ver 1.43: Try to handle the case with high speed CPUs overflowing    **
  592. ;**          some network cards or packet drivers.            **
  593. ;**                                    **
  594. ;** Ver 1.44: Show in front of diff the packets dropped due to no bufs. **
  595. ;**          Server mode now displays packets and load statistics.    **
  596. ;**          With flag=32 the interval is in units of 0.1 ms.        **
  597. ;**          With flag=64 udp= will send discard packets.        **
  598. ;**                                    **
  599. ;** Ver 1.45: Fixed display of junk characters if the time server IP    **
  600. ;**          had all 12 digits in the "Clock set to ..." message.    **
  601. ;**                                    **
  602. ;** Ver 1.46: Added Flag=128 to suppress "End of pdclkset" message.    **
  603. ;**                                    **
  604. ;** Ver 1.50: Enhanced Flag= documentation. Flag=256 zero fills IP    **
  605. ;**          numbers to fixed length suitable for sorting. Nicer    **
  606. ;**          display when tablebuilding. The tables now shows the    **
  607. ;**          number of ARP requests from each host so you can sort on    **
  608. ;**          the most important hosts. Subdirectory for source code.    **
  609. ;**                                    **
  610. ;** Ver 1.51: Increased stacksize to fix some pdtbuild hangs, also    **
  611. ;**          always check stack overflow. Make ";" equivalent to ","    **
  612. ;**          (useful for BAT-file arguments, ":" is equiv to "=").    ** 
  613. ;**          Flag=512 will cause sends during packet driver upcalls    **
  614. ;**          in server mode (to see if the driver can handle it).    **
  615. ;**                                    **
  616. ;** Ver 1.52: Count the number of out of sequence, repeated or lost    **
  617. ;**          packets. Flag=1024: stop sending after above errors.    **
  618. ;**          Change size default to -50, giving a 34-50 size sweep.    **
  619. ;**                                    **
  620. ;** Ver 1.53: Fixed so that undefined send errors dont print garbage.    **
  621. ;**                                    **
  622. ;** Ver 2.00: Increased number of full size buffers from 27 do 300+ by    **
  623. ;**          converting all the code to use far addresses for buffers.    **
  624. ;**          The above change needed for ping servers on a VERY loaded    **
  625. ;**          network, where I've now seen up to 160 buffers in the    **
  626. ;**          send queue waiting for collisions to finnish. Packet loss    **
  627. ;**          computed differently during pinging to give a more stable    **
  628. ;**          value at long delays. Ping throughput up by 10 - 20 % by    **
  629. ;**          removing instructions and change register usage and    **
  630. ;**          enhance the checksum routine. Lots of small changes. The    **
  631. ;**          code change may have introduced bugs. There is definitely    **
  632. ;**          one in tablebuilding. Flag=4096 enables IP sizes up to    **
  633. ;**          4082 (for Token Ring). Fixed a bug that gave a not    **
  634. ;**          completely correct port or protocol unreachable packet.    **
  635. ;**          Added a min-size parameter for size sweeping.        **
  636. ;**          Added a lot of useful debug code.                **
  637. ;**                                    **
  638. ;** ver 2.01: Found the tablebuilding bug. The source code restructured    **
  639. ;**          to appear in a more logical order. DOS interrupt bottle-    **
  640. ;**          necks replaced, giving a 40 % throughput increase! The    **
  641. ;**          code is now 100% MAC hardware address length independent.    **
  642. ;**          Interval may now have a decimal point and digit. Added    **
  643. ;**          special handling for true SLIP and Token Ring (untested,    **
  644. ;**          no source routing). Moved the EchoDisplay calls to    **
  645. ;**          Somethig2Do, giving a more stable and accurate load    **
  646. ;**          figure. Source quench code now use millisecond instead of    **
  647. ;**          tick resolution, giving a more even load.            **
  648. ;**                                    **
  649. ;** ver 2.02: Made documentation changes for the above 2.x features.    **
  650. ;**                                    **
  651. ;** ver 2.03: Fixed server mode bug causing divide overflow or hangs.    **
  652. ;**                                    **
  653. ;** ver 2.04: Changed default echo interval to equal display interval,    **
  654. ;**          giving better display rythm. Echo interval algorithm    **
  655. ;**          changed to be more accurate and CPU speed independent.     **
  656. ;**          Fixed tablebuild bug causing display not always updated.    **
  657. ;**                                    **
  658. ;** ver 2.05: Changed buffer allocation to leave room for COMMAND.COM    **
  659. ;**          so you can recall the previous command with the F3 key.    **
  660. ;**                                    **
  661. ;** ver 2.06: Fixed a hang that could occur after a long while running    **
  662. ;**          ping client or server.                    **
  663. ;**                                    **
  664. ;** ver 2.07: Ping display line was not advanced after other print.    **
  665. ;**                                    **
  666. ;** ver 2.08: Add "/" to ";" as alias for "," in batch arguments.    **
  667. ;**                                    **
  668. ;** ver 2.10: Implement a very fast hop check (trace route) function.    **
  669. ;**          Algorithm change in 1996 for european summer times.    **
  670. ;**          Don't count repeats as loss. Show them negative in error    **
  671. ;**          distribution. Increase display update rate from 5 to 9    **
  672. ;**          times per second. Allow leading digits in domain names.    **
  673. ;**                                    **
  674. ;** ver 2.11: Repeated packets that were not adjacent gave incorrect    **
  675. ;**          statistics, now they can be 511 packets apart. Increase    **
  676. ;**          max name size from 32 to 48 in hopcheck mode. Better    **
  677. ;**          nameserver request resend algorithm. Handle inconsistent    **
  678. ;**          remaining ttl values returned by some hosts. Hopcheck    **
  679. ;**          results that overfills the screen can now be scrolled.    **
  680. ;**                                    **
  681. ;** ver 2.12: Rename PDTBUILD to PDTSTNET.                **
  682. ;**                                    **
  683. ;** ver 2.13: Fixed hang that happened if echo/hopcheck not terminated    **
  684. ;**          within half an hour. End of pdtstnet line displayed also    **
  685. ;**          for hop check mode.                    **
  686. ;**                                    **
  687. ;** ver 2.14: Declarations moved up using include files. Allow loopback    **
  688. ;**          pings to itself.                        **
  689. ;**                                    **
  690. ;** ver 2.15: Found error introduced in v2.00 causing data corruption    **
  691. ;**          and instability when using gateways. Found error causing    **
  692. ;**          false duplicate IP nr alarm.                **
  693. ;**                                    **
  694. ;** ver 2.16: Can now continue to work after IP nr defending.        **
  695. ;**                                    **
  696. ;** ver 2.17: Use default "fixed" size 34/35/36 for hop check mode.    **
  697. ;**          Improve scroll key response when receiving a burst of    **
  698. ;**          packets.                            **
  699. ;**                                    **
  700. ;*************************************************************************
  701. ;**        ACKNOWLEDGMENTS                     **
  702. ;*************************************************************************
  703. ;**                                    **
  704. ;** The checksum routine used is a modified NCSA Telnet version.    **
  705. ;** The dst algorithm was modelled after PCIP SETCLOCK (thanks Drew!),    **
  706. ;** but enhanced to use parameters from a table.            **
  707. ;** The dst algorithm table was derived from a comp.sources.unix 1989    **
  708. ;** posting by ado@ncifcrf.gov of localtime.c and related routines    **
  709. ;** and tables, and a later update (very useful data, thanks!).     **
  710. ;** The master environment is found using Pat's code.            **
  711. ;** The millisecond timer is based on code from Dean Pentcheff.     **
  712. ;** The DateTimeCalc routine is my own invention.            **
  713. ;** The packet driver interface routines were copied from the Crynwr    **
  714. ;** packet driver distribution, without which this project would not    **
  715. ;** have been possible (thanks Russ!).                    **
  716. ;** The asynchronously working trace route routine is my own invention,    **
  717. ;** as is the tablebuilding code.                    **
  718. ;**                                    **
  719. ;** The small UDP/IP library was written by me, and can probably be    **
  720. ;** used in other small assembler applications. It is now fully RFC    **
  721. ;** compliant, except for a few small cases mentioned in the code. It    **
  722. ;** DOES handle IP type of service, fragment reassembly, source quench    **
  723. ;** throttling, sending port and protocol unreachables, multiple    **
  724. ;** default gateways, etc.                        **
  725. ;**                                    **
  726. ;*************************************************************************
  727. ;**        WHERE TO GET IT FROM                    **
  728. ;*************************************************************************
  729. ;**                                    **
  730. ;** Current version of PDCLKSET can be obtained by anonymous FTP from    **
  731. ;** ftp.lu.se:/pub/network/pdclkset/pdtstxxx.zip or from        **
  732. ;** msdos.ftp.sunet.se:pub/network/pdclkset/pdtstxxx.zip or from Novell **
  733. ;** server LUSTORFS/ARC:PUB\NETWORK\PDCLKSET\PDTSTxxx.ZIP        **
  734. ;** (Netware access only in Lund and around).                **
  735. ;** Major releases will also be available on the Simtel20 archive and    **
  736. ;** its mirror sites (like oak.oakland.edu, wuarchive.wustl.edu and    **
  737. ;** ftp.funet.fi) in the ...msdos/pktdrvr directory.            **
  738. ;**                                    **
  739. ;*                                     *
  740. ;* Jan Engvald, Lund University Computing Center             *
  741. ;* ____________________________________________________________________  *
  742. ;*   Address: Box 783            E-mail: Jan.Engvald@ldc.lu.se     *
  743. ;*          S-220 07 LUND    Earn/Bitnet: xjeldc@seldc52         *
  744. ;*          SWEDEN          (Span/Hepnet: Sweden::Gemini::xjeldc)     *
  745. ;*    Office: Soelvegatan 18        VAXPSI: psi%2403732202020::xjeldc     *
  746. ;* Telephone: +46 46 107458        (X.400: C=se; A=""; P=Sunet; O=lu;     *
  747. ;*   Telefax: +46 46 138225            OU=ldc; S=Engvald; G=Jan)     *
  748. ;*     Telex: 33533 LUNIVER S                         *
  749. ;*                                     *
  750. ;*************************************************************************
  751.  
  752. ; Note: If you want to assemble this code yourself, you need Turbo ASM 
  753. ; (at least MASM 5.1 does not like comments on structure calls!).
  754. ; Also, some files from the Crynwr packet driver collection are needed,
  755. ; see MAKEFILE for details.
  756.  
  757. ;************************************************************************
  758. ;*        Compile time constants                    *
  759. ;************************************************************************
  760.  
  761.         .lfcond  
  762. PRGVERSION    equ    ' v2.17'
  763. TBLBUILD     equ     0
  764. PINGCLIENT     equ     1
  765. HOPCHK        equ    TBLBUILD
  766. HOPDEFAULT    equ    40            ; hopcheck max hops (<63)
  767. ; DEBUG values above 5 degrade throughput a lot.
  768. DEBUG         equ     0
  769.  
  770. MN        equ    60            ; seconds in a minute
  771. HR        equ    60*MN            ; seconds in an hour
  772.  
  773. SUN        equ    0            ; Sunday
  774. SAT        equ    6            ; Saturday
  775. DAT        equ    0ffh            ; Specific date follows
  776.  
  777. FEB2W        equ    31+2*7                ; Feb 2nd week
  778. MAR1W        equ    31+28+1*7            ; Mar 1st week
  779. MAR2W        equ    31+28+2*7            ; Mar 2nd week
  780. MAR3W        equ    31+28+3*7            ; Mar 2rd week
  781. MARLW        equ    31+28+31            ; Mar last week
  782. APR01        equ    31+28+31+1            ; Apr 1
  783. APR03        equ    31+28+31+3            ; Apr 3
  784. APR07        equ    31+28+31+7            ; Apr 7
  785. APR1W        equ    31+28+31+1*7            ; Apr 1st week
  786. APR2W        equ    31+28+31+2*7            ; Apr 2nd week
  787. APR14        equ    31+28+31+14            ; Apr 14
  788. APR18        equ    31+28+31+18            ; Apr 18
  789. APRNL        equ    31+28+31+30-7            ; Apr next last week
  790. APR23        equ    31+28+31+23            ; Apr 23
  791. APR26        equ    31+28+31+26            ; Apr 26
  792. MAY01        equ    31+28+31+30+1            ; May 1
  793. MAY04        equ    31+28+31+30+4            ; May 4
  794. MAY2W        equ    31+28+31+30+2*7         ; May 2nd week
  795. AUG28        equ    31+28+31+30+31+30+31+28     ; Aug 28
  796. SEP01        equ    31+28+31+30+31+30+31+31+1    ; Sep 1
  797. SEP08        equ    31+28+31+30+31+30+31+31+8    ; Sep 8
  798. SEP12        equ    31+28+31+30+31+30+31+31+12    ; Sep 12
  799. SEP2W        equ    31+28+31+30+31+30+31+31+2*7    ; Sep 2nd week
  800. SEP17        equ    31+28+31+30+31+30+31+31+17    ; Sep 17
  801. SEP20        equ    31+28+31+30+31+30+31+31+20    ; Sep 20
  802. SEP3W        equ    31+28+31+30+31+30+31+31+3*7    ; Sep 3rd week
  803. SEP28        equ    31+28+31+30+31+30+31+31+28    ; Sep 28
  804. SEP30        equ    31+28+31+30+31+30+31+31+30    ; Sep 30
  805. SEPLW        equ    31+28+31+30+31+30+31+31+30    ; Sep last week
  806. OCT01        equ    31+28+31+30+31+30+31+31+30+1    ; Oct 1
  807. OCT2W        equ    31+28+31+30+31+30+31+31+30+2*7    ; Oct 2nd week
  808. OCT24        equ    31+28+31+30+31+30+31+31+30+24    ; Oct 18 - 24
  809. OCT4W        equ    31+28+31+30+31+30+31+31+30+4*7    ; Oct 4th week
  810. OCT29        equ    31+28+31+30+31+30+31+31+30+29    ; Oct 23 - 29
  811. OCTLW        equ    31+28+31+30+31+30+31+31+30+31        ; Oct last week
  812. NOV13        equ    31+28+31+30+31+30+31+31+30+31+13    ; Nov 5 - 13
  813.  
  814. AlgE        struc
  815. AlgName     db    "EUR "            ;; Name of dst algorithm
  816. AlgFromTime    dw    2*HR            ;; local standard time dst start
  817. AlgFromWeekDay    dw    SUN            ;; weekday dst start
  818. AlgFromWeek    dw    MARLW            ;; last day-of-year dst start
  819. AlgUntilTime    dw    2*HR            ;; local standard time dst end
  820. AlgUntilWeekDay dw    SUN            ;; weekday dst end
  821. AlgUntilWeek    dw    SEPLW            ;; last day-of-year dst end
  822. AlgAddAmount    dw    1*HR            ;; dst advance amount
  823. AlgE        ends
  824.  
  825. ALGENTRYLEN    equ    size AlgE
  826.  
  827. AlgData     struc
  828. AWEu AlgE <"W_EU", 1*HR,SUN,MARLW, 1*HR,SUN,SEPLW, HR>  ;; West Europe - 95
  829. AWE6 AlgE <"W_EU", 1*HR,SUN,MARLW, 1*HR,SUN,OCTLW, HR>  ;; West Europe 1996+
  830. AMEu AlgE <"M_EU", 2*HR,SUN,MARLW, 2*HR,SUN,SEPLW, HR>  ;; Central Europe + SU
  831. AME6 AlgE <"M_EU", 2*HR,SUN,MARLW, 2*HR,SUN,OCTLW, HR>  ;; Central Europe + SU
  832. AEEu AlgE <"E_EU", 3*HR,SUN,MARLW, 3*HR,SUN,SEPLW, HR>  ;; East Europe - 95
  833. AEE6 AlgE <"E_EU", 3*HR,SUN,MARLW, 3*HR,SUN,OCTLW, HR>  ;; East Europe 1996+
  834.  
  835. ; Entries above switch to a new algorithm in year 1996
  836.  
  837. AUSA AlgE <"USA ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; USA Canada Mexico
  838. ACub AlgE <"CUB ", 0*HR,SUN,MAY2W,-1*HR,SUN,OCT2W, HR>  ;; Cuba
  839. AChl AlgE <"CHIL", 0*HR,SUN,OCT2W,-1*HR,SUN,MAR2W, HR>  ;; Chile
  840. ABrz AlgE <"BRZ ", 2*HR,SAT,OCT4W, 1*HR,SAT,FEB2W, HR>  ;; Brazil
  841. AGBR AlgE <"GBR ", 1*HR,SUN,MARLW, 1*HR,SUN,OCT29, HR>  ;; United Kingdom
  842. ALby AlgE <"LIBY", 2*HR,DAT,APR01, 1*HR,DAT,SEP30, HR>  ;; Libya
  843. AEgy AlgE <"EGY ", 2*HR,DAT,MAY01, 1*HR,DAT,OCT01, HR>  ;; Egypt
  844. ATur AlgE <"TURK", 1*HR,SUN,MARLW, 0*HR,SUN,SEPLW, HR>  ;; Turkey
  845. AIra AlgE <"IRAN", 2*HR,SUN,MARLW, 1*HR,SUN,SEP3W, HR>  ;; Iran
  846. APRC AlgE <"PRC ", 2*HR,SUN,APR2W, 2*HR,SUN,SEP2W, HR>  ;; People Rep of China
  847. AROK AlgE <"ROK ", 2*HR,SUN,MAY2W, 2*HR,SUN,OCT2W, HR>  ;; Rep of Korea
  848. AAus AlgE <"AUS ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR3W, HR>  ;; South Australia
  849. ATas AlgE <"TASM", 2*HR,SUN,OCT24, 2*HR,SUN,MAR3W, HR>  ;; Tasmania
  850. ANSW AlgE <"NSW ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>  ;; New South Wales
  851. ALHI AlgE <"LHI ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, 30*MN> ;; LHI (Australia) 
  852. ANZe AlgE <"NZE ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>  ;; New Zealand
  853.  
  854. ; All entries below this line are indexed by year modulo 4
  855.  
  856. APa0 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,NOV13, HR>  ;; Pacific presidential
  857. APa1 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  858. APa2 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  859. APa3 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>  ;; Pacific non-pres
  860.  
  861. ; All entries above this line are cyclic and will last forever
  862. ; All entries below this line are non-cyclic, they only last 4 years
  863.  
  864. AIs0 AlgE <"ISR ", 0*HR,DAT,APR14,-1*HR,DAT,SEP08, HR>  ;; Israel 1996
  865. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY04,-1*HR,DAT,SEP28, HR>  ;; Israel 1997
  866. AIs2 AlgE <"ISR ", 0*HR,DAT,APR03,-1*HR,DAT,AUG28, HR>  ;; Israel 1994
  867. AIs3 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>  ;; Israel 1995
  868.  
  869. if 0    ; as years go by, replace entries above from below with same label
  870. AIs2 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>  ;; Israel 1998
  871. AIs3 AlgE <"ISR ", 0*HR,DAT,APR11,-1*HR,DAT,SEP05, HR>  ;; Israel 1999
  872. AIs0 AlgE <"ISR ", 0*HR,DAT,APR30,-1*HR,DAT,SEP24, HR>  ;; Israel 2000
  873. AIs1 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>  ;; Israel 2001
  874. AIs2 AlgE <"ISR ", 0*HR,DAT,APR07,-1*HR,DAT,SEP01, HR>  ;; Israel 2002
  875. AIs3 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>  ;; Israel 2003
  876. AIs0 AlgE <"ISR ", 0*HR,DAT,APR18,-1*HR,DAT,SEP12, HR>  ;; Israel 2004
  877. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY01,-1*HR,DAT,SEP25, HR>  ;; Israel 2005
  878. AIs2 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>  ;; Israel 2006
  879. AIs3 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>  ;; Israel 2007
  880. AIs0 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>  ;; Israel 2008
  881. AIs1 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>  ;; Israel 2009
  882. endif
  883. AlgData         ends
  884.  
  885. WARNYEAR        equ     1998                    ; acyclic data invalid year
  886.  
  887. ;************************************************************************
  888.