home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / networking / misc / socket_lib10a.lha / socket.doc < prev    next >
Encoding:
Text File  |  1994-02-23  |  19.0 KB  |  495 lines

  1.  
  2.                S O C K E T . L I B R A R Y - E M U L A T I O N
  3.                ===============================================
  4.  
  5. [  No, it's not one of these fancy AmigaGuide® documents.  Consider me one of
  6. these  old  fashioned  Unix  hackers,  which prefer writing code over writing
  7. documentation ]
  8.  
  9.  
  10. COPYRIGHT
  11.  
  12. This program is © 1993, 1994 by Henning Schmiedehausen.  All rights reserved.
  13.  
  14. This  program is Chocolade-Ware.  If you find it useful, feel free to send me
  15. a bar of chocolade or two (I like 'Milka Vollmilch').
  16.  
  17. I  will  not  distribute  the  source  of  this software at the current time,
  18. because  it  is  programmed  after  a  documentation  file,  which  is (C) by
  19. Commodore 1990, 1991, 1992 and still under non-disclosure.
  20.  
  21. I  can  tell  you  something  about the compatibility, but if you need *real*
  22. documentation,  it  is  necessary,  that  you  become  an  official Commodore
  23. Developer  and  sign  a  non-disclosure  agreement  with Commodore to receive
  24. autodocs on the AS225R2 package.
  25.  
  26. The  whole  program  and  all  files  in  this  archive  are (C) 1994 Henning
  27. Schmiedehausen.  All rights reserved.  This is freely distributable software,
  28. not Public Domain.
  29.  
  30.  
  31. AUTHOR
  32.  
  33. Henning Schmiedehausen
  34. Marquardsenstraße 3
  35. D-91054 Erlangen
  36. Germany
  37.  
  38. EMail:
  39. barnard@forge.franken.de
  40.  
  41. The program was written with CygnusED 3.5 and compiled with SAS C V 6.3 using
  42. the  3.1  AUK,  the  AmiTCP  includes  and the AS225R2 developer kit.  
  43. (I'm an official Commodore developer, so this is legal)
  44.  
  45. It  was  tested and debugged on two A3000 with AmigaOS 3.1 using a Picasso II
  46. Gfx Board, some Ariadne Ethernet Boards and AmiTCP 2.3.
  47.  
  48.  
  49. DISTRIBUTION
  50.  
  51. This  program  may be copied and freely distributed via electronic media such
  52. as  Mailboxes,  Internet  and  Usenet,  as long as the integrity of the whole
  53. archive is kept and this README is included without any changes.
  54.  
  55. You  are  allowed  to re-pack this archive with other compressing methods, as
  56. long as all files are kept unmodified in such a new archive.
  57.  
  58. You  are  not  allowed to add any files to the archive, delete any files from
  59. the archive or modify any of the files in the archive.
  60.  
  61. Especially  BBS  sysops  are  not  allowed  to  add any advertisments to this
  62. archive or to any of the files of the archive.
  63.  
  64. If you find any archive with such BBS ads, please send them to me.
  65.  
  66. This  software  may  only  be included in freely distributable Disk and CDROM
  67. libraries  with  the  written  permission  of  the author.  If you want to be
  68. added, please send me a stamped, self addressed envelope.
  69.  
  70. This permission is herewith given for
  71.  
  72. The Fred Fish Library (including the CD ROM releases)
  73. The Fred Fish Library on CD ROM
  74. SAAR AG PD Series
  75. The AmiNet CD ROM's from Walnut Creek
  76.  
  77.  
  78. DISCLAIMER
  79.  
  80. The following disclaimer is for the program called 'socket.library', from now
  81. on called 'program'.
  82.  
  83. I  hereby  reject  any  liability  or  responsibility  for these or any other
  84. consequences from the use of 'program' whatsoever.  This includes, but is not
  85. limited  to,  damage to your equipment, to your data, personal injuries, loss
  86. of money, loss of hair, loss of concience or any other kinds of side effects.
  87.  
  88. Although  'program'  has been tested thoroughly on some different machines, I
  89. cannot rule out the possibility that 'program'
  90.  
  91.    * is somehow incompatible to your equipment
  92.  
  93.    * has bugs that show up on your equipment
  94.  
  95.    * does not do what it is supposed to do on your equipment
  96.  
  97. It  is  your  responsiblity  to  take  any  precautions  necessary to protect
  98. yourself  from these or any other effects.  I explicitly reject any liability
  99. or responsibility from the consequences of you using 'program'.
  100.  
  101. And  for  our  german  friends,  who feel the urge to express certain politic
  102. statements with the distribution of their software:
  103.  
  104. Hiermit  sei  es ausdrücklich gestattet diese Software zu all jenen Dingen zu
  105. gebrauchen,  die kleinkarierte Dogmatiker ihren potentiellen Kunden verbieten
  106. wollen,   also   beispielsweise   die   Übertragung   der  Wasserstoffbomben-
  107. konstruktionsunterlagen an Killer-Mutanten vom Mars oder der Verkauf an Arme,
  108. die   der   kostenfreien  Beschaffungsmöglichkeiten  von  frei  vertreibbarer
  109. Software unkundig sind.  Dennoch wird um Zusendung von Schokolade gebeten.
  110.  
  111.  
  112. THANKS
  113.  
  114. * The AmiTCP group, consisting of
  115.         Tomi Ollila    <Tomi.Ollila@cs.hut.fi>
  116.         Pekka Pessi    <Pekka.Pessi@hut.fi>
  117.         Markus Peuhkuri    <Markus.Peuhkuri@hut.fi>
  118.         Jarno Rajahalme    <Jarno.Rajahalme@hut.fi>
  119.  
  120.   for bringing such a superb program like AmiTCP to the Amiga community.
  121.  
  122.   ... and for rolling the ball to me.
  123.  
  124. *  All the folks at the Commodore developer support for providing us with at
  125.    least a little information
  126.  
  127. *  Ken Dyke and Randell Jesup for answering lots of silly questions
  128.  
  129. *  David Swasbrook, Author of 'SwazInfo', where I stole the upper part of the
  130.    Disclaimer
  131.  
  132. *  Lutz Vieweg; I stole the german 'Disclaimer' from his TWC archive :-)
  133.    (You'll get a chocolade next time you come to an Amiga meeting.  :-)
  134.  
  135. *  My Beta-Testers:
  136.       The AmiTCP group  -    amitcp-group@hut.fi 
  137.       Markus Illenseer  -    markus@techfak.uni-bielefeld.de
  138.       Hakan Tandogan    -    hakan@kahalo.franken.de
  139.       Rudolf Neuhaus    -    rudy@dorn.ruhr.de
  140.       Thomas Kroener    -    kroener@mercury.saar.de 
  141.       Carsten Heyl      -    ch@irb.informatik.uni-dortmund.de
  142.       Matthias Scheler  -    tron@lyssa.pb.owl.de
  143.       Timo Rossi        -    trossi@tukki.jyu.fi
  144.       Cor Bosman        -    cor@hacktic.nl
  145.       Chris Mattingly   -    ozzy@catt.ncsu.edu
  146.       Michael B. Smith  -    mbs@adastra.cvl.va.us
  147.       Michael C. Taylor -    MCTAYLOR@mta.ca
  148.       Ty Sarna          -    tsarna@endicor.com
  149.       Dale Luck         -    dale@ntg.com
  150.       Mike Meyer        -    mwm@contessa.phone.net 
  151.  
  152. *  The nice people who live in the appartment on the floor above and tolerate
  153.    programming sessions till 5am without knocking on my door
  154.  
  155. *  :-) Guess, who. :-)
  156.  
  157. *  All the folks from #amigager, who much too often successfully distracted me
  158.    from my real work.
  159.  
  160.  
  161. NEEDED EQUIPMENT
  162.  
  163. - Amiga computer, running AmigaOS 2.04 or beyond.
  164.   2.1 or better is recommended (see get_tz)
  165.  
  166. - AmiTCP installed; V 2.3 or beyond is recommended
  167.  
  168. - Some basic grip to TCP/IP software
  169.  
  170.  
  171. WHAT IS IT FOR
  172.  
  173. Currently,  networking  on the Amiga is in a terrible situation:
  174.  
  175. There is an official TCP/IP package from Commodore, called AS225R2, but it is
  176. not  released yet and only available to official Commodore Devlopers.  Due to
  177. the situation of Commodore, I do not expect them to release it any time soon.
  178. This  package  has  the  advantage of containing well ported clients and some
  179. servers, including an NFS Server for the Amiga.  Unfortunately, almost nobody
  180. has it.
  181.  
  182. Then there is AmiTCP.  Brand new, a little rugged, but a great effort, Freely
  183. distributable and comes with full source.  Every programmers dream.
  184.  
  185. You can guess, what happened:  Both protocol stacks come with different APIs.
  186. Programs, which run under AmiTCP will not work under AS225 and vice versa.
  187.  
  188. Most  of the people who develop TCP/IP software for the Amiga, write (in this
  189. desparate situation) their software for both both protocol stacks and put for
  190. every program two archives on the ftp sites.
  191.  
  192. I  always  thought,  that  this  is  the  wrong  approach  to the problem.  I
  193. investigated  both possibilities to unify the APIs of AmiTCP and AS225, but I
  194. always thought that the AmiTCP API is in many way superior to AS225 API.
  195.  
  196. Due to some problems (I will tell you later), only one approach is possible:
  197.  
  198. Putting  an AS225R2 compatible socket.library on top of AmiTCP.
  199.  
  200. This  library enables, most of the AS225 client programs to run under AmiTCP,
  201. and make the transition from AS225 to AmiTCP as smooth as possible.
  202.  
  203. I tried the following client programs for AS225:
  204.  
  205. Original-Commodore:
  206.  
  207. finger         - works
  208. ftp            - works with KLUDGE switch (see below)
  209. nfsmgr         - works
  210. showmount      - works
  211. ping           - works
  212. rsh            - works
  213. rlogin         - works
  214.  
  215. nfsd           - works
  216.  
  217. rcp            - this program is linked with the socket-link library. It will
  218.                  never run. No chance to emulate.
  219.  
  220. Shell-Telnet   from Matthias Scheler: works
  221. AmigaIrc Alpha from Petra Zeidler:    works
  222.  
  223.  
  224. INSTALLATION
  225.  
  226. Make a directory called 'AmiTCP:LIBS'
  227. Copy the socket.library file to this directory.
  228.  
  229.  
  230. VERSION
  231.  
  232. Don't  be  confused  by the version of the socket.library.  Many of the older
  233. AS225 programs rely on a socket.library V 4.x.  So the library adds itself as
  234. 'socket.library  V  4.4' to the system.  You can find out the real version of
  235. the socket.library mit 'version file libs:socket.library'.
  236.  
  237.  
  238. USAGE
  239.  
  240. AmiTCP *must* be started, before any program can open socket.library.
  241.  
  242. Most  of  the AS225 programs open 'Inet:libs/socket.library'.  To work around
  243. this,  you must load the library into memory before using it (or the programs
  244. will  say 'cannot open socket.library').  There is a 'loadlib' tool provided,
  245. which can do this for you.
  246. You  use it as 'loadlib AmiTCP:libs/socket.library' Best thing will be to put
  247. it into your AmiTCP:bin/startnet file.
  248.  
  249. You  can  also  make an assign 'ASSIGN INET:  AmiTCP:'.  This will solve your
  250. problem without any library-loading.  You have one more assign, though.
  251.  
  252.  
  253. CONFIG FILES
  254.  
  255. The library needs two things:
  256.  
  257. -  The  hostname  of your Amiga must be set in ENV:HOSTNAME *WITHOUT* domain.
  258.    e.g. setenv HOSTNAME forge (this is my hostname)
  259.  
  260. -  You  need  a  environment  variable  called  'ENV:SOCKETCONFIG'  with  the
  261.    following options:
  262.  
  263.    UID/N/A    - User ID of the user at the console
  264.  
  265.    GID/N/A    - Group ID of the user at the console
  266.  
  267.    USER/A     - Name of the user at the console
  268.  
  269.    DOMAIN/A   - Domain of your Amiga *without* leading dot
  270.  
  271.    UMASK/A/N  - Umask for NFS writes
  272.  
  273.    KLUDGE/S   - see below
  274.  
  275.    An example is:
  276.  
  277.    setenv SOCKETCONFIG "UID=200 GID=200 USER=barnard DOMAIN=franken.de UMASK=002"
  278.  
  279.  
  280. Well, then you should be ready to go.
  281.  
  282.  
  283. COMPATIBILITY (that's what you've waited for)
  284.  
  285. Well,  at  first I thought of this whole project as impossible.  That's why I
  286. put  it back again and again (I first had the thought right after the release
  287. of AmiTCP 1.0)
  288.  
  289. But   then   again   I   looked   at   it   and   some   UseNet  Articles  in
  290. comp.sys.amiga.datacomm  seemed to imply that it *can* be done.  AS225 is, as
  291. far  as  I  know,  derived from the BSD 4.3 Networking code, while the AmiTCP
  292. comes  from the Mach BSD port of the Berkley Net/2 release.  So, they are not
  293. too different from each other.  After looking at the fuction calls, it seemed
  294. to possible.
  295.  
  296.  
  297. COMPATIBILITY ISSUES
  298.  
  299. - library calls
  300.  
  301.   - The following calls have been ported and should work without any drawbacks:
  302.  
  303.     setup_sockets, cleanup_sockets, socket, s_close, s_getsignal,
  304.     gethostbyname, gethostbyaddr, inet_addr, inet_makeaddr, inet_lnaof,
  305.     inet_netof, inet_network, inet_ntoa, listen, recv, send, shutdown,
  306.     setsockopt, getsockopt, getnetbyaddr, getnetbyname, getprotobyname,
  307.     getprotobynumber, getservbyname, getservbyport, getpwuid, getpwnam,
  308.     getpeername, getsockname, gethostname, s_syslog, rcmd
  309.  
  310.   - strerror
  311.       AmiTCP  does  not  contain a system call for returning an error string.
  312.       (Shame  on  you  folks.   This increases every AmiTCP user program by 2
  313.       KBytes  for  useless  strings)  I  took  the  strings  from  the  AS225
  314.       sys/errno.h file.
  315.  
  316.   - getuid, getgid, getlogin, getdomainname, getumask, umask
  317.       AmiTCP has (to my knowledge) no concept of the user at the console. It
  318.       seems to be always the root user. These calls return the contents of
  319.       the ENV:SOCKETCONFIG file:
  320.  
  321.       getuid:        UID
  322.       getgid:        GID
  323.       getlogin:      USER
  324.       getdomainname: DOMAIN
  325.       getumask:      UMASK
  326.  
  327.   - getgroups
  328.       Gets only the primary group of the user.
  329.  
  330.   - get_tz
  331.       AmiTCP has some nice code featuring locale.library to get the offset.
  332.       I use it also for get_tz. AS225 just reads it from its config file.
  333.  
  334.   - select, selectwait
  335.       NUMFD is bigger for AS225 than for AmiTCP.  AS225 uses fd_sets with 128
  336.       Bits,  for FD masks while AmiTCP uses fd_sets, which have only 64 Bits.
  337.       This seems not much of a problem for me, because most programs won't us
  338.       that  much sockets, but you have been noticed.  If you think, that this
  339.       is a problem, recompile AmiTCP with 128 Bits for FD_SETSIZE.
  340.  
  341.       NOTE:   I  was  pretty impressed that AS225 identically to AmiTCP has a
  342.       call   like  'selectwait  /  WaitSelect',  which  is  not  only  almost
  343.       identically named but has almost the same parameters.  The AmiTCP folks
  344.       say,  that  they haven't seen the AS225 API before releasing AmiTCP, so
  345.       it seems to be a logic extension to the BSD stuff. I haven't tested it
  346.       under all circumstances, but it seems to work
  347.  
  348.   - accept, bind, connect, recvfrom, sendto
  349.       AmiTCP  has  a  different  idea  than AS225 of what a 'struct sockaddr'
  350.       should  be.  (This not the fault of the AmiTCP folks, but of the people
  351.       who  moved 4.3 into the Net/2 Release.  :-) ) I wrote a wrapper for all
  352.       These  functions,  it should work, but I do not claim responsibility if
  353.       this is one reason for failure.
  354.  
  355.   - s_ioctl
  356.       The first tough one. AmiTCP has total different codes for its ioctls.
  357.       I've supported only the following IOCTL's:
  358.  
  359.        SIOCATMARK, FIONBIO, FIONREAD, FIOASYNC, SIOCSPGRP, SIOCGPGRP
  360.  
  361.       Of course this effectivly keeps almost everything not related to
  362.       sockets from running. But then again, these are only:
  363.  
  364.         SIOCADDRT, SIOCDELRT - for route support, so the AS225
  365.         'route' command and the 'routed' will not work
  366.  
  367.         [NOTE: Somebody told me, that the routed *does* run, but is not
  368.         able to add new routes, which it gets from other routed's via RIP
  369.         into the AmiTCP route tables. But it should be able to broadcast
  370.         its known routes to other machines on the net. I didn't test it
  371.         but IMHO it is possible. I have neither connection to a bigger 
  372.         public network nor the possibility to test this in deep. ]
  373.  
  374.         SIOCSIFADDR, SIOCGIFADDR, SIOCSIFDSTADDR, SIOCGIFDSTADDR,
  375.         SIOCSIFFLAGS, SIOCGIFFLAGS, SIOCGIFBRDADDR, SIOCSIFBRDADDR,
  376.         SIOCGIFNETMASK, SIOCSIFNETMASK, SIOCGIFMETRIC, SIOCSIFMETRIC,
  377.         SIOCGIFCONF
  378.  
  379.         this keeps also the 'ifconfig' and 'netstat' commands from working
  380.  
  381.         SIOCSARP, SIOCGARP, SIOCDARP
  382.  
  383.         this kills the 'arp' command.
  384.  
  385.         NOTE:   Even  if  you  implement the ioctl's you won't be able to run
  386.         ifconfig from AS225, because AmiTCP uses different (IMHO silly) names
  387.         for  the  interfaces.  Why didn't they omit the '.device'?  'ifconfig
  388.         slip/0'  would  be  sooo  nice.   :-)  (Consider  this an enhancement
  389.         request)
  390.  
  391.         NOTE2:   Most  of  the ioctls are also there in AmiTCP.  However, the
  392.         structures  used in AmiTCP and AS225 are *very* different (there seem
  393.         to  be heavy changes in the 4.3->Net/2 transition).  I consider these
  394.         ioctls less important, so I dropped this from this release.
  395.  
  396.         SIOCSSLIPDEV, SIOCSIFMTU, SIOCGIFMTU
  397.  
  398.         These ioctls() are missing completly, they're not in AmiTCP.
  399.  
  400.   - getpwent, endpwent, setpwent
  401.       They're in there. However, I do not recommend to use them.
  402.  
  403.   - s_dev_list
  404.       This  is  a  funny  one.  AS225 uses this one to map the list of socket
  405.       descriptors to the list of file descriptors of SAS C 5.  This call does
  406.       no  longer  work  with  SAS C 6, because there this list is no longer a
  407.       static  array but a linked list.  I could have skipped this call if not
  408.       for the 'ftp' program:
  409.  
  410.       If  s_dev_list()  does  nothing, the AS225 'ftp' client no longer works
  411.       correct.  You won't see any output from it.  It seems to me, that some-
  412.       how, 'ftp' uses this file<->socket relation; maybe the programmer wrote
  413.       a wrapper to use sockets as files.  I don't know.
  414.  
  415.       This is, where the 'KLUDGE' switch from the config file comes in:
  416.       If you enter 'KLUDGE' in the config-file, socket.library will claim the
  417.       first  eight  sockets  of  every open library base and return no socket
  418.       numbers below '8'.  Then 'ftp' works.  Don't ask me, why, though.  :-)
  419.  
  420.       I don't really like this kludge; I don't think, any of the user supplied
  421.       programs for AS225 will ever make real use of this call, especially not
  422.       under  SAS  C  6.x.   So  you  may  need this kludge only for the 'ftp'
  423.       client.  If you will not use it, don't set it.
  424.  
  425.   -  setnetent,  endnetent, getnetent, setprotoent, endprotoent, getprotoent,
  426.      setservent, endservent, getservent, sethostent, endhostent, gethostent
  427.  
  428.       These are internal calls to access various files (networks, protocols,
  429.       services, hosts).  Will not be supported.  Don't use them.
  430.  
  431.   -  reconfig
  432.       Not supported. Should be possible via sending an ARexx Command to the
  433.       stack.  I can't think of an application to use this.
  434.  
  435.   -  s_release, s_inherit
  436.       These are the bad guys.  Not supported, I doubt that they ever will be.
  437.       (I  have no idea, how) This prevents *every* AS225 server from running,
  438.       because  AmiTCP  uses  a  different (BETTER!) protocol to give a socket
  439.       from inetd to a started server.
  440.  
  441.   -  recvmsg, sendmsg
  442.       Advanced send() and recv(). Should be implementable without too much
  443.       hassle, but I didn't need it.... :-)
  444.  
  445. - structures
  446.  
  447.   Well, most of the structures needed are identical (Thank god) or don't care
  448.   (sockets).   I had to deal explicitly with two:  passwd and sockaddr.
  449.   Both wrappers should work fine.
  450.  
  451. CONCLUSION
  452.  
  453. Well,  so  much for that.  This library now pretty much fills *my* needs.  If
  454. you  have any ideas or if you find bugs, tell me.  My EMail address is listed
  455. above.   I  will  not  implement  anything  new until I need it or get public
  456. demand.   If find programs that run (...that not run) which are not mentioned
  457. in the list above, please send me a mail.
  458.  
  459. BTW: The writing of a bsdsocket.library to sit on AS225:
  460.  
  461. Sorry, but thats IMHO not possible. Several reasons:
  462.  
  463. a)  The  brain  damaged way, AmiTCP handles its Password file.  The calls for
  464.     that  (along  with  the  group  stuff  and  gethostname)  are in a *LINK*
  465.     library.   Pretty  much  all  user programs, who need this stuff carry it
  466.     around in its binary.  So you can't write a library to redirect.  I hope,
  467.     this will be changed in AmiTCP 3.0 or beyond.  (But I think, it's already
  468.     too late.  :( )
  469.  
  470. b)  The missing strerror() call. Same as above
  471.  
  472. c)  Totally different signal structure. AS225 allocates its signals and gives
  473.     the user the ability to query them via getsignal().
  474.     AmiTCP just offers a call to set complete masks for the signals. To come
  475.     from AmiTCP to AS225 is easy (allocate two signals in the library base,
  476.     give them to AmiTCP and return them on getsignal()). But how to emulate
  477.     the setting of masks?
  478.  
  479. ENHANCEMENT REQUEST (Not really...  :-) )
  480.  
  481. I  desperatly  need  an  SMTP  and an NNTP client and a SMTPd and a NNTPd for
  482. AmiTCP.   Is  there nobody out there, who will write this stuff?  I'm willing
  483. to Beta-test...
  484.  
  485.  
  486. HISTORY
  487.  
  488.  7. 1. 94  - V 1.0ß - First Beta release (including a release for the KA '94 
  489.                                           German Amiga Users Meeting)
  490.  
  491. 20. 2. 94  - V 1.0  - First public release
  492.  
  493.  
  494. -- © Henning Schmiedehausen 1994 - All rights reserved
  495.