/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hash.h"
#include "llist.h"
#include "settings-parser.h"
#include "master-service-private.h"
#include "master-service-settings.h"
#include "master-service-settings-cache.h"
/* we start with just a guess. it's updated later. */
struct settings_entry {
const char *local_name;
};
struct master_service_settings_cache {
const char *module;
const char *service_name;
/* global settings for this service (after they've been read) */
/* cache for other settings (local_ip/local_name set) */
/* separate list for entries whose parser=global_parser */
/* local_name, local_ip => struct settings_entry */
/* Initial size for new settings entry pools */
/* number of bytes malloced by cached settings entries
(doesn't count memory used by hash table or global sets) */
};
struct master_service_settings_cache *
const char *module, const char *service_name)
{
1024*12);
return cache;
}
{
/* parsers need to be deinitialized, because they reference the pool */
}
}
}
static bool
const struct master_service_settings_input *input)
{
if (cache->service_uses_local) {
return FALSE;
}
if (cache->service_uses_remote) {
return FALSE;
}
return TRUE;
}
static bool
const struct master_service_settings_input *input,
const struct setting_parser_context **parser_r)
{
if (!cache->done_initial_lookup)
return FALSE;
return TRUE;
}
return FALSE;
}
if (cache->service_uses_remote)
return FALSE;
/* see if we have it already in cache. if local_name is specified,
don't even try to use local_ip (even though we have it), because
there may be different settings specifically for local_name */
input->local_name);
}
}
}
return TRUE;
}
return FALSE;
}
static void
struct settings_entry *entry)
{
}
static struct setting_parser_context *
const struct master_service_settings_input *input,
const struct master_service_settings_output *output,
struct setting_parser_context *parser)
{
char *entry_local_name;
/* these are same as global settings */
}
}
if (cache->service_uses_remote) {
/* for now we don't try to handle caching remote IPs */
return parser;
}
return parser;
if (!output->used_local) {
so we'll find them */
/* free the oldest and reuse its pool */
} else {
}
if (!output->used_local) {
entry);
} else {
}
}
}
entry_local_name) == NULL);
}
}
}
const struct master_service_settings_input *input,
const struct dynamic_settings_parser *dyn_parsers,
const struct setting_parser_context **parser_r,
const char **error_r)
{
return 0;
if (dyn_parsers != NULL) {
}
return -1;
if (!cache->done_initial_lookup) {
}
*error_r = "BUG: config unexpectedly returned local settings";
return -1;
}
*error_r = "BUG: config unexpectedly returned remote settings";
return -1;
}
return 0;
}