Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4172:8982857c24fa HEAD
Moved dbox data structures to dbox-format.h which can be easily included
from elsewhere.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 12 Apr 2006 19:52:02 +0300 |
parents | b3251beec0d3 |
children | 1ba7983b814c |
files | src/lib-storage/index/dbox/Makefile.am src/lib-storage/index/dbox/dbox-format.h src/lib-storage/index/dbox/dbox-list.c src/lib-storage/index/dbox/dbox-storage.c src/lib-storage/index/dbox/dbox-storage.h |
diffstat | 5 files changed, 70 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/Makefile.am Wed Apr 12 19:51:38 2006 +0300 +++ b/src/lib-storage/index/dbox/Makefile.am Wed Apr 12 19:52:02 2006 +0300 @@ -23,6 +23,7 @@ noinst_HEADERS = \ dbox-file.h \ + dbox-format.h \ dbox-keywords.h \ dbox-storage.h \ dbox-sync.h \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lib-storage/index/dbox/dbox-format.h Wed Apr 12 19:52:02 2006 +0300 @@ -0,0 +1,66 @@ +#ifndef __DBOX_FORMAT_H +#define __DBOX_FORMAT_H + +#define DBOX_SUBSCRIPTION_FILE_NAME "dovecot.subscriptions" +#define DBOX_INDEX_PREFIX "dovecot.index" +#define DBOX_MAILDIR_NAME "Mails" +#define DBOX_MAIL_FILE_PREFIX "msg." +#define DBOX_MAIL_FILE_FORMAT DBOX_MAIL_FILE_PREFIX"%u" + +#define DBOX_KEYWORD_COUNT 64 +#define DBOX_KEYWORD_NAMES_RESERVED_SPACE (2048-sizeof(struct dbox_file_header)) + +/* Default rotation settings */ +#define DBOX_DEFAULT_ROTATE_SIZE (2*1024*1024) +#define DBOX_DEFAULT_ROTATE_MIN_SIZE (1024*16) +#define DBOX_DEFAULT_ROTATE_DAYS 0 + +struct dbox_file_header { + /* Size of the base header. sizeof(struct dbox_file_header) */ + unsigned char base_header_size_hex[4]; + /* Size of the full header, including keywords list and padding */ + unsigned char header_size_hex[8]; + /* Offset where to store the next mail. note that a mail may already + have been fully written here and added to uidlist, but this offset + just wasn't updated. In that case the append_offset should be + updated instead of overwriting the mail. */ + unsigned char append_offset_hex[16]; + /* Initial file creation time as UNIX timestamp. */ + unsigned char create_time_hex[8]; + /* Size of each message's header. */ + unsigned char mail_header_size_hex[4]; + /* If set, mail headers start always at given alignmentation. + Currently not supported. */ + unsigned char mail_header_align_hex[4]; + /* Number of keywords allocated for each mail (not necessarily used) */ + unsigned char keyword_count_hex[4]; + /* Offset for the keyword list inside the file header. */ + unsigned char keyword_list_offset_hex[8]; + + /* Non-zero if some mails have been marked as expunged in the file. */ + unsigned char have_expunged_mails; + + /* space reserved for keyword list and possible other future + extensions. */ + /* unsigned char [header_size - header_base_size]; */ +}; + +#define DBOX_MAIL_HEADER_MAGIC "\001\003" +struct dbox_mail_header { + /* This field acts as kind of a verification marker to make sure that + seeked offset is valid. So the magic value should be something that + normally doesn't occur in mails. */ + unsigned char magic[2]; + unsigned char uid_hex[8]; + unsigned char mail_size_hex[16]; + unsigned char received_time_hex[8]; + unsigned char answered; + unsigned char flagged; + unsigned char deleted; + unsigned char seen; + unsigned char draft; + unsigned char expunged; + /* unsigned char keywords[keywords_count]; */ +}; + +#endif
--- a/src/lib-storage/index/dbox/dbox-list.c Wed Apr 12 19:51:38 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-list.c Wed Apr 12 19:52:02 2006 +0300 @@ -129,7 +129,7 @@ ctx->next = dbox_list_subs; path = t_strconcat(istorage->dir, - "/" SUBSCRIPTION_FILE_NAME, NULL); + "/"DBOX_SUBSCRIPTION_FILE_NAME, NULL); ctx->subsfile_ctx = subsfile_list_init(storage, path); if (ctx->subsfile_ctx == NULL) {
--- a/src/lib-storage/index/dbox/dbox-storage.c Wed Apr 12 19:51:38 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-storage.c Wed Apr 12 19:52:02 2006 +0300 @@ -568,7 +568,7 @@ const char *path; path = t_strconcat(INDEX_STORAGE(storage)->dir, - "/" SUBSCRIPTION_FILE_NAME, NULL); + "/"DBOX_SUBSCRIPTION_FILE_NAME, NULL); return subsfile_set_subscribed(_storage, path, INDEX_STORAGE(storage)->temp_prefix,
--- a/src/lib-storage/index/dbox/dbox-storage.h Wed Apr 12 19:51:38 2006 +0300 +++ b/src/lib-storage/index/dbox/dbox-storage.h Wed Apr 12 19:52:02 2006 +0300 @@ -1,77 +1,16 @@ #ifndef __DBOX_STORAGE_H #define __DBOX_STORAGE_H -#define SUBSCRIPTION_FILE_NAME "dovecot.subscriptions" -#define DBOX_INDEX_PREFIX "dovecot.index" -#define DBOX_MAILDIR_NAME "Mails" -#define DBOX_MAIL_FILE_PREFIX "msg." -#define DBOX_MAIL_FILE_FORMAT DBOX_MAIL_FILE_PREFIX"%u" - -#define DBOX_KEYWORD_COUNT 64 -#define DBOX_KEYWORD_NAMES_RESERVED_SPACE (2048-sizeof(struct dbox_file_header)) - #include "index-storage.h" +#include "dbox-format.h" #define STORAGE(mbox_storage) \ (&(mbox_storage)->storage.storage) #define INDEX_STORAGE(mbox_storage) \ (&(mbox_storage)->storage) -/* Default rotation settings */ -#define DBOX_DEFAULT_ROTATE_SIZE (2*1024*1024) -#define DBOX_DEFAULT_ROTATE_MIN_SIZE (1024*16) -#define DBOX_DEFAULT_ROTATE_DAYS 0 - struct dbox_uidlist; -struct dbox_file_header { - /* Size of the base header. sizeof(struct dbox_file_header) */ - unsigned char base_header_size_hex[4]; - /* Size of the full header, including keywords list and padding */ - unsigned char header_size_hex[8]; - /* Offset where to store the next mail. note that a mail may already - have been fully written here and added to uidlist, but this offset - just wasn't updated. In that case the append_offset should be - updated instead of overwriting the mail. */ - unsigned char append_offset_hex[16]; - /* Initial file creation time as UNIX timestamp. */ - unsigned char create_time_hex[8]; - /* Size of each message's header. */ - unsigned char mail_header_size_hex[4]; - /* If set, mail headers start always at given alignmentation. - Currently not supported. */ - unsigned char mail_header_align_hex[4]; - /* Number of keywords allocated for each mail (not necessarily used) */ - unsigned char keyword_count_hex[4]; - /* Offset for the keyword list inside the file header. */ - unsigned char keyword_list_offset_hex[8]; - - /* Non-zero if some mails have been marked as expunged in the file. */ - unsigned char have_expunged_mails; - - /* space reserved for keyword list and possible other future - extensions. */ - /* unsigned char [header_size - header_base_size]; */ -}; - -#define DBOX_MAIL_HEADER_MAGIC "\001\003" -struct dbox_mail_header { - /* This field acts as kind of a verification marker to make sure that - seeked offset is valid. So the magic value should be something that - normally doesn't occur in mails. */ - unsigned char magic[2]; - unsigned char uid_hex[8]; - unsigned char mail_size_hex[16]; - unsigned char received_time_hex[8]; - unsigned char answered; - unsigned char flagged; - unsigned char deleted; - unsigned char seen; - unsigned char draft; - unsigned char expunged; - /* unsigned char keywords[keywords_count]; */ -}; - struct dbox_storage { struct index_storage storage; };