[glibmm] giomm: Add the TlsConnection class.



commit 205cd7025fd2a2dccdee6e0a308c504be05a7208
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Thu Jan 3 22:20:42 2013 -0500

    giomm: Add the TlsConnection class.
    
    	* gio/src/filelist.am:
    	* gio/src/tlsconnection.{ccg,hg}: Add the new sources wrapping the
    	methods, properties and signals of the new class.  Also add the
    	sources to the list of files to be built and add the virtual
    	functions as a TODO.
    	* gio/src/gio_vfuncs.defs: Add the definitions of the virtual
    	functions of the class for when the virtual functions are wrapped.
    	* tools/m4/convert_gio.m4: Add conversions relevant to wrapping the
    	class.

 ChangeLog                 |   14 ++++++
 gio/src/filelist.am       |    1 +
 gio/src/gio_vfuncs.defs   |   31 +++++++++++++
 gio/src/tlsconnection.ccg |   28 ++++++++++++
 gio/src/tlsconnection.hg  |  103 +++++++++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gio.m4   |    8 +++-
 6 files changed, 184 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9ebe5b3..fd83066 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2013-01-03  Josà Alburquerque  <jaalburquerque gmail com>
 
+	giomm: Add the TlsConnection class.
+
+	* gio/src/filelist.am:
+	* gio/src/tlsconnection.{ccg,hg}: Add the new sources wrapping the
+	methods, properties and signals of the new class.  Also add the
+	sources to the list of files to be built and add the virtual
+	functions as a TODO.
+	* gio/src/gio_vfuncs.defs: Add the definitions of the virtual
+	functions of the class for when the virtual functions are wrapped.
+	* tools/m4/convert_gio.m4: Add conversions relevant to wrapping the
+	class.
+
+2013-01-03  Josà Alburquerque  <jaalburquerque gmail com>
+
 	TlsDatabase: Add a TODO to wrap virtual functions.
 
 	* gio/src/tlsdatabase.hg: Add the virtual functions but as a TODO so
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 8a179ab..0816543 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		\
+	tlsconnection.hg		\
 	tlsdatabase.hg			\
 	tlsfiledatabase.hg		\
 	tlsinteraction.hg		\
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index ca8d7e3..f9a011e 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -725,6 +725,37 @@
  )
 )
 
+; GTlsConnection
+
+(define-vfunc handshake
+  (of-object "GTlsConnection")
+  (return-type "gboolean")
+  (parameters
+   '("GCancellable*" "cancellable")
+   '("GError**" "error")
+  )
+)
+
+(define-vfunc handshake_async
+  (of-object "GTlsConnection")
+  (return-type "void")
+  (parameters
+   '("int" "io_priority")
+   '("GCancellable*" "cancellable")
+   '("GAsyncReadyCallback" "callback")
+   '("gpointer" "user_data")
+  )
+)
+
+(define-vfunc handshake_finish
+  (of-object "GTlsConnection")
+  (return-type "gboolean")
+  (parameters
+   '("GAsyncResult*" "result")
+   '("GError**" "error")
+  )
+)
+
 ; GTlsDatabase
 
 (define-vfunc verify_chain
diff --git a/gio/src/tlsconnection.ccg b/gio/src/tlsconnection.ccg
new file mode 100644
index 0000000..8d8ccce
--- /dev/null
+++ b/gio/src/tlsconnection.ccg
@@ -0,0 +1,28 @@
+/* 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/iostream.h>
+#include <giomm/tlsdatabase.h>
+#include <giomm/tlsinteraction.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/tlsconnection.hg b/gio/src/tlsconnection.hg
new file mode 100644
index 0000000..0d35ca8
--- /dev/null
+++ b/gio/src/tlsconnection.hg
@@ -0,0 +1,103 @@
+/* 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/tlscertificate.h>
+#include <giomm/asyncresult.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(TlsRehandshakeMode,GTlsRehandshakeMode)
+
+class Cancellable;
+class IOStream;
+class TlsDatabase;
+class TlsInteraction;
+
+/** TlsConnection - TLS connection type.
+ * TlsConnection is the base TLS connection class type, which wraps an IOStream
+ * and provides TLS encryption on top of it. Its subclasses,
+ * TlsClientConnection and TlsServerConnection, implement client-side and
+ * server-side TLS, respectively. 
+ * @newin{2,36}
+ */
+class TlsConnection : public Glib::Object
+{
+  _CLASS_GOBJECT(TlsConnection, GTlsConnection, G_TLS_CONNECTION, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_METHOD(void set_certificate(const Glib::RefPtr<TlsCertificate>& certificate), g_tls_connection_set_certificate)
+
+  _WRAP_METHOD(Glib::RefPtr<TlsCertificate> get_certificate(), g_tls_connection_get_certificate)
+  _WRAP_METHOD(Glib::RefPtr<const TlsCertificate> get_certificate() const, g_tls_connection_get_certificate, constversion)
+
+  _WRAP_METHOD(TlsCertificateFlags get_peer_certificate_errors() const, g_tls_connection_get_peer_certificate_errors)
+
+  _WRAP_METHOD(void set_require_close_notify(bool require_close_notify), g_tls_connection_set_require_close_notify)
+  _WRAP_METHOD(bool get_require_close_notify() const, g_tls_connection_get_require_close_notify)
+
+  _WRAP_METHOD(void set_rehandshake_mode(TlsRehandshakeMode mode), g_tls_connection_set_rehandshake_mode)
+  _WRAP_METHOD(TlsRehandshakeMode get_rehandshake_mode() const, g_tls_connection_get_rehandshake_mode)
+
+  _WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb), g_tls_connection_set_use_system_certdb)
+  _WRAP_METHOD(bool get_use_system_certdb() const, g_tls_connection_get_use_system_certdb)
+
+  _WRAP_METHOD(Glib::RefPtr<TlsDatabase> get_database(), g_tls_connection_get_database)
+  _WRAP_METHOD(Glib::RefPtr<const TlsDatabase> get_database() const, g_tls_connection_get_database, constversion)
+
+  _WRAP_METHOD(void set_database(const Glib::RefPtr<TlsDatabase>& database), g_tls_connection_set_database)
+
+  _WRAP_METHOD(Glib::RefPtr<TlsInteraction> get_interaction(), g_tls_connection_get_interaction)
+  _WRAP_METHOD(Glib::RefPtr<const TlsInteraction> get_interaction() const, g_tls_connection_get_interaction, constversion)
+
+  _WRAP_METHOD(void set_interaction(const Glib::RefPtr<TlsInteraction>& interaction), g_tls_connection_set_interaction)
+
+  _WRAP_METHOD(bool handshake(const Glib::RefPtr<Cancellable>& cancellable{?}), g_tls_connection_handshake, errthrow)
+
+  _WRAP_METHOD(void handshake_async(const SlotAsyncReady& slot{callback}, const Glib::RefPtr<Cancellable>& cancellable{.?}, int io_priority{.} = Glib::PRIORITY_DEFAULT), g_tls_connection_handshake_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(bool handshake_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_connection_handshake_finish, errthrow)
+
+  _WRAP_METHOD(bool emit_accept_certificate(const Glib::RefPtr<const TlsCertificate>& peer_cert, TlsCertificateFlags errors), g_tls_connection_emit_accept_certificate)
+
+  _WRAP_PROPERTY("base-io-stream", Glib::RefPtr<IOStream>)
+  _WRAP_PROPERTY("certificate", Glib::RefPtr<TlsCertificate>)
+  _WRAP_PROPERTY("database", Glib::RefPtr<TlsDatabase>)
+  _WRAP_PROPERTY("interaction", Glib::RefPtr<TlsInteraction>)
+  _WRAP_PROPERTY("peer-certificate", Glib::RefPtr<TlsCertificate>)
+  _WRAP_PROPERTY("peer-certificate-errors", TlsCertificateFlags)
+  _WRAP_PROPERTY("rehandshake-mode", TlsRehandshakeMode)
+  _WRAP_PROPERTY("require-close-notify", bool)
+  _WRAP_PROPERTY("use-system-certdb", bool)
+
+#m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr<const TlsCertificate>&',`Glib::wrap($3, true)')
+  _WRAP_SIGNAL(bool accept_certificate(const Glib::RefPtr<const TlsCertificate>& peer_cert, TlsCertificateFlags errors), "accept_certificate")
+
+/* TODO:
+  _WRAP_VFUNC(bool handshake(const Glib::RefPtr<GCancellable>& cancellable), "handshake", errthrow)
+  _WRAP_VFUNC(void handshake_async(int io_priority, const Glib::RefPtr<GCancellable>& cancellable, GAsyncReadyCallback callback, gpointer user_data), "handshake_async")
+  _WRAP_VFUNC(bool handshake_finish(const Glib::RefPtr<GAsyncResult>& result), "handshake_finish", errthrow)
+*/
+};
+
+} // namespace Gio
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 0dd94ad..91cc703 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -44,6 +44,7 @@ _CONV_ENUM(G,TlsDatabaseVerifyFlags)
 _CONV_ENUM(G,TlsDatabaseLookupFlags)
 _CONV_ENUM(G,TlsInteractionResult)
 _CONV_ENUM(G,TlsPasswordFlags)
+_CONV_ENUM(G,TlsRehandshakeMode)
 _CONV_ENUM(G,UnixSocketAddressType)
 _CONV_ENUM(G,ZlibCompressorFormat)
 
@@ -270,9 +271,14 @@ _CONVERSION(`GTimeZoneMonitor*',`Glib::RefPtr<TimeZoneMonitor>',`Glib::wrap($3)'
 _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)')
-#
+
+#TlsDatabase
+_CONVERSION(`GTlsDatabase*',`Glib::RefPtr<TlsDatabase>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<TlsDatabase>&',`GTlsDatabase*',`Glib::unwrap($3)')
+
 #TlsInteraction
 _CONVERSION(`const Glib::RefPtr<TlsInteraction>&',`GTlsInteraction*',`Glib::unwrap($3)')
+_CONVERSION(`GTlsInteraction*',`Glib::RefPtr<TlsInteraction>',`Glib::wrap($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]