summaryrefslogtreecommitdiff
path: root/src/daemon/db/gsignond-db-metadata-database.h
blob: 4e5a94398b113d07d2b08f652b75d7d37ecc1972 (plain)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* vi: set et sw=4 ts=4 cino=t0,(0: */
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of gsignond
 *
 * Copyright (C) 2012 Intel Corporation.
 *
 * Contact: Imran Zaman <imran.zaman@linux.intel.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef __GSIGNOND_DB_METADATA_DATABASE_H__
#define __GSIGNOND_DB_METADATA_DATABASE_H__

#include <glib.h>
#include <glib-object.h>
#include "common/gsignond-identity-info.h"
#include <gsignond/gsignond-config.h>
#include <common/db/gsignond-db-sql-database.h>

G_BEGIN_DECLS

/*
 * Type macros.
 */
#define GSIGNOND_DB_TYPE_METADATA_DATABASE   \
                                       (gsignond_db_metadata_database_get_type ())
#define GSIGNOND_DB_METADATA_DATABASE(obj)  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
                                           GSIGNOND_DB_TYPE_METADATA_DATABASE, \
                                           GSignondDbMetadataDatabase))
#define GSIGNOND_DB_IS_METADATA_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
                                           GSIGNOND_DB_TYPE_METADATA_DATABASE))
#define GSIGNOND_DB_METADATA_DATABASE_CLASS(klass) \
                                            (G_TYPE_CHECK_CLASS_CAST ((klass), \
                                             GSIGNOND_DB_TYPE_METADATA_DATABASE, \
                                             GSignondDbMetadataDatabaseClass))
#define GSIGNOND_DB_IS_METADATA_DATABASE_CLASS(klass) \
                                            (G_TYPE_CHECK_CLASS_TYPE ((klass), \
                                             GSIGNOND_DB_TYPE_METADATA_DATABASE))
#define GSIGNOND_DB_METADATA_DATABASE_GET_CLASS(obj) \
                                            (G_TYPE_INSTANCE_GET_CLASS ((obj), \
                                             GSIGNOND_DB_TYPE_METADATA_DATABASE, \
                                             GSignondDbMetadataDatabaseClass))

typedef struct _GSignondDbMetadataDatabasePrivate
                    GSignondDbMetadataDatabasePrivate;

typedef struct
{
    GSignondDbSqlDatabase parent_instance;

    /*< private >*/
    GSignondConfig *config;
    GSignondDbMetadataDatabasePrivate *priv;
} GSignondDbMetadataDatabase;

typedef struct {
    GSignondDbSqlDatabaseClass parent_class;

} GSignondDbMetadataDatabaseClass;

/* used by GSIGNOND_DB_TYPE_METADATA_DATABASE */
GType
gsignond_db_metadata_database_get_type (void);

GSignondDbMetadataDatabase*
gsignond_db_metadata_database_new (GSignondConfig *config);

gboolean
gsignond_db_metadata_database_open (GSignondDbMetadataDatabase *self);

gboolean
gsignond_db_metadata_database_insert_method (
        GSignondDbMetadataDatabase *self,
        const gchar *method,
        guint32 *method_id);

guint32
gsignond_db_metadata_database_get_method_id (
        GSignondDbMetadataDatabase *self,
        const gchar *method);

GList *
gsignond_db_metadata_database_get_methods (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id,
        GSignondSecurityContext* sec_ctx);

guint32
gsignond_db_metadata_database_update_identity (
        GSignondDbMetadataDatabase *self,
        GSignondIdentityInfo *identity);

GSignondIdentityInfo *
gsignond_db_metadata_database_get_identity (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id);

GSignondIdentityInfoList *
gsignond_db_metadata_database_get_identities (
        GSignondDbMetadataDatabase *self,
        GSignondDictionary *filter);

gboolean
gsignond_db_metadata_database_remove_identity (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id);

gboolean
gsignond_db_metadata_database_insert_reference (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id,
        const GSignondSecurityContext *ref_owner,
        const gchar *reference);

gboolean
gsignond_db_metadata_database_remove_reference (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id,
        const GSignondSecurityContext *ref_owner,
        const gchar *reference);

GList *
gsignond_db_metadata_database_get_references (
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id,
        const GSignondSecurityContext* ref_owner);

GSignondSecurityContextList *
gsignond_db_metadata_database_get_accesscontrol_list(
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id);

GSignondSecurityContext *
gsignond_db_metadata_database_get_owner(
        GSignondDbMetadataDatabase *self,
        const guint32 identity_id);

G_END_DECLS

#endif /* __GSIGNOND_DB_METADATA_DATABASE_H__ */