source: trunk/athena/bin/discuss/server/mtg.h @ 11464

Revision 11464, 5.4 KB checked in by ghudson, 27 years ago (diff)
From kretch: add support for byte-swapping when a meeting was written out on a platform with the opposite endianness.
Line 
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 */
43typedef 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        short flags;                    /* meeting flag (low-bit 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/* Masks for meeting flags */
66#define MTG_PUBLIC      0x01
67#define MTG_NOZEPHYR    0x02
68
69/* version number */
70#define MTG_SUPER_1 1
71
72/* unique number and its byte-swapped equivalent */
73#define MTG_SUPER_UNIQUE 100866
74#define MTG_SUPER_UNIQUE_SWAP 42598656
75
76
77/*
78 *
79 * chain_blk -- Basic component of the chain structure, which is kept in the
80 *              control file.  Since it is a fixed length structure,
81 *              the chain_blk's are just an array based at
82 *              mtg_super.chain_start, extending to the end of the file.
83 *
84 *              The information in this structure describes two different
85 *              entities, which are merged for convenience's sake.  The
86 *              first half describes the chaining information for the
87 *              transaction numbered 'current'.  The second half describes
88 *              the chain numbered 'current'.  We can do this because
89 *              we will never have more chains than transactions.
90 *
91 */
92typedef struct {
93        int version;                            /* version number */
94        int unique;                             /* magic number */
95        trn_nums current;                       /* this trn num */
96        trn_nums prev;                          /* previous non-deleted trn */
97        trn_nums next;                          /* next trn */
98        trn_nums pref;                          /* pref trn */
99        trn_nums nref;                          /* nref trn */
100        int trn_chain;                          /* which chain trn is in */
101        faddr trn_addr;                         /* location of trn */
102        short flags;                            /* transaction deleted, etc */
103        bool filler;                            /* filler -- must be zero */
104
105        /* the rest of this information describes the chain numbered current */
106        trn_nums chain_fref;                    /* fref of chain */
107        trn_nums chain_lref;                    /* lref of chain */
108} chain_blk;
109
110/* version & magic */
111#define CHAIN_BLK_1 1
112#define CHAIN_BLK_UNIQUE 102966
113
114/* flags for transactions */
115#define CB_DELETED 1
116
117/*
118 *
119 * trn_base --  base of transaction file.  This structure records
120 *              historical information about the creation of this meeting.
121 *              This is kept just in case something gets destroyed.
122 *
123 */
124
125typedef struct {
126        int version;                    /* version of this structure */
127        int unique;                     /* magic number */
128        date_times date_created;        /* when created */
129        faddr long_name_addr;           /* location of long name string */
130        faddr chairman_addr;            /* location of chairman string */
131        slen long_name_len;             /* len of long name */
132        slen chairman_len;              /* len of chairman */
133        bool public_flag;               /* meeting is public */
134} trn_base;
135
136#define TRN_BASE_1 1
137#define TRN_BASE_UNIQUE 070476
138#define TRN_BASE_UNIQUE_SWAP 07634200000 /* byte-swapped version of
139                                          * TRN_BASE_UNIQUE */
140
141/*
142 *
143 *  trn_hdr --  defines the header of a transaction.  This holds everything
144 *              but the chaining information, except it remembers what pref
145 *              was (so that chains can be reconstructed).
146 *
147 */
148typedef struct {
149        int version;                            /* version of this struct */
150        int unique;                             /* magic number */
151        trn_nums current;                       /* this transaction number */
152        trn_nums orig_pref;                     /* original pref trn */
153        date_times date_entered;                /* date/time trn entered */
154        int num_lines;                          /* # lines in trn */
155        int num_chars;                          /* # chars in trn */
156        faddr prev_trn;                         /* addr of prev */
157        faddr subject_addr;                     /* address of subject */
158        faddr author_addr;                      /* addr of author & signature*/
159        faddr text_addr;                        /* address of trn text */
160        slen subject_len;                       /* subject len (incl NULL) */
161        slen author_len;                        /* author + signature len */
162} trn_hdr;
163
164#define TRN_HDR_1 1
165#define TRN_HDR_UNIQUE 102463
Note: See TracBrowser for help on using the repository browser.