Add.
[shishi.git] / db / db.c
blob0d54852d79ba3d28101d14b82f9fcab5627f4fd2
1 /* db.c --- Definitions of all Shisa database backends.
2 * Copyright (C) 2003, 2004 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Shishi; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "info.h"
24 /* Get "file" database prototypes. */
25 #include "file.h"
27 static _Shisa_backend _shisa_backends[] = {
28 {"file",
29 shisa_file_init,
30 shisa_file_done,
31 shisa_file_enumerate_realms,
32 shisa_file_enumerate_principals,
33 shisa_file_principal_find,
34 shisa_file_principal_update,
35 shisa_file_principal_add,
36 shisa_file_principal_remove,
37 shisa_file_keys_find,
38 shisa_file_key_add,
39 shisa_file_key_update,
40 shisa_file_key_remove}
43 /* Return structure with function pointers implementing a Shisa
44 backend, given a name (e.g., "file"). */
45 _Shisa_backend *
46 _shisa_find_backend (const char *name)
48 size_t i;
49 for (i = 0; i < sizeof (_shisa_backends) / sizeof (_shisa_backends[0]); i++)
50 if (strcmp (name, _shisa_backends[i].name) == 0)
51 return &_shisa_backends[i];
53 return NULL;