[glibmm] giomm: Add the TlsDatabase class which implements TlsFileDatabase.



commit 00db87629ceeb57a4d7fb3c9b50583e51c419a02
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Thu Jan 3 00:17:22 2013 -0500

    giomm: Add the TlsDatabase class which implements TlsFileDatabase.
    
    	* gio/src/filelist.am:
    	* gio/src/tlsdatabase.{ccg,hg}: Add the sources wrapping the C
    	functions and include the sources in the list of files to be built.
    	* tools/m4/convert_gio.m4: Add the necessary conversions for the
    	wrapped methods in the sources.
    
    	* gio/src/tlsfiledatabase.hg: Add a TODO.

 ChangeLog                  |   12 ++++++
 gio/src/filelist.am        |    1 +
 gio/src/tlsdatabase.ccg    |   27 ++++++++++++++
 gio/src/tlsdatabase.hg     |   82 ++++++++++++++++++++++++++++++++++++++++++++
 gio/src/tlsfiledatabase.hg |    3 ++
 tools/m4/convert_gio.m4    |    6 +++
 6 files changed, 131 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b940855..ccd0db8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-03  Josà Alburquerque  <jaalburquerque gmail com>
+
+	giomm: Add the TlsDatabase class which implements TlsFileDatabase.
+
+	* gio/src/filelist.am:
+	* gio/src/tlsdatabase.{ccg,hg}: Add the sources wrapping the C
+	functions and include the sources in the list of files to be built.
+	* tools/m4/convert_gio.m4: Add the necessary conversions for the
+	wrapped methods in the sources.
+
+	* gio/src/tlsfiledatabase.hg: Add a TODO.
+
 2013-01-02  Josà Alburquerque  <jaalburquerque gmail com>
 
 	giomm: Add the TlsFileDatabase interface.
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 47f59af..8a179ab 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -114,6 +114,7 @@ giomm_files_any_hg =			\
 	threadedsocketservice.hg	\
 	themedicon.hg			\
 	tlscertificate.hg		\
+	tlsdatabase.hg			\
 	tlsfiledatabase.hg		\
 	tlsinteraction.hg		\
 	tlspassword.hg			\
diff --git a/gio/src/tlsdatabase.ccg b/gio/src/tlsdatabase.ccg
new file mode 100644
index 0000000..1964349
--- /dev/null
+++ b/gio/src/tlsdatabase.ccg
@@ -0,0 +1,27 @@
+/* Copyright (C) 2013 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/cancellable.h>
+#include <giomm/socketconnectable.h>
+#include <giomm/tlsinteraction.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/tlsdatabase.hg b/gio/src/tlsdatabase.hg
new file mode 100644
index 0000000..058faf6
--- /dev/null
+++ b/gio/src/tlsdatabase.hg
@@ -0,0 +1,82 @@
+/* Copyright (C) 2013 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/asyncresult.h>
+#include <giomm/tlscertificate.h>
+#include <giomm/tlsfiledatabase.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(TlsDatabaseVerifyFlags, GTlsDatabaseVerifyFlags)
+_WRAP_ENUM(TlsDatabaseLookupFlags, GTlsDatabaseLookupFlags)
+
+class Cancellable;
+class SocketConnectable;
+class TlsInteraction;
+
+/** TlsDatabase - TLS database type.
+ * TlsDatabase is used to lookup certificates and other information from a
+ * certificate or key store. It is an abstract base class which TLS library
+ * specific subtypes override.
+ *
+ * Most common client applications will not directly interact with TlsDatabase.
+ * It is used internally by TlsConnection.
+ * @newin{2,36}
+ */
+class TlsDatabase : public Glib::Object, public TlsFileDatabase
+{
+  _CLASS_GOBJECT(TlsDatabase, GTlsDatabase, G_TLS_DATABASE, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(TlsFileDatabase)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  //TODO?: Have a constant for the C macro G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER (which is a string)?
+  //TODO?: Have a constant for the C macro G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT (which is a string)?
+
+  _WRAP_METHOD(TlsCertificateFlags verify_chain(const Glib::RefPtr<TlsCertificate>& chain, const Glib::ustring& purpose, const Glib::RefPtr<SocketConnectable>& identity{?}, const Glib::RefPtr<TlsInteraction>& interaction{?}, const Glib::RefPtr<Cancellable>& cancellable{.?}, TlsDatabaseVerifyFlags flags{.} = TLS_DATABASE_VERIFY_NONE), g_tls_database_verify_chain, errthrow)
+  _WRAP_METHOD(void verify_chain_async(const Glib::RefPtr<TlsCertificate>& chain, const Glib::ustring& purpose, const Glib::RefPtr<SocketConnectable>& identity{?}, const Glib::RefPtr<TlsInteraction>& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr<Cancellable>& cancellable{.?}, TlsDatabaseVerifyFlags flags{.} = TLS_DATABASE_VERIFY_NONE), g_tls_database_verify_chain_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(TlsCertificateFlags verify_chain_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_database_verify_chain_finish, errthrow)
+
+  _WRAP_METHOD(Glib::RefPtr<TlsCertificate> lookup_certificate_issuer(const Glib::RefPtr<TlsCertificate>& certificate, const Glib::RefPtr<TlsInteraction>& interaction, TlsDatabaseLookupFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}), g_tls_database_lookup_certificate_issuer, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<const TlsCertificate> lookup_certificate_issuer(const Glib::RefPtr<TlsCertificate>& certificate, const Glib::RefPtr<TlsInteraction>& interaction, TlsDatabaseLookupFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}) const, g_tls_database_lookup_certificate_issuer, errthrow, constversion)
+
+  _WRAP_METHOD(void lookup_certificate_issuer_async(const Glib::RefPtr<TlsCertificate>& certificate, const Glib::RefPtr<TlsInteraction>& interaction, TlsDatabaseLookupFlags flags, const SlotAsyncReady& slot{callback}, const Glib::RefPtr<Cancellable>& cancellable{.?}), g_tls_database_lookup_certificate_issuer_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(Glib::RefPtr<TlsCertificate> lookup_certificate_issuer_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_database_lookup_certificate_issuer_finish, errthrow)
+
+  //TODO: _WRAP_METHOD(GList* lookup_certificates_issued_by(GByteArray* issuer_raw_dn, const Glib::RefPtr<TlsInteraction>& interaction, TlsDatabaseLookupFlags flags, const Glib::RefPtr<Cancellable>& cancellable), g_tls_database_lookup_certificates_issued_by, errthrow)
+
+  //TODO: _WRAP_METHOD(void lookup_certificates_issued_by_async(GByteArray* issuer_raw_dn, const Glib::RefPtr<TlsInteraction>& interaction, TlsDatabaseLookupFlags flags, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot, gpointer user_data), g_tls_database_lookup_certificates_issued_by_async)
+
+  //TODO: _WRAP_METHOD(GList* lookup_certificates_issued_by_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_database_lookup_certificates_issued_by_finish, errthrow)
+
+  _WRAP_METHOD(Glib::ustring create_certificate_handle(const Glib::RefPtr<const TlsCertificate>& certificate) const, g_tls_database_create_certificate_handle)
+
+  _WRAP_METHOD(Glib::RefPtr<TlsCertificate> lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr<TlsInteraction>& interaction, const Glib::RefPtr<Cancellable>& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_for_handle, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<const TlsCertificate> lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr<TlsInteraction>& interaction, const Glib::RefPtr<Cancellable>& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE) const, g_tls_database_lookup_certificate_for_handle, errthrow, constversion)
+
+  _WRAP_METHOD(void lookup_certificate_for_handle_async(const Glib::ustring& handle, const Glib::RefPtr<TlsInteraction>& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr<Cancellable>& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_for_handle_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(Glib::RefPtr<TlsCertificate> lookup_certificate_for_handle_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_database_lookup_certificate_for_handle_finish, errthrow)
+};
+
+} // namespace Gio
diff --git a/gio/src/tlsfiledatabase.hg b/gio/src/tlsfiledatabase.hg
index be4adc5..2c5d9f8 100644
--- a/gio/src/tlsfiledatabase.hg
+++ b/gio/src/tlsfiledatabase.hg
@@ -39,6 +39,9 @@ class TlsFileDatabase : public Glib::Interface
   _CLASS_INTERFACE(TlsFileDatabase, GTlsFileDatabase, G_TLS_FILE_DATABASE, GTlsFileDatabaseInterface)
 
 public:
+  //TODO: Wrap the the g_tls_file_database_new() C function which returns a
+  //GTlsDatabase* and does more than calling g_initable_new().
+
   _WRAP_PROPERTY("anchors", Glib::ustring)
 };
 
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 7028675..0dd94ad 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -40,6 +40,8 @@ _CONV_ENUM(G,SocketMsgFlags)
 _CONV_ENUM(G,SocketProtocol)
 _CONV_ENUM(G,SocketType)
 _CONV_ENUM(G,TlsCertificateFlags)
+_CONV_ENUM(G,TlsDatabaseVerifyFlags)
+_CONV_ENUM(G,TlsDatabaseLookupFlags)
 _CONV_ENUM(G,TlsInteractionResult)
 _CONV_ENUM(G,TlsPasswordFlags)
 _CONV_ENUM(G,UnixSocketAddressType)
@@ -267,6 +269,10 @@ _CONVERSION(`GTimeZoneMonitor*',`Glib::RefPtr<TimeZoneMonitor>',`Glib::wrap($3)'
 #TlsCertificate
 _CONVERSION(`GTlsCertificate*', `Glib::RefPtr<TlsCertificate>', `Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<const TlsCertificate>&', `GTlsCertificate*', `const_cast<GTlsCertificate*>(Glib::unwrap($3))')
+_CONVERSION(`const Glib::RefPtr<TlsCertificate>&',`GTlsCertificate*',`Glib::unwrap($3)')
+#
+#TlsInteraction
+_CONVERSION(`const Glib::RefPtr<TlsInteraction>&',`GTlsInteraction*',`Glib::unwrap($3)')
 
 #TlsPassword
 _CONVERSION(`const Glib::RefPtr<const TlsPassword>&',`GTlsPassword*',`const_cast<GTlsPassword*>(Glib::unwrap($3))')



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