File: info.h

package info (click to toggle)
shishi 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 22,144 kB
  • ctags: 7,865
  • sloc: ansic: 61,153; sh: 12,212; yacc: 1,219; makefile: 1,164; perl: 624; sed: 16
file content (140 lines) | stat: -rw-r--r-- 4,057 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* info.h --- Internal header file for shisa library.
 * Copyright (C) 2002, 2003, 2004, 2007  Simon Josefsson
 *
 * This file is part of Shishi.
 *
 * Shishi is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Shishi is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Shishi; if not, see http://www.gnu.org/licenses or write
 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA
 *
 */

#ifndef _INFO_H
#define _INFO_H

#if HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>

#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)

/* Get xmalloc. */
#include "xalloc.h"

/* Get prototypes. */
#include "shisa.h"

typedef int (*_Shisa_db_init) (Shisa * dbh,
			       const char *location,
			       const char *options, void **state);
typedef void (*_Shisa_db_done) (Shisa * dbh, void *state);

typedef int (*_Shisa_db_enumerate_realms) (Shisa * dbh,
					   void *state,
					   char ***realms, size_t * nrealms);
typedef int (*_Shisa_db_enumerate_principals) (Shisa * dbh,
					       void *state,
					       const char *realm,
					       char ***principals,
					       size_t * nprincipals);

typedef int (*_Shisa_db_principal_find) (Shisa * dbh,
					 void *state,
					 const char *realm,
					 const char *principal,
					 Shisa_principal * ph);
typedef int (*_Shisa_db_principal_update) (Shisa * dbh,
					   void *state,
					   const char *realm,
					   const char *principal,
					   const Shisa_principal * ph);
typedef int (*_Shisa_db_principal_add) (Shisa * dbh,
					void *state,
					const char *realm,
					const char *principal,
					const Shisa_principal * ph,
					const Shisa_key * key);
typedef int (*_Shisa_db_principal_remove) (Shisa * dbh,
					   void *state,
					   const char *realm,
					   const char *principal);

typedef int (*_Shisa_db_keys_find) (Shisa * dbh,
				    void *state,
				    const char *realm,
				    const char *principal,
				    const Shisa_key * hint,
				    Shisa_key *** keys, size_t * nkeys);
typedef int (*_Shisa_db_key_add) (Shisa * dbh,
				  void *state,
				  const char *realm,
				  const char *principal,
				  const Shisa_key * key);
typedef int (*_Shisa_db_key_update) (Shisa * dbh,
				     void *state,
				     const char *realm,
				     const char *principal,
				     const Shisa_key * oldkey,
				     const Shisa_key * newkey);
typedef int (*_Shisa_db_key_remove) (Shisa * dbh,
				     void *state,
				     const char *realm,
				     const char *principal,
				     const Shisa_key * key);

struct _Shisa_backend
{
  const char *name;
  _Shisa_db_init init;
  _Shisa_db_done done;
  _Shisa_db_enumerate_realms enumerate_realms;
  _Shisa_db_enumerate_principals enumerate_principals;
  _Shisa_db_principal_find principal_find;
  _Shisa_db_principal_update principal_update;
  _Shisa_db_principal_add principal_add;
  _Shisa_db_principal_remove principal_remove;
  _Shisa_db_keys_find keys_find;
  _Shisa_db_key_add key_add;
  _Shisa_db_key_update key_update;
  _Shisa_db_key_remove key_remove;
};
typedef struct _Shisa_backend _Shisa_backend;

struct _Shisa_db
{
  _Shisa_backend *backend;
  void *state;
};
typedef struct _Shisa_db _Shisa_db;

struct Shisa
{
  _Shisa_db *dbs;
  size_t ndbs;
};

/* Return structure with function pointers implementing a Shisa
   backend, given a name (e.g., "file"). */
extern _Shisa_backend *_shisa_find_backend (const char *name);

#endif /* _INFO_H */