[gnome-keyring] gck: Documentation, introspection, and header fixes



commit 7755ae74eedbdfb5a734fc3470728422c6fe436d
Author: Stef Walter <stefw collabora co uk>
Date:   Thu Sep 29 12:49:17 2011 +0200

    gck: Documentation, introspection, and header fixes

 .gitignore                              |    2 +
 docs/reference/gck/Makefile.am          |    2 +-
 docs/reference/gck/gck-docs.sgml        |    3 ++
 docs/reference/gck/gck-pkcs11-links.xml |    4 +-
 docs/reference/gck/gck-sections.txt     |   60 ++++++++++++++++++++++++++-----
 gck/Makefile.am                         |   20 +++++++++-
 gck/gck-attributes.c                    |   16 ++++----
 gck/gck-enum-types.c.template           |   43 ++++++++++++++++++++++
 gck/gck-enum-types.h.template           |   28 ++++++++++++++
 gck/gck-misc.c                          |   21 +++++++----
 gck/gck-module.c                        |   22 ++++++++++-
 gck/gck-modules.c                       |    8 ++++
 gck/gck-object.c                        |    6 ++--
 gck/gck-session.c                       |   25 +++++++++++--
 gck/gck-slot.c                          |   30 ++++++++++++++--
 gck/gck-uri.c                           |   57 +++++++++++++++++++++++++----
 gck/gck.h                               |   29 ++++++++-------
 17 files changed, 314 insertions(+), 62 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d76ebbf..a56b81a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,6 +105,8 @@ run-tests
 /daemon/control/tests/frob-control-quit
 /daemon/control/tests/frob-control-unlock
 
+/gck/gck-enum-types.[ch]
+
 /gck/tests/test-gck-attributes
 /gck/tests/test-gck-crypto
 /gck/tests/test-gck-enumerator
diff --git a/docs/reference/gck/Makefile.am b/docs/reference/gck/Makefile.am
index cfe53cd..a14f92c 100644
--- a/docs/reference/gck/Makefile.am
+++ b/docs/reference/gck/Makefile.am
@@ -24,7 +24,7 @@ SCANGOBJ_OPTIONS=
 
 # Extra options to supply to gtkdoc-scan.
 # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
-SCAN_OPTIONS=
+SCAN_OPTIONS=--deprecated-guards="GCK_DISABLE_DEPRECATED"
 
 # Extra options to supply to gtkdoc-mkdb.
 # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
diff --git a/docs/reference/gck/gck-docs.sgml b/docs/reference/gck/gck-docs.sgml
index ef48bf8..f5668f3 100644
--- a/docs/reference/gck/gck-docs.sgml
+++ b/docs/reference/gck/gck-docs.sgml
@@ -29,4 +29,7 @@
 	</chapter>
 
 	<xi:include href="gck-pkcs11-links.xml"/>
+	<xi:include href="xml/annotation-glossary.xml">
+		<xi:fallback />
+	</xi:include>
 </book>
diff --git a/docs/reference/gck/gck-pkcs11-links.xml b/docs/reference/gck/gck-pkcs11-links.xml
index fdd6fad..9341ccf 100644
--- a/docs/reference/gck/gck-pkcs11-links.xml
+++ b/docs/reference/gck/gck-pkcs11-links.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"; [
 ]>
 <chapter xml:id="pkcs11-links">
-	<title>About PKCS\#11</title>
+	<title>About PKCS#11</title>
 
 	<anchor id="CK-NOTIFY:CAPS"/>
 	<anchor id="CK-SLOT-ID:CAPS"/>
@@ -14,7 +14,7 @@
 	<anchor id="CK-ULONG:CAPS"/>
 	<anchor id="CK-BBOOL:CAPS"/>
 
-	<para>PKCS\#11 is an API for storing and using crypto objects, and performing
+	<para>PKCS#11 is an API for storing and using crypto objects, and performing
 	crypto operations on them.</para>
 
 	<para>It is specified at the
diff --git a/docs/reference/gck/gck-sections.txt b/docs/reference/gck/gck-sections.txt
index e200c28..14a7d30 100644
--- a/docs/reference/gck/gck-sections.txt
+++ b/docs/reference/gck/gck-sections.txt
@@ -26,12 +26,14 @@ gck_attribute_clear
 gck_attribute_free
 gck_attribute_dump
 gck_attribute_equal
+<SUBSECTION Private>
+GCK_TYPE_ATTRIBUTE
+gck_attribute_get_type
 </SECTION>
 
 <SECTION>
 <FILE>gck-attributes</FILE>
 GckAttributes
-GCK_TYPE_ATTRIBUTES
 gck_attributes_new
 gck_attributes_new_empty
 gck_attributes_at
@@ -54,9 +56,12 @@ gck_attributes_ref
 gck_attributes_unref
 gck_attributes_contains
 gck_attributes_dump
-gck_attributes_get_boxed_type
 gck_attributes_new_full
 GckAllocator
+<SUBSECTION Standard>
+gck_attributes_get_type
+GCK_TYPE_ATTRIBUTES
+gck_attributes_get_boxed_type
 </SECTION>
 
 <SECTION>
@@ -74,6 +79,7 @@ gck_module_get_functions
 gck_module_get_info
 gck_module_get_slots
 GckModuleInfo
+gck_module_info_copy
 gck_module_info_free
 <SUBSECTION Standard>
 GckModuleClass
@@ -85,6 +91,8 @@ GCK_MODULE_CLASS
 GCK_MODULE_GET_CLASS
 GCK_TYPE_MODULE
 GckModulePrivate
+GCK_TYPE_MODULE_INFO
+gck_module_info_get_type
 </SECTION>
 
 <SECTION>
@@ -104,12 +112,12 @@ gck_modules_tokens_for_uri
 <SECTION>
 <FILE>gck-slot</FILE>
 GckMechanismInfo
+gck_mechanism_info_copy
 gck_mechanism_info_free
-GckMechanisms
 gck_mechanisms_length
 gck_mechanisms_at
-gck_mechanisms_free
 gck_mechanisms_check
+GckSessionOptions
 GckSlot
 gck_slot_equal
 gck_slot_hash
@@ -129,10 +137,11 @@ gck_slot_open_session_async
 gck_slot_open_session_finish
 gck_slot_from_handle
 GckSlotInfo
+gck_slot_info_copy
 gck_slot_info_free
 GckTokenInfo
+gck_token_info_copy
 gck_token_info_free
-gck_token_info_match
 <SUBSECTION Standard>
 GckSlotClass
 gck_slot_get_type
@@ -143,12 +152,21 @@ GCK_SLOT_CLASS
 GCK_SLOT_GET_CLASS
 GCK_TYPE_SLOT
 GckSlotPrivate
+GCK_TYPE_MECHANISM_INFO
+GCK_TYPE_SLOT_INFO
+GCK_TYPE_TOKEN_INFO
+GckMechanisms
+gck_mechanisms_free
+gck_mechanism_info_get_type
+gck_slot_info_get_type
+gck_token_info_get_type
+GCK_TYPE_SESSION_OPTIONS
+gck_session_options_get_type
 </SECTION>
 
 <SECTION>
 <FILE>gck-session</FILE>
 GckSession
-GckSessionOptions
 gck_session_from_handle
 gck_session_get_module
 gck_session_get_slot
@@ -192,7 +210,6 @@ gck_session_generate_key_pair_finish
 gck_session_generate_key_pair_full
 gck_session_get_options
 gck_session_get_state
-gck_session_get_type
 gck_session_init_pin
 gck_session_init_pin_async
 gck_session_init_pin_finish
@@ -208,9 +225,11 @@ gck_session_wrap_key_async
 gck_session_wrap_key_finish
 gck_session_wrap_key_full
 GckSessionInfo
+gck_session_info_copy
 gck_session_info_free
 GckMechanism
 <SUBSECTION Standard>
+gck_session_get_type
 GckSessionClass
 GCK_IS_SESSION
 GCK_IS_SESSION_CLASS
@@ -219,6 +238,8 @@ GCK_SESSION_CLASS
 GCK_SESSION_GET_CLASS
 GCK_TYPE_SESSION
 GckSessionPrivate
+GCK_TYPE_SESSION_INFO
+gck_session_info_get_type
 </SECTION>
 
 <SECTION>
@@ -268,21 +289,31 @@ GckObjectPrivate
 GCK_VENDOR_CODE
 GCK_ERROR
 gck_message_from_rv
-CKR_GCK_MODULE_PROBLEM
 </SECTION>
 
 <SECTION>
 <FILE>gck-uri</FILE>
 GckUriData
+GckUriError
 GckUriFlags
+GCK_URI_FOR_MODULE_WITH_VERSION
+GCK_URI_FOR_OBJECT_ON_TOKEN
+GCK_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE
 gck_uri_data_new
 gck_uri_parse
 gck_uri_build
+gck_uri_data_copy
 gck_uri_data_free
-GCK_URI_BAD_PREFIX
 GCK_URI_ERROR
 <SUBSECTION Private>
 gck_uri_get_error_quark
+GCK_URI_DATA_TYPE
+gck_uri_data_get_type
+gck_uri_error_get_quark
+GCK_TYPE_URI_ERROR
+GCK_TYPE_URI_FLAGS
+gck_uri_error_get_type
+gck_uri_flags_get_type
 </SECTION>
 
 <SECTION>
@@ -306,6 +337,7 @@ GCK_TYPE_ENUMERATOR
 
 <SECTION>
 <FILE>gck-misc</FILE>
+GckError
 gck_list_ref_copy
 gck_list_unref_free
 gck_string_from_chars
@@ -315,6 +347,16 @@ gck_value_to_ulong
 GCK_INVALID
 <SUBSECTION Private>
 gck_get_error_quark
+gck_error_get_quark
 GCK_TYPE_LIST
 gck_list_get_boxed_type
+GCK_TYPE_ERROR
+gck_error_get_type
 </SECTION>
+
+<SECTION>
+<FILE>gck-private</FILE>
+<SUBSECTION Private>
+GCK_URI_BAD_PREFIX
+CKR_GCK_MODULE_PROBLEM
+</SECTION>
\ No newline at end of file
diff --git a/gck/Makefile.am b/gck/Makefile.am
index e1a07f8..a6d9a97 100644
--- a/gck/Makefile.am
+++ b/gck/Makefile.am
@@ -3,10 +3,14 @@ SUBDIRS = . tests
 
 incdir = $(includedir)/gck- GCK_MAJOR@/gck
 
-inc_HEADERS = \
+HEADER_FILES = \
 	gck.h \
 	gck-deprecated.h
 
+inc_HEADERS = \
+	$(HEADER_FILES) \
+	gck-enum-types.h
+
 INCLUDES = \
 	-I$(top_builddir) \
 	-I$(top_srcdir) \
@@ -20,12 +24,14 @@ INCLUDES = \
 	-DPKCS11_REGISTRY_DIR=\"$(libdir)/pkcs11\"
 
 BUILT_SOURCES = \
-	gck-marshal.c gck-marshal.h
+	gck-marshal.c gck-marshal.h \
+	gck-enum-types.c gck-enum-types.h
 
 lib_LTLIBRARIES = libgck- GCK_MAJOR@.la
 
 PUBLIC_FILES = \
 	gck.h \
+	gck-enum-types.h \
 	gck-attributes.c \
 	gck-dump.c \
 	gck-enumerator.c \
@@ -79,6 +85,14 @@ gck-marshal.c: gck-marshal.list $(GLIB_GENMARSHAL)
 	echo "#include \"gck-marshal.h\"" > $@ && \
 	$(GLIB_GENMARSHAL) $< --body --prefix=_gck_marshal >> $@
 
+gck-enum-types.h: gck.h gck-enum-types.h.template
+	$(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gck-enum-types.h.template \
+		$(HEADER_FILES) > $@
+
+gck-enum-types.c: gck.h gck-enum-types.c.template
+	$(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gck-enum-types.c.template \
+		$(HEADER_FILES) > $@
+
 # ------------------------------------------------------------------
 # INTROSPECTION
 
@@ -130,6 +144,8 @@ EXTRA_DIST = \
 	gck.pc.in \
 	gck-marshal.list \
 	gck.symbols \
+	gck-enum-types.h.template \
+	gck-enum-types.c.template \
 	pkcs11-trust-assertions.h
 
 CLEANFILES = \
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index 2d28bae..c5d56a8 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -74,7 +74,7 @@ attribute_init (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init: (skip):
+ * gck_attribute_init: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  * @value: The raw value of the attribute.
@@ -95,7 +95,7 @@ gck_attribute_init (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init_invalid: (skip):
+ * gck_attribute_init_invalid: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  *
@@ -117,7 +117,7 @@ gck_attribute_init_invalid (GckAttribute *attr, gulong attr_type)
 }
 
 /**
- * gck_attribute_init_empty: (skip):
+ * gck_attribute_init_empty: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  *
@@ -147,7 +147,7 @@ attribute_init_boolean (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init_boolean: (skip):
+ * gck_attribute_init_boolean: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  * @value: The boolean value of the attribute.
@@ -184,7 +184,7 @@ attribute_init_date (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init_date: (skip):
+ * gck_attribute_init_date: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  * @value: The date value of the attribute.
@@ -213,7 +213,7 @@ attribute_init_ulong (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init_ulong: (skip):
+ * gck_attribute_init_ulong: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  * @value: The ulong value of the attribute.
@@ -241,7 +241,7 @@ attribute_init_string (GckAttribute *attr, gulong attr_type,
 }
 
 /**
- * gck_attribute_init_string: (skip):
+ * gck_attribute_init_string: (skip)
  * @attr: An uninitialized attribute.
  * @attr_type: The PKCS\#11 attribute type to set on the attribute.
  * @value: The null terminated string value of the attribute.
@@ -793,7 +793,7 @@ gck_attributes_new (void)
 }
 
 /**
- * gck_attributes_new_full: (skip):
+ * gck_attributes_new_full: (skip)
  * @allocator: Memory allocator for attribute data, or NULL for default.
  *
  * Create a new GckAttributes array.
diff --git a/gck/gck-enum-types.c.template b/gck/gck-enum-types.c.template
new file mode 100644
index 0000000..d609535
--- /dev/null
+++ b/gck/gck-enum-types.c.template
@@ -0,0 +1,43 @@
+/*** BEGIN file-header ***/
+
+#include <glib-object.h>
+
+#ifndef GCR_COMPILATION
+#define GCR_COMPILATION
+#endif
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+#include "@filename@"
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+
+GType
+ enum_name@_get_type (void)
+{
+    static GType etype = 0;
+    if (G_UNLIKELY(etype == 0)) {
+        static const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+            { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+            { 0, NULL, NULL }
+        };
+        etype = g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+    }
+    return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+ /**/
+/*** END file-tail ***/
diff --git a/gck/gck-enum-types.h.template b/gck/gck-enum-types.h.template
new file mode 100644
index 0000000..ecb732b
--- /dev/null
+++ b/gck/gck-enum-types.h.template
@@ -0,0 +1,28 @@
+/*** BEGIN file-header ***/
+#if !defined (__GCK_INSIDE_HEADER__) && !defined (GCK_COMPILATION)
+#error "Only <gck/gck.h> can be included directly."
+#endif
+
+#ifndef __GCK_ENUM_TYPES_H__
+#define __GCK_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX _TYPE_@ENUMSHORT@ (@enum_name _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __GCK_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/gck/gck-misc.c b/gck/gck-misc.c
index bcdeebb..74b5059 100644
--- a/gck/gck-misc.c
+++ b/gck/gck-misc.c
@@ -40,6 +40,13 @@
  */
 
 /**
+ * SECTION:gck-private
+ * @title: Private, not used in docs
+ * @short_description: Should not show up in docs
+ *
+ */
+
+/**
  * GCK_INVALID:
  *
  * Used as a terminator at the end of variable argument lists.
@@ -53,12 +60,12 @@
  */
 
 /**
- * CKR_GCK_MODULE_PROBLEM:
- *
- * A result code that signifies there was a problem loading a PKCS11
- * module, usually a shared library.
+ * GckError:
+ * @GCK_ERROR_MODULE_PROBLEM: a result code that signifies there was a problem
+ *                            loading a PKCS\#11 module, usually a shared library
  *
- * More details can be found in the error string.
+ * Various error codes. All the CKR_XXX error codes from PKCS\#11 are also
+ * relevant error codes.
  */
 
 /**
@@ -233,7 +240,7 @@ gck_list_get_boxed_type (void)
 }
 
 /**
- * gck_list_unref_free: (skip):
+ * gck_list_unref_free: (skip)
  * @reflist: List of Gobject reference counted pointers.
  *
  * Free a list of GObject based pointers. All objects in the list
@@ -251,7 +258,7 @@ gck_list_unref_free (GList *reflist)
 }
 
 /**
- * gck_list_ref_copy: (skip):
+ * gck_list_ref_copy: (skip)
  * @reflist: List of GObject reference counted objects.
  *
  * Copy a list of GObject based pointers. All objects
diff --git a/gck/gck-module.c b/gck/gck-module.c
index 725b12f..d3a76bd 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -367,6 +367,14 @@ gck_module_info_get_type (void)
 	return type;
 }
 
+/**
+ * gck_module_info_copy:
+ * @module_info: a module info
+ *
+ * Make a copy of the module info.
+ *
+ * Returns: (transfer full): a newly allocated copy module info
+ */
 GckModuleInfo *
 gck_module_info_copy (GckModuleInfo *module_info)
 {
@@ -505,6 +513,16 @@ gck_module_initialize (const gchar *path,
 	return args.result;
 }
 
+/**
+ * gck_module_initialize_async:
+ * @path: the file system path to the PKCS\#11 module to load
+ * @cancellable: (allow-none): optional cancellation object
+ * @callback: a callback which will be called when the operation completes
+ * @user_data: data to pass to the callback
+ *
+ * Asynchronously load and initialize a PKCS\#11 module represented by a
+ * #GckModule object.
+ **/
 void
 gck_module_initialize_async (const gchar *path,
                              GCancellable *cancellable,
@@ -554,7 +572,7 @@ gck_module_initialize_finish (GAsyncResult *result,
 }
 
 /**
- * gck_module_new: (skip):
+ * gck_module_new: (skip)
  * @funcs: Initialized PKCS\#11 function list pointer
  *
  * Create a GckModule representing a PKCS\#11 module. It is assumed that
@@ -756,7 +774,7 @@ gck_module_get_path (GckModule *self)
 }
 
 /**
- * gck_module_get_functions: (skip):
+ * gck_module_get_functions: (skip)
  * @self: The module for which to get the function list.
  *
  * Get the PKCS\#11 function list for the module.
diff --git a/gck/gck-modules.c b/gck/gck-modules.c
index 43b52a3..5c5ccb4 100644
--- a/gck/gck-modules.c
+++ b/gck/gck-modules.c
@@ -114,6 +114,14 @@ gck_modules_initialize_registered (GCancellable *cancellable,
 	return args.results;
 }
 
+/**
+ * gck_modules_initialize_registered_async:
+ * @cancellable: optional cancellation object
+ * @callback: a callback which will be called when the operation completes
+ * @user_data: data to pass to the callback
+ *
+ * Load and initialize all the registered modules asynchronously.
+ */
 void
 gck_modules_initialize_registered_async (GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
diff --git a/gck/gck-object.c b/gck/gck-object.c
index 11ba3b6..8231635 100644
--- a/gck/gck-object.c
+++ b/gck/gck-object.c
@@ -886,8 +886,8 @@ free_get_attribute_data (GetAttributeData *args)
  *
  * This call may block for an indefinite period.
  *
- * Return: (transfer full) (array length=n_data): the resulting PKCS\#11
- *         attribute data, or %NULL if an error occurred
+ * Returns: (transfer full) (array length=n_data): the resulting PKCS\#11
+ *          attribute data, or %NULL if an error occurred
  **/
 guchar *
 gck_object_get_data (GckObject *self,
@@ -904,7 +904,7 @@ gck_object_get_data (GckObject *self,
 }
 
 /**
- * gck_object_get_data_full: (skip):
+ * gck_object_get_data_full: (skip)
  * @self: The object to get attribute data from.
  * @attr_type: The attribute to get data for.
  * @allocator: An allocator with which to allocate memory for the data, or NULL for default.
diff --git a/gck/gck-session.c b/gck/gck-session.c
index da22f06..4edbbd1 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -51,8 +51,9 @@
 
 /**
  * GckSessionOptions:
+ * @GCK_SESSION_READ_ONLY: Open session as read only
  * @GCK_SESSION_READ_WRITE: Open sessions as read/write
- * @GCK_SESSION_LOGIN_USER: Login as user on new sessions.
+ * @GCK_SESSION_LOGIN_USER: Login as user on new sessions
  * @GCK_SESSION_AUTHENTICATE: Authenticate as necessary
  *
  * Options for creating sessions.
@@ -320,6 +321,14 @@ gck_session_info_get_type (void)
 	return type;
 }
 
+/**
+ * gck_session_info_copy:
+ * @session_info: a session info structure
+ *
+ * Make a new copy of a session info structure.
+ *
+ * Returns: (transfer full): a new copy of the session info
+ */
 GckSessionInfo *
 gck_session_info_copy (GckSessionInfo *session_info)
 {
@@ -395,7 +404,7 @@ gck_session_get_handle (GckSession *self)
  *
  * Get the PKCS\#11 module to which this session belongs.
  *
- * Return: (transfer full): The module, which should be unreffed after use.
+ * Returns: (transfer full): the module, which should be unreffed after use
  **/
 GckModule *
 gck_session_get_module (GckSession *self)
@@ -465,6 +474,14 @@ gck_session_get_info (GckSession *self)
 	return sessioninfo;
 }
 
+/**
+ * gck_session_get_state:
+ * @self: the session
+ *
+ * Get the session state. The state is the various PKCS\#11 CKS_XXX flags.
+ *
+ * Returns: the session state
+ */
 gulong
 gck_session_get_state (GckSession *self)
 {
@@ -1139,8 +1156,8 @@ gck_session_find_objects_async (GckSession *self, GckAttributes *attrs,
  *
  * Get the result of a find operation.
  *
- * Return: (transfer full) (element-type Gck.Object): a list of the matching
- *         objects, which may be empty
+ * Returns: (transfer full) (element-type Gck.Object): a list of the matching
+ *          objects, which may be empty
  **/
 GList *
 gck_session_find_objects_finish (GckSession *self, GAsyncResult *result, GError **error)
diff --git a/gck/gck-slot.c b/gck/gck-slot.c
index 91671f3..200d043 100644
--- a/gck/gck-slot.c
+++ b/gck/gck-slot.c
@@ -218,6 +218,14 @@ gck_slot_info_get_type (void)
 	return type;
 }
 
+/**
+ * gck_slot_info_copy:
+ * @slot_info: a slot info
+ *
+ * Make a copy of the slot info.
+ *
+ * Returns: (transfer full): a newly allocated copy slot info
+ */
 GckSlotInfo *
 gck_slot_info_copy (GckSlotInfo *slot_info)
 {
@@ -294,6 +302,14 @@ gck_token_info_get_type (void)
 	return type;
 }
 
+/**
+ * gck_token_info_copy:
+ * @token_info: a token info
+ *
+ * Make a copy of the token info.
+ *
+ * Returns: (transfer full): a newly allocated copy token info
+ */
 GckTokenInfo *
 gck_token_info_copy (GckTokenInfo *token_info)
 {
@@ -354,6 +370,14 @@ gck_mechanism_info_get_type (void)
 	return type;
 }
 
+/**
+ * gck_mechanism_info_copy:
+ * @mech_info: a mechanism info
+ *
+ * Make a copy of the mechanism info.
+ *
+ * Returns: (transfer full): a newly allocated copy mechanism info
+ */
 GckMechanismInfo *
 gck_mechanism_info_copy (GckMechanismInfo *mech_info)
 {
@@ -1010,7 +1034,7 @@ gck_slot_open_session (GckSlot *self, guint options, GCancellable *cancellable,
 }
 
 /**
- * gck_slot_open_session_full: (skip):
+ * gck_slot_open_session_full: (skip)
  * @self: The slot to open a session on.
  * @options: The options to open the new session with.
  * @pkcs11_flags: Additional raw PKCS\#11 flags.
@@ -1081,7 +1105,7 @@ gck_slot_open_session_async (GckSlot *self, guint options, GCancellable *cancell
 }
 
 /**
- * gck_slot_open_session_full_async: (skip):
+ * gck_slot_open_session_full_async: (skip)
  * @self: The slot to open a session on.
  * @options: Options to open the new session with.
  * @pkcs11_flags: Additional raw PKCS\#11 flags.
@@ -1131,7 +1155,7 @@ gck_slot_open_session_full_async (GckSlot *self, guint options, gulong pkcs11_fl
  * Get the result of an open session operation. If the 'auto reuse' setting is set,
  * then this may be a recycled session with the same flags.
  *
- * Return: (transfer full): the new session or %NULL if an error occurs.
+ * Returns: (transfer full): the new session or %NULL if an error occurs
  */
 GckSession*
 gck_slot_open_session_finish (GckSlot *self, GAsyncResult *result, GError **err)
diff --git a/gck/gck-uri.c b/gck/gck-uri.c
index c083529..aa4bff5 100644
--- a/gck/gck-uri.c
+++ b/gck/gck-uri.c
@@ -76,22 +76,64 @@
  * @GCK_URI_FOR_MODULE: the URI will be used to match modules.
  * @GCK_URI_FOR_TOKEN: the URI will be used to match tokens.
  * @GCK_URI_FOR_OBJECT: the URI will be used to match objects.
+ * @GCK_URI_WITH_VERSION: the URI has specific version numbers for module and/or token
  * @GCK_URI_FOR_ANY: parse all recognized components of the URI.
- * @GCK_URI_FOR_MODULE_WITH_VERSION: the URI will match specific version of modules.
- * @GCK_URI_FOR_OBJECT_ON_TOKEN: the URI will match objects on a specific token.
- * @GCK_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE: the URI will match objects on a specific
- *      token inserted into a device with a specific module.
  *
  * Which parts of the PKCS\#11 URI will be parsed or formatted. These can be
  * combined.
  */
 
 /**
+ * GCK_URI_FOR_MODULE_WITH_VERSION:
+ *
+ * The URI will match specific version of modules. To be used as a GckUriFlags argument.
+ */
+
+/**
+ * GCK_URI_FOR_OBJECT_ON_TOKEN:
+ *
+ * The URI will match objects on a specific token. To be used as a GckUriFlags argument.
+ */
+
+/**
+ * GCK_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE:
+ *
+ * The token inserted into a device with a specific module.
+ */
+
+/**
+ * GckUriError:
+ * @GCK_URI_BAD_SCHEME: invalid URI scheme
+ * @GCK_URI_BAD_ENCODING: bad URI encoding
+ * @GCK_URI_BAD_SYNTAX: bad URI syntax
+ * @GCK_URI_BAD_VERSION: bad URI version component
+ * @GCK_URI_NOT_FOUND: piece of the URI was not found
+ *
+ * Various error codes used with PKCS\#11 URIs
+ */
+
+/**
  * GCK_URI_ERROR:
  *
  * Error domain for URI errors.
  */
 
+/**
+ * GCK_URI_BAD_PREFIX:
+ *
+ * Use %GCK_URI_BAD_SCHEME instead.
+ *
+ * Deprecated: Since 3.2
+ */
+
+/**
+ * CKR_GCK_MODULE_PROBLEM:
+ *
+ * Use %GCK_ERROR_MODULE_PROBLEM instead.
+ *
+ * Deprecated: Since 3.4
+ */
+
 #define URI_PREFIX "pkcs11:"
 #define N_URI_PREFIX 7
 
@@ -124,14 +166,15 @@ gck_uri_error_get_quark (void)
 }
 
 /**
- * gck_uri_new:
+ * gck_uri_data_new:
  *
  * Allocate a new GckUriData structure. None of the fields
  * will be set.
  *
- * Returns: A newly allocated GckUriData, free with gck_uri_data_free().
+ * Returns: (transfer full): a newly allocated GckUriData, free with
+ *          gck_uri_data_free()
  */
-GckUriData*
+GckUriData *
 gck_uri_data_new (void)
 {
 	return g_slice_new0 (GckUriData);
diff --git a/gck/gck.h b/gck/gck.h
index 0657726..c627bb6 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -29,7 +29,11 @@
 #include <gio/gio.h>
 
 #include "pkcs11.h"
+
+#define __GCK_INSIDE_HEADER__
+
 #include "gck-deprecated.h"
+#include "gck-enum-types.h"
 
 G_BEGIN_DECLS
 
@@ -46,7 +50,7 @@ G_BEGIN_DECLS
 
 /* An error code which results from a failure to load the PKCS11 module */
 typedef enum {
-	GCK_ERROR_MODULE_PROBLEM = (CKR_VENDOR_DEFINED | (GCK_VENDOR_CODE + 1))
+	GCK_ERROR_MODULE_PROBLEM = (CKR_VENDOR_DEFINED | (GCK_VENDOR_CODE + 1)),
 } GckError;
 
 #define             GCK_ERROR                               (gck_error_get_quark ())
@@ -491,9 +495,6 @@ struct _GckTokenInfo {
 	gint64 utc_time;
 };
 
-gboolean            gck_token_info_match                    (GckTokenInfo *match,
-                                                             GckTokenInfo *info);
-
 #define             GCK_TYPE_TOKEN_INFO                     (gck_token_info_get_type ())
 
 GType               gck_token_info_get_type                 (void) G_GNUC_CONST;
@@ -619,7 +620,8 @@ GckSession*         gck_slot_open_session_finish            (GckSlot *self,
  * SESSION
  */
 
-typedef enum _GckSessionOptions {
+typedef enum {
+	GCK_SESSION_READ_ONLY = 0,
 	GCK_SESSION_READ_WRITE = 1 << 1,
 	GCK_SESSION_LOGIN_USER =  1 << 2,
 	GCK_SESSION_AUTHENTICATE = 1 << 3,
@@ -1208,18 +1210,15 @@ typedef enum {
 	GCK_URI_FOR_OBJECT =  (1 << 1),
 	GCK_URI_FOR_TOKEN =   (1 << 2),
 	GCK_URI_FOR_MODULE =  (1 << 3),
+	GCK_URI_WITH_VERSION = (1 << 4),
+	GCK_URI_FOR_ANY =     0x0000FFFF,
+} GckUriFlags;
 
-	GCK_URI_FOR_MODULE_WITH_VERSION =
-		(1 << 4) | GCK_URI_FOR_MODULE,
-
-	GCK_URI_FOR_OBJECT_ON_TOKEN =
-		GCK_URI_FOR_OBJECT | GCK_URI_FOR_TOKEN,
+#define             GCK_URI_FOR_MODULE_WITH_VERSION         (GCK_URI_WITH_VERSION | GCK_URI_FOR_MODULE)
 
-	GCK_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE =
-		GCK_URI_FOR_OBJECT_ON_TOKEN | GCK_URI_FOR_MODULE,
+#define             GCK_URI_FOR_OBJECT_ON_TOKEN             (GCK_URI_FOR_OBJECT | GCK_URI_FOR_TOKEN)
 
-	GCK_URI_FOR_ANY =     0x0000FFFF,
-} GckUriFlags;
+#define             GCK_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE  (GCK_URI_FOR_OBJECT_ON_TOKEN | GCK_URI_FOR_MODULE)
 
 struct _GckUriData {
 	gboolean any_unrecognized;
@@ -1254,4 +1253,6 @@ void                gck_uri_data_free                       (GckUriData *uri_dat
 
 G_END_DECLS
 
+#undef __GCK_INSIDE_HEADER__
+
 #endif /* GCK_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]