home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / net / defs.h < prev    next >
C/C++ Source or Header  |  1980-02-17  |  4KB  |  161 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. # define THEKEY "hellotherekids"
  3. /*
  4.    get all the machine dependencies, standard I/O, and the
  5.    configuration definitions (LOCAL machine, etc.)
  6. */
  7.  
  8. # include "mach.h"
  9. # include <stdio.h>
  10. # include "Paths.h"
  11.  
  12. # define min(a,b) (a > b ? b : a)
  13. # define getremote(S) (remtable[(S)-'a'])
  14.  
  15. /* adjustable parameters, may differ per machine */
  16.  
  17. # define MAXBREAD     3
  18. # define ATIME         20
  19. # define DBV         0
  20. # define BLOCKSIZE     500
  21. # define SIZE         100
  22. # define INITFILE    "/usr/net/initfile"
  23. # define NSEND         20
  24. # define SAMPL         3600        /* 1 hour = 3600 */
  25. # define BIGSAMPL     64800L        /* 18 hours = 64800L */
  26. # define LINKS        9
  27.  
  28. /* adjustable parameters, must be same on all machines */
  29.  
  30. # define MAXFILE     100000L
  31. # define VMAJOR        1
  32. # define VMINOR     0
  33. # define TIMEBASE     282098011L
  34.  
  35. /* non-adjustable constants */
  36.  
  37. # define FNS 40
  38. # define BFS 260
  39. # define NS 10
  40. # define BROKENREAD -2
  41. # define WRITEFAIL -3
  42. # define INCR 040
  43. # define MINSIZE 50
  44.  
  45. /* flags for packet type (pcode) */
  46. # define RESET 01
  47. # define REQUEST 02
  48. # define ACK 04
  49. # define PURGE 020
  50.  
  51. /* flags for mach type */
  52. # define M_CORY 1
  53. # define M_CC 2
  54. # define M_VAX 3
  55. # define M_INGRES 4
  56. # define M_SRC 5
  57.  
  58. /* codes for cflag, powers of two */
  59. # define F_NONOTIFY 04
  60.  
  61. /* tokens, returned by parser */
  62. # define MACHINE 1
  63. # define LOGIN 2
  64. # define PASSWORD 3
  65. # define NOTIFY 5
  66. # define COMMAND 7
  67. # define ID 8
  68. # define YES 9
  69. # define DEFAULT 10
  70. # define WRITE 11
  71. # define NO 12
  72. # define FORCE 13
  73. # define LOCALTOK 14
  74. # define LINK 15
  75. # define SPEED 16
  76. # define VAXTOVAX 17
  77. # define LENGTH 18
  78. # define DEBUGTOK 19
  79. # define ALTIME 20
  80. # define ALCOUNT 21
  81.  
  82.  
  83. int debugflg;
  84. char remote, local;        /* must be global, remote is not initialized*/
  85. char netcmd[],senddir[], resfile[], logfile[], writecmd[], mailcmd[], Bsh[];
  86. char cmd[BFS*2], realcmd[BFS*2];
  87. char device[20], machtype[], remtable[];
  88. long ltime;
  89. short masterseqno, lastseqno;
  90. extern errno;
  91. extern char *sys_errlist[];
  92. int datasize;
  93. char ttystr[20];
  94. FILE *readtty,*writetty;
  95. int readfd, writefd, pipesim;
  96. int maxbread, atime;
  97.  
  98. /* used by parser which reads netrc and initfile */
  99. struct tokstruct {
  100.     char *tokstr;
  101.     int tval;
  102.     } toktab[];
  103.  
  104. /* used by parser to parse filenames, e.g. mach:file */
  105. struct fd {
  106.     char mach;
  107.     char *fn;
  108.     };
  109.  
  110. /* used to pass around info about user */
  111. struct info {
  112.     char login[NS];
  113.     char mpasswd[20];
  114.     int muid;        /* combines uid and gid for FUID */
  115.     int mgid;        /* unused for FUID */
  116.     char dir[FNS];
  117.     char loginshell[FNS];
  118.     char localname[NS];
  119.     int jobno;
  120.     char defcmd[FNS];
  121.     char force;        /* if true, always prompt for login and pass */
  122.     char nonotify;        /* if true, don't send anything back */
  123.     char nowrite;        /* if true, mail rather than write to user */
  124.     } status;
  125. struct stat statbuf;
  126. struct direct dirbuf;
  127. struct packet {
  128.     short seqno;
  129.     char pcode;
  130.     char len;
  131.     char chksum;
  132.     char data[1];
  133.     };
  134.     
  135. /* the chksum is only on a per-perpacket level,
  136.    which is not enough.
  137.    There should be a checksum on the entire file as well.
  138.    */
  139. struct dumpstruc {
  140.     long shorttime, longtime, elaptot, waittime, waittot;    /* in secs */
  141.     long outime, ostime;                /* in 60ths sec */
  142.     long nbytesent,nbytercv, bytetot;        /* in bytes */
  143.     int nretrans, nabnormal, nloop;
  144.     int ncksum,npacksent,npackrcv;
  145.     int nnetcp,nnetlpr,nsmail,nnetmail,nresp,nnet;
  146.     int npass, nsend, nsendfail;
  147.     } dump;
  148. struct bstruct {
  149.     char *bname;
  150.     char bmach;
  151.     } btable[];
  152.  
  153. /* functions */
  154.  
  155. char *calloc(), *crypt(), *ctime(), *getenv(), *longname();
  156. char *getun(), *comptime(), *getpass(), *handlesp();
  157. FILE *mopen(), *fdopen();
  158. struct passwd *getpwnam(), *getpwuid();
  159. struct packet *getpacket();
  160. long fixuplong(),atol();
  161.