home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / kboot22.zoo / kboot22.2 < prev   
Encoding:
Text File  |  1991-02-22  |  40.8 KB  |  1,384 lines

  1.  
  2. #! /bin/sh
  3. # This is a shell archive.  Remove anything before this line, then unpack
  4. # it by saving it into a file and typing "sh file".  To overwrite existing
  5. # files, type "sh file -c".  You can also feed this as standard input via
  6. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  7. # will see the following message at the end:
  8. #        "End of archive 2 (of 2)."
  9. # Contents:  aarpd.c getaa.c aarpd.8 kboot.8 aarpd.h appletalk.h
  10. #   config.h kbox.h patchlevel.h cmdidx.h kboot.h Makefile README
  11. # Wrapped by bobs@chumley on Wed Feb 13 22:14:59 1991
  12. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  13. if test -f 'aarpd.c' -a "${1}" != "-c" ; then 
  14.   echo shar: Will not clobber existing file \"'aarpd.c'\"
  15. else
  16. echo shar: Extracting \"'aarpd.c'\" \(7348 characters\)
  17. sed "s/^X//" >'aarpd.c' <<'END_OF_FILE'
  18. X#ifndef lint
  19. Xstatic char    *RCSid="$Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/aarpd.c,v 1.1 91/01/29 17:36:55 root Exp $";
  20. X#endif lint
  21. X
  22. X/*
  23. X * $Log:    aarpd.c,v $
  24. X * Revision 1.1  91/01/29  17:36:55  root
  25. X * Initial revision
  26. X * 
  27. X */
  28. X
  29. X/*
  30. X * aarpd - Appletalk ARP daemon.  Obtain an appletalk protocol address,
  31. X *       then listen forever, responding to any appletalk probes and
  32. X *       requests sent to us.  Depends on SunOS 4.x NIT interface.
  33. X *
  34. X * Author: Bob Schwartzkopf, The RAND Corporation.  Based on an earlier
  35. X *       version written by Dan Tappan at BBN that ran under SunOS 3.x.
  36. X *
  37. X * Comments, suggestions, patches, bug reports, etc. may be sent to
  38. X * bobs@rand.org.
  39. X */
  40. X
  41. X#include <stdio.h>
  42. X#include <syslog.h>
  43. X#include <sys/types.h>
  44. X#include <sys/errno.h>
  45. X#include <sys/socket.h>
  46. X#include <sys/fcntl.h>
  47. X#include <sys/termios.h>
  48. X#include <net/if.h>
  49. X#include <netinet/in.h>
  50. X#include <netinet/if_ether.h>
  51. X#include <rpc/rpc.h>
  52. X#include <sys/time.h>
  53. X#include <sys/timeb.h>
  54. X#include "appletalk.h"
  55. X#include "aarpd.h"
  56. X#include "config.h"
  57. X#include "patchlevel.h"
  58. X
  59. Xextern char    *rindex ();
  60. Xint        aarp_read ();
  61. X
  62. Xextern struct ether_addr    myether;    /* Setup by nit_init    */
  63. Xextern int            errno;
  64. Xextern char            *sys_errlist[];
  65. X
  66. X#define VERSION        2
  67. X
  68. X/*
  69. X * Globals.
  70. X */
  71. Xchar            *progname;
  72. Xchar            *interface = NULL;
  73. Xstruct ether_addr    ebc = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
  74. Xlong            atalkaddr;    /* Current appletalk address    */
  75. Xint            haveaddr = 0;    /* Have appletalk address    */
  76. Xint            conflict;    /* We're in confict with someone*/
  77. Xint            detached = 0;    /* Detached from tty        */
  78. Xint            debug = 0;    /* Debugging            */
  79. Xstruct ether_header    eh;        /* Output ethernet header    */
  80. Xstruct ether_aarp    ap;        /* Output packet        */
  81. X
  82. Xmain (argc, argv)
  83. X
  84. Xint    argc;
  85. Xchar    **argv;
  86. X
  87. X{
  88. X  char    c;
  89. X  int    i;
  90. X  
  91. X  if ((progname = rindex (argv[0], '/')) == NULL)
  92. X      progname = *argv;
  93. X  else
  94. X      progname++;
  95. X  while (--argc > 0) {
  96. X      argv++;
  97. X      c = (*argv)[0] == '-' ? (*argv)[1] : (*argv)[0];
  98. X      switch (c) {
  99. X    case 'd' :
  100. X      debug++;
  101. X      break;
  102. X    case 'i' :
  103. X      if (argc <= 1)
  104. X          usage ();
  105. X      argv++;
  106. X      argc--;
  107. X      interface = *argv;
  108. X      break;
  109. X    case 'v' :
  110. X      printf ("%s version number %d.%d\n", progname, VERSION, PATCHLEVEL);
  111. X      exit (0);
  112. X    default :
  113. X      usage ();
  114. X      }
  115. X  }
  116. X  if (!debug) {                /* Detach ourselves        */
  117. X      detached++;
  118. X      if (fork ())
  119. X      exit (0);
  120. X      if ((i = open ("/dev/tty", O_RDONLY)) >= 0)
  121. X      ioctl (i, TIOCNOTTY, 0);
  122. X      i = getdtablesize ();
  123. X      while (--i >= 0)
  124. X      close (i);
  125. X      open ("/dev/null", 0);
  126. X      dup2 (0, 1);
  127. X      dup2 (0, 2);
  128. X      openlog (progname, 0, LOG_DAEMON);
  129. X  }
  130. X  nit_init (interface);
  131. X  nit_open (sizeof (ap) + sizeof (eh), AARP);
  132. X  aarp_probe ();            /* Get appletalk address    */
  133. X  initrpc ();                /* Prepare for RPC        */
  134. X  ap.aarp_op = htons (AARPResp);    /* Set up for sending replies    */
  135. X  nit_dispatch (aarp_read, 0, &svc_fdset, svc_getreqset, NULL);
  136. X}
  137. X
  138. X/*
  139. X * usage - Print usage and die.
  140. X */
  141. Xusage ()
  142. X
  143. X{
  144. X  fprintf (stderr, "Usage: %s [-d] [-i interface]\n", progname);
  145. X  exit (1);
  146. X}
  147. X
  148. X/*
  149. X * aarp_probe - Get unused appletalk address.  Algorithm is to try each
  150. X *   in turn, probing to see if anyone else is using each address.  When
  151. X *   no one answers a probe, we use that address.  Note this routine
  152. X *   initializes some global data structures (eh, ap), parts of which are
  153. X *   used later by aarp_read ().
  154. X */
  155. Xaarp_probe ()
  156. X
  157. X{
  158. X  u_long        spa;
  159. X  int            i;
  160. X  struct timeval    timeout;
  161. X  struct timeb        tstart;
  162. X  struct timeb        tcur;
  163. X  int            utotal;
  164. X  int            ucur;
  165. X
  166. X    /* Init ether header        */
  167. X  ether_copy (&ebc, &eh.ether_dhost);
  168. X  ether_copy (&myether, &eh.ether_shost);
  169. X  eh.ether_type = htons (AARP);
  170. X    /* Init aarp header        */
  171. X  ap.aarp_hrd = htons (H_Ethernet);
  172. X  ap.aarp_pro = htons (P_AppleTalk);
  173. X  ap.aarp_hln = HL_Ethernet;
  174. X  ap.aarp_pln = PL_AppleTalk;
  175. X  ap.aarp_op = htons (AARPProbe);
  176. X  ether_copy (&myether, &ap.aarp_sha);
  177. X  bzero (&ap.aarp_tha, HL_Ethernet);
  178. X  nit_timeout (APrbTicks, &timeout);
  179. X  utotal = timeout.tv_sec * 1000000 + timeout.tv_usec;
  180. X  for (atalkaddr = 1; atalkaddr < 254; atalkaddr++) {
  181. X      spa = htonl (atalkaddr);
  182. X      bcopy (&spa, ap.aarp_spa, PL_AppleTalk);
  183. X      bcopy (&spa, ap.aarp_tpa, PL_AppleTalk);
  184. X      conflict = 0;
  185. X      for (i = 0; !conflict && i < APrbTries; i++) {
  186. X      nit_write ((caddr_t) &eh, (caddr_t) &ap, sizeof ap);
  187. X      ftime (&tstart);
  188. X      do {
  189. X          nit_dispatch (aarp_read, 1, NULL, NULL, &timeout);
  190. X          ftime (&tcur);
  191. X          ucur = (tcur.time - tstart.time) * 1000000 +
  192. X             (tcur.millitm - tstart.millitm) * 1000;
  193. X      } while (!conflict && utotal > ucur);
  194. X      }
  195. X      if (!conflict) {
  196. X      if (debug)
  197. X          fprintf (stderr, "aarp_probe: Using appletalk address %d\n",
  198. X               atalkaddr);
  199. X      break;
  200. X      }
  201. X  }
  202. X  if (conflict) {
  203. X      logerr ("aarp_probe: Couldn't find appletalk address, exiting...\n");
  204. X      exit (1);
  205. X  }
  206. X  haveaddr++;
  207. X}
  208. X
  209. X/*
  210. X * aarp_read - Handle AARP response packets.
  211. X */
  212. Xaarp_read (p, pl)
  213. X
  214. Xstruct aarp_packet    *p;
  215. Xint            pl;
  216. X
  217. X{
  218. X  int    op;
  219. X  long    spa;
  220. X  long    tpa;
  221. X
  222. X  if (pl != sizeof (*p)) {
  223. X      if (debug)
  224. X          fprintf (stderr, "aarp_read: Truncated packet len %d\n", pl);
  225. X      return;
  226. X  }
  227. X  op = ntohs (p->ap_op);
  228. X  bcopy ((caddr_t) p->ap_spa, &spa, PL_AppleTalk);
  229. X  spa = ntohl (spa);
  230. X  switch (op) {
  231. X    case AARPProbe :
  232. X    case AARPReq :
  233. X      bcopy ((caddr_t) p->ap_tpa, &tpa, PL_AppleTalk);
  234. X      tpa = ntohl (tpa);
  235. X      if (haveaddr && tpa == atalkaddr) {
  236. X    /*
  237. X     * Most of the output header and packet (eh, ap) should already be
  238. X     * set up since it was used for probing initially.  Should only need
  239. X     * to fill in destination addresses.
  240. X     */
  241. X      ether_copy (&p->ap_sha, &eh.ether_dhost);
  242. X      ether_copy (&p->ap_sha, &ap.aarp_tha);
  243. X      bcopy (p->ap_spa, ap.aarp_tpa, PL_AppleTalk);
  244. X      if (debug) {
  245. X          fprintf (stderr, "aarp_read: Replying to %s from %d (%s)\n",
  246. X              op == AARPProbe ? "probe" : "request",
  247. X              spa, ether_ntoa (&p->ap_sha));
  248. X      }
  249. X      nit_write ((caddr_t) &eh, (caddr_t) &ap, sizeof ap);
  250. X      }
  251. X      break;
  252. X
  253. X    case AARPResp :
  254. X      if (debug)
  255. X      fprintf (stderr, "aarp_read: Reply from %d (%s)\n",
  256. X           spa, ether_ntoa (&p->ap_sha));
  257. X      if (!haveaddr && spa == atalkaddr)
  258. X          conflict++;
  259. X      break;
  260. X
  261. X    default :
  262. X      logerr ("aarp_read: Unknown AARP operation %d\n", op);
  263. X  }
  264. X}
  265. X
  266. X/*
  267. X * getaa - Return appletalk address for this host.
  268. X */
  269. Xgetaa (request, xprt)
  270. X
  271. Xstruct svc_req    *request;
  272. XSVCXPRT        *xprt;
  273. X
  274. X{
  275. X  struct sockaddr_in    *sa;
  276. X
  277. X  if (debug) {
  278. X      sa = svc_getcaller (xprt);
  279. X      fprintf (stderr, "getaa: Returning %d to %s\n",
  280. X          atalkaddr, inet_ntoa (sa->sin_addr));
  281. X  }
  282. X  switch (request->rq_proc) {
  283. X    case NULLPROC:
  284. X      if (!svc_sendreply (xprt, xdr_void, 0)) {
  285. X      logerr ("getaa(NULLPROC): svc_sendreply failed\n");
  286. X      exit (1);
  287. X      }
  288. X      break;
  289. X
  290. X    case GETAAPROC:
  291. X      if (!svc_sendreply (xprt, xdr_u_long, (caddr_t) &atalkaddr)) {
  292. X      logerr ("getaa(GETAAPROC): svc_sendreply failed\n");
  293. X      exit (1);
  294. X      }
  295. X      break;
  296. X
  297. X    default:
  298. X      svcerr_noproc (xprt);
  299. X      break;
  300. X  }
  301. X}
  302. X
  303. X/*
  304. X * Initialize RPC stuff.
  305. X */
  306. Xinitrpc ()
  307. X
  308. X{
  309. X  SVCXPRT    *xprt;
  310. X
  311. X  if ((xprt = svcudp_create (RPC_ANYSOCK)) == NULL) {
  312. X      logerr ("initrpc: svcudp_create failed\n");
  313. X      exit (1);
  314. X  }
  315. X  pmap_unset (GETAAPROG, GETAAVERS);
  316. X  if (!svc_register (xprt, GETAAPROG, GETAAVERS, getaa, IPPROTO_UDP)) {
  317. X      logerr ("initrpc: Can't register %d %d\n", GETAAPROG, GETAAVERS);
  318. X      exit (1);
  319. X  }
  320. X}
  321. END_OF_FILE
  322. if test 7348 -ne `wc -c <'aarpd.c'`; then
  323.     echo shar: \"'aarpd.c'\" unpacked with wrong size!
  324. fi
  325. # end of 'aarpd.c'
  326. fi
  327. if test -f 'getaa.c' -a "${1}" != "-c" ; then 
  328.   echo shar: Will not clobber existing file \"'getaa.c'\"
  329. else
  330. echo shar: Extracting \"'getaa.c'\" \(787 characters\)
  331. sed "s/^X//" >'getaa.c' <<'END_OF_FILE'
  332. X#ifndef lint
  333. Xstatic char    *RCSid="$Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/getaa.c,v 1.1 91/01/29 17:37:21 root Exp $";
  334. X#endif lint
  335. X
  336. X/*
  337. X * $Log:    getaa.c,v $
  338. X * Revision 1.1  91/01/29  17:37:21  root
  339. X * Initial revision
  340. X * 
  341. X */
  342. X
  343. X#include <stdio.h>
  344. X#include <rpc/rpc.h>
  345. X#include "aarpd.h"
  346. X
  347. X/*
  348. X * getaa - Return appletalk address of "host".  If host is NULL get
  349. X *   local host address.  Makes RPC call to aarpd on host.
  350. X */
  351. Xint getaa (host, aa)
  352. X
  353. Xchar    *host;
  354. Xint    *aa;
  355. X
  356. X{
  357. X  int    i;
  358. X  int    s;
  359. X
  360. X  if (host == NULL)
  361. X      host = "localhost";
  362. X/*
  363. X * Give aarpd a chance to register with portmap...
  364. X */
  365. X  for (i = 0; i < 3; i++)
  366. X      if ((s = callrpc (host, GETAAPROG, GETAAVERS, GETAAPROC,
  367. X                   xdr_void, 0, xdr_u_long, aa)) == 0)
  368. X      break;
  369. X      else
  370. X      sleep (2);
  371. X  return (s);
  372. X}
  373. END_OF_FILE
  374. if test 787 -ne `wc -c <'getaa.c'`; then
  375.     echo shar: \"'getaa.c'\" unpacked with wrong size!
  376. fi
  377. # end of 'getaa.c'
  378. fi
  379. if test -f 'aarpd.8' -a "${1}" != "-c" ; then 
  380.   echo shar: Will not clobber existing file \"'aarpd.8'\"
  381. else
  382. echo shar: Extracting \"'aarpd.8'\" \(888 characters\)
  383. sed "s/^X//" >'aarpd.8' <<'END_OF_FILE'
  384. X.TH aarpd 8 "25 October 90"
  385. X.SH NAME
  386. Xaarpd \- Appletalk Arp daemon.
  387. X.SH SYNOPSIS
  388. X.I
  389. Xaarpd
  390. X.B [-d]
  391. X.B [-i interface]
  392. X.B [-v]
  393. X.SH DESCRIPTION
  394. X.I aarpd
  395. Ximplements the Appletalk Arp protocol on a unix host.  It obtains an
  396. XAppletalk node number, and then listens and replies to other nodes
  397. Xtrying to find out if this node number is in use.
  398. X.LP
  399. XOther processes on the host (eg kboot) can obtain the node number for
  400. Xthis host via an RPC call.
  401. X.SH OPTIONS
  402. X.TP
  403. X.B \-d
  404. XTurn on debugging.
  405. X.TP
  406. X.B \-i interface
  407. XSpecify interface name (eg ie1).  Defaults to first interface in kernel.
  408. X.TP
  409. X.B \-v
  410. XPrint aarpd version number.
  411. X.SH "SEE ALSO"
  412. Xkboot(8), nit(4)
  413. X.SH BUGS
  414. X.I aarpd
  415. Xdepends on the SunOS 4\.x NIT interface and probably isn't very portable.
  416. X.SH AUTHOR
  417. XBob Schwartzkopf, The RAND Corporation.  Much credit is due Dan Tappan
  418. Xof BBN, who wrote the first version of
  419. X.I kboot
  420. Xthat ran on SunOS 3.x.
  421. END_OF_FILE
  422. if test 888 -ne `wc -c <'aarpd.8'`; then
  423.     echo shar: \"'aarpd.8'\" unpacked with wrong size!
  424. fi
  425. # end of 'aarpd.8'
  426. fi
  427. if test -f 'kboot.8' -a "${1}" != "-c" ; then 
  428.   echo shar: Will not clobber existing file \"'kboot.8'\"
  429. else
  430. echo shar: Extracting \"'kboot.8'\" \(3803 characters\)
  431. sed "s/^X//" >'kboot.8' <<'END_OF_FILE'
  432. X.TH kboot 8 "25 October 90"
  433. X.SH NAME
  434. Xkboot - Monitor and reboot Fastpath 4 gateways.
  435. X.SH SYNOPSIS
  436. X.I kboot
  437. X.B [-bclrs fastpath]
  438. X.B [-d]
  439. X.B [-i interface]
  440. X.B [-p int]
  441. X.B [-t fastpath [server]]
  442. X.B [-v]
  443. X.B [-w]
  444. X.SH DESCRIPTION
  445. X.I kboot
  446. Xis a program that can monitor, load and configure Kinetics/Shiva Fastpath 4
  447. Xgateways over an ethernet from a Sun running SunOS 4.x.
  448. X.LP
  449. X.I kboot
  450. Xwill only talk to fastpaths specified in the configuration file
  451. X/usr/local/etc/kbootcf.  The format of this file is simply the hostname
  452. Xof each fastpath, followed by white space and the name of the KSTAR
  453. Xsoftware to be downloaded in the event that kboot reloads the fastpath.
  454. XThe KSTAR program filename in the configuration file should be relative to
  455. Xthe directory where the configuration file is, by default this is
  456. X/usr/local/etc.
  457. X.LP
  458. X.I kboot
  459. Xgets an appletalk node number from a separate daemon called aarpd(8) via
  460. Xan RPC call.  aarpd must be running for
  461. X.I kboot
  462. Xto work.
  463. X.LP
  464. X.I kboot
  465. Xreads the fastpath's ethernet address from /etc/ethers (or equivalent
  466. XNIS map), each fastpath managed by
  467. X.I kboot
  468. Xmust have its correct ethernet address in that file.
  469. X.LP
  470. XEach configured fastpath should have a corresponding state file.  These
  471. Xcan be obtained in one of two ways.  They can be generated using the
  472. Xfastpath manager program on a Mac, in which case they should be transferred
  473. Xto the file /usr/local/etc/<fastpath>.config on the host
  474. X.I kboot
  475. Xis running on.  Alternatively, the current state vector of a fastpath
  476. Xcan be read directly from the fastpath using the \-s option of
  477. X.I kboot.
  478. XIn this case the state will be saved as /usr/local/etc/<fastpath>.state.
  479. XIf both files exist, the file generated by the fastpath manager (.config)
  480. Xwill be used.
  481. X.LP
  482. XSending
  483. X.I kboot
  484. Xa HUP signal while it's in "watch" mode will cause
  485. X.I kboot
  486. Xto reread the configuration file kbootcf.  This is useful after editing
  487. Xthe configuration file.
  488. X.SH OPTIONS
  489. X.TP
  490. X.B \-b fastpath
  491. XDownload KSTAR program and state to specified fastpath gateway.
  492. X.TP
  493. X.B \-c fastpath
  494. XDownload state to specified fastpath gateway.
  495. X.TP
  496. X.B \-d
  497. XTurn on debugging.
  498. X.TP
  499. X.B \-l fastpath
  500. XRead state from specified fastpath and print various fields.
  501. X.TP
  502. X.B \-i interface
  503. XSpecify interface name (eg ie1).  Defaults to first interface in kernel.
  504. X.TP
  505. X.B \-p int
  506. XSet ping interval, in seconds.
  507. X.TP
  508. X.B \-r fastpath
  509. XReset specified fastpath.
  510. X.TP
  511. X.B \-s fastpath
  512. XRead state vector from specified fastpath and save to a file.  This file
  513. Xcan be used for downloading later.
  514. X.TP
  515. X.B \-t fastpath [server]
  516. XAsk
  517. X.I kboot
  518. Xrunning in "watch" mode (see -w option below) on
  519. X.I server
  520. Xto reload the specified fastpath.  Useful for forcing a reboot
  521. Xwithout killing a currently running kboot daemon, manually reloading
  522. Xwith -b, and restarting the daemon.
  523. X.TP
  524. X.B \-w
  525. XPut
  526. X.I kboot
  527. Xin "watch" mode.  In this mode,
  528. X.I kboot
  529. Xwill periodically ping the fastpaths
  530. Xspecified in the config file, rebooting them if they don't answer.
  531. X.I kboot
  532. Xwill also listen for RPC requests sent by interactively run
  533. X.I kboot
  534. Xprocesses requesting reloads (see -t option).
  535. X.TP
  536. X.B \-v
  537. XPrint
  538. X.I kboot
  539. Xversion number.
  540. X.SH FILES
  541. X.TP
  542. X.B /usr/local/etc/kbootcf
  543. XConfiguration file.
  544. X.TP
  545. X.B /usr/local/etc/<fastpath>.config
  546. XAscii fastpath configuration as generated by fastpath manager.
  547. X.TP
  548. X.B /usr/local/etc/<fastpath>.state
  549. XBinary state vector read from fastpath.
  550. X.SH "SEE ALSO"
  551. Xaarpd(8), nit(4)
  552. X.SH BUGS
  553. X.I kboot
  554. Xdepends on the SunOS 4\.x NIT interface and probably isn't very portable.
  555. X.LP
  556. X.I kboot
  557. Xcan only download/configure fastpaths on the same ethernet
  558. Xthat the host
  559. X.I kboot
  560. Xis running on is attached to.
  561. X.SH AUTHOR
  562. XBob Schwartzkopf, The RAND Corporation.  Much credit is due Dan Tappan
  563. Xof BBN, who wrote the first version of
  564. X.I kboot
  565. Xthat ran on SunOS 3.x, and Phil Budne of Shiva, who helped make it
  566. Xwork with KSTAR 8.0.
  567. END_OF_FILE
  568. if test 3803 -ne `wc -c <'kboot.8'`; then
  569.     echo shar: \"'kboot.8'\" unpacked with wrong size!
  570. fi
  571. # end of 'kboot.8'
  572. fi
  573. if test -f 'aarpd.h' -a "${1}" != "-c" ; then 
  574.   echo shar: Will not clobber existing file \"'aarpd.h'\"
  575. else
  576. echo shar: Extracting \"'aarpd.h'\" \(259 characters\)
  577. sed "s/^X//" >'aarpd.h' <<'END_OF_FILE'
  578. X/*
  579. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/aarpd.h,v 1.1 91/01/29 17:37:30 root Exp $
  580. X *
  581. X * $Log:    aarpd.h,v $
  582. X * Revision 1.1  91/01/29  17:37:30  root
  583. X * Initial revision
  584. X * 
  585. X */
  586. X
  587. X#define GETAAPROG    0x20000001
  588. X#define GETAAVERS    1
  589. X#define GETAAPROC    1
  590. END_OF_FILE
  591. if test 259 -ne `wc -c <'aarpd.h'`; then
  592.     echo shar: \"'aarpd.h'\" unpacked with wrong size!
  593. fi
  594. # end of 'aarpd.h'
  595. fi
  596. if test -f 'appletalk.h' -a "${1}" != "-c" ; then 
  597.   echo shar: Will not clobber existing file \"'appletalk.h'\"
  598. else
  599. echo shar: Extracting \"'appletalk.h'\" \(2078 characters\)
  600. sed "s/^X//" >'appletalk.h' <<'END_OF_FILE'
  601. X/*
  602. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/appletalk.h,v 1.1 91/01/29 17:37:31 root Exp $
  603. X *
  604. X * $Log:    appletalk.h,v $
  605. X * Revision 1.1  91/01/29  17:37:31  root
  606. X * Initial revision
  607. X * 
  608. X */
  609. X
  610. X/*
  611. X * appletalk.h - Definitions for Appletalk protocols.
  612. X */
  613. X#define AT_Broadcast    0xFF        /* Broadcast appletalk address    */
  614. X#define AARP        0x80F3        /* AARP protocol type        */
  615. X#define H_Ethernet    1        /* Hardware type for ethernet    */
  616. X#define HL_Ethernet    6        /* Ethernet address length    */
  617. X#define P_AppleTalk    0x809B        /* Protocol type for appletalk    */
  618. X#define PL_AppleTalk    4        /* Appletalk address length    */
  619. X#define AReqTicks    2        /* # of ticks between requests    */
  620. X#define AReqTries    6        /* # of tries on requests    */
  621. X/*
  622. X * Inside Appletalk suggests APrbTicks should be 2 and APrbTries 20.
  623. X * Our hosts don't always respond that fast, and that seems like way
  624. X * too many retries, so we'll slow down the timeout and decrease the
  625. X * retries.
  626. X */
  627. X#define APrbTicks    20        /* # of ticks between probes    */
  628. X#define APrbTries    5        /* # of tries on probes        */
  629. X
  630. X/*
  631. X * Appletalk ARP header.
  632. X */
  633. Xstruct ether_aarp {
  634. X  u_short        aarp_hrd;    /* Hardware type        */
  635. X  u_short        aarp_pro;    /* Protocol type        */
  636. X  u_char        aarp_hln;    /* Hardware address length    */
  637. X  u_char         aarp_pln;    /* Protocol address length    */
  638. X  u_short        aarp_op;    /* Command            */
  639. X#define AARPReq        1
  640. X#define AARPResp    2
  641. X#define AARPProbe    3
  642. X  struct ether_addr    aarp_sha;    /* Sender hardware address    */
  643. X  u_char        aarp_spa[4];    /* Sender protocol address    */
  644. X  struct ether_addr    aarp_tha;    /* Target hardware address    */
  645. X  u_char        aarp_tpa[4];    /* Target protocol address    */
  646. X};
  647. X
  648. Xstruct aarp_packet {
  649. X  struct ether_header    ap_ehdr;
  650. X  struct ether_aarp    ap_ahdr;
  651. X};
  652. X#define ap_dhost    ap_ehdr.ether_dhost
  653. X#define ap_shost    ap_ehdr.ether_shost
  654. X#define ap_type        ap_ehdr.ether_type
  655. X#define ap_hrd        ap_ahdr.aarp_hrd
  656. X#define ap_pro        ap_ahdr.aarp_pro
  657. X#define ap_hln        ap_ahdr.aarp_hln
  658. X#define ap_pln        ap_ahdr.aarp_pln
  659. X#define ap_op        ap_ahdr.aarp_op
  660. X#define ap_sha        ap_ahdr.aarp_sha
  661. X#define ap_spa        ap_ahdr.aarp_spa
  662. X#define ap_tha        ap_ahdr.aarp_tha
  663. X#define ap_tpa        ap_ahdr.aarp_tpa
  664. END_OF_FILE
  665. if test 2078 -ne `wc -c <'appletalk.h'`; then
  666.     echo shar: \"'appletalk.h'\" unpacked with wrong size!
  667. fi
  668. # end of 'appletalk.h'
  669. fi
  670. if test -f 'config.h' -a "${1}" != "-c" ; then 
  671.   echo shar: Will not clobber existing file \"'config.h'\"
  672. else
  673. echo shar: Extracting \"'config.h'\" \(546 characters\)
  674. sed "s/^X//" >'config.h' <<'END_OF_FILE'
  675. X/*
  676. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/config.h,v 1.1 91/01/29 17:37:42 root Exp $
  677. X *
  678. X * $Log:    config.h,v $
  679. X * Revision 1.1  91/01/29  17:37:42  root
  680. X * Initial revision
  681. X * 
  682. X */
  683. X
  684. X/*
  685. X * config.h - Tunable stuff for kboot should all be here.
  686. X */
  687. X
  688. X    /* KSTAR images and fastpath config files live here    */
  689. X#define ETCDIR        "/usr/local/etc"
  690. X    /* Seconds between pings to make sure fastpaths are ok    */
  691. X#define PINGINTERVAL    120
  692. X    /* Number of ping retries                */
  693. X#define PINGRETRIES    5
  694. X    /* Timeout (seconds) for pings                */
  695. X#define PINGTIMEOUT    2
  696. END_OF_FILE
  697. if test 546 -ne `wc -c <'config.h'`; then
  698.     echo shar: \"'config.h'\" unpacked with wrong size!
  699. fi
  700. # end of 'config.h'
  701. fi
  702. if test -f 'kbox.h' -a "${1}" != "-c" ; then 
  703.   echo shar: Will not clobber existing file \"'kbox.h'\"
  704. else
  705. echo shar: Extracting \"'kbox.h'\" \(4880 characters\)
  706. sed "s/^X//" >'kbox.h' <<'END_OF_FILE'
  707. X/*
  708. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/kbox.h,v 1.2 91/02/12 19:37:15 root Exp $
  709. X *
  710. X * $Log:    kbox.h,v $
  711. X * Revision 1.2  91/02/12  19:37:15  root
  712. X * Remove unused commands.
  713. X * 
  714. X * Revision 1.1  91/01/29  17:37:47  root
  715. X * Initial revision
  716. X * 
  717. X */
  718. X
  719. X#define FP_TYPE        'K'
  720. X#define FP_CMD        'C'
  721. X#define FP_ACK        'A'
  722. X#define FP_RESP        'R'
  723. X/*
  724. X * The fp_state structure declared in cmdmacro.h doesn't align all the
  725. X * fields properly when compiled on sparc machines, so kboot uses these
  726. X * offsets into an array to access interesting fields.
  727. X */
  728. X#define O_ATNET        0        /* Net number appletalk side    */
  729. X#define O_ETNET        2        /* Net number ethertalk side    */
  730. X#define O_VALID        4        /* Appletalk node number valid    */
  731. X#define O_NODE        5        /* Appletalk node number    */
  732. X#define O_BRIDGE    7        /* Bridge number        */
  733. X#define O_ETHER        8        /* Ethernet address        */
  734. X#define O_NAME        14        /* Gateway name            */
  735. X#define O_FILE        35        /* Loadfile name        */
  736. X#define O_PFORCE    56        /* Force execution of prom loop    */
  737. X#define O_ATZONE    62        /* Localtalk zone        */
  738. X#define O_ETZONE    95        /* Ethertalk zone        */
  739. X#define O_ETVALID    128        /* Ethertalk node number valid    */
  740. X#define O_ETNODE    129        /* Ethertalk node number    */
  741. X#define O_AUTOCONFIG    130        /* Autoconfig switch        */
  742. X#define O_AUTOBOOT    132        /* Autoboot switch        */
  743. X#define O_OPTIONS    134        /* Options            */
  744. X#define O_OPTPARAM    138        /* Optional parameters        */
  745. X#define O_SN        170        /* Serial number        */
  746. X#define O_DATE        174        /* Configuration date        */
  747. X#define O_TYPE        178        /* Type                */
  748. X#define O_CONFIG    180        /* Name of config file        */
  749. X#define O_UDPZONE    214        /* UDP zone name        */
  750. X#define O_IPDEFROUTER    248        /* Default gateway        */
  751. X#define O_IPADDRESS    252        /* Ip address            */
  752. X#define O_ATIPADDRESS    256        /* Localtalk IP net        */
  753. X#define O_IPBROADCAST    260        /* Broadcast address        */
  754. X#define O_IPSUBMASK    264        /* Subnet mask            */
  755. X#define O_IPKIPSERVER    268        /* Admin host            */
  756. X#define O_UDPNET    272        /* UDP net number        */
  757. X#define O_UDPNODE    274        /* UDP node number        */ 
  758. X#define O_NAMESERVER    276        /* DNS host            */
  759. X#define O_FILESERVER    280        /* File server            */
  760. X#define O_LP1        284        /* Local parameter 1        */
  761. X#define O_LP2        288        /* Local parameter 2        */
  762. X#define O_LP3        292        /* Local parameter 3        */
  763. X#define O_LP4        296        /* Local parameter 4        */
  764. X#define O_NDYNAMICS    300        /* Number of dynamic ip addrs    */
  765. X#define O_NSTATICS    302        /* Number of static ip addrs    */
  766. X#define O_SIGNATURE    304        /* Signature            */
  767. X#define O_AREANODE    308        /* DECnet area and node        */
  768. X#define O_BACKTIMER    310        /* DECnet routing timer        */
  769. X#define O_HELLOTIMER    312        /* DECnet hello timer        */
  770. X#define O_RSTART    314        /* Range start for ET 2.0    */
  771. X#define O_REND        316        /* Range end for ET 2.0        */
  772. X#define O_ET2NET    318        /* Net number ET 2.0 side    */
  773. X#define O_ET2VALID    320        /* ET 2.0 node number valid    */
  774. X#define O_ET2NODE    321        /* ET 2.0 node number        */
  775. X#define O_ZONELIST    322        /* Zonelist            */
  776. X#define O_CONFIGTYPES    326        /* Reserved for FPM        */
  777. X#define O_DATATYPE    330        /* Define following data    */
  778. X#define O_DATALEN    332        /* Length of following data    */
  779. X#define O_ATAPOPTIONS    334
  780. X#define O_ATAPRETRY    336
  781. X
  782. X#define STATE_LENGTH    0x24A        /* Length of state vector    */
  783. X#define FPCOPYSIZE    10        /* Copy structure size        */
  784. X#define PROMRAMSIZE    64        /* promram structure size    */
  785. X#define HTSIZE        32
  786. X#define MAXHOSTNAME    64
  787. X#define MAXKBOX        256
  788. X#define MAXFN        256
  789. X#define MAXZONELIST    256
  790. X
  791. Xstruct kbox {
  792. X  struct sockaddr_in    ip;
  793. X  int            reload;
  794. X  char            name[MAXHOSTNAME];
  795. X  char            bootfile[MAXFN];
  796. X  char            conffile[MAXFN];
  797. X  struct ether_addr    ea;
  798. X  u_char        aa;
  799. X  struct kbox        *nxt;
  800. X};
  801. X
  802. X/*
  803. X * Send functions with no parameters.
  804. X */
  805. X#define send_execute(kp)    send_gen (kp, X_EXECUTE, 0)
  806. X#define send_promram(kp)    send_gen (kp, X_PROMRAM, 5)
  807. X#define send_reset(kp)        send_gen (kp, X_RESET, 0)
  808. X#define send_exprom(kp)        send_gen (kp, X_EXPROM, 0)
  809. X
  810. X/*
  811. X * Packet used to talk to Kinetics Fastpaths.  Does not include link
  812. X * level header (ether_header).
  813. X */
  814. X#define MAXFPPKT    1024
  815. Xstruct ether_fastpath {
  816. X  unsigned char        fastpath_lapdest;
  817. X  unsigned char        fastpath_lapsrc;
  818. X  unsigned char        fastpath_laptype;
  819. X  unsigned char        fastpath_len[2];
  820. X  unsigned char        fastpath_cmd;
  821. X  unsigned char        fastpath_scmd;
  822. X  unsigned char        fastpath_data[MAXFPPKT];
  823. X};
  824. X
  825. Xstruct fp_packet {
  826. X  struct ether_header    fp_ehdr;
  827. X  struct ether_fastpath    fp_fphdr;
  828. X};
  829. X#define fp_dhost    fp_ehdr.ether_dhost
  830. X#define fp_shost    fp_ehdr.ether_shost
  831. X#define fp_type        fp_ehdr.ether_type
  832. X#define fp_lapdest    fp_fphdr.fastpath_lapdest
  833. X#define fp_lapsrc    fp_fphdr.fastpath_lapsrc
  834. X#define fp_laptype    fp_fphdr.fastpath_laptype
  835. X#define fp_len        fp_fphdr.fastpath_len
  836. X#define fp_cmd        fp_fphdr.fastpath_cmd
  837. X#define fp_scmd        fp_fphdr.fastpath_scmd
  838. X#define fp_data        fp_fphdr.fastpath_data
  839. X
  840. Xtypedef struct {
  841. X  short    num_elements;    /* Number of elements in following array    */
  842. X  short    type;        /* Type of element (1 for zonelist)        */
  843. X  short    bytes;        /* Length of element                */
  844. X} elemlist;
  845. X
  846. X#define NAMELEN        21
  847. X#define CONFIGLEN    33
  848. END_OF_FILE
  849. if test 4880 -ne `wc -c <'kbox.h'`; then
  850.     echo shar: \"'kbox.h'\" unpacked with wrong size!
  851. fi
  852. # end of 'kbox.h'
  853. fi
  854. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  855.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  856. else
  857. echo shar: Extracting \"'patchlevel.h'\" \(296 characters\)
  858. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  859. X/*
  860. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/patchlevel.h,v 1.2 91/02/12 19:38:43 root Exp $
  861. X *
  862. X * $Log:    patchlevel.h,v $
  863. X * Revision 1.2  91/02/12  19:38:43  root
  864. X * *** empty log message ***
  865. X * 
  866. X * Revision 1.1  91/01/29  17:37:51  root
  867. X * Initial revision
  868. X * 
  869. X */
  870. X
  871. X#define PATCHLEVEL    2
  872. END_OF_FILE
  873. if test 296 -ne `wc -c <'patchlevel.h'`; then
  874.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  875. fi
  876. # end of 'patchlevel.h'
  877. fi
  878. if test -f 'cmdidx.h' -a "${1}" != "-c" ; then 
  879.   echo shar: Will not clobber existing file \"'cmdidx.h'\"
  880. else
  881. echo shar: Extracting \"'cmdidx.h'\" \(8803 characters\)
  882. sed "s/^X//" >'cmdidx.h' <<'END_OF_FILE'
  883. X/*
  884. X * Copyright (c) 1985, 1986 Kinetics, Inc.
  885. X *
  886. X * $Header: /usr/fp/include/fp/RCS/cmdidx.h,v 1.6 86/02/20 19:54:20 root Exp $
  887. X *
  888. X *    Indices into the jump table for PROM routines.
  889. X *    Also, the command numbers for the routines when invoked
  890. X *    from Kinetics LAP type command packets.
  891. X *    The values of these constants are actually determined by
  892. X *    their position in the jump table in .../proms/kfpx.s.
  893. X *    See cmdmacro.h for the actual calls through the jump table.
  894. X *    After the indices are defined, structure definitions for
  895. X *    each call's pointer parameter are also defined..
  896. X */
  897. X
  898. X#define    X_VERSION     0
  899. X#define    X_EXECUTE     1
  900. X#define    X_ACK         2
  901. X#define    X_REBOOT     3
  902. X#define    X_SET68         4
  903. X#define    X_SET86         5
  904. X#define    X_ATINIT     6
  905. X#define    X_ATWRITE     7
  906. X#define    X_WAIT         8
  907. X#define    X_WHEREIS     9
  908. X#define    X_GETMEM    10
  909. X#define    X_PROTECT    11
  910. X#define    X_COPYMEM    12
  911. X#define    X_CLRMEM    13
  912. X#define    X_PROMRAM    14
  913. X#define    X_RESET        15
  914. X#define    X_USER0        16
  915. X#define    X_USER1        17
  916. X#define    X_USER2        18
  917. X#define    X_USER3        19
  918. X#define    X_USER4        20
  919. X#define    X_USER5        21
  920. X#define    X_USER6        22
  921. X#define    X_USER7        23
  922. X#define    X_BUFINIT    24
  923. X#define    X_BUFGET    25
  924. X#define    X_BUFFREE    26
  925. X#define    X_BUFENQ    27
  926. X#define    X_BUFDEQ    28
  927. X#define    X_ERR        29
  928. X#define    X_IDLE        30
  929. X#define    X_KLAP        31
  930. X#define    X_WHO        32
  931. X#define    X_CA86        33
  932. X#define    X_RES86        34
  933. X#define    X_CLRINT    35
  934. X#define    X_RCSID        36
  935. X#define    X_EXPROM    37
  936. X#define    X_INIPROM    38
  937. X#define    X_RES8530    39
  938. X#define    X_DMTSERV    40
  939. X#define    X_SREC        41
  940. X#define    X_SPL        42
  941. X#define    X_NOTIMP    43
  942. X
  943. X/* structures for the above commands */
  944. X
  945. X/* X_VERSION */
  946. Xstruct fp_version {
  947. X    short    fpv_entries;        /* number of valid entries in jump table */
  948. X    short    fpv_version;        /* version of the prom code */
  949. X    long    fpv_model;        /* "KFPS", "KFPQ", or "KFPM" */
  950. X};
  951. X
  952. X/* X_EXECUTE */
  953. X/* no parameters */
  954. X
  955. X/* X_ACK */
  956. X/* no parameters */
  957. X
  958. X/* X_REBOOT */
  959. X/* no parameters */
  960. X
  961. X/* X_SET68 */
  962. X/* no parameters */
  963. X
  964. X/* X_SET86 */
  965. X/* this structure is really defined in ie.h, but it should look like this */
  966. X#ifdef    NEVER
  967. Xstruct scb {
  968. X    unsigned short    sc_status;    /* status */
  969. X    unsigned short    sc_cmd;        /* command */
  970. X    unsigned short    sc_clist;    /* command list */
  971. X    unsigned short    sc_rlist;    /* receive frame list */
  972. X    unsigned short    sc_crcerrs;    /* crc errors */
  973. X    unsigned short    sc_alnerrs;    /* alignment errors */
  974. X    unsigned short    sc_rscerrs;    /* resource errors (lack of rfd/rbd's) */
  975. X    unsigned short    sc_ovrnerrs;    /* overrun errors (mem bus not avail) */
  976. X};
  977. X#endif    NEVER
  978. X
  979. X/* X_ATINIT */
  980. X/* The parameter is a pointer to a short which is filled in with
  981. X   the node number chosen by the AppleTalk initialization sequence */
  982. X
  983. X/* X_ATWRITE */
  984. Xstruct fp_atwrite {
  985. X    short    fpw_length;    /* number of bytes in hte following string */
  986. X    unsigned char *fpw_str;    /* string to be output onto the network */
  987. X};
  988. X
  989. X/* X_WAIT */
  990. X/* The parameter is a long integer which indicates
  991. X   the number of milliseconds to delay */
  992. X
  993. X/* X_WHEREIS */
  994. Xstruct fp_whereis {
  995. X    char    *fpw_rom0;    /* first address of 1st ROM */
  996. X    char    *fpw_rom1;    /* first address of 2nd ROM */
  997. X    char    *fpw_8530;    /* address of Zilog 8530 chip */
  998. X    char    *fpw_0port;    /* address of 1st 8-bit port */
  999. X    char    *fpw_1port;    /* address of 2nd 8-bit port */
  1000. X    char    *fpw_ram2;    /* address of 1st RAM location */
  1001. X    char    *fpw_ramtop;    /* address of last RAM location */
  1002. X};
  1003. X
  1004. X/* X_GETMEM and X_CLRMEM and X_BUFINIT */
  1005. Xstruct fp_mem {
  1006. X    short    fpm_count;    /* number of bytes */
  1007. X    char    *fpm_memp;    /* addr of allocated or to be cleared memory */
  1008. X};
  1009. X
  1010. X/* X_PROTECT */
  1011. Xstruct fp_proelem {        /* protection array element */
  1012. X    short    fpp_count;    /* number of bytes to protect */
  1013. X    char    *fpp_memp;    /* address of memory to protect */
  1014. X    short    fpp_chksum;    /* checksum of protected memory */
  1015. X};
  1016. X
  1017. Xstruct fp_protect {
  1018. X    short    fpt_oper;    /* type of protection operation and result */
  1019. X    short    fpt_count;    /* number of elements in protection array */
  1020. X    struct fp_proelem *fpt_elem; /* addr 1st element in protection array */
  1021. X};
  1022. X
  1023. X/* fpt_oper operations */
  1024. X#define    PR_FAIL        -1    /* result: check of checksums failed */
  1025. X#define    PR_PASS        0    /* result: check of checksums passed */
  1026. X#define    PR_PROTECT    1    /* operation: start protect via elem array */
  1027. X#define    PR_CHECK    2    /* operation: verify protect via elem array */
  1028. X#define    PR_CANCEL    3    /* operation: cancel protect via elem array */
  1029. X
  1030. X/* X_COPYMEM */
  1031. Xstruct fp_copy {
  1032. X    char    *fpc_from;    /* location to copy bytes from */
  1033. X    char    *fpc_to;    /* location to copy bytes to */
  1034. X    short    fpc_count;    /* number of bytes to copy */
  1035. X};
  1036. X
  1037. X/* X_PROMRAM */
  1038. Xstruct fp_bufinfo {
  1039. X    struct pbuf **fpb_pfree;/* beginning of the free list */
  1040. X    struct pqueue *fpb_pq;    /* received buffers queue (both networks) */
  1041. X    struct pqueue *fpb_sendq;/* Ethernet transmit queue */
  1042. X    short    fpb_bsize;    /* size of a buffer including header */
  1043. X    short    fpb_pbnfree;    /* pbufs on our free list */
  1044. X    short    fpb_pbndrops;    /* times failed to find space */
  1045. X    short    fpb_pbntypes[16];/* type specific pbuf allocations */
  1046. X};
  1047. X
  1048. Xstruct fp_state {
  1049. X    unsigned short    fps_atnet;  /* current net number for AppleTalk side */
  1050. X    unsigned short    fps_etnet;  /* current net number for Ethernet side */
  1051. X    unsigned char    fps_valid;  /* following AppleTalk node number valid */
  1052. X    unsigned char    fps_node;   /* current AppleTalk LAP node number */
  1053. X    unsigned char    fps_netw;   /* network number (not used) */
  1054. X    unsigned char    fps_bridge; /* last known bridge num on net if any */
  1055. X    unsigned char    fps_ether[6]; /* current ethernet address */
  1056. X#define    SNAMESIZE    21        /* extra char for null at end */
  1057. X    char    fps_name[SNAMESIZE];/* ascii name of the gateway */
  1058. X    char    fps_file[SNAMESIZE];/* ascii name of srec file last loaded */
  1059. X    unsigned char    fps_pforce; /* non-zero forces execution of prom loop */
  1060. X    unsigned char    fps_reserve;
  1061. X    unsigned char    fps_unused[70];
  1062. X};
  1063. X
  1064. Xstruct fp_abstats {
  1065. X    int    fpa_interrupts;    /* Appletalk interrupts */
  1066. X    int    fpa_ipackets;    /* packets received */
  1067. X    int    fpa_opackets;    /* packets transmitted */
  1068. X    int    fpa_crc;    /* crc errors */
  1069. X    int    fpa_ovr;    /* receive overrun errors */
  1070. X    int    fpa_iund;    /* receive underrun errors */
  1071. X    int    fpa_xx;
  1072. X    int    fpa_yy;
  1073. X    int    fpa_bad;    /* bad packets received */
  1074. X    int    fpa_coll;    /* collisions */
  1075. X    int    fpa_defer;    /* times deferred to other packets */
  1076. X    int    fpa_idleto;    /* packets that timed out waiting for the end */
  1077. X    int    fpa_zz;
  1078. X    int    fpa_nodata;    /* packets without data (nothing after rts) */
  1079. X    int    fpa_ound;    /* transmit underrun errors */
  1080. X    int    fpa_badddp;    /* bad ddp packets */
  1081. X    int    fpa_spur;    /* spurrious interrupts */
  1082. X};
  1083. X
  1084. Xstruct fp_iestats {
  1085. X    struct scb *fpi_scbptr;    /* status control block */
  1086. X    int    fpi_ipackets;    /* input packets */
  1087. X    int    fpi_opackets;    /* output packets */
  1088. X    int    fpi_ierrors;    /* input errors */
  1089. X    int    fpi_oerrors;    /* output errors */
  1090. X    int    fpi_cmdbusy;    /* busy waits */
  1091. X};
  1092. X
  1093. Xstruct fp_promram {
  1094. X    short    fpr_count;            /* number of valid ptrs that follow */
  1095. X    char    *fpr_jtable;            /* jump table */
  1096. X    struct fp_bufinfo *fpr_bufs;    /* buffer manager vector */
  1097. X    struct fp_state *fpr_state;    /* Prompt program's state vector */
  1098. X    struct fp_abstats *fpr_abstats;    /* AppleTalk statistics vector */
  1099. X    struct fp_iestats *fpr_iestats;    /* Ethernet statistics vector */
  1100. X    char    *fpr_1debug;            /* first level debug flag */
  1101. X    char    *fpr_2debug;            /* second level debug flag */
  1102. X    char    *fpr_3debug;            /* third level debug flag */
  1103. X    char    *fpr_unused[24];        /* remaining ptrs are not defined yet */
  1104. X};
  1105. X
  1106. X/* X_RESET */
  1107. X/* no parameters */
  1108. X
  1109. X/* X_USER0, X_USER1, X_USER2, X_USER3, X_USER4, X_USER5, X_USER6, X_USER7 */
  1110. X/* parameters (if any) defined by user */
  1111. X
  1112. X/* X_BUFGET */
  1113. Xstruct fp_bget {
  1114. X    struct pbuf *fpg_buf;    /* address of buffer returned */
  1115. X    short    fpg_type;    /* type of buffer to be "gotten" */
  1116. X};
  1117. X
  1118. X/* X_BUFFREE */
  1119. Xstruct fp_bfree {
  1120. X    struct pbuf *fpf_buf;    /* address of buffer to be freed */
  1121. X    struct pbuf *fpf_nxt;    /* the freed buffer's link before it was freed*/
  1122. X};
  1123. X
  1124. X/* X_BUFENQ and  X_BUFDEQ */
  1125. Xstruct fp_bqueue {
  1126. X    struct pqueue *fpq_q;    /* addr of queue to enqueue to / dequeue from */
  1127. X    struct pbuf *fpq_buf;    /* addr of buffer to be enqueued or dequeued */
  1128. X};
  1129. X
  1130. X/* X_ERR */
  1131. X/* no parameters */
  1132. X
  1133. X/* X_IDLE */
  1134. X/* no parameters */
  1135. X
  1136. X/* X_KLAP */
  1137. X/* The parameter is the address of a pbuf structure. See pbuf.h. */
  1138. X
  1139. X/* X_WHO */
  1140. X/* no parameters */
  1141. X
  1142. X/* X_CA86 */
  1143. X/* no parameters */
  1144. X
  1145. X/* X_RES86 */
  1146. X/* no parameters */
  1147. X
  1148. X/* X_CLRINT */
  1149. X/* no parameters */
  1150. X
  1151. X/* X_RCSID */
  1152. X/* The parameter is the address of a character array which is filled
  1153. X   in with the current RCS identification string of this PROM version. */
  1154. X
  1155. X/* X_EXPROM */
  1156. X/* no parameters */
  1157. X
  1158. X/* X_INIPROM */
  1159. X/* no parameters */
  1160. X
  1161. X/* X_RES8530 */
  1162. X/* no parameters */
  1163. X
  1164. X/* X_DMTSERV */
  1165. X/* no parameters */
  1166. X
  1167. X/* X_SREC */
  1168. X/* The parameter is the address of a character array which contains
  1169. X   the S-record to be interpreted and used by the gateway */
  1170. X
  1171. X/* X_SPL */
  1172. X/* The parameter is the address short which becomes the next processor priority
  1173. X   level. The previous priority level is returned at the same location */
  1174. X
  1175. X/* X_NOTIMP */
  1176. X/* no parameters */
  1177. X
  1178. END_OF_FILE
  1179. if test 8803 -ne `wc -c <'cmdidx.h'`; then
  1180.     echo shar: \"'cmdidx.h'\" unpacked with wrong size!
  1181. fi
  1182. # end of 'cmdidx.h'
  1183. fi
  1184. if test -f 'kboot.h' -a "${1}" != "-c" ; then 
  1185.   echo shar: Will not clobber existing file \"'kboot.h'\"
  1186. else
  1187. echo shar: Extracting \"'kboot.h'\" \(268 characters\)
  1188. sed "s/^X//" >'kboot.h' <<'END_OF_FILE'
  1189. X/*
  1190. X * $Header: /tmp_mnt/home/src/rand/etc/kboot/RCS/kboot.h,v 1.1 91/02/12 19:38:26 root Exp $
  1191. X *
  1192. X * $Log:    kboot.h,v $
  1193. X * Revision 1.1  91/02/12  19:38:26  root
  1194. X * Initial revision
  1195. X * 
  1196. X */
  1197. X
  1198. X#define KBOOTPROG        0x20000002
  1199. X#define KBOOTVERS        1
  1200. X#define KBOOTPROC_RELOAD    1
  1201. END_OF_FILE
  1202. if test 268 -ne `wc -c <'kboot.h'`; then
  1203.     echo shar: \"'kboot.h'\" unpacked with wrong size!
  1204. fi
  1205. # end of 'kboot.h'
  1206. fi
  1207. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  1208.   echo shar: Will not clobber existing file \"'Makefile'\"
  1209. else
  1210. echo shar: Extracting \"'Makefile'\" \(966 characters\)
  1211. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  1212. XKBOOT    = kboot.o getaa.o nitlib.o cmd.o icmp.o
  1213. XAARPD    = aarpd.o nitlib.o
  1214. XCFLAGS    = -g
  1215. XETCDIR    = /usr/rand/etc
  1216. XMANDIR    = /usr/rand/man/man8
  1217. XSRCS1    = aarpd.c getaa.c
  1218. XSRCS2    = cmd.c icmp.c kboot.c nitlib.c
  1219. XINCS    = aarpd.h appletalk.h config.h kbox.h patchlevel.h cmdidx.h kboot.h
  1220. XMANS    = aarpd.8 kboot.8
  1221. X
  1222. Xall:    aarpd kboot
  1223. X
  1224. Xkboot:    $(KBOOT)
  1225. X    cc -o kboot $(KBOOT)
  1226. X
  1227. Xaarpd:    $(AARPD)
  1228. X    cc -o aarpd $(AARPD)
  1229. X
  1230. Xinstall:
  1231. X    install -c kboot $(ETCDIR)/kboot
  1232. X    install -c aarpd $(ETCDIR)/aarpd
  1233. X
  1234. Xinstall.man:
  1235. X    install -c kboot.8 $(MANDIR)/kboot.8
  1236. X    install -c aarpd.8 $(MANDIR)/aarpd.8
  1237. X
  1238. Xclean:
  1239. X    rm -f aarpd kboot *.o core *~
  1240. X
  1241. Xshar:    $(SRCS1) $(SRCS2) $(INCS) $(MANS) Makefile README
  1242. X    shar -n1 -e2 $(SRCS2) > kboot1.shar
  1243. X    shar -n2 -e2 $(SRCS1) $(MANS) $(INCS) Makefile README > kboot2.shar
  1244. X
  1245. Xaarpd.o:    appletalk.h aarpd.h config.h patchlevel.h
  1246. Xkboot.o:    appletalk.h kbox.h cmdidx.h config.h kboot.h patchlevel.h
  1247. Xcmd.o:        appletalk.h kbox.h cmdidx.h config.h
  1248. Xicmp.o:        kbox.h config.h
  1249. Xnitlib.o:    config.h
  1250. END_OF_FILE
  1251. if test 966 -ne `wc -c <'Makefile'`; then
  1252.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1253. fi
  1254. # end of 'Makefile'
  1255. fi
  1256. if test -f 'README' -a "${1}" != "-c" ; then 
  1257.   echo shar: Will not clobber existing file \"'README'\"
  1258. else
  1259. echo shar: Extracting \"'README'\" \(4134 characters\)
  1260. sed "s/^X//" >'README' <<'END_OF_FILE'
  1261. XKboot is a program used to monitor, boot and configure Shiva Fastpaths
  1262. Xfrom a sun running SunOS 4.x.  It was originally written by Dan Tappan
  1263. Xof BBN, and ran under SunOS 3.5.  I've ported it to SunOS 4.x and
  1264. Xadded support for KSTAR version 8.0 and up.  Complaints, suggestions
  1265. Xand bug fixes can be sent to me.
  1266. X
  1267. XBob Schwartzkopf
  1268. XThe RAND Corporation
  1269. X1700 Main Street
  1270. XPO Box 2138
  1271. XSanta Monica, Ca. 90407-2138
  1272. Xbobs@rand.org
  1273. X
  1274. XThe kboot package consists of 2 separate programs, kboot and aarpd.
  1275. Xkboot is the program that monitors, configures and downloads Shiva
  1276. XFastpaths; aarpd implements some of the Appletalk ARP protocol.
  1277. XAarpd obtains an Appletalk node number dynamically for the
  1278. Xlocal host; kboot queries aarpd via an RPC call to learn the
  1279. Xnode number it should use when communicating with Fastpaths.
  1280. XPlease note that kboot and aarpd must be run on a sun on the same
  1281. Xethernet as the Fastpaths it will be talking to, as it depends on
  1282. Xbroadcasts to learn the Appeltalk addresses of each Fastpath specified
  1283. Xin its configuration file.
  1284. X
  1285. XTo build kboot and aarpd:
  1286. X
  1287. X    - Edit Makefile and set ETCDIR and MANDIR
  1288. X
  1289. X    - Edit config.h as necessary
  1290. X
  1291. X    - make
  1292. X
  1293. XTo install:
  1294. X
  1295. X    - make install
  1296. X
  1297. X    - make install.man
  1298. X
  1299. XOnce kboot and aarpd are installed you must create the following
  1300. Xfiles in ETCDIR:
  1301. X
  1302. Xkbootcf    - kboot configuration file.
  1303. XKSTAR    - KSTAR software, which comes with Fastpath Manager and is also
  1304. X      available via anonymous ftp from shiva.com.
  1305. X
  1306. XYou will also need a configuration file for each Fastpath.  These
  1307. Xfiles also are installed in ETCDIR with the name FASTPATH.config
  1308. Xor FASTPATH.state, where FASTPATH is the hostname of the Fastpath.
  1309. XThe .config files are ascii configuration files created by Fastpath
  1310. XManager.  The .state files are binary files created by kboot, which
  1311. Xhas an option to read the state of a currently running Fastpath
  1312. Xand save it to ETCDIR/FASTPATH.state.
  1313. X
  1314. XThe kboot configuration file (ETCDIR/kbootcf) contains a list of
  1315. XFASTPATH hostnames followed by the name of the KSTAR image to download.
  1316. XFor example, if you have 2 Fastpaths, one running 7.0.1 and the other
  1317. Xrunning 8.0, you could copy the appropriate KSTAR software to
  1318. XETCDIR/KSTAR-7.0.1 and ETCDIR/KSTAR-8.0.  Your kbootcf file would
  1319. Xthen look like:
  1320. X
  1321. X    fastpath1    KSTAR-7.0.1
  1322. X    fastpath2    KSTAR-8.0
  1323. X
  1324. XKboot learns the ethernet address of each configured Fastpath by
  1325. Xlooking at the ethernet header of the packets sent to it by each Fastpath.
  1326. XIt verifies that address with the address in the ethers NIS map (or
  1327. Xfile if you're not running NIS), so it is necessary that each
  1328. Xconfigured Fastpath have its ethernet address entered in the ethers map.
  1329. XKboot will complain about unknown Fastpaths if the ethers map
  1330. Xis not correct.
  1331. X
  1332. XNOTE:    The appletalk phase II zonelist (specified in Fastpath
  1333. X    Manager) is not included in the Fastpath configuration
  1334. X    structure.  Hence it is not downloaded when a Fastpath
  1335. X    is configured.  Instead, it is converted into s-records
  1336. X    and downloaded with the KSTAR software.  Since a zonelist
  1337. X    is not part of the configuration structure, the configuration
  1338. X    read by kboot and stored in ETCDIR/FASTPATH.state will not
  1339. X    contain the zonelist in use by the Fastpath.
  1340. X
  1341. X    The Fastpath Manager software does include the zonelist in
  1342. X    the ascii configuration file, and kboot knows how to read
  1343. X    it from there, convert it to s-records, and download it to
  1344. X    the Fastpath.  Hence, if you're running Appletalk phase II,
  1345. X    and have a non empty zonelist, you cannot use the binary
  1346. X    state files generated by kboot.  You must instead use
  1347. X    Fastpath manager to create an ascii configuration file which
  1348. X    includes the zonelist and copy it to ETCDIR.
  1349. X
  1350. X    Since I have no documentation on the Fastpath I had to reverse
  1351. X    engineer the format of the s-records, the address where they're
  1352. X    stored in the Fastpath, and how they're encoded in the
  1353. X    configuration file.  My thanks to Phil Budne of Shiva who
  1354. X    helped me with some of this stuff.  I don't guarantee this
  1355. X    code is perfect (especially since we're not running phase II
  1356. X    yet), however the one test I ran did seem to work.  Please
  1357. X    let me know if you have any problems with zonelists, or any
  1358. X    other part of kboot for that matter.
  1359. END_OF_FILE
  1360. if test 4134 -ne `wc -c <'README'`; then
  1361.     echo shar: \"'README'\" unpacked with wrong size!
  1362. fi
  1363. # end of 'README'
  1364. fi
  1365. echo shar: End of archive 2 \(of 2\).
  1366. cp /dev/null ark2isdone
  1367. MISSING=""
  1368. for I in 1 2 ; do
  1369.     if test ! -f ark${I}isdone ; then
  1370.     MISSING="${MISSING} ${I}"
  1371.     fi
  1372. done
  1373. if test "${MISSING}" = "" ; then
  1374.     echo You have unpacked both archives.
  1375.     rm -f ark[1-9]isdone
  1376. else
  1377.     echo You still need to unpack the following archives:
  1378.     echo "        " ${MISSING}
  1379. fi
  1380. ##  End of shell archive.
  1381. exit 0
  1382.  
  1383.  
  1384.