[glibmm] giomm: Add the Tls[Client|Server]Connection classes.



commit f93b3475007804cb8a84f77eec732f8cc5b60cea
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Jan 8 23:57:32 2013 -0500

    giomm: Add the Tls[Client|Server]Connection classes.
    
    	* gio/src/tlsclientconnection.{ccg,hg}: Add the new client sources
    	wrapping the methods and properties.
    	* gio/src/tlsserverconnection.{ccg,hg}: Add the new server sources
    	wrapping its single property.
    	* gio/src/filelist.am: Include the new sources in the list of files to
    	be built.
    	* gio/src/enums.hg: Add the TlsAuthenticationMode enum needed for the
    	server class here because it is documented in the Tls Overview section
    	of the C API's documentation and not as part of any other class.
    	* tools/m4/convert_gio.m4: Add a necessary conversion.
    
    	* gio/src/tlsdatabase.{ccg,hg}: Fix the includes so that the
    	tlscertificate.h header file does not have to be included in the .h
    	file but instead in the .c file.

 ChangeLog                       |   19 +++++++++++
 gio/src/enums.hg                |    1 +
 gio/src/filelist.am             |    2 +
 gio/src/tlsclientconnection.ccg |   19 +++++++++++
 gio/src/tlsclientconnection.hg  |   67 +++++++++++++++++++++++++++++++++++++++
 gio/src/tlsdatabase.ccg         |    1 +
 gio/src/tlsdatabase.hg          |    3 +-
 gio/src/tlsserverconnection.ccg |   18 ++++++++++
 gio/src/tlsserverconnection.hg  |   48 ++++++++++++++++++++++++++++
 tools/m4/convert_gio.m4         |    1 +
 10 files changed, 178 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 095ef05..0fbbc95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2013-01-08  Josà Alburquerque  <jaalburquerque gmail com>
+
+	giomm: Add the Tls[Client|Server]Connection classes.
+
+	* gio/src/tlsclientconnection.{ccg,hg}: Add the new client sources
+	wrapping the methods and properties.
+	* gio/src/tlsserverconnection.{ccg,hg}: Add the new server sources
+	wrapping its single property.
+	* gio/src/filelist.am: Include the new sources in the list of files to
+	be built.
+	* gio/src/enums.hg: Add the TlsAuthenticationMode enum needed for the
+	server class here because it is documented in the Tls Overview section
+	of the C API's documentation and not as part of any other class.
+	* tools/m4/convert_gio.m4: Add a necessary conversion.
+
+	* gio/src/tlsdatabase.{ccg,hg}: Fix the includes so that the
+	tlscertificate.h header file does not have to be included in the .h
+	file but instead in the .c file.
+
 2013-01-07  Josà Alburquerque  <jaalburquerque gmail com>
 
 	giomm.h: Add the new tls*.h headers.
diff --git a/gio/src/enums.hg b/gio/src/enums.hg
index 315e7fd..2518559 100644
--- a/gio/src/enums.hg
+++ b/gio/src/enums.hg
@@ -29,6 +29,7 @@ _WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE)
 _WRAP_ENUM(DataStreamNewlineType, GDataStreamNewlineType, NO_GTYPE)
 _WRAP_ENUM(ErrorEnum, GIOErrorEnum, NO_GTYPE)
 _WRAP_ENUM(SocketFamily, GSocketFamily)
+_WRAP_ENUM(TlsAuthenticationMode, GTlsAuthenticationMode)
 _WRAP_ENUM(TlsCertificateFlags, GTlsCertificateFlags)
 
 } // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 0816543..5e8e44b 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -114,11 +114,13 @@ giomm_files_any_hg =			\
 	threadedsocketservice.hg	\
 	themedicon.hg			\
 	tlscertificate.hg		\
+	tlsclientconnection.hg		\
 	tlsconnection.hg		\
 	tlsdatabase.hg			\
 	tlsfiledatabase.hg		\
 	tlsinteraction.hg		\
 	tlspassword.hg			\
+	tlsserverconnection.hg		\
 	volume.hg			\
 	volumemonitor.hg		\
 	zlibdecompressor.hg		\
diff --git a/gio/src/tlsclientconnection.ccg b/gio/src/tlsclientconnection.ccg
new file mode 100644
index 0000000..0ea183e
--- /dev/null
+++ b/gio/src/tlsclientconnection.ccg
@@ -0,0 +1,19 @@
+/* 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/socketconnectable.h>
diff --git a/gio/src/tlsclientconnection.hg b/gio/src/tlsclientconnection.hg
new file mode 100644
index 0000000..57da809
--- /dev/null
+++ b/gio/src/tlsclientconnection.hg
@@ -0,0 +1,67 @@
+/* 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/interface.h>
+#include <giomm/enums.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GTlsClientConnectionInterface GTlsClientConnectionInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+class SocketConnectable;
+
+/** TlsClientConnection - TLS client-side connection.
+ * TlsClientConnection is the client-side subclass of TlsConnection,
+ * representing a client-side TLS connection.
+ * @newin{2,36}
+ */
+class TlsClientConnection : public Glib::Interface
+{
+  _CLASS_INTERFACE(TlsClientConnection, GTlsClientConnection, G_TLS_CLIENT_CONNECTION, GTlsClientConnectionInterface)
+
+public:
+  //TODO: This new function creates an IOStream, not a TlsClientConnection:
+  // GIOStream* g_tls_client_connection_new(GIOStream *base_io_stream, GSocketConnectable *server_identity, GError **error);
+
+  _WRAP_METHOD(void set_server_identity(const Glib::RefPtr<SocketConnectable>& identity), g_tls_client_connection_set_server_identity)
+
+  _WRAP_METHOD(Glib::RefPtr<SocketConnectable> get_server_identity(), g_tls_client_connection_get_server_identity)
+  _WRAP_METHOD(Glib::RefPtr<const SocketConnectable> get_server_identity() const, g_tls_client_connection_get_server_identity, constversion)
+
+  _WRAP_METHOD(void set_validation_flags(TlsCertificateFlags flags), g_tls_client_connection_set_validation_flags)
+  _WRAP_METHOD(TlsCertificateFlags get_validation_flags() const, g_tls_client_connection_get_validation_flags)
+
+  _WRAP_METHOD(void set_use_ssl3(bool use_ssl3), g_tls_client_connection_set_use_ssl3)
+  _WRAP_METHOD(bool get_use_ssl3() const, g_tls_client_connection_get_use_ssl3)
+
+  //TODO: _WRAP_METHOD(GList* get_accepted_cas(), g_tls_client_connection_get_accepted_cas)
+
+  //TODO: _WRAP_PROPERTY("accepted-cas", gpointer)
+
+  _WRAP_PROPERTY("server-identity", Glib::RefPtr<SocketConnectable>)
+  _WRAP_PROPERTY("use-ssl3", bool)
+  _WRAP_PROPERTY("validation-flags", TlsCertificateFlags)
+};
+
+} // namespace Gio
diff --git a/gio/src/tlsdatabase.ccg b/gio/src/tlsdatabase.ccg
index 1964349..a5bd098 100644
--- a/gio/src/tlsdatabase.ccg
+++ b/gio/src/tlsdatabase.ccg
@@ -18,6 +18,7 @@
 #include <gio/gio.h>
 #include <giomm/cancellable.h>
 #include <giomm/socketconnectable.h>
+#include <giomm/tlscertificate.h>
 #include <giomm/tlsinteraction.h>
 #include "slot_async.h"
 
diff --git a/gio/src/tlsdatabase.hg b/gio/src/tlsdatabase.hg
index fc64cce..6f3c01f 100644
--- a/gio/src/tlsdatabase.hg
+++ b/gio/src/tlsdatabase.hg
@@ -17,7 +17,7 @@
 
 #include <glibmm/object.h>
 #include <giomm/asyncresult.h>
-#include <giomm/tlscertificate.h>
+#include <giomm/enums.h>
 #include <giomm/tlsfiledatabase.h>
 
 _DEFS(giomm,gio)
@@ -31,6 +31,7 @@ _WRAP_ENUM(TlsDatabaseLookupFlags, GTlsDatabaseLookupFlags)
 
 class Cancellable;
 class SocketConnectable;
+class TlsCertificate;
 class TlsInteraction;
 
 /** TlsDatabase - TLS database type.
diff --git a/gio/src/tlsserverconnection.ccg b/gio/src/tlsserverconnection.ccg
new file mode 100644
index 0000000..d76f332
--- /dev/null
+++ b/gio/src/tlsserverconnection.ccg
@@ -0,0 +1,18 @@
+/* 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>
diff --git a/gio/src/tlsserverconnection.hg b/gio/src/tlsserverconnection.hg
new file mode 100644
index 0000000..ed374b8
--- /dev/null
+++ b/gio/src/tlsserverconnection.hg
@@ -0,0 +1,48 @@
+/* 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/interface.h>
+#include <giomm/enums.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GTlsServerConnectionInterface GTlsServerConnectionInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+/** TlsServerConnection - TLS server-side connection.
+ * TlsServerConnection is the server-side subclass of TlsConnection,
+ * representing a server-side TLS connection.
+ * @newin{2,36}
+ */
+class TlsServerConnection : public Glib::Interface
+{
+  _CLASS_INTERFACE(TlsServerConnection, GTlsServerConnection, G_TLS_SERVER_CONNECTION, GTlsServerConnectionInterface)
+
+public:
+  //TODO: This new function creates an IOStream, not a TlsServerConnection:
+  //GIOStream* g_tls_server_connection_new(GIOStream *base_io_stream, GTlsCertificate *certificate, GError **error);
+
+  _WRAP_PROPERTY("authentication-mode", TlsAuthenticationMode)
+};
+
+} // namespace Gio
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 5893341..4fac16d 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -256,6 +256,7 @@ _CONVERSION(`GSocketAddressEnumerator*',`Glib::RefPtr<SocketAddressEnumerator>',
 #SocketConnectable
 _CONVERSION(`const Glib::RefPtr<SocketConnectable>&',`GSocketConnectable*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const SocketConnectable>&', `GSocketConnectable*', `const_cast<GSocketConnectable*>(Glib::unwrap($3))')
+_CONVERSION(`GSocketConnectable*',`Glib::RefPtr<SocketConnectable>',`Glib::wrap($3)')
 
 #SocketConnection
 _CONVERSION(`GSocketConnection*',`Glib::RefPtr<SocketConnection>',`Glib::wrap($3)')



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