Branch data Line data Source code
1 : : /* libsecret - GLib wrapper for Secret Service 2 : : * 3 : : * Copyright 2012 Stef Walter 4 : : * 5 : : * This program is free software: you can redistribute it and/or modify 6 : : * it under the terms of the GNU Lesser General Public License as published 7 : : * by the Free Software Foundation; either version 2.1 of the licence or (at 8 : : * your option) any later version. 9 : : * 10 : : * See the included COPYING file for more information. 11 : : * 12 : : * Author: Stef Walter <stefw@gnome.org> 13 : : */ 14 : : 15 : : #include "config.h" 16 : : 17 : : #include "secret-schema.h" 18 : : #include "secret-schemas.h" 19 : : 20 : : static const SecretSchema note_schema = { 21 : : "org.gnome.keyring.Note", 22 : : SECRET_SCHEMA_NONE, 23 : : { 24 : : { NULL, 0 }, 25 : : } 26 : : }; 27 : : 28 : : const SecretSchema * SECRET_SCHEMA_NOTE = ¬e_schema; 29 : : 30 : : static const SecretSchema network_schema = { 31 : : "org.gnome.keyring.NetworkPassword", 32 : : SECRET_SCHEMA_NONE, 33 : : { 34 : : { "user", SECRET_SCHEMA_ATTRIBUTE_STRING }, 35 : : { "domain", SECRET_SCHEMA_ATTRIBUTE_STRING }, 36 : : { "object", SECRET_SCHEMA_ATTRIBUTE_STRING }, 37 : : { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING }, 38 : : { "port", SECRET_SCHEMA_ATTRIBUTE_INTEGER }, 39 : : { "server", SECRET_SCHEMA_ATTRIBUTE_STRING }, 40 : : { "authtype", SECRET_SCHEMA_ATTRIBUTE_STRING }, 41 : : { NULL, 0 }, 42 : : } 43 : : }; 44 : : 45 : : const SecretSchema * SECRET_SCHEMA_COMPAT_NETWORK = &network_schema; 46 : : 47 : : /** 48 : : * secret_get_schema: 49 : : * @type: type of schema to get 50 : : * 51 : : * Get a secret storage schema of the given @type. 52 : : * 53 : : * C code may access the schemas (such as %SECRET_SCHEMA_NOTE) directly, but 54 : : * language bindings cannot, and must use this accessor. 55 : : * 56 : : * Returns: (transfer none): schema type 57 : : * 58 : : * Since: 0.18.6 59 : : */ 60 : : const SecretSchema * 61 : 0 : secret_get_schema (SecretSchemaType type) 62 : : { 63 [ # # # ]: 0 : switch (type) { 64 : 0 : case SECRET_SCHEMA_TYPE_NOTE: 65 : 0 : return SECRET_SCHEMA_NOTE; 66 : 0 : case SECRET_SCHEMA_TYPE_COMPAT_NETWORK: 67 : 0 : return SECRET_SCHEMA_COMPAT_NETWORK; 68 : 0 : default: 69 : 0 : g_assert_not_reached (); 70 : : } 71 : : g_return_val_if_reached (NULL); 72 : : }