doveadm-dump-index.c revision c93aca832ee532010ead91b85fa9f614132e1be2
/* Copyright (c) 2007-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "hex-binary.h"
#include "file-lock.h"
#include "message-parser.h"
#include "message-part-serialize.h"
#include "mail-index-private.h"
#include "mail-cache-private.h"
#include "mail-index-modseq.h"
#include "doveadm-dump.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct index_vsize_header {
};
struct maildir_index_header {
};
struct mbox_index_header {
};
struct sdbox_index_header {
};
struct mdbox_index_header {
};
struct mdbox_mail_index_record {
};
struct obox_mail_index_record {
unsigned char guid[GUID_128_SIZE];
unsigned char oid[GUID_128_SIZE];
};
struct mobox_mail_index_header {
};
struct mobox_mail_index_record {
};
struct mobox_map_mail_index_header {
};
struct mobox_map_mail_index_record {
};
struct mailbox_list_index_record {
};
struct fts_index_header {
};
struct virtual_mail_index_header {
};
struct virtual_mail_index_mailbox_record {
};
struct virtual_mail_index_record {
};
struct mdbox_mail_index_map_record {
};
{
unsigned int i;
printf("uid validity ............. = %u (%s)\n", hdr->uid_validity, unixdate2str(hdr->uid_validity));
if (hdr->minor_version == 0) {
} else {
}
}
const struct mail_index_ext *ext)
{
const void *data;
void *buf;
return;
/* add some padding, since we don't bother to handle undersized
headers correctly */
printf("header\n");
printf("header\n");
printf("header\n");
printf(" - sync_size .. = %llu\n",
printf(" - mailbox_guid = %s\n",
printf("header\n");
printf(" - mailbox_guid ...... = %s\n",
printf("header\n");
printf(" - mailbox_guid .. = %s\n",
printf("header\n");
printf(" - mailbox_guid ...... = %s\n",
printf("header\n");
printf("header\n");
printf(" - highest_modseq = %llu\n",
(unsigned long long)hdr->highest_modseq);
printf("header\n");
printf(" - last_indexed_uid ..... = %u\n",
printf(" - settings_checksum .... = %u\n",
const struct virtual_mail_index_mailbox_record *rec;
const unsigned char *name;
unsigned int i;
printf("header\n");
printf(" - highest_modseq = %llu\n",
(unsigned long long)rec->highest_modseq);
}
} else {
printf("header ........ = %s\n",
}
}
{
const struct mail_index_ext *extensions;
unsigned int i, count;
else
count = 0;
if (count == 0) {
printf("no extensions\n");
return;
}
for (i = 0; i < count; i++) {
printf("-- Extension %u --\n", i);
} T_END;
}
}
{
const unsigned int *kw_indexes;
const char *const *keywords;
unsigned int i, count;
printf("-- Keywords --\n");
return;
if (count == 0)
return;
for (i = 0; i < count; i++)
}
{
const char *str;
switch (type & ~MAIL_CACHE_DECISION_FORCED) {
case MAIL_CACHE_DECISION_NO:
str = "no";
break;
case MAIL_CACHE_DECISION_TEMP:
str = "tmp";
break;
case MAIL_CACHE_DECISION_YES:
str = "yes";
break;
default:
}
if ((type & MAIL_CACHE_DECISION_FORCED) != 0)
return str;
}
#define CACHE_TYPE_IS_FIXED_SIZE(type) \
((type) == MAIL_CACHE_FIELD_FIXED_SIZE || \
(type) == MAIL_CACHE_FIELD_BITMASK)
{
switch (type) {
return "fix";
return "var";
case MAIL_CACHE_FIELD_STRING:
return "str";
case MAIL_CACHE_FIELD_BITMASK:
return "bit";
case MAIL_CACHE_FIELD_HEADER:
return "hdr";
default:
}
}
{
const struct mail_cache_header *hdr;
(void)mail_cache_open_and_verify(cache);
if (MAIL_CACHE_IS_UNUSABLE(cache)) {
printf("cache is unusable\n");
return;
}
printf("file_seq ............. = %u (%s) (%d compressions)\n",
printf("field_header_offset .. = %u (0x%08x nontranslated)\n",
printf("-- Cache fields --\n");
&count);
" # Name Type Size Dec Last used\n");
for (i = 0; i < cache->file_fields_count; i++) {
else
printf(" - ");
printf("%-4s %.16s\n",
}
}
{
}
}
}
static void
{
const struct message_part *part;
const char *error;
return;
}
}
{
struct mail_cache_lookup_iterate_ctx iter;
const struct mail_cache_field *field;
struct mail_cache_iterate_field iter_field;
const void *data;
unsigned int size;
int ret;
printf(" - cache offset=%u size=%u, prev_offset = %u\n",
}
str_truncate(str, 0);
}
/* fall through */
case MAIL_CACHE_FIELD_BITMASK:
break;
case MAIL_CACHE_FIELD_STRING:
if (size > 0)
break;
case MAIL_CACHE_FIELD_HEADER: {
int i;
for (i = 0;; i++) {
if (i == 0 && size == 0) {
/* header doesn't exist */
break;
}
size = 0;
break;
}
if (lines[i] == 0)
break;
if (i > 0)
}
if (i == 1 && size > 0 &&
size--;
if (size > 0)
break;
}
case MAIL_CACHE_FIELD_COUNT:
i_unreached();
break;
}
}
if (ret < 0)
printf(" - broken cache\n");
}
{
if ((flags & MAIL_ANSWERED) != 0)
if ((flags & MAIL_FLAGGED) != 0)
if ((flags & MAIL_DELETED) != 0)
if ((flags & MAIL_DRAFT) != 0)
return "";
}
{
const struct mail_index_record *rec;
const struct mail_index_registered_ext *ext;
const void *data;
unsigned int i, ext_count;
bool expunged;
printf("RECORD: seq=%u, uid=%u, flags=0x%02x %s\n",
for (i = 0; i < ext_count; i++) {
continue;
str_truncate(str, 0);
} else {
}
}
}
}
{
}
{
const char *p;
else
return NULL;
else
}
{
struct mail_index *index;
struct mail_index_view *view;
struct mail_cache_view *cache_view;
}
if (uid == 0) {
}
T_BEGIN {
printf("\n");
} T_END;
}
}
}
static bool test_dump_index(const char *path)
{
struct mail_index *index;
bool ret;
return FALSE;
if (ret > 0)
return ret;
}
struct doveadm_cmd_dump doveadm_cmd_dump_index = {
"index",
};