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