1 /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 Copyright (C) 2011 Red Hat, Inc. 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, see <http://www.gnu.org/licenses/>. 17 */ 18 #ifndef __SPICE_SMARTCARD_MANAGER_H__ 19 #define __SPICE_SMARTCARD_MANAGER_H__ 20 21 #if !defined(__SPICE_CLIENT_H_INSIDE__) && !defined(SPICE_COMPILATION) 22 #warning "Only <spice-client.h> can be included directly" 23 #endif 24 25 #include "spice-types.h" 26 #include "spice-util.h" 27 28 G_BEGIN_DECLS 29 30 #define SPICE_TYPE_SMARTCARD_MANAGER (spice_smartcard_manager_get_type ()) 31 #define SPICE_SMARTCARD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_TYPE_SMARTCARD_MANAGER, SpiceSmartcardManager)) 32 #define SPICE_SMARTCARD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_TYPE_SMARTCARD_MANAGER, SpiceSmartcardManagerClass)) 33 #define SPICE_IS_SMARTCARD_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_TYPE_SMARTCARD_MANAGER)) 34 #define SPICE_IS_SMARTCARD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_TYPE_SMARTCARD_MANAGER)) 35 #define SPICE_SMARTCARD_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_TYPE_SMARTCARD_MANAGER, SpiceSmartcardManagerClass)) 36 37 #define SPICE_TYPE_SMARTCARD_READER (spice_smartcard_reader_get_type()) 38 39 typedef struct _SpiceSmartcardManager SpiceSmartcardManager; 40 typedef struct _SpiceSmartcardManagerClass SpiceSmartcardManagerClass; 41 typedef struct _SpiceSmartcardManagerPrivate SpiceSmartcardManagerPrivate; 42 43 /** 44 * SpiceSmartcardReader: 45 * 46 * The #SpiceSmartcardReader struct is opaque and cannot be accessed directly. 47 */ 48 typedef struct _SpiceSmartcardReader SpiceSmartcardReader; 49 50 /** 51 * SpiceSmartcardManager: 52 * 53 * The #SpiceSmartcardManager struct is opaque and should not be accessed directly. 54 */ 55 struct _SpiceSmartcardManager 56 { 57 GObject parent; 58 59 /*< private >*/ 60 SpiceSmartcardManagerPrivate *priv; 61 /* Do not add fields to this struct */ 62 }; 63 64 /** 65 * SpiceSmartcardManagerClass: 66 * @parent_class: Parent class. 67 * @reader_added: Signal class handler for the #SpiceSmartcardManager::reader_added signal. 68 * @reader_removed: Signal class handler for the #SpiceSmartcardManager::reader_removed signal. 69 * @card_inserted: Signal class handler for the #SpiceSmartcardManager::card_inserted signal. 70 * @card_removed: Signal class handler for the #SpiceSmartcardManager::card_removed signal. 71 * 72 * Class structure for #SpiceSmartcardManager. 73 */ 74 struct _SpiceSmartcardManagerClass 75 { 76 GObjectClass parent_class; 77 /*< public >*/ 78 /* signals */ 79 void (*reader_added)(SpiceSmartcardManager *manager, SpiceSmartcardReader *reader); 80 void (*reader_removed)(SpiceSmartcardManager *manager, SpiceSmartcardReader *reader); 81 void (*card_inserted)(SpiceSmartcardManager *manager, SpiceSmartcardReader *reader); 82 void (*card_removed)(SpiceSmartcardManager *manager, SpiceSmartcardReader *reader ); 83 84 /*< private >*/ 85 /* 86 * If adding fields to this struct, remove corresponding 87 * amount of padding to avoid changing overall struct size 88 */ 89 gchar _spice_reserved[SPICE_RESERVED_PADDING]; 90 }; 91 92 GType spice_smartcard_manager_get_type(void); 93 GType spice_smartcard_reader_get_type(void); 94 95 SpiceSmartcardManager *spice_smartcard_manager_get(void); 96 gboolean spice_smartcard_manager_insert_card(SpiceSmartcardManager *manager); 97 gboolean spice_smartcard_manager_remove_card(SpiceSmartcardManager *manager); 98 gboolean spice_smartcard_reader_is_software(SpiceSmartcardReader *reader); 99 gboolean spice_smartcard_reader_insert_card(SpiceSmartcardReader *reader); 100 gboolean spice_smartcard_reader_remove_card(SpiceSmartcardReader *reader); 101 GList *spice_smartcard_manager_get_readers(SpiceSmartcardManager *manager); 102 103 G_END_DECLS 104 105 #endif /* __SPICE_SMARTCARD_MANAGER_H__ */ 106