1 /* info.h --- Internal header file for shisa library.
2 * Copyright (C) 2002, 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
36 #define _(String) dgettext (PACKAGE, String)
37 #define gettext_noop(String) String
38 #define N_(String) gettext_noop (String)
43 /* Get getline, ssize_t. */
47 #include "getsubopt.h"
52 typedef int (*_Shisa_db_init
) (Shisa
* dbh
,
54 const char *options
, void **state
);
55 typedef void (*_Shisa_db_done
) (Shisa
* dbh
, void *state
);
57 typedef int (*_Shisa_db_enumerate_realms
) (Shisa
* dbh
,
59 char ***realms
, size_t * nrealms
);
60 typedef int (*_Shisa_db_enumerate_principals
) (Shisa
* dbh
,
64 size_t * nprincipals
);
66 typedef int (*_Shisa_db_principal_find
) (Shisa
* dbh
,
69 const char *principal
,
70 Shisa_principal
* ph
);
71 typedef int (*_Shisa_db_principal_update
) (Shisa
* dbh
,
74 const char *principal
,
75 const Shisa_principal
* ph
);
76 typedef int (*_Shisa_db_principal_add
) (Shisa
* dbh
,
79 const char *principal
,
80 const Shisa_principal
* ph
,
81 const Shisa_key
* key
);
82 typedef int (*_Shisa_db_principal_remove
) (Shisa
* dbh
,
85 const char *principal
);
87 typedef int (*_Shisa_db_keys_find
) (Shisa
* dbh
,
90 const char *principal
,
91 const Shisa_key
* hint
,
92 Shisa_key
*** keys
, size_t * nkeys
);
93 typedef int (*_Shisa_db_key_add
) (Shisa
* dbh
,
96 const char *principal
,
97 const Shisa_key
* key
);
98 typedef int (*_Shisa_db_key_update
) (Shisa
* dbh
,
101 const char *principal
,
102 const Shisa_key
* oldkey
,
103 const Shisa_key
* newkey
);
104 typedef int (*_Shisa_db_key_remove
) (Shisa
* dbh
,
107 const char *principal
,
108 const Shisa_key
* key
);
110 struct _Shisa_backend
115 _Shisa_db_enumerate_realms enumerate_realms
;
116 _Shisa_db_enumerate_principals enumerate_principals
;
117 _Shisa_db_principal_find principal_find
;
118 _Shisa_db_principal_update principal_update
;
119 _Shisa_db_principal_add principal_add
;
120 _Shisa_db_principal_remove principal_remove
;
121 _Shisa_db_keys_find keys_find
;
122 _Shisa_db_key_add key_add
;
123 _Shisa_db_key_update key_update
;
124 _Shisa_db_key_remove key_remove
;
126 typedef struct _Shisa_backend _Shisa_backend
;
130 _Shisa_backend
*backend
;
133 typedef struct _Shisa_db _Shisa_db
;
141 /* Return structure with function pointers implementing a Shisa
142 backend, given a name (e.g., "file"). */
143 extern _Shisa_backend
*_shisa_find_backend (const char *name
);