1 | /* |
---|
2 | * |
---|
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 | * |
---|
10 | * mtg.h -- Include file for things that define the structure of a meeting. |
---|
11 | * |
---|
12 | */ |
---|
13 | |
---|
14 | #include <discuss/types.h> |
---|
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 */ |
---|
58 | bool public_flag; /* meeting is public */ |
---|
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 | |
---|
65 | /* version number */ |
---|
66 | #define MTG_SUPER_1 1 |
---|
67 | |
---|
68 | /* unique number */ |
---|
69 | #define MTG_SUPER_UNIQUE 100866 |
---|
70 | |
---|
71 | |
---|
72 | /* |
---|
73 | * |
---|
74 | * chain_blk -- Basic component of the chain structure, which is kept in the |
---|
75 | * control file. Since it is a fixed length structure, |
---|
76 | * the chain_blk's are just an array based at |
---|
77 | * mtg_super.chain_start, extending to the end of the file. |
---|
78 | * |
---|
79 | * The information in this structure describes two different |
---|
80 | * entities, which are merged for convenience's sake. The |
---|
81 | * first half describes the chaining information for the |
---|
82 | * transaction numbered 'current'. The second half describes |
---|
83 | * the chain numbered 'current'. We can do this because |
---|
84 | * we will never have more chains than transactions. |
---|
85 | * |
---|
86 | */ |
---|
87 | typedef struct { |
---|
88 | int version; /* version number */ |
---|
89 | int unique; /* magic number */ |
---|
90 | trn_nums current; /* this trn num */ |
---|
91 | trn_nums prev; /* previous non-deleted trn */ |
---|
92 | trn_nums next; /* next trn */ |
---|
93 | trn_nums pref; /* pref trn */ |
---|
94 | trn_nums nref; /* nref trn */ |
---|
95 | int trn_chain; /* which chain trn is in */ |
---|
96 | faddr trn_addr; /* location of trn */ |
---|
97 | short flags; /* transaction deleted, etc */ |
---|
98 | bool filler; /* filler -- must be zero */ |
---|
99 | |
---|
100 | /* the rest of this information describes the chain numbered current */ |
---|
101 | trn_nums chain_fref; /* fref of chain */ |
---|
102 | trn_nums chain_lref; /* lref of chain */ |
---|
103 | } chain_blk; |
---|
104 | |
---|
105 | /* version & magic */ |
---|
106 | #define CHAIN_BLK_1 1 |
---|
107 | #define CHAIN_BLK_UNIQUE 102966 |
---|
108 | |
---|
109 | /* flags for transactions */ |
---|
110 | #define CB_DELETED 1 |
---|
111 | |
---|
112 | /* |
---|
113 | * |
---|
114 | * trn_base -- base of transaction file. This structure records |
---|
115 | * historical information about the creation of this meeting. |
---|
116 | * This is kept just in case something gets destroyed. |
---|
117 | * |
---|
118 | */ |
---|
119 | |
---|
120 | typedef struct { |
---|
121 | int version; /* version of this structure */ |
---|
122 | int unique; /* magic number */ |
---|
123 | date_times date_created; /* when created */ |
---|
124 | faddr long_name_addr; /* location of long name string */ |
---|
125 | faddr chairman_addr; /* location of chairman string */ |
---|
126 | slen long_name_len; /* len of long name */ |
---|
127 | slen chairman_len; /* len of chairman */ |
---|
128 | bool public_flag; /* meeting is public */ |
---|
129 | } trn_base; |
---|
130 | |
---|
131 | #define TRN_BASE_1 1 |
---|
132 | #define TRN_BASE_UNIQUE 070476 |
---|
133 | |
---|
134 | /* |
---|
135 | * |
---|
136 | * trn_hdr -- defines the header of a transaction. This holds everything |
---|
137 | * but the chaining information, except it remembers what pref |
---|
138 | * was (so that chains can be reconstructed). |
---|
139 | * |
---|
140 | */ |
---|
141 | typedef struct { |
---|
142 | int version; /* version of this struct */ |
---|
143 | int unique; /* magic number */ |
---|
144 | trn_nums current; /* this transaction number */ |
---|
145 | trn_nums orig_pref; /* original pref trn */ |
---|
146 | date_times date_entered; /* date/time trn entered */ |
---|
147 | int num_lines; /* # lines in trn */ |
---|
148 | int num_chars; /* # chars in trn */ |
---|
149 | faddr prev_trn; /* addr of prev */ |
---|
150 | faddr subject_addr; /* address of subject */ |
---|
151 | faddr author_addr; /* addr of author & signature*/ |
---|
152 | faddr text_addr; /* address of trn text */ |
---|
153 | slen subject_len; /* subject len (incl NULL) */ |
---|
154 | slen author_len; /* author + signature len */ |
---|
155 | } trn_hdr; |
---|
156 | |
---|
157 | #define TRN_HDR_1 1 |
---|
158 | #define TRN_HDR_UNIQUE 102463 |
---|