home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / kommunik / macos / daemon-1.hqx / Daemon-110 / Documentation < prev    next >
Text File  |  1996-04-29  |  9KB  |  178 lines

  1. Daemon v1.1.0 © 1992-96 Peter N Lewis.
  2. This program is free for any use.
  3.  
  4. Contents
  5.  
  6.     What Daemon Does
  7.     Using Daemon
  8.     The Services
  9.     Tokens
  10.     Example Plan and Whois Files
  11.     Limitations
  12.     Small Print
  13.     Warranty
  14.     Fine Print
  15.     How It Works
  16.     Version History
  17.  
  18. What Daemon Does
  19.  
  20. Daemon is a general TCP server, implementing several simple unix daemons, namely Finger, Whois, Ident, Daytime, Time and NTP.  It runs as a background only application, and answers queries to those services.
  21.  
  22. Using Daemon
  23.  
  24. Simply put an alias to Daemon into the Startup Items folder and launch it.  You will also need to write a Plan and Whois file as described under in The Services section.
  25.  
  26. The Services
  27.  
  28. Finger (79/tcp) - The finger protocol allows people on the Internet to get information about a user.  The remote finger client sends the Mac a username, and Daemon returns information about that user.  This information often includes contact info (phone numbers, FAX numbers, etc), and info about when you will be available, prefered Email address, and of course the mandatory silly quotes :-).  You can specify what is to be returned by write a TEXT-only file, named "Plan" and putting it in the Preferences Folder in the System Folder.  As well as normal text, the file can contain "tokens" which let you put non-static information (such as the Idle time).  See the section on Tokens for more information.
  29.  
  30. Whois (43/tcp) - The whois protocol is pretty much identical to the Finger protocol.  Its generally less personal, and more geared towards providing information (name, department, etc).  You specify the returned information by writing a TEXT-only file named "Whois" and putting it in the Preferences Folder in the System Folder.  The file can contain tokens in the same way as the Plan file.
  31.  
  32. Ident (113/tcp) - The Ident protocol is intended to identify the user of a particular TCP connection on a multi-user machine.  Since the Mac is a single-user machine, all Daemon does is answer back with the Owner name of the Macintosh.
  33.  
  34. Daytime (13/tcp) - The daytime protocol gives the local time in human readable form.  This is useful if someone wants to know what your time is to get an idea of when you are likely to be around.
  35.  
  36. Time (37/tcp) - The time protcol gives the GMT time in binary form (not human readable, but machines love it).  It should be the same for all machines, but of course its not always exact.
  37.  
  38. NTP (123/udp) - The NTP protocol give information for setting time based on another machine’s time.  This is a server, so other machines can set their time based on this Mac using programs like NetTime.
  39.  
  40. Tokens
  41.  
  42. When Daemon interprets the Plan and Whois file, it looks for tokens and converts them into the information they specify.  Tokens stat with a % sign.  You can get a normal % sign by doubling it (%%), and you can hide a line break by ending the line with a % sign.
  43.  
  44. Here is a list of the tokens that Daemon understands, with examples of the information that replace the token.
  45.  
  46. %LOG
  47. %STARTUP-LONG     Thursday, 11 February 1993
  48. %STARTUP-SHORT    11/2/93
  49. %STARTUP-ABBREV   Thu, 11 Feb 1993
  50. %STARTUP-TIME     4:59
  51. %STARTUP-TIMESEC  4:59:56
  52. %CURRENT-LONG     Thursday, 11 February 1993
  53. %CURRENT-SHORT    11/2/93
  54. %CURRENT-ABBREV   Thu, 11 Feb 1993
  55. %CURRENT-TIME     16:50
  56. %CURRENT-TIMESEC  16:50:30
  57. %IDLE-TIME        0:03
  58. %IDLE-TIMESEC     0:03:15
  59. %TIMEON-TIME      11:50
  60. %TIMEON-TIMESEC   11:50:34
  61. %IDLEINWORDS     3 minutes 15 seconds
  62. %INPUT            Whoever
  63. %MACHINE          Rocky
  64. %OWNER            Peter
  65. %ICBM             N=-31.55' E=115.49'
  66. %GMT              8:00
  67. %MACENVY-APPLETALK       56
  68. %MACENVY-FPU             unknown
  69. %MACENVY-KEYBOARD        Extended ADB Keyboard
  70. %MACENVY-LOWMEMORY       8192
  71. %MACENVY-RAMSIZE         16M (010B7890)
  72. %MACENVY-LOGICALRAMSIZE  16M (010B7890)
  73. %MACENVY-MACHINE         Macintosh IIsi
  74. %MACENVY-ICON         <ascii-art display of the icon>
  75. %MACENVY-MMU             68030 MMU
  76. %MACENVY-PAGESIZE        32768
  77. %MACENVY-CPU             68030
  78. %MACENVY-QUICKDRAW       2.3.0
  79. %MACENVY-REALRAMSIZE     17M (01100000)
  80. %MACENVY-PHYSICALRAMSIZE 17M (01100000)
  81. %MACENVY-ROMSIZE         512K (00080000)
  82. %MACENVY-ROM             067C
  83. %MACENVY-SLOTS           0
  84. %MACENVY-SOUND           Stereo sound with sound input
  85. %MACENVY-SYSTEM          7.0.1
  86. %MACENVY-TEXTEDIT        5
  87. %MACENVY-GESTALT         1
  88.  
  89. %IDLEINWORDS was written initially by Stuart Cheshire.
  90. %MACENVY was written initially by Quinn.
  91.  
  92. %FILE-:File
  93.       Returns the file (basically, it includes the File at this point).
  94.  
  95. %FILES-:Files
  96.       Returns the file in the specified folder named by the fingerer as the username.  The username may contain colons (:) to specify folders, but not two colons in a row, so they cannot go back up the folder tree to get at your whole file system (I hope not, anyway).  If the filename is blank, then filename @ will be used instead.  If the specified filename doesn't exist, the filename ? will be used instead. 
  97.  
  98. %LOOKUP-:Lookup
  99.       This will scan the specified file and return any lines containg the words in the fingered name.  You could use this to provide a primitive information server (such as an Email or price data base).
  100.  
  101. %FORTUNE-:Fortune
  102.       Returns a randomly selected fortune from the specified folder.  The format of the fortune file is a sequence of fortunes seperated by a line containing only a hash (#) character.  The file must end with a hash character followed by a return.  For example
  103.  
  104. Fortune line 1
  105. #
  106. Fortune line 2
  107. a two line fortune
  108. #
  109.  
  110.  
  111. Remember to format your fortunes, files, and the Plan file for an 80 column screen.  Also, the files specified in the %FORTUNE, %FILES and %LOOKUP tokens can themselves contain tokens, so you can create quite complex plans.
  112.  
  113. BTW (By the way), in the last four tokens I have used files in the Preferences folder in the System Folder as examples.  You don't have to restrict yourself to this folder, you could for example use the token %FORTUNE-HardDisk:FortuneFile to specify that the fortune file was named FortuneFile and could be found in the root folder of the hard disk named HardDisk, or to make your entire hard disk named FreeAccess visible on the internet you could put %FILES-FreeAccess.  WARNING: %FILES is a serious security risk, so only use it if you are sure you want to make all files in the specified folder and all its sub-folders visible to the entire networld!
  114.  
  115. Example Plan and Whois Files
  116.  
  117. Since there is only one user on a Mac, you can have a very simple Plan or Whois file like this:
  118.  
  119. *****
  120. %OWNER has been on %MACENVY-MACHINE since %STARTUP-TIME, %STARTUP-ABBREV.  
  121. Idle %IDLE-TIMESEC.  Current time is %CURRENT-TIME, %CURRENT-ABBREV
  122.  
  123. At work:     Computer Systems Officer, NCRPDA, Curtin University,
  124.              GPO Box U1987, Perth WA 6001, AUSTRALIA.
  125. Phone:       +61 9 345 6789
  126. After Hours: Mac Programmer/Hacker (in the traditional sense of the word).
  127. *****
  128.  
  129. But you may have more than one user on the Mac, or you may want to pretend you do.  So make a directory in the Preferences Folder "Files", and then make the Plan file:
  130.  
  131. *****
  132. %FILES-:Files
  133. *****
  134.  
  135. Now in the Files folder, put the follwing files:
  136. Peter - containing the Finger/Whois information for Peter
  137. Fred - ditto for Fred
  138. @ - the information for when they finger "everyone" (ie, finger @your.mac)
  139. ? - the information for when they finger someone invalid (ie, finger womble@your.mac)
  140.  
  141. Limitations
  142.  
  143. Daemon requires MacTCP 1.1 and probably requires the 128k ROM (or later).
  144.  
  145. Small Print
  146.  
  147. This program is Free.  You can use it anywhere you want, you can do anything you like with it.
  148.  
  149. Warranty
  150.  
  151. While I have made every attempt at making this program work correctly, I cannot guarentee it will work.  If it doesn’t work, I’ll refund your money :-)
  152.  
  153. Fine Print
  154.  
  155. Peter Lewis hereby disclaims all warranties relating to this software, whether express or implied, including without limitation any implied warranties of merchantability or fitness for a particular purpose.  Peter Lewis will not be liable for any special, incidental, consequential, indirect or similar damages due to loss of data or any other reason, even if Peter Lewis or an agent of his has been advised of the possibility of such damages.  In no event shall Peter Lewis be liable for any damages, regardless of the form of the claim.  The person using the software bears all risk as to the quality and performance of the software.
  156.  
  157. How It Works
  158.  
  159. Daemon starts up and looks at all the TEXT resources contained within its resource fork.  For each resource, it spawns two identical tasks (using the Task Manager package written by Michael Hecht), that listen to port ID-10000 (where ID is the ID of the TEXT resource).  When a connection is made on that port, it reads a line (unless the resource name starts with a + or -), and then sends the resource back after converting the tokens (only one if the name starts with a +).  If the name doesn't start with a +, it also convers <cr> to <crlf>, and translates Mac 8-bit characters to ISO standard characters.
  160.  
  161. Version History
  162.  
  163. Still to do -
  164.  
  165. UDP support for Time/Daytime protocols?
  166. $HOST-IP, $HOST-NAME tokens?
  167. all the fingerd stuff
  168. >Change %LOG to take parameters for what to log
  169. >(ip, fingered name, time, symbolic IP, etc).
  170.  
  171. 1.1.0
  172. ~support NTP
  173. ~Support for nested tokens (eg %"FILE-HD:%"INPUT":Plan")
  174. ~support for extended finger (gnufinger) (strip "/W ")
  175. ~quits properly under OT
  176.  
  177. 1.0.0
  178.