Update gnulib files.
[shishi.git] / db / info.h
blobc66be377dc2afefb0c80cff47078194ec3140caa
1 /* info.h --- Internal header file for shisa library.
2 * Copyright (C) 2002, 2003, 2004, 2007 Simon Josefsson
4 * This file is part of Shishi.
6 * Shishi is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Shishi is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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, see http://www.gnu.org/licenses or write
18 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 * Floor, Boston, MA 02110-1301, USA
23 #ifndef _INFO_H
24 #define _INFO_H
26 #if HAVE_CONFIG_H
27 # include "config.h"
28 #endif
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stdarg.h>
33 #include <ctype.h>
34 #include <string.h>
36 #include "gettext.h"
37 #define _(String) dgettext (PACKAGE, String)
38 #define gettext_noop(String) String
39 #define N_(String) gettext_noop (String)
41 /* Get xmalloc. */
42 #include "xalloc.h"
44 /* Get prototypes. */
45 #include "shisa.h"
47 typedef int (*_Shisa_db_init) (Shisa * dbh,
48 const char *location,
49 const char *options, void **state);
50 typedef void (*_Shisa_db_done) (Shisa * dbh, void *state);
52 typedef int (*_Shisa_db_enumerate_realms) (Shisa * dbh,
53 void *state,
54 char ***realms, size_t * nrealms);
55 typedef int (*_Shisa_db_enumerate_principals) (Shisa * dbh,
56 void *state,
57 const char *realm,
58 char ***principals,
59 size_t * nprincipals);
61 typedef int (*_Shisa_db_principal_find) (Shisa * dbh,
62 void *state,
63 const char *realm,
64 const char *principal,
65 Shisa_principal * ph);
66 typedef int (*_Shisa_db_principal_update) (Shisa * dbh,
67 void *state,
68 const char *realm,
69 const char *principal,
70 const Shisa_principal * ph);
71 typedef int (*_Shisa_db_principal_add) (Shisa * dbh,
72 void *state,
73 const char *realm,
74 const char *principal,
75 const Shisa_principal * ph,
76 const Shisa_key * key);
77 typedef int (*_Shisa_db_principal_remove) (Shisa * dbh,
78 void *state,
79 const char *realm,
80 const char *principal);
82 typedef int (*_Shisa_db_keys_find) (Shisa * dbh,
83 void *state,
84 const char *realm,
85 const char *principal,
86 const Shisa_key * hint,
87 Shisa_key *** keys, size_t * nkeys);
88 typedef int (*_Shisa_db_key_add) (Shisa * dbh,
89 void *state,
90 const char *realm,
91 const char *principal,
92 const Shisa_key * key);
93 typedef int (*_Shisa_db_key_update) (Shisa * dbh,
94 void *state,
95 const char *realm,
96 const char *principal,
97 const Shisa_key * oldkey,
98 const Shisa_key * newkey);
99 typedef int (*_Shisa_db_key_remove) (Shisa * dbh,
100 void *state,
101 const char *realm,
102 const char *principal,
103 const Shisa_key * key);
105 struct _Shisa_backend
107 const char *name;
108 _Shisa_db_init init;
109 _Shisa_db_done done;
110 _Shisa_db_enumerate_realms enumerate_realms;
111 _Shisa_db_enumerate_principals enumerate_principals;
112 _Shisa_db_principal_find principal_find;
113 _Shisa_db_principal_update principal_update;
114 _Shisa_db_principal_add principal_add;
115 _Shisa_db_principal_remove principal_remove;
116 _Shisa_db_keys_find keys_find;
117 _Shisa_db_key_add key_add;
118 _Shisa_db_key_update key_update;
119 _Shisa_db_key_remove key_remove;
121 typedef struct _Shisa_backend _Shisa_backend;
123 struct _Shisa_db
125 _Shisa_backend *backend;
126 void *state;
128 typedef struct _Shisa_db _Shisa_db;
130 struct Shisa
132 _Shisa_db *dbs;
133 size_t ndbs;
136 /* Return structure with function pointers implementing a Shisa
137 backend, given a name (e.g., "file"). */
138 extern _Shisa_backend *_shisa_find_backend (const char *name);
140 #endif /* _INFO_H */