dict.c revision eddd9bf1a1369aea4a2715f6be1137da6d17d293
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2005-2007 Dovecot authors, see the included COPYING file */
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenstatic ARRAY_DEFINE(dict_drivers, struct dict *);
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenstatic struct dict *dict_driver_lookup(const char *name)
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainen unsigned int i, count;
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen for (i = 0; i < count; i++) {
072f06b60d69fe9456c3fffe20e72a7d09f2825dTimo Sirainen if (dict_driver_lookup(driver->name) != NULL) {
395682d473b161c86165e7b9323ce4e45afb94bdTimo Sirainen i_fatal("dict_driver_register(%s): Already registered",
395682d473b161c86165e7b9323ce4e45afb94bdTimo Sirainenvoid dict_driver_unregister(struct dict *driver)
d979c1179d55ad86e40f869e48ef3e4db9c817b5Timo Sirainen unsigned int i, count;
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainen for (i = 0; i < count; i++) {
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainenstruct dict *dict_init(const char *uri, enum dict_data_type value_type,
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen const char *p, *name;
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen i_error("Dictionary URI is missing ':': %s", uri);
363929157786b549c80630bda3c3575f5115c6c5Timo Sirainen dict->v.init(dict, p+1, value_type, username);
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainenint dict_lookup(struct dict *dict, pool_t pool, const char *key,
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainen const char **value_r)
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainen return dict->v.lookup(dict, pool, key, value_r);
18a41cbd38f83429b790414c1159c097af4a59b8Timo Sirainendict_iterate_init(struct dict *dict, const char *path,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen return dict->v.iterate_init(dict, path, flags);
e2d268e9531227ead6a98466ecf3c046c857ef70Timo Sirainen return ctx->dict->v.iterate(ctx, key_r, value_r);
c9c4494be2e6e8664ed2a37f74c2989c9b0ffe65Aki Tuomivoid dict_iterate_deinit(struct dict_iterate_context *ctx)
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenstruct dict_transaction_context *dict_transaction_begin(struct dict *dict)
8eba883232f80178b60fa416f73292bf5f990fecTimo Sirainenint dict_transaction_commit(struct dict_transaction_context *ctx)
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenvoid dict_transaction_rollback(struct dict_transaction_context *ctx)
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainenvoid dict_set(struct dict_transaction_context *ctx,
c9c4494be2e6e8664ed2a37f74c2989c9b0ffe65Aki Tuomivoid dict_unset(struct dict_transaction_context *ctx,
c115c742f730e312d6b6ab5064595cd0d8b4e26eTimo Sirainen const char *key)