summaryrefslogtreecommitdiff
path: root/plugins/smartcard/msd-smartcard-manager.h
blob: 269e1daef7e96f157dbec329a9fb5ba63715117f (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
/* msd-smartcard-manager.h - object for monitoring smartcard insertion and
 *                           removal events
 *
 * Copyright (C) 2006, 2009 Red Hat, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * Written by: Ray Strode
 */
#ifndef MSD_SMARTCARD_MANAGER_H
#define MSD_SMARTCARD_MANAGER_H

#define MSD_SMARTCARD_ENABLE_INTERNAL_API
#include "msd-smartcard.h"

#include <glib.h>
#include <glib-object.h>

#ifdef __cplusplus
extern "C" {
#endif
#define MSD_TYPE_SMARTCARD_MANAGER            (msd_smartcard_manager_get_type ())
#define MSD_SMARTCARD_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MSD_TYPE_SMARTCARD_MANAGER, MsdSmartcardManager))
#define MSD_SMARTCARD_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MSD_TYPE_SMARTCARD_MANAGER, MsdSmartcardManagerClass))
#define MSD_IS_SMARTCARD_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_SMARTCARD_MANAGER))
#define MSD_IS_SMARTCARD_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_SMARTCARD_MANAGER))
#define MSD_SMARTCARD_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), MSD_TYPE_SMARTCARD_MANAGER, MsdSmartcardManagerClass))
#define MSD_SMARTCARD_MANAGER_ERROR           (msd_smartcard_manager_error_quark ())
typedef struct _MsdSmartcardManager MsdSmartcardManager;
typedef struct _MsdSmartcardManagerClass MsdSmartcardManagerClass;
typedef struct _MsdSmartcardManagerPrivate MsdSmartcardManagerPrivate;
typedef enum _MsdSmartcardManagerError MsdSmartcardManagerError;

struct _MsdSmartcardManager {
    GObject parent;

    /*< private > */
    MsdSmartcardManagerPrivate *priv;
};

struct _MsdSmartcardManagerClass {
        GObjectClass parent_class;

        /* Signals */
        void (*smartcard_inserted) (MsdSmartcardManager *manager,
                                    MsdSmartcard        *token);
        void (*smartcard_removed) (MsdSmartcardManager *manager,
                                   MsdSmartcard        *token);
        void (*error) (MsdSmartcardManager *manager,
                       GError              *error);
};

enum _MsdSmartcardManagerError {
    MSD_SMARTCARD_MANAGER_ERROR_GENERIC = 0,
    MSD_SMARTCARD_MANAGER_ERROR_WITH_NSS,
    MSD_SMARTCARD_MANAGER_ERROR_LOADING_DRIVER,
    MSD_SMARTCARD_MANAGER_ERROR_WATCHING_FOR_EVENTS,
    MSD_SMARTCARD_MANAGER_ERROR_REPORTING_EVENTS
};

GType msd_smartcard_manager_get_type (void) G_GNUC_CONST;
GQuark msd_smartcard_manager_error_quark (void) G_GNUC_CONST;

MsdSmartcardManager *msd_smartcard_manager_new (const char *module);

gboolean msd_smartcard_manager_start (MsdSmartcardManager  *manager,
                                      GError              **error);

void msd_smartcard_manager_stop (MsdSmartcardManager *manager);

char *msd_smartcard_manager_get_module_path (MsdSmartcardManager *manager);
gboolean msd_smartcard_manager_login_card_is_inserted (MsdSmartcardManager *manager);

#ifdef __cplusplus
}
#endif
#endif                                /* MSD_SMARTCARD_MANAGER_H */