summaryrefslogtreecommitdiff
path: root/gck/gck-module.c
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-09-09 14:54:32 +0200
committerStef Walter <stefw@collabora.co.uk>2011-09-09 14:54:32 +0200
commitc7b1d28d5b933210855e8aefcb44e9b7db2003ad (patch)
tree347fee2a15a1a17743d09a5ccf30b383b22ef423 /gck/gck-module.c
parent2a73924b070044ceb9e600c0daf007f0bddaf65b (diff)
downloadgcr-c7b1d28d5b933210855e8aefcb44e9b7db2003ad.tar.gz
gck: Add functions for matching uri to modules and tokens
Diffstat (limited to 'gck/gck-module.c')
-rw-r--r--gck/gck-module.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gck/gck-module.c b/gck/gck-module.c
index 1b018ed..0015a88 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -736,3 +736,34 @@ gck_module_get_functions (GckModule *self)
g_return_val_if_fail (GCK_IS_MODULE (self), NULL);
return self->pv->funcs;
}
+
+/**
+ * gck_module_match:
+ * @self: the module to match
+ * @uri: the uri to match against the module
+ *
+ * Check whether the PKCS\#11 URI matches the module
+ *
+ * Returns: whether the URI matches or not
+ */
+gboolean
+gck_module_match (GckModule *self,
+ GckUriData *uri)
+{
+ gboolean match = TRUE;
+ GckModuleInfo *info;
+
+ g_return_val_if_fail (GCK_IS_MODULE (self), FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
+
+ if (uri->any_unrecognized)
+ match = FALSE;
+
+ if (match && uri->module_info) {
+ info = gck_module_get_info (self);
+ match = _gck_module_info_match (uri->module_info, info);
+ gck_module_info_free (info);
+ }
+
+ return match;
+}