home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / OSKBox.lzh / read.me
Text File  |  1993-04-25  |  14KB  |  263 lines

  1. 4/25/93
  2.  
  3. Here is source code for a mailbox system I call the OSKbox that I've
  4. been running for over 4 years on my Hazelwood Uniquad 20x (68020
  5. system).  Note that I say "mailbox system" instead of "program," because
  6. this is a system consisting of several cooperative programs.  Here is an
  7. abbreviated cast of characters:
  8.  
  9.   "host" runs in the background detached from any terminals and
  10.   communicates with a TNC via WA8DED host mode.  One task running
  11.   "host" is required for each packet port.  "host" communicates with
  12.   other programs via pipes.
  13.  
  14.   "mailbox" is the primary user interface to the mail system.  It can be
  15.   run from any terminal (in fact, "mailbox" can't tell the difference
  16.   between a terminal and a user on a TNC), but is usually forked by "host"
  17.   in response to a user connection on a packet port.
  18.  
  19.   "msgproc" is executed in the background every time a new message arrives
  20.   at the BBS.  It checks for forwarding loops, missing address parts, and
  21.   can be told to modify selected message fields or place messages on hold.
  22.  
  23.   "cron" is a program that also runs in the background detached from any
  24.   terminals and executes a schedule of things to do, specifically
  25.   maintenance programs that the mailbox needs done from time to time.  A
  26.   couple of those things are...
  27.  
  28.   "forward" does what it says: initiates packet connections to other BBSs
  29.   and passes messages to them.  It can also request a reverse forward from
  30.   other BBSs.
  31.  
  32.   "beacon" makes up a string of text describing pending mail for local
  33.   users for broadcast as a UI frame via "host".
  34.  
  35. There are more programs, but you get the idea.  Functionality is added
  36. by writing new programs that interface with the rest of the system,
  37. rather than incrementally growing a single monolithic program.  Note
  38. that no terminals need be dedicated to the packet BBS, you are free to
  39. continue to use your OSK computer for other purposes while the BBS is
  40. running.  (Provided, of course, that you have sufficient memory.)  You
  41. also retain the ability to make outgoing connections via the hostube
  42. program without shutting down the BBS.  You can also have dial-in ports
  43. to give hams who aren't on packet access to the mailbox.  (Very handy
  44. for remote sysop operations.)
  45.  
  46. Note that a mailbox is only one possible packet application.  Using
  47. the host program, just about any kind of application program can be
  48. hooked up to packet.  If you get any neat ideas, pass them on.
  49.  
  50.  
  51. 73, eric
  52.  
  53. Eric Williams
  54. 5860 Clinton Ave.
  55. Richmond, CA 94805
  56. Home: 510-237-9909    Work: 510-524-3950    Fax: 510-524-9954
  57. Packet: WD6CMU @ WD6CMU.#NOCAL.CA.USA.NA  Internet: wd6cmu@netcom.com
  58.  
  59.                     ***** GETTING STARTED *****
  60.  
  61. Documentation is admittedly sparse.  Look in MAILBOX/CC/DOCS and
  62. MAILBOX/HELP.  If you get stuck, drop me a note and I'll write up
  63. something that fills in the gaps. 
  64.  
  65. First thing that needs to be done is to convert your TNC(s) to WA8DED
  66. host mode firmware.  This is available for the TNC-1 (put those old,
  67. dusty TNCs to work!), TNC-2 (and clones) and PK-88.  Check out the
  68. MAILBOX/FILES/WA8DED directory, code and documentation are stored there. 
  69. (I'm missing the PK-88 version, let me know if you need it and I'll
  70. track it down.)  Burn a ROM with your version and plug it in.  WA8DED has
  71. a terminal mode that is very usable (some prefer it to the TAPR
  72. interface), and, more importantly, a computer-literate host mode that
  73. OSKbox requires.  (I'd also like to support AEA host mode, but don't have
  74. any hardware.  If you'd like to take on the project, let me know.)
  75.  
  76. The next thing is to set up your disk directories.  I've set up this
  77. floppy in approximately the same configuration as my hard disk.  The
  78. MAILBOX/startup file contains the boot-up procedure I use for my
  79. particular configuration, and I've also included a couple of sample
  80. forward and distribution files.  If you have extra memory, you may want
  81. to store your forwarding tables and bulletin distribution lists on RAM
  82. disk to speed up execution.  If so, you need to modify the DISDIR and
  83. FWDIR #define's in mailbox.h, then add to your startup procedure to copy
  84. the files to RAM from disk. 
  85.  
  86. Next, you need to customize the code and compile it.  Customization
  87. consists mainly of modifying mailbox.h.  The relevant #define's are:
  88.  
  89.   HOME     Place where the mail directory file, user directory file,
  90.            info file, HELP directory, etc. live.
  91.  
  92.   DISDIR   Place where distribution list files (*.dis) live.
  93.  
  94.   FWDIR    Place where forward files (*.fwd) live.
  95.  
  96.   MYCALL   Your callsign.
  97.  
  98.   MYHADDR  Your hierarchical address in the BBS network.
  99.  
  100.   MYZIP    Your zipcode.
  101.  
  102.   MYQTH    Optional field that shows up in your forwarding header.
  103.            (Keep it short, lest ye be flamed by your brother sysop!)
  104.  
  105.   BANNER   Identifying line that shows up when people connect.
  106.  
  107.   UTC      Number of hours from GMT to local time.  (Yes, this means you
  108.            re-compile twice a year for daylight saving's time.  It's a crock,
  109.            but I haven't come up with a better system yet.)
  110.  
  111. Then take a look at the makefile to make sure it is compatible with your
  112. machine, then use it to compile the programs in MAILBOX/CC.  (I've also
  113. thrown in some orbit calculation programs in MAILBOX/SAT.  The program
  114. sun.c will have to be customized with your latitude, longitude,
  115. altitude, and GMT time difference.)
  116.  
  117. Next task is to build the mail directory file.  This file is held in
  118. memory during mailbox execution and is about 178K, so I would recommend a
  119. minimum of 1MB to run the system.  (Alternatively, you can reduce memory
  120. requirements by reducing the value of MAXMAIL.  Re-compile *everything* if
  121. you change this!)  Go to your HOME directory (defined above) and run
  122. makemail, redirecting output to mail_dir ("makemail >mail_dir").  The
  123. resulting file will be loaded into memory when mbinit is run in your
  124. startup procedure.
  125.  
  126. Next, get your forward and distribution files set up.  Look at the ones
  127. I provided for examples.  Throw together an info file (brag about how
  128. great your system is) and maybe a motd (Message Of The Day) file.  Then
  129. change MISC/crontab to schedule forwarding and other things the way you
  130. want.  Customize your startup file, and let 'er rip!  You can probably
  131. leave the hold.lst and bidclean.lst files for when you are up and
  132. running and have a better idea of what local conditions are like. 
  133.  
  134.                      *****  RANDOM NOTES *****
  135.  
  136. To help shut the BBS down, I've written a program called quit, which
  137. will send a signal #2 to the specified process(es).  This signal will
  138. cause mailbox tasks to force their users to log off, shut down host
  139. tasks in an orderly manner, and make cron stop.  (It should also make
  140. forward coast to a stop, but it doesn't seem to always work.) If you
  141. have time for a graceful shut-down, quit cron and then create a text
  142. file named "down" in the FWDIR directory.  This will cause anyone
  143. connecting (acutally, any non-sysop) to receive the contents of the file
  144. (which can explain the reason for going down, when you'll be back up,
  145. etc.), followed by an immediate disconnect.  When all the mailbox,
  146. forward, etc.  tasks have come to a halt, quit the host tasks and turn
  147. the system off. 
  148.  
  149. When you run mbinit, the mail directory file is loaded into memory and
  150. the directory locking events are created.  The mailbox system will not
  151. run without these things being done, but mbinit will not run correctly
  152. if either one already exist.  Therefore, it might be possible to end up
  153. in a situation where you have to clean out the old mailbox stuff in
  154. order to re-initialize the system.  Aside from cycling power, this can
  155. be done with a few utilities.  The standard unlink program can be
  156. repeatedly called on mail_dir until the link count goes to zero and the
  157. module goes away.  There are no standard utilities for dealing with
  158. system events, so I wrote a few: evstat, evsig, evulink and evdel. 
  159. evstat will tell you what the events currently look like.  evdel will
  160. delete events, but only if their link count is already zero.  evulink
  161. will decrement the link count so you can reach that state.  When
  162. everything is cleaned out, mbinit can be run to re-initialize the memory
  163. structures. 
  164.  
  165. evsig can be used to signal an event, possibly unlocking the mail
  166. directory module from a dead program.  Use this with care!  If you
  167. generate a superfluous signal, there is no way to fix it except to reset
  168. everything and start over.  The existing programs should never need this
  169. unless there is a physical glitch in your system. 
  170.  
  171. Even though OSKbox uses 32 bits to represent message numbers, other
  172. systems in the network are not capable of handling numbers over 65535. 
  173. When you approach this number, re-numbering becomes necessary.  Go to
  174. your HOME directory, shut down cron and all the ports, make a back-up of
  175. your mail_dir file, and run renumber.  Redirect the output from renumber
  176. to a file (eg: "renumber >mail_dir.xref), this is a list of old message
  177. numbers versus new ones, so you can match them up in the log file if
  178. need be.  Run the mailbox locally and make sure everything looks OK,
  179. then bring the ports and cron back up.
  180.  
  181. The log file gets appended to every time something significant happens. 
  182. One problem with the OS-9 file system is that files that get
  183. incrementally expanded eventually get so fragmented that their block
  184. table fills up and you can't add any more to it.  To prevent this from
  185. happening, you'll see a line in the crontab file that periodically
  186. copies the log file to a temporary file, deletes the original, and
  187. renames the temp file.  This should clean up the worst of the
  188. fragmentation and keep the log file alive.  The same thing happens to
  189. the user file when cleanup runs. 
  190.  
  191.  
  192.                 ***** THE FINE ART OF SYSOPING *****
  193.  
  194. Since OSK users tend to be on the fringe of "normal" computer hobyists,
  195. I thought it might be appropriate to suggest some aspects of operating a
  196. packet BBS that they might not be aware of.
  197.  
  198. The most important thing you should keep in mind about running a packet
  199. BBS is that, more than any other aspect of amateur radio, it is a
  200. cooperative effort.  A packet BBS that operates in isolation is a
  201. contradiction in terms, and the only way you are going to do anything
  202. useful with OSKbox is with the cooperation of your fellow sysops.  If
  203. there is a local organization of sysops, join it.  Cultivate your
  204. relationship with your fellow sysops and never, NEVER let yourself get
  205. into emotional feuds with them.  After all, it's only a hobby, and life
  206. has enough things in it to get upset over that really count. 
  207.  
  208. Always keep your forwarding header short.  Make yourself available to
  209. your users and other sysops.  Try to read your mail at least once a day
  210. and *answer* it.  Give other sysops your phone numbers.  (Nothing is
  211. more frustrating than to try and contact another sysop about a mutual
  212. problem, only to be responded to by un-answered mail or un-returned
  213. phone calls.)  Keep your forward files up to date and deal swiftly
  214. with forwarding loops, stuck mail, incorrect addresses, etc.  Keep your
  215. radios, TNCs and computer operating reliably.  Lots of people think they
  216. want to be a sysop until they find out how much real work it can be. 
  217.  
  218. The second most important thing to remember is that you exist to serve
  219. your users.  The messages you pass mean nothing if there is nobody who
  220. wants to use your box to read them.  Operate your box appropriately,
  221. making rules of operation for your users that enhance the usability of
  222. the box rather than reducing it. 
  223.  
  224. Users can also be a pain -- they ask stupid questions, send stupid
  225. christmas card pictures, give incorrect commands, type messages with no
  226. carriage returns, give wrong addresses and then complain about delivery
  227. times, and expect the system to be smart enough to compensate for the
  228. fact that they are too lazy to read the help messages.  Most of the
  229. time, the problems are educational, and all that is needed is a friendly
  230. suggestion and some detailed instructions.  Your local sysop
  231. organization probably has some kind of educational program that can use
  232. your help.  A maxim I find useful is Hanlon's razor:
  233.  
  234. Never attribute to malice that which is adequately explained by stupidity.
  235.  
  236. 99% of the time, education is all that is needed, but there *are* some
  237. people who either don't give a damn or are actively seeking to disrupt
  238. things and you might just run into one.  When that happens and you are
  239. in danger of experiencing significant system problems (don't sweat the
  240. small stuff), CALMLY lay down the law, tell him what you expect of him
  241. and what he can expect of you.  If he doesn't comply, shut him out with
  242. the PNG (Personna Non Gratta) flag in the user file, forget about him,
  243. and go back to work.  If he or anyone else disputes your actions, flood
  244. them with the copious evidence of the PNG's crimes you've collected up
  245. to this point, and stand by your decision.  In the final analysis, it's
  246. *your* station, and you have the right to eject whoever you want, but
  247. temper this with the knowledge that you operate within a network and
  248. that you want to show your actions are reasonable. 
  249.  
  250.  
  251. ***********************************************************************
  252.  
  253. Things added since 7/11/92:
  254.  
  255. o Moved message file deletion out of loop in cleanup to reduce window
  256.   of vulnerability during directory shuffel.
  257.  
  258. o Added msgproc for message processing.  Generalized message field
  259.   modification description (hold.lst file).
  260.  
  261. o Fixed bug in forward that caused cycle abort if timeout occured while
  262.   waiting for first prompt from target BBS.
  263.