Debian Codegraph @

pkcs11/gkm/gkm-store.h

raw
1 /*
2 * gnome-keyring
3 *
4 * Copyright (C) 2008 Stefan Walter
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * This program 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 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __GKM_STORE_H__
22 #define __GKM_STORE_H__
23
24 #include <glib-object.h>
25
26 #include "gkm-types.h"
27
28 #include "pkcs11/pkcs11.h"
29
30 enum {
31 GKM_STORE_IS_INTERNAL = 0x01,
32 GKM_STORE_IS_SENSITIVE = 0x02
33 };
34
35 #define GKM_TYPE_STORE (gkm_store_get_type ())
36 #define GKM_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_STORE, GkmStore))
37 #define GKM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_STORE, GkmStoreClass))
38 #define GKM_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_STORE))
39 #define GKM_IS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_STORE))
40 #define GKM_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_STORE, GkmStoreClass))
41
42 typedef struct _GkmStoreClass GkmStoreClass;
43 typedef struct _GkmStorePrivate GkmStorePrivate;
44
45 struct _GkmStore {
46 GObject parent;
47 GkmStorePrivate *pv;
48 };
49
50 struct _GkmStoreClass {
51 GObjectClass parent_class;
52
53 /* Virtual methods */
54
55 CK_RV (*read_value) (GkmStore *self, GkmObject *object, CK_ATTRIBUTE_PTR attr);
56
57 void (*write_value) (GkmStore *self, GkmTransaction *transaction, GkmObject *object, CK_ATTRIBUTE_PTR attr);
58 };
59
60 typedef CK_RV (*GkmStoreValidator) (GkmObject *object,
61 CK_ATTRIBUTE_PTR attr);
62
63 GType gkm_store_get_type (void);
64
65 gboolean gkm_store_lookup_schema (GkmStore *self,
66 CK_ATTRIBUTE_TYPE type,
67 guint *flags);
68
69 void gkm_store_register_schema (GkmStore *self,
70 CK_ATTRIBUTE_PTR type_and_default,
71 GkmStoreValidator validator,
72 guint flags);
73
74 void gkm_store_set_attribute (GkmStore *self,
75 GkmTransaction *transaction,
76 GkmObject *object,
77 CK_ATTRIBUTE_PTR attr);
78
79 void gkm_store_write_value (GkmStore *self,
80 GkmTransaction *transaction,
81 GkmObject *object,
82 CK_ATTRIBUTE_PTR attr);
83
84 CK_RV gkm_store_get_attribute (GkmStore *self,
85 GkmObject *object,
86 CK_ATTRIBUTE_PTR attr);
87
88 gconstpointer gkm_store_read_value (GkmStore *self,
89 GkmObject *object,
90 CK_ATTRIBUTE_TYPE type,
91 gsize *n_value);
92
93 gchar* gkm_store_read_string (GkmStore *self,
94 GkmObject *object,
95 CK_ATTRIBUTE_TYPE type);
96
97 void gkm_store_notify_attribute (GkmStore *self,
98 GkmObject *object,
99 CK_ATTRIBUTE_TYPE type);
100
101 #endif /* __GKM_STORE_H__ */