1 /* BEGIN INCLUDE FILE: BFT.H */ 2 3 /* COMPILER: Lattice C, V2.15 */ 4 5 6 /* HISTORY COMMENTS: 7 1) change(86-10-31,Rohs), approve(87-07-13,MCR7580), audit(87-07-13,Leskiw), 8 install(87-08-07,MR12.1-1072): 9 Created. 10 2) change(87-10-23,Flegel), approve(87-10-23,MCR7787), 11 audit(88-01-26,DGHowe): 12 Added appropriate changes to support multiple queue entries and having 13 Multics perform ALL of the queue handling. 14 END HISTORY COMMENTS */ 15 16 /* NOTES 17 18 In this implementation of the compiler (Lattice C, V2.15), the type "long" 19 is a 4-character / 32-bit entity. This is important as the flags in the 20 data_block MUST be 32 bits long - hence the use of type "long". 21 */ 22 23 /************************************************************** 24 Constants 25 ***************************************************************/ 26 27 #define MAXARGSTRING 256 /* size of argument string passed to remote */ 28 #define STRINGSIZE 118 /* string size of error messages and such */ 29 #define PATHNAMESIZE 168 /* size of maximum pathname expected */ 30 #define ENTRYNAMESIZE 13 /* Size of a PC entryname */ 31 #define STACKSIZE 25000 /* amount of stack space allocated to BFT */ 32 #define DISKBUFF 1024 /* number bytes read in during a disk access */ 33 #define BUFFSIZE 110 /* number bytes of the file in each "packet" */ 34 #define MU_ENTRYNAME_SIZE 33 /* Size of Multics entrynames */ 35 36 #define BFT_MIN_PRIORITY 1 /* Lowest priority level */ 37 #define BFT_MAX_PRIORITY 4 /* Highest priority level */ 38 #define BFT_PATH_ID 32 /* Request ID = pathname */ 39 #define BFT_TIME_ID 33 /* Request ID = ID */ 40 #define BFT_ENTRY_ID 34 /* Request ID = Entry */ 41 42 #define BFT_LOUD 32 /* Loud shutdown message */ 43 #define BFT_QUIET 33 /* Quiet shutdown */ 44 45 #define BFT_FIRST 32 /* Find first match */ 46 #define BFT_NEXT 33 /* Find next match */ 47 48 #define DELIMITER "\377" /* delimter between args in the argstring */ 49 50 /************************************************************** 51 Error Codes 52 ***************************************************************/ 53 /* The sys_error_table and bft_error_table exists in bfterror.c */ 54 55 #define BFT_BASE_ERROR 100 /* Base error number */ 56 57 #ifndef D_SYSERR 58 extern char *sys_error_table[]; 59 extern int sys_error_table_size; 60 extern int errno; 61 #endif 62 63 #ifndef D_BFTERR 64 extern char *bft_error_table[]; 65 extern int bft_error_table_size; 66 #endif 67 68 #define issyserr(c) ((c >= 0)&&(c <= sys_error_table_size)) 69 #define isbfterr(c) ((c >= BFT_BASE_ERROR)&&(c <= bft_error_table_size + BFT_BASE_ERROR)) 70 #define getsyserr(c) ((issyserr(c)) ? sys_error_table[c] : NULL) 71 #define getbfterr(c) ((isbfterr(c)) ? bft_error_table[c-BFT_BASE_ERROR] : NULL) 72 73 #define BFT_NOERROR 0 /* No error */ 74 #define BFT_INVALID_PRIORITY 101 /* Invalid priority */ 75 #define BFT_INVALID_MINOR 102 /* Invalid minor capability */ 76 #define BFT_BADARG 103 /* Bad command argument */ 77 #define BFT_BADOPT 104 /* Bad option to argument */ 78 #define BFT_EXPECTING 105 /* Argument expected */ 79 #define BFT_NOARG 106 /* No argument */ 80 #define BFT_BAD_REQUEST_ID 107 /* Invalid request id type */ 81 #define BFT_BAD_PATH 108 /* Bad pathname specified */ 82 #define BFT_INCOMPATIBLE 109 /* Incomaptible control args */ 83 84 /************************************************************** 85 Control Flags 86 ***************************************************************/ 87 /* Transfer mode flags - used to mask with BFT_DATA.x_flags */ 88 89 #define BFT_NOTIFY 0x01 /* Completion notification */ 90 #define BFT_BINARY 0x02 /* Binary mode */ 91 #define BFT_INITIATED 0x04 /* Compatibility with Multics switches */ 92 #define BFT_ALLOCATED 0x08 /* Compatibility with Multics switches */ 93 94 /************************************************************** 95 Structures 96 ***************************************************************/ 97 98 /* Data pointer structure for use with BFT. */ 99 100 typedef struct 101 { 102 long inpos; /* source file input position */ 103 int inbuffpos; /* source file buffer input position */ 104 int inbufflen; /* source file input buffer length */ 105 int outbuffpos; /* destination file buffer output position */ 106 long outpos; /* file position of next write */ 107 char source_file [PATHNAMESIZE]; /* source file name */ 108 long source_flags; /* source transfer modes */ 109 char destination_file[PATHNAMESIZE]; /* destination file name */ 110 long destination_flags; /* destination transfer modes */ 111 char inbuffer [DISKBUFF+1]; /* buffer for file Input */ 112 char outbuffer [DISKBUFF+1]; /* buffer for file Output */ 113 char expand_dirname [PATHNAMESIZE]; /* Path for expanding paths with */ 114 } bft_data, *bft_data_ptr; 115 116 /************************************************************** 117 BFT minor capability numbers 118 ***************************************************************/ 119 120 /* BFT internal minor capabilities */ 121 122 #define ADD_TO_FETCH_QUEUE 64 /* adds the transfer request to the queue */ 123 #define ADD_TO_STORE_QUEUE 65 /* adds the transfer request to the queue */ 124 #define CHECK_FILE_LENGTH 66 /* finds the length of the destination file */ 125 #define INITIATE_FETCH 67 /* opens the destination file on the remote */ 126 #define BFT_SHUT_DOWN 68 /* Shutdown bft */ 127 #define POSITION_FILE_POINTER 69 /* opens a file and for read at location x */ 128 #define REC_DATA 70 /* receive a packet of a file a writes it */ 129 #define REC_EOF 71 /* closes the destination file */ 130 #define REC_FETCH 72 /* recover fetch */ 131 #define REC_STORE 73 /* recover store */ 132 #define READ_ERROR 74 /* read error encounted on the remote */ 133 #define INITIATE_STORE 75 /* see if the remote can start a store */ 134 #define WRITE_ERROR 76 /* called when the remote couldnt write */ 135 #define SEND_DATA 77 /* reads a packet of the file and sends it */ 136 #define CANCEL_REQUEST 78 /* Cancel a request from the queue */ 137 #define EXPAND_PC_PATH 80 /* expand pathname */ 138 #define FULL_PC_PATH 81 /* expanded pc path */ 139 140 /* END INCLUDE FILE: BFT.H */