1299093ee70931cdf07482680b7566281917ff22
[profile/ivi/gsignond.git] / include / gsignond / gsignond-extension-interface.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of gsignond
5  *
6  * Copyright (C) 2012 Intel Corporation.
7  *
8  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23  * 02110-1301 USA
24  */
25
26 #ifndef _GSIGNOND_EXTENSION_INTERFACE_H_
27 #define _GSIGNOND_EXTENSION_INTERFACE_H_
28
29 #include <glib-object.h>
30
31 #include <gsignond/gsignond-config.h>
32 #include <gsignond/gsignond-storage-manager.h>
33 #include <gsignond/gsignond-secret-storage.h>
34 #include <gsignond/gsignond-access-control-manager.h>
35
36 G_BEGIN_DECLS
37
38 #define GSIGNOND_TYPE_EXTENSION \
39     (gsignond_extension_get_type ())
40 #define GSIGNOND_EXTENSION(obj) \
41     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSIGNOND_TYPE_EXTENSION, \
42                                  GSignondExtension))
43 #define GSIGNOND_IS_EXTENSION(obj) \
44     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSIGNOND_TYPE_EXTENSION))
45 #define GSIGNOND_EXTENSION_CLASS(klass) \
46     (G_TYPE_CHECK_CLASS_CAST ((klass), GSIGNOND_TYPE_EXTENSION, \
47                               GSignondExtensionClass))
48 #define GSIGNOND_IS_EXTENSION_CLASS(klass) \
49     (G_TYPE_CHECK_CLASS_TYPE ((klass), GSIGNOND_TYPE_EXTENSION))
50 #define GSIGNOND_EXTENSION_GET_CLASS(obj) \
51     (G_TYPE_INSTANCE_GET_CLASS ((obj), GSIGNOND_TYPE_EXTENSION, \
52                                 GSignondExtensionClass))
53
54 typedef struct _GSignondExtension GSignondExtension;
55 typedef struct _GSignondExtensionClass GSignondExtensionClass;
56 typedef struct _GSignondExtensionPrivate GSignondExtensionPrivate;
57 typedef GSignondExtension * (*GSignondExtensionInit) (void);
58
59 struct _GSignondExtension
60 {
61     GObject parent_instance;
62     GSignondExtensionPrivate *priv;
63 };
64
65 struct _GSignondExtensionClass
66 {
67     GObjectClass parent_class;
68
69     /**
70      * get_extension_name:
71      * @self: object instance.
72      *
73      * Get human readable name of the extension.
74      * 
75      * Returns: (transfer none) name of the extension.
76      */
77     const gchar * (*get_extension_name) (GSignondExtension *self);
78     /**
79      * get_extension_version:
80      * @self: object instance.
81      *
82      * Get version of the extension, split into four bytes in order from MSB
83      * to LSB; major, minor, patchlevel, build.
84      */
85     guint32 (*get_extension_version) (GSignondExtension *self);
86     /**
87      * get_storage_manager:
88      * @self: object instance.
89      * @config: configuration object instance.
90      *
91      * Factory method to get a singleton storage manager object.
92      *
93      * Returns: storage manager object instance.
94      */
95     GSignondStorageManager * (*get_storage_manager) (GSignondExtension *self,
96                                                      GSignondConfig *config);
97     /**
98      * get_secret_storage:
99      * @self: object instance.
100      * @config: configuration object instance.
101      *
102      * Factory method to get a singleton secret storage object.
103      *
104      * Returns: secret storage object instance.
105      */
106     GSignondSecretStorage * (*get_secret_storage) (GSignondExtension *self,
107                                                    GSignondConfig *config);
108     /**
109      * get_access_control_manager:
110      * @self: object instance.
111      * @config: configuration object instance.
112      *
113      * Factory method to get a singleton access control manager object.
114      *
115      * Returns: access control manager object instance.
116      */
117     GSignondAccessControlManager * (*get_access_control_manager) (
118                                                     GSignondExtension *self,
119                                                     GSignondConfig *config);
120 };
121
122 GType gsignond_extension_get_type ();
123
124 const gchar *
125 gsignond_extension_get_name (GSignondExtension *self);
126
127 guint32
128 gsignond_extension_get_version (GSignondExtension *self);
129
130 GSignondStorageManager *
131 gsignond_extension_get_storage_manager (GSignondExtension *self,
132                                         GSignondConfig *config);
133
134 GSignondSecretStorage *
135 gsignond_extension_get_secret_storage (GSignondExtension *self,
136                                        GSignondConfig *config);
137
138 GSignondAccessControlManager *
139 gsignond_extension_get_access_control_manager (GSignondExtension *self,
140                                                GSignondConfig *config);
141
142 GSignondExtension *
143 default_extension_init ();
144
145 G_END_DECLS
146
147 #endif  /* _GSIGNOND_EXTENSION_INTERFACE_H_ */
148