1 /* plugin.h -- header file for the generic plugin routines for vlock,
2 * the VT locking program for linux
4 * This program is copyright (C) 2007 Frank Benkstein, and is free
5 * software which is freely distributable under the terms of the
6 * GNU General Public License version 2, included as the file COPYING in this
7 * distribution. It is NOT public domain software, and any
8 * redistribution not permitted by the GNU General Public License is
9 * expressly forbidden without prior written permission from
18 #include <glib-object.h>
20 /* Names of dependencies plugins may specify. */
21 #define nr_dependencies 6
22 extern const char *dependency_names
[nr_dependencies
];
24 /* A plugin hook consists of a name and a handler function. */
28 void (*handler
)(const char *);
31 /* Hooks that a plugin may define. */
33 extern const struct hook hooks
[nr_hooks
];
36 #define VLOCK_PLUGIN_ERROR vlock_plugin_error_quark()
37 GQuark
vlock_plugin_error_quark(void);
40 VLOCK_PLUGIN_ERROR_FAILED
,
41 VLOCK_PLUGIN_ERROR_DEPENDENCY
,
42 VLOCK_PLUGIN_ERROR_NOT_FOUND
48 #define TYPE_VLOCK_PLUGIN (vlock_plugin_get_type())
49 #define VLOCK_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_VLOCK_PLUGIN,\
51 #define VLOCK_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
54 #define IS_VLOCK_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
56 #define IS_VLOCK_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
58 #define VLOCK_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),\
62 typedef struct _VlockPlugin VlockPlugin
;
63 typedef struct _VlockPluginClass VlockPluginClass
;
67 GObject parent_instance
;
71 GList
*dependencies
[nr_dependencies
];
76 struct _VlockPluginClass
78 GObjectClass parent_class
;
80 bool (*open
)(VlockPlugin
*self
, GError
**error
);
81 bool (*call_hook
)(VlockPlugin
*self
, const gchar
*hook_name
);
84 GType
vlock_plugin_get_type(void);
86 /* Open the plugin. */
87 bool vlock_plugin_open(VlockPlugin
*self
, GError
**error
);
89 GList
*vlock_plugin_get_dependencies(VlockPlugin
*self
,
90 const gchar
*dependency_name
);
91 bool vlock_plugin_call_hook(VlockPlugin
*self
, const gchar
*hook_name
);