mail-cache-lookup.c revision b44a50ea4123f21dfc8e1b6c602f690fd9721b67
/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "byteorder.h"
#include "mail-cache-private.h"
#define CACHE_PREFETCH 1024
const char *
{
unsigned char *buf;
if (offset == 0)
return NULL;
return NULL;
idx);
return NULL;
}
if (data_size == 0) {
"Header %u points to empty string", idx);
return NULL;
}
return NULL;
}
idx);
return NULL;
}
"Header %u points to invalid string", idx);
return NULL;
}
}
const char *const *
{
char *str;
return NULL;
}
}
unsigned int idx)
{
const char *str;
int i;
/* t_strsplit() is a bit slow, so we cache it */
t_push();
for (i = 0; i < MAIL_CACHE_HEADERS_COUNT; i++) {
cache->split_offsets[i] =
cache->split_headers[i] =
}
t_pop();
}
}
struct mail_cache_record *
int index_offset)
{
struct mail_cache_record *cache_rec;
if (!index_offset)
if (offset == 0)
return NULL;
sizeof(*cache_rec) + CACHE_PREFETCH) < 0)
return NULL;
return NULL;
}
return NULL;
}
if (size > CACHE_PREFETCH) {
return NULL;
}
return NULL;
}
return cache_rec;
}
struct mail_cache_record *
struct mail_cache_record *rec)
{
struct mail_cache_record *next;
return NULL;
}
return next;
}
struct mail_cache_record *
enum mail_cache_field fields)
{
const struct mail_index_record *rec;
struct mail_index_map *map;
return NULL;
return NULL;
/* it's being appended in some transaction */
return NULL;
}
return NULL;
/* FIXME: we should check if newer file is available? */
return NULL;
}
}
enum mail_cache_field
{
struct mail_cache_record *cache_rec;
enum mail_cache_field fields = 0;
}
return fields;
}
struct mail_cache_record *cache_rec,
enum mail_cache_field field,
{
unsigned char *buf;
unsigned int mask;
int i;
continue;
/* all records are at least 32bit. we have to check this
before getting data_size. */
"Record continues outside it's allocated size");
return FALSE;
}
if ((mask & MAIL_CACHE_FIXED_MASK) != 0)
else {
}
if (next_offset > rec_size) {
"Record continues outside it's allocated size");
return FALSE;
}
if (data_size == 0) {
"Field size is 0");
return FALSE;
}
return TRUE;
}
}
i_unreached();
return FALSE;
}
enum mail_cache_field field,
{
struct mail_cache_record *cache_rec;
}
}
return FALSE;
}
enum mail_cache_field field,
{
void *data;
return FALSE;
return TRUE;
}
const char *
enum mail_cache_field field)
{
const void *data;
return NULL;
"String field %x doesn't end with NUL", field);
return NULL;
}
return data;
}
enum mail_cache_field field,
{
const void *data;
return FALSE;
if (buffer_size != size) {
i_panic("cache: fixed field %x wrong size "
}
return TRUE;
}
{
// FIXME:
return 0;
}