| 1 |
/* |
| 2 |
* gnome-keyring |
| 3 |
* |
| 4 |
* Copyright (C) 2009 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_SECRET_FIELDS_H__ |
| 22 |
#define __GKM_SECRET_FIELDS_H__ |
| 23 |
|
| 24 |
#include "pkcs11.h" |
| 25 |
|
| 26 |
#include <glib.h> |
| 27 |
#include <glib-object.h> |
| 28 |
|
| 29 |
/* |
| 30 |
* This represents a set of attributes from the secrets API. We |
| 31 |
* call them 'fields' here, so they don't get mixed up with the |
| 32 |
* PKCS#11 API's notion of attributes. |
| 33 |
* |
| 34 |
* Each field has a name, and a string value. |
| 35 |
* |
| 36 |
* Previous versions of gnome-keyring had the notion of attributes |
| 37 |
* that were integers. In this version everything is a string. |
| 38 |
* |
| 39 |
* Compatibility attributes start with gkr:compat: |
| 40 |
* |
| 41 |
* gkr:compat:uint32:xxxx The presence of this attribute means that |
| 42 |
* the xxxx attribute is a uint32 in older versions of gnome-keyring. |
| 43 |
* The value of this attribute is insignificant. |
| 44 |
* |
| 45 |
* gkr:compat:hashed:xxxx This attribute contains a hashed version |
| 46 |
* of xxxx. |
| 47 |
*/ |
| 48 |
|
| 49 |
#define GKM_SECRET_FIELD_SCHEMA "xdg:schema" |
| 50 |
|
| 51 |
#define GKM_BOXED_SECRET_FIELDS (gkm_secret_fields_boxed_type ()) |
| 52 |
|
| 53 |
GType gkm_secret_fields_boxed_type (void); |
| 54 |
|
| 55 |
GHashTable* gkm_secret_fields_new (void); |
| 56 |
|
| 57 |
void gkm_secret_fields_add (GHashTable *fields, |
| 58 |
const gchar *name, |
| 59 |
const gchar *value); |
| 60 |
|
| 61 |
void gkm_secret_fields_take (GHashTable *fields, |
| 62 |
gchar *name, |
| 63 |
gchar *value); |
| 64 |
|
| 65 |
const gchar* gkm_secret_fields_get (GHashTable *fields, |
| 66 |
const gchar *name); |
| 67 |
|
| 68 |
CK_RV gkm_secret_fields_parse (CK_ATTRIBUTE_PTR attr, |
| 69 |
GHashTable **fields, |
| 70 |
gchar **schema_name); |
| 71 |
|
| 72 |
CK_RV gkm_secret_fields_serialize (CK_ATTRIBUTE_PTR attr, |
| 73 |
GHashTable *fields, |
| 74 |
const gchar *schema_name); |
| 75 |
|
| 76 |
gboolean gkm_secret_fields_match (GHashTable *haystack, |
| 77 |
GHashTable *needle); |
| 78 |
|
| 79 |
gboolean gkm_secret_fields_match_one (GHashTable *haystack, |
| 80 |
const gchar *needle_key, |
| 81 |
const gchar *needle_value); |
| 82 |
|
| 83 |
GList* gkm_secret_fields_get_names (GHashTable *fields); |
| 84 |
|
| 85 |
/* COMPAT ------------------------------------------------------------------------ */ |
| 86 |
|
| 87 |
GList* gkm_secret_fields_get_compat_hashed_names (GHashTable *fields); |
| 88 |
|
| 89 |
void gkm_secret_fields_add_compat_uint32 (GHashTable *fields, |
| 90 |
const gchar *name, |
| 91 |
guint32 value); |
| 92 |
|
| 93 |
gboolean gkm_secret_fields_get_compat_uint32 (GHashTable *fields, |
| 94 |
const gchar *name, |
| 95 |
guint32 *value); |
| 96 |
|
| 97 |
void gkm_secret_fields_add_compat_hashed_string (GHashTable *fields, |
| 98 |
const gchar *name, |
| 99 |
const gchar *value); |
| 100 |
|
| 101 |
gboolean gkm_secret_fields_get_compat_hashed_string (GHashTable *fields, |
| 102 |
const gchar *name, |
| 103 |
gchar **value); |
| 104 |
|
| 105 |
void gkm_secret_fields_add_compat_hashed_uint32 (GHashTable *fields, |
| 106 |
const gchar *name, |
| 107 |
guint32 value); |
| 108 |
|
| 109 |
gboolean gkm_secret_fields_get_compat_hashed_uint32 (GHashTable *fields, |
| 110 |
const gchar *name, |
| 111 |
guint32 *value); |
| 112 |
|
| 113 |
#endif /* __GKM_SECRET_FIELDS_H__ */ |