[1628] | 1 | /* |
---|
| 2 | * |
---|
[1939] | 3 | * Copyright (C) 1988, 1989 by the Massachusetts Institute of Technology |
---|
| 4 | * Developed by the MIT Student Information Processing Board (SIPB). |
---|
| 5 | * For copying information, see the file mit-copyright.h in this release. |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | /* |
---|
| 9 | * |
---|
[1628] | 10 | * mtg.h -- Include file for things that define the structure of a meeting. |
---|
| 11 | * |
---|
| 12 | */ |
---|
| 13 | |
---|
[1629] | 14 | #include <discuss/types.h> |
---|
[1628] | 15 | |
---|
| 16 | /* |
---|
| 17 | * |
---|
| 18 | * A discuss meeting is a directory with various files in it, |
---|
| 19 | * like the 'trans' file, and the 'control' file. |
---|
| 20 | * |
---|
| 21 | * 'trans' contains the text of the transactions, one after another, |
---|
| 22 | * and is written in an append-only fashion. This reduces the chance that |
---|
| 23 | * actual transactions will become munged, and will make writing utilities |
---|
| 24 | * to hack meetings (expunging them, salvaging them) very easy. |
---|
| 25 | * |
---|
| 26 | * 'control' contains the other parts of the meeting. This contains the |
---|
| 27 | * latest information about the meeting itself (the superblock), and |
---|
| 28 | * how transactions are chained together. |
---|
| 29 | * |
---|
| 30 | */ |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | * |
---|
| 34 | * mtg_super -- Structure definition for the meeting superblk. This structure |
---|
| 35 | * sits at the base of the control file. |
---|
| 36 | * |
---|
| 37 | * Short name, long name, and chairman are strings, which we do |
---|
| 38 | * not hold in any fixed length field. They are stored at |
---|
| 39 | * location faddr, in the file, and have slen bytes, including |
---|
| 40 | * a trailing NULL. |
---|
| 41 | * |
---|
| 42 | */ |
---|
| 43 | typedef struct { |
---|
| 44 | int version; /* version of this structure */ |
---|
| 45 | int unique; /* magic number */ |
---|
| 46 | trn_nums first; /* first logical trn */ |
---|
| 47 | trn_nums last; /* last logical trn */ |
---|
| 48 | trn_nums lowest; /* lowest physical trn */ |
---|
| 49 | trn_nums highest; /* highest physical trn */ |
---|
| 50 | trn_nums highest_chain; /* highest chain number */ |
---|
| 51 | date_times date_created; /* when created */ |
---|
| 52 | date_times date_modified; /* when modified */ |
---|
| 53 | |
---|
| 54 | faddr long_name_addr; /* location of long name string */ |
---|
| 55 | faddr chairman_addr; /* location of chairman string */ |
---|
| 56 | slen long_name_len; /* len of long name */ |
---|
| 57 | slen chairman_len; /* len of chairman */ |
---|
[3472] | 58 | short flags; /* meeting flag (low-bit is public) */ |
---|
[1628] | 59 | faddr chain_start; /* starting address for chain structure */ |
---|
| 60 | faddr high_water; /* next byte to be used in control file */ |
---|
| 61 | faddr trn_fsize; /* next byte to be used in trn file */ |
---|
| 62 | faddr highest_trn_addr; /* address of highest trn addr */ |
---|
| 63 | } mtg_super; |
---|
| 64 | |
---|
[3472] | 65 | /* Masks for meeting flags */ |
---|
| 66 | #define MTG_PUBLIC 0x01 |
---|
| 67 | #define MTG_NOZEPHYR 0x02 |
---|
| 68 | |
---|
[1628] | 69 | /* version number */ |
---|
| 70 | #define MTG_SUPER_1 1 |
---|
| 71 | |
---|
| 72 | /* unique number */ |
---|
| 73 | #define MTG_SUPER_UNIQUE 100866 |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * |
---|
| 78 | * chain_blk -- Basic component of the chain structure, which is kept in the |
---|
| 79 | * control file. Since it is a fixed length structure, |
---|
| 80 | * the chain_blk's are just an array based at |
---|
| 81 | * mtg_super.chain_start, extending to the end of the file. |
---|
| 82 | * |
---|
| 83 | * The information in this structure describes two different |
---|
| 84 | * entities, which are merged for convenience's sake. The |
---|
| 85 | * first half describes the chaining information for the |
---|
| 86 | * transaction numbered 'current'. The second half describes |
---|
| 87 | * the chain numbered 'current'. We can do this because |
---|
| 88 | * we will never have more chains than transactions. |
---|
| 89 | * |
---|
| 90 | */ |
---|
| 91 | typedef struct { |
---|
| 92 | int version; /* version number */ |
---|
| 93 | int unique; /* magic number */ |
---|
| 94 | trn_nums current; /* this trn num */ |
---|
| 95 | trn_nums prev; /* previous non-deleted trn */ |
---|
| 96 | trn_nums next; /* next trn */ |
---|
| 97 | trn_nums pref; /* pref trn */ |
---|
| 98 | trn_nums nref; /* nref trn */ |
---|
| 99 | int trn_chain; /* which chain trn is in */ |
---|
| 100 | faddr trn_addr; /* location of trn */ |
---|
| 101 | short flags; /* transaction deleted, etc */ |
---|
| 102 | bool filler; /* filler -- must be zero */ |
---|
| 103 | |
---|
| 104 | /* the rest of this information describes the chain numbered current */ |
---|
| 105 | trn_nums chain_fref; /* fref of chain */ |
---|
| 106 | trn_nums chain_lref; /* lref of chain */ |
---|
| 107 | } chain_blk; |
---|
| 108 | |
---|
| 109 | /* version & magic */ |
---|
| 110 | #define CHAIN_BLK_1 1 |
---|
| 111 | #define CHAIN_BLK_UNIQUE 102966 |
---|
| 112 | |
---|
| 113 | /* flags for transactions */ |
---|
| 114 | #define CB_DELETED 1 |
---|
| 115 | |
---|
| 116 | /* |
---|
| 117 | * |
---|
| 118 | * trn_base -- base of transaction file. This structure records |
---|
| 119 | * historical information about the creation of this meeting. |
---|
| 120 | * This is kept just in case something gets destroyed. |
---|
| 121 | * |
---|
| 122 | */ |
---|
| 123 | |
---|
| 124 | typedef struct { |
---|
| 125 | int version; /* version of this structure */ |
---|
| 126 | int unique; /* magic number */ |
---|
| 127 | date_times date_created; /* when created */ |
---|
| 128 | faddr long_name_addr; /* location of long name string */ |
---|
| 129 | faddr chairman_addr; /* location of chairman string */ |
---|
| 130 | slen long_name_len; /* len of long name */ |
---|
| 131 | slen chairman_len; /* len of chairman */ |
---|
| 132 | bool public_flag; /* meeting is public */ |
---|
| 133 | } trn_base; |
---|
| 134 | |
---|
| 135 | #define TRN_BASE_1 1 |
---|
| 136 | #define TRN_BASE_UNIQUE 070476 |
---|
| 137 | |
---|
| 138 | /* |
---|
| 139 | * |
---|
| 140 | * trn_hdr -- defines the header of a transaction. This holds everything |
---|
| 141 | * but the chaining information, except it remembers what pref |
---|
| 142 | * was (so that chains can be reconstructed). |
---|
| 143 | * |
---|
| 144 | */ |
---|
| 145 | typedef struct { |
---|
| 146 | int version; /* version of this struct */ |
---|
| 147 | int unique; /* magic number */ |
---|
| 148 | trn_nums current; /* this transaction number */ |
---|
| 149 | trn_nums orig_pref; /* original pref trn */ |
---|
| 150 | date_times date_entered; /* date/time trn entered */ |
---|
| 151 | int num_lines; /* # lines in trn */ |
---|
| 152 | int num_chars; /* # chars in trn */ |
---|
| 153 | faddr prev_trn; /* addr of prev */ |
---|
| 154 | faddr subject_addr; /* address of subject */ |
---|
[2742] | 155 | faddr author_addr; /* addr of author & signature*/ |
---|
[1628] | 156 | faddr text_addr; /* address of trn text */ |
---|
| 157 | slen subject_len; /* subject len (incl NULL) */ |
---|
[2742] | 158 | slen author_len; /* author + signature len */ |
---|
[1628] | 159 | } trn_hdr; |
---|
| 160 | |
---|
| 161 | #define TRN_HDR_1 1 |
---|
| 162 | #define TRN_HDR_UNIQUE 102463 |
---|