5a84ae1a42017755eac0e52a1bede87e90bcc3c3
[mmh] / h / dropsbr.h
1
2 /*
3  * dropsbr.h -- definitions for maildrop-style files
4  */
5
6 /*
7  * A file which is formatted like a maildrop may have a corresponding map
8  * file which is an index to the bounds of each message.  The first record
9  * of such an map is special, it contains:
10  *
11  *      d_id    = number of messages in file
12  *      d_size  = version number of map
13  *      d_start = last message read
14  *      d_stop  = size of file
15  *
16  *  Each record after that contains:
17  *
18  *      d_id    = BBoard-ID: of message, or similar info
19  *      d_size  = size of message in ARPA Internet octets (\n == 2 octets)
20  *      d_start = starting position of message in file
21  *      d_stop  = stopping position of message in file
22  *
23  * Note that d_start/d_stop do NOT include the message delimiters, so
24  * programs using the map can simply fseek to d_start and keep reading
25  * until the position is at d_stop.
26  */
27
28 /*
29  * various formats for maildrop files
30  */
31 #define OTHER_FORMAT 0
32 #define MBOX_FORMAT  1
33 #define MMDF_FORMAT  2
34
35 #define DRVRSN 3
36
37 struct drop {
38     int   d_id;
39     int   d_size;
40     off_t d_start;
41     off_t d_stop;
42 };
43
44 /*
45  * prototypes
46  */
47 int mbx_open (char *, int, uid_t, gid_t, mode_t);
48 int mbx_read (FILE *, long, struct drop **, int);
49 int mbx_write(char *, int, FILE *, int, long, long, off_t, int, int);
50 int mbx_copy (char *, int, int, int, int, char *, int);
51 int mbx_size (int, off_t, off_t);
52 int mbx_close (char *, int);
53 char *map_name (char *);
54 int map_read (char *, long, struct drop **, int);
55 int map_write (char *, int, int, long, off_t, off_t, long, int, int);
56 int map_chk (char *, int, struct drop *, long, int);
57