Annotation of 40BSD/cmd/berknet/defs.h, revision 1.1

1.1     ! root        1: /*
        !             2:    get all the machine dependencies, standard I/O, and the
        !             3:    configuration definitions (LOCAL machine, etc.)
        !             4: */
        !             5: 
        !             6: # include <stdio.h>
        !             7: 
        !             8: # define min(a,b) (a > b ? b : a)
        !             9: # define getremote(S) (remtable[(S)-'a'])
        !            10: 
        !            11: /* adjustable parameters, may differ per machine */
        !            12: 
        !            13: # define MAXBREAD      3
        !            14: # define ATIME                 20
        !            15: # define DBV           0
        !            16: # define BLOCKSIZE     500
        !            17: # define SIZE          100
        !            18: # define INITFILE      "/usr/net/initfile"
        !            19: # define NSEND                 20
        !            20: # define SAMPL                 3600            /* 1 hour = 3600 */
        !            21: # define BIGSAMPL      64800L          /* 18 hours = 64800L */
        !            22: # define LINKS         9
        !            23: # define SUPERUSER     0
        !            24: 
        !            25: /* adjustable parameters, must be same on all machines */
        !            26: 
        !            27: /* MAXFILE is the file size limit.  If changed on one machine 
        !            28:    but not the others, files bigger than the common minimum will
        !            29:    be flushed with no guarantee of err msgs. Thus if one link
        !            30:    is to be of a different limit than the others, make sure the users
        !            31:    know this.
        !            32: */
        !            33: # define MAXFILE       100000L
        !            34: # define MAXFILELARGE  500000L
        !            35: /* the version of the protocol the network speaks */
        !            36: # define VMAJOR                1
        !            37: # define VMINOR        0
        !            38: /* the time constant added to all time stamps sent around the net */
        !            39: # define TIMEBASE      282098011L
        !            40: /* the number of mail forwarding hops allowed before looping is detected */
        !            41: # define MAXHOPS       30
        !            42: /* the buffer size used in prot.c */
        !            43: # define MAXNBUF 1024
        !            44: 
        !            45: /* non-adjustable constants */
        !            46: 
        !            47: /* PARMLIST = max size of variable length parm list used in protocol */
        !            48: # define PARMLIST 2000
        !            49: /* FNS = max length of file name string */
        !            50: # define FNS 80
        !            51: /* NS = length of UNIX user name*/
        !            52: # define NS 10
        !            53: /* returned by prot.c */
        !            54: # define BROKENREAD -2
        !            55: # define WRITEFAIL -3
        !            56: # define INCR 040
        !            57: # define MINSIZE 50
        !            58: # define TRUE 1
        !            59: # define FALSE 0
        !            60: 
        !            61: /* flags for packet type (pcode) */
        !            62: # define REQUEST 02
        !            63: # define ACK 04
        !            64: # define PURGE 020
        !            65: 
        !            66: /* flags for mach type */
        !            67: # define M_CC 2
        !            68: # define M_INGRES 4
        !            69: # define M_OTHER 6
        !            70: 
        !            71: /* codes for cflag, powers of two, max (8 bits - 'a'), others may be added */
        !            72: 
        !            73: /* F_QUIET means send back only error messages and output of programs,
        !            74:    don't send back confimation with no data */
        !            75: /* F_NONOTIFY means don't send back anything, ever, 
        !            76:    even if there are errors (used for responses, etc.) */
        !            77: 
        !            78: # define F_QUIET       02
        !            79: # define F_NONOTIFY    04
        !            80: 
        !            81: 
        !            82: /* 
        !            83:    at this point bring in the locally-dependent definitions.
        !            84:    this way the above parms may be altered.
        !            85: */
        !            86: # include "mach.h"
        !            87: # include "Paths.h"
        !            88: /* bring in the exit codes */
        !            89: # include <sysexits.h>
        !            90: 
        !            91: 
        !            92: /* structure declarations */
        !            93: struct packet {
        !            94:        short seqno;
        !            95:        char pcode;
        !            96:        short len;
        !            97:        char chksum;
        !            98:        char data[1];
        !            99:        };
        !           100:        
        !           101: struct packet *packptr;        /* just used to get the sizeof to work */
        !           102: # define ACKLENGTH (sizeof *packptr - 1)
        !           103: /* these are the lengths to be read and writ if using high-speed block dev. */
        !           104: /* must be bigger than ACKLENGTH */
        !           105: # define SENDLEN 256
        !           106: 
        !           107: /* the chksum is only on a per-perpacket level,
        !           108:    which is not enough.
        !           109:    There should be a checksum on the entire file as well.
        !           110:    */
        !           111: struct dumpstruc {
        !           112:        long longtime, elaptot;                         /* in secs */
        !           113:        long nbytesent,nbytercv, bytetot;               /* in bytes */
        !           114:        long lastndays;                                 /* in days */
        !           115:        long braw, brawtot;                             /* raw bytes*/
        !           116:        int nretrans, nabnormal, nloop;
        !           117:        int ncksum,npacksent,npackrcv;
        !           118:        int nnetcp,nnetlpr,nsmail,nnetmail,nresp,nnet;
        !           119:        int npass, nsend, nsendfail;
        !           120:        };
        !           121: 
        !           122: struct bstruct {
        !           123:        char *bname;
        !           124:        char bmach;
        !           125:        };
        !           126: /* functions */
        !           127: 
        !           128: char *calloc(), *crypt(), *ctime(), *getenv(), *longname();
        !           129: char *comptime(), *getpass(), *handlesp(), *SnCurrent();
        !           130: FILE *fopen(), *fdopen(), *popen(), *mailopen();
        !           131: struct passwd *getpwnam(), *getpwuid(), *PwdCurrent(), *getpwent();
        !           132: struct packet *getpacket();
        !           133: long atol();
        !           134: 
        !           135: /* constant variables */
        !           136: extern char *sys_errlist[];
        !           137: char netcmd[],senddir[], resfile[], Bsh[];
        !           138: char machtype[], remtable[];
        !           139: char local;
        !           140: 
        !           141: /* variables which are modified */
        !           142: extern errno;
        !           143: int debugflg;
        !           144: char remote;           /* must be global, remote is not initialized*/
        !           145: 
        !           146: /* various structure types */
        !           147: 
        !           148: /* used to pass around info about user */
        !           149: struct userinfo {
        !           150:        char    login[NS];
        !           151:        char    mpasswd[20];
        !           152:        int     muid;           /* combines uid and gid for FUID */
        !           153:        int     mgid;           /* unused for FUID */
        !           154:        int     jobno;          /* CC job no, 32767 if null */
        !           155:        char    dir[FNS];       /* login directory */
        !           156:        char    loginshell[FNS];/* login shell */
        !           157:        char    localname[NS];
        !           158:        char    defcmd[FNS];
        !           159:        char    force;          /* if true, always prompt for login and pass */
        !           160:        char    nonotify;       /* if true, don't send anything back */
        !           161:        char    nowrite;        /* if true, mail rather than write to user */
        !           162:        char    quiet;          /* if true, only send a response back if rc !=0
        !           163:                                   or if there is stdout or stderr */
        !           164:        } ;
        !           165: 
        !           166: /* unique message - id sent with requests */
        !           167: struct messageid {
        !           168:        char    msg_mch;        /* machine it is on */
        !           169:        int     msg_pid;        /* process id */
        !           170:        long    msg_ltime;      /* current time */
        !           171: };
        !           172: 
        !           173: /* header which describes information transferred across the link */
        !           174: struct header {
        !           175:        char    hd_mchto;               /* 1-letter code for dest. machine */
        !           176:        char    hd_mchfrom;             /* 1-letter code for source machine */
        !           177:        char    hd_snto[NS];            /* login name on mchto mach */
        !           178:        char    hd_snfrom[NS];          /* login name on mchfrom mach */
        !           179:        char    hd_spasswd[20];         /* password for snto */
        !           180:        char    hd_code;                /* request code in protocol */
        !           181:        char    hd_fnonotify;           /* if true, don't send anything back */
        !           182:        char    hd_fquiet;              /* if true, only send back if error */
        !           183:        char    hd_vmajor;              /* major version number */
        !           184:        char    hd_vminor;              /* minor version number */
        !           185:        char    hd_sttyname[20];        /* tty user is on,e.g. /dev/tty0 */
        !           186:        char    hd_scmdact[BUFSIZ];     /* the actual cmd the net will exec */
        !           187:        char    hd_scmdvirt[BUFSIZ];    /* the cmd the user thinks he is exec */
        !           188:        long    hd_lttytime;            /* the time for tty login in utmp */
        !           189:        long    hd_ltimesent;           /* the time the request was sent */
        !           190:        char    hd_srespfile[FNS];      /* response file name, if sepecified */
        !           191:        char    hd_sinfile[FNS];        /* remote input file, if sepecified */
        !           192:        char    hd_soutfile[FNS];       /* remote output file, if sepecified */
        !           193:        /* sent but not computed (always 32767) across the net */
        !           194:        int     hd_ijobno;              /* CC job number, if applicable */
        !           195:        /* computed, not transferred across the net */
        !           196:        char    hd_addrto[FNS];         /* address of dest. acct */
        !           197:        char    hd_addrfrom[FNS];       /* address of source acct */
        !           198:        /* not now being sent over, will be someday, don't use now */
        !           199:        char    hd_sencpasswd[20];      /* encrypted passwd with nbs 2way enc */
        !           200:        int     hd_ifilemode;           /* file mode for netcp */
        !           201:        char    hd_sfndefault[FNS];     /* default filename ext, for netcp */
        !           202:        int     hd_uidfrom;             /* userid on the from machine */
        !           203:        int     hd_gidfrom;             /* groupid on the from machine */
        !           204:        struct messageid hd_mesgid;     /* message id unique to this request */
        !           205:        char    hd_fcompressed;         /* if true, data is compressed */
        !           206:        char    hd_facctpair;           /* if true, is an accnt pair w/o pwds */
        !           207:        char    hd_addrreplyto[FNS];    /* reply to this address */
        !           208: };
        !           209: 
        !           210: /* 
        !           211:        this structure defines the various parameters the daemon and testing
        !           212:        programs use -- most of the info comes from netrc.c
        !           213:        NOTE-- thi structure is initialized in netrc.c
        !           214:        don't add members without changing that structure
        !           215: */
        !           216: struct daemonparms {
        !           217:        int     dp_inspeed;     /* for stty, 7=300, 9=1200, 13=9600 baud */
        !           218:        int     dp_outspeed;    /* for stty, 7=300, 9=1200, 13=9600 baud */
        !           219:        int     dp_maxbread;    /* number of read time outs allowed */
        !           220:        int     dp_atime;       /* time to set alarm for timeout */
        !           221:        int     dp_oatime;      /* default time alarm for timeout */
        !           222:        char    dp_device[20];  /* name of the network file, e.g. /dev/net-A*/
        !           223:        int     dp_datasize;    /* length of data part of packet */
        !           224:        int     dp_onlyuid;     /* if non-zero, only send this uid's things */
        !           225:        int     dp_linefd;      /* daemon should read and write from this */
        !           226:        char    dp_usehispeed;  /* if true, use high-speed link */
        !           227:        char    dp_hispeedlink[20];/* device name of high speed link */
        !           228:        short   dp_sndorcv;     /* if <0, only send, if > 0, only recieve */
        !           229:        int     dp_linedis;     /* line disc we use, normal is 0 */ 
        !           230:        int     dp_pipesim;     /* simulate with pipes */
        !           231:        FILE    *dp_rdfile;     /* if pipesim then should read from this */
        !           232:        int     dp_pwritefd;    /* if pipesim then should write from this */
        !           233:        int     dp_use8bit;     /* use 8 bit protocol */
        !           234: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.