* (C) Copyright 1994 by Carnegie Mellon University
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
*/
#include<sys/types.h>
typedefunsignedbit32;
#define MAX_MAILBOX_PATH 4096
#define MAX_USER_FLAGS (16*8)
#define MAILBOX_HEADER_MAGIC "\241\002\213\015Cyrus mailbox header\n\"The best thing about this system was that it had lots of goals.\"\n\t--Jim Morris on Andrew\n"
#define MAILBOX_FORMAT_NORMAL 0
#define MAILBOX_FORMAT_NETNEWS 1
#define MAILBOX_MINOR_VERSION 0
#define FNAME_HEADER "/cyrus.header"
#define FNAME_INDEX "/cyrus.index"
#define FNAME_CACHE "/cyrus.cache"
#define FNAME_QUOTADIR "/quota/"
#define FNAME_LOGDIR "/log/"
#define QUOTA_UNITS (1024)
structquota{
FILE*file;
intlock_count;
char*root;
/* Information in quota file */
unsignedlongused;
intlimit;/* in QUOTA_UNITS */
};
structmailbox{
FILE*header;
FILE*index;
FILE*cache;
intheader_lock_count;
intindex_lock_count;
intseen_lock_count;
intpop_lock_count;
time_theader_mtime;
time_tindex_mtime;
longindex_ino;
/* Information in mailbox list */
char*name;
char*path;
char*acl;
longmyrights;
/* Information in header */
/* quota.root */
char*flagname[MAX_USER_FLAGS];
/* Information in index file */
bit32generation_no;
intformat;
intminor_version;
unsignedlongstart_offset;
unsignedlongrecord_size;
unsignedlongexists;
time_tlast_appenddate;
unsignedlonglast_uid;
unsignedlongquota_mailbox_used;
unsignedlongpop3_last_uid;
unsignedlonguidvalidity;
structquotaquota;
};
structindex_record{
unsignedlonguid;
time_tinternaldate;
time_tsentdate;
unsignedlongsize;
unsignedlongheader_size;
unsignedlongcontent_offset;
unsignedlongcache_offset;
time_tlast_updated;
bit32system_flags;
bit32user_flags[MAX_USER_FLAGS/32];
};
/* Offsets of index header fields */
#define OFFSET_GENERATION_NO 0
#define OFFSET_FORMAT 4
#define OFFSET_MINOR_VERSION 8
#define OFFSET_START_OFFSET 12
#define OFFSET_RECORD_SIZE 16
#define OFFSET_EXISTS 20
#define OFFSET_LAST_APPENDDATE 24
#define OFFSET_LAST_UID 28
#define OFFSET_QUOTA_MAILBOX_USED 32
#define OFFSET_POP3_LAST_UID 36
#define OFFSET_UIDVALIDITY 40
/* Offsets of index_record fields in index file */