[glib-networking] gnutls: reorganize some code to avoid needing forward declarations
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking] gnutls: reorganize some code to avoid needing forward declarations
- Date: Sat, 3 Dec 2011 18:35:21 +0000 (UTC)
commit 865b4e5925e0fab13aba88f3101de6452c136482
Author: Dan Winship <danw gnome org>
Date: Sat Dec 3 16:18:24 2011 +0100
gnutls: reorganize some code to avoid needing forward declarations
tls/gnutls/gtlsclientconnection-gnutls.c | 74 +++++++------------
tls/gnutls/gtlsconnection-gnutls.c | 117 ++++++++++--------------------
tls/gnutls/gtlsserverconnection-gnutls.c | 83 ++++++++-------------
3 files changed, 100 insertions(+), 174 deletions(-)
---
diff --git a/tls/gnutls/gtlsclientconnection-gnutls.c b/tls/gnutls/gtlsclientconnection-gnutls.c
index 176624c..da435bf 100644
--- a/tls/gnutls/gtlsclientconnection-gnutls.c
+++ b/tls/gnutls/gtlsclientconnection-gnutls.c
@@ -39,25 +39,6 @@ enum
PROP_ACCEPTED_CAS
};
-static void g_tls_client_connection_gnutls_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void g_tls_client_connection_gnutls_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void g_tls_client_connection_gnutls_constructed (GObject *object);
-static void g_tls_client_connection_gnutls_finalize (GObject *object);
-
-static void g_tls_client_connection_gnutls_begin_handshake (GTlsConnectionGnutls *conn);
-static gboolean g_tls_client_connection_gnutls_verify_peer (GTlsConnectionGnutls *gnutls,
- GTlsCertificate *peer_certificate,
- GTlsCertificateFlags *errors);
-static void g_tls_client_connection_gnutls_finish_handshake (GTlsConnectionGnutls *conn,
- gboolean success,
- GError **inout_error);
-
static void g_tls_client_connection_gnutls_client_connection_interface_init (GTlsClientConnectionInterface *iface);
static int g_tls_client_connection_gnutls_retrieve_function (gnutls_session_t session,
@@ -83,33 +64,6 @@ struct _GTlsClientConnectionGnutlsPrivate
GPtrArray *accepted_cas;
};
-static void
-g_tls_client_connection_gnutls_class_init (GTlsClientConnectionGnutlsClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GTlsConnectionGnutlsClass *connection_gnutls_class = G_TLS_CONNECTION_GNUTLS_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GTlsClientConnectionGnutlsPrivate));
-
- gobject_class->get_property = g_tls_client_connection_gnutls_get_property;
- gobject_class->set_property = g_tls_client_connection_gnutls_set_property;
- gobject_class->constructed = g_tls_client_connection_gnutls_constructed;
- gobject_class->finalize = g_tls_client_connection_gnutls_finalize;
-
- connection_gnutls_class->begin_handshake = g_tls_client_connection_gnutls_begin_handshake;
- connection_gnutls_class->verify_peer = g_tls_client_connection_gnutls_verify_peer;
- connection_gnutls_class->finish_handshake = g_tls_client_connection_gnutls_finish_handshake;
-
- g_object_class_override_property (gobject_class, PROP_VALIDATION_FLAGS, "validation-flags");
- g_object_class_override_property (gobject_class, PROP_SERVER_IDENTITY, "server-identity");
- g_object_class_override_property (gobject_class, PROP_USE_SSL3, "use-ssl3");
- g_object_class_override_property (gobject_class, PROP_ACCEPTED_CAS, "accepted-cas");
-}
-
-static void
-g_tls_client_connection_gnutls_client_connection_interface_init (GTlsClientConnectionInterface *iface)
-{
-}
static void
g_tls_client_connection_gnutls_init (GTlsClientConnectionGnutls *gnutls)
@@ -402,3 +356,31 @@ g_tls_client_connection_gnutls_finish_handshake (GTlsConnectionGnutls *conn,
g_tls_backend_gnutls_uncache_session_data (gnutls->priv->session_id);
}
}
+
+static void
+g_tls_client_connection_gnutls_class_init (GTlsClientConnectionGnutlsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GTlsConnectionGnutlsClass *connection_gnutls_class = G_TLS_CONNECTION_GNUTLS_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GTlsClientConnectionGnutlsPrivate));
+
+ gobject_class->get_property = g_tls_client_connection_gnutls_get_property;
+ gobject_class->set_property = g_tls_client_connection_gnutls_set_property;
+ gobject_class->constructed = g_tls_client_connection_gnutls_constructed;
+ gobject_class->finalize = g_tls_client_connection_gnutls_finalize;
+
+ connection_gnutls_class->begin_handshake = g_tls_client_connection_gnutls_begin_handshake;
+ connection_gnutls_class->verify_peer = g_tls_client_connection_gnutls_verify_peer;
+ connection_gnutls_class->finish_handshake = g_tls_client_connection_gnutls_finish_handshake;
+
+ g_object_class_override_property (gobject_class, PROP_VALIDATION_FLAGS, "validation-flags");
+ g_object_class_override_property (gobject_class, PROP_SERVER_IDENTITY, "server-identity");
+ g_object_class_override_property (gobject_class, PROP_USE_SSL3, "use-ssl3");
+ g_object_class_override_property (gobject_class, PROP_ACCEPTED_CAS, "accepted-cas");
+}
+
+static void
+g_tls_client_connection_gnutls_client_connection_interface_init (GTlsClientConnectionInterface *iface)
+{
+}
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 8469658..36e0df2 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -38,43 +38,6 @@
#include <glib/gi18n-lib.h>
-static void g_tls_connection_gnutls_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void g_tls_connection_gnutls_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void g_tls_connection_gnutls_finalize (GObject *object);
-
-static gboolean g_tls_connection_gnutls_handshake (GTlsConnection *connection,
- GCancellable *cancellable,
- GError **error);
-static void g_tls_connection_gnutls_handshake_async (GTlsConnection *conn,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-static gboolean g_tls_connection_gnutls_handshake_finish (GTlsConnection *conn,
- GAsyncResult *result,
- GError **error);
-
-static GInputStream *g_tls_connection_gnutls_get_input_stream (GIOStream *stream);
-static GOutputStream *g_tls_connection_gnutls_get_output_stream (GIOStream *stream);
-
-static gboolean g_tls_connection_gnutls_close (GIOStream *stream,
- GCancellable *cancellable,
- GError **error);
-static void g_tls_connection_gnutls_close_async (GIOStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-static gboolean g_tls_connection_gnutls_close_finish (GIOStream *stream,
- GAsyncResult *result,
- GError **error);
-
static ssize_t g_tls_connection_gnutls_push_func (gnutls_transport_ptr_t transport_data,
const void *buf,
size_t buflen);
@@ -155,46 +118,6 @@ struct _GTlsConnectionGnutlsPrivate
static gint unique_interaction_id = 0;
static void
-g_tls_connection_gnutls_class_init (GTlsConnectionGnutlsClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GTlsConnectionClass *connection_class = G_TLS_CONNECTION_CLASS (klass);
- GIOStreamClass *iostream_class = G_IO_STREAM_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GTlsConnectionGnutlsPrivate));
-
- gobject_class->get_property = g_tls_connection_gnutls_get_property;
- gobject_class->set_property = g_tls_connection_gnutls_set_property;
- gobject_class->finalize = g_tls_connection_gnutls_finalize;
-
- connection_class->handshake = g_tls_connection_gnutls_handshake;
- connection_class->handshake_async = g_tls_connection_gnutls_handshake_async;
- connection_class->handshake_finish = g_tls_connection_gnutls_handshake_finish;
-
- iostream_class->get_input_stream = g_tls_connection_gnutls_get_input_stream;
- iostream_class->get_output_stream = g_tls_connection_gnutls_get_output_stream;
- iostream_class->close_fn = g_tls_connection_gnutls_close;
- iostream_class->close_async = g_tls_connection_gnutls_close_async;
- iostream_class->close_finish = g_tls_connection_gnutls_close_finish;
-
- g_object_class_override_property (gobject_class, PROP_BASE_IO_STREAM, "base-io-stream");
- g_object_class_override_property (gobject_class, PROP_REQUIRE_CLOSE_NOTIFY, "require-close-notify");
- g_object_class_override_property (gobject_class, PROP_REHANDSHAKE_MODE, "rehandshake-mode");
- g_object_class_override_property (gobject_class, PROP_USE_SYSTEM_CERTDB, "use-system-certdb");
- g_object_class_override_property (gobject_class, PROP_DATABASE, "database");
- g_object_class_override_property (gobject_class, PROP_CERTIFICATE, "certificate");
- g_object_class_override_property (gobject_class, PROP_INTERACTION, "interaction");
- g_object_class_override_property (gobject_class, PROP_PEER_CERTIFICATE, "peer-certificate");
- g_object_class_override_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS, "peer-certificate-errors");
-}
-
-static void
-g_tls_connection_gnutls_initable_iface_init (GInitableIface *iface)
-{
- iface->init = g_tls_connection_gnutls_initable_init;
-}
-
-static void
g_tls_connection_gnutls_init (GTlsConnectionGnutls *gnutls)
{
gint unique_id;
@@ -1378,3 +1301,43 @@ on_pin_prompt_callback (const char *pinfile,
}
#endif /* HAVE_PKCS11 */
+
+static void
+g_tls_connection_gnutls_class_init (GTlsConnectionGnutlsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GTlsConnectionClass *connection_class = G_TLS_CONNECTION_CLASS (klass);
+ GIOStreamClass *iostream_class = G_IO_STREAM_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GTlsConnectionGnutlsPrivate));
+
+ gobject_class->get_property = g_tls_connection_gnutls_get_property;
+ gobject_class->set_property = g_tls_connection_gnutls_set_property;
+ gobject_class->finalize = g_tls_connection_gnutls_finalize;
+
+ connection_class->handshake = g_tls_connection_gnutls_handshake;
+ connection_class->handshake_async = g_tls_connection_gnutls_handshake_async;
+ connection_class->handshake_finish = g_tls_connection_gnutls_handshake_finish;
+
+ iostream_class->get_input_stream = g_tls_connection_gnutls_get_input_stream;
+ iostream_class->get_output_stream = g_tls_connection_gnutls_get_output_stream;
+ iostream_class->close_fn = g_tls_connection_gnutls_close;
+ iostream_class->close_async = g_tls_connection_gnutls_close_async;
+ iostream_class->close_finish = g_tls_connection_gnutls_close_finish;
+
+ g_object_class_override_property (gobject_class, PROP_BASE_IO_STREAM, "base-io-stream");
+ g_object_class_override_property (gobject_class, PROP_REQUIRE_CLOSE_NOTIFY, "require-close-notify");
+ g_object_class_override_property (gobject_class, PROP_REHANDSHAKE_MODE, "rehandshake-mode");
+ g_object_class_override_property (gobject_class, PROP_USE_SYSTEM_CERTDB, "use-system-certdb");
+ g_object_class_override_property (gobject_class, PROP_DATABASE, "database");
+ g_object_class_override_property (gobject_class, PROP_CERTIFICATE, "certificate");
+ g_object_class_override_property (gobject_class, PROP_INTERACTION, "interaction");
+ g_object_class_override_property (gobject_class, PROP_PEER_CERTIFICATE, "peer-certificate");
+ g_object_class_override_property (gobject_class, PROP_PEER_CERTIFICATE_ERRORS, "peer-certificate-errors");
+}
+
+static void
+g_tls_connection_gnutls_initable_iface_init (GInitableIface *iface)
+{
+ iface->init = g_tls_connection_gnutls_initable_init;
+}
diff --git a/tls/gnutls/gtlsserverconnection-gnutls.c b/tls/gnutls/gtlsserverconnection-gnutls.c
index 9360c3a..24d9ac2 100644
--- a/tls/gnutls/gtlsserverconnection-gnutls.c
+++ b/tls/gnutls/gtlsserverconnection-gnutls.c
@@ -34,27 +34,8 @@ enum
PROP_AUTHENTICATION_MODE
};
-static void g_tls_server_connection_gnutls_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void g_tls_server_connection_gnutls_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void g_tls_server_connection_gnutls_begin_handshake (GTlsConnectionGnutls *conn);
-static gboolean g_tls_server_connection_gnutls_verify_peer (GTlsConnectionGnutls *gnutls,
- GTlsCertificate *peer_certificate,
- GTlsCertificateFlags *errors);
-static void g_tls_server_connection_gnutls_finish_handshake (GTlsConnectionGnutls *conn,
- gboolean success,
- GError **inout_error);
-
static void g_tls_server_connection_gnutls_initable_interface_init (GInitableIface *iface);
-static gboolean g_tls_server_connection_gnutls_initable_init (GInitable *initable,
- GCancellable *cancellable,
- GError **error);
+
static void g_tls_server_connection_gnutls_server_connection_interface_init (GTlsServerConnectionInterface *iface);
static int g_tls_server_connection_gnutls_retrieve_function (gnutls_session_t session,
@@ -79,37 +60,6 @@ struct _GTlsServerConnectionGnutlsPrivate
};
static void
-g_tls_server_connection_gnutls_class_init (GTlsServerConnectionGnutlsClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GTlsConnectionGnutlsClass *connection_gnutls_class = G_TLS_CONNECTION_GNUTLS_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GTlsServerConnectionGnutlsPrivate));
-
- gobject_class->get_property = g_tls_server_connection_gnutls_get_property;
- gobject_class->set_property = g_tls_server_connection_gnutls_set_property;
-
- connection_gnutls_class->begin_handshake = g_tls_server_connection_gnutls_begin_handshake;
- connection_gnutls_class->verify_peer = g_tls_server_connection_gnutls_verify_peer;
- connection_gnutls_class->finish_handshake = g_tls_server_connection_gnutls_finish_handshake;
-
- g_object_class_override_property (gobject_class, PROP_AUTHENTICATION_MODE, "authentication-mode");
-}
-
-static void
-g_tls_server_connection_gnutls_server_connection_interface_init (GTlsServerConnectionInterface *iface)
-{
-}
-
-static void
-g_tls_server_connection_gnutls_initable_interface_init (GInitableIface *iface)
-{
- g_tls_server_connection_gnutls_parent_initable_iface = g_type_interface_peek_parent (iface);
-
- iface->init = g_tls_server_connection_gnutls_initable_init;
-}
-
-static void
g_tls_server_connection_gnutls_init (GTlsServerConnectionGnutls *gnutls)
{
gnutls_certificate_credentials_t creds;
@@ -255,3 +205,34 @@ g_tls_server_connection_gnutls_finish_handshake (GTlsConnectionGnutls *gnutls,
GError **inout_error)
{
}
+
+static void
+g_tls_server_connection_gnutls_class_init (GTlsServerConnectionGnutlsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GTlsConnectionGnutlsClass *connection_gnutls_class = G_TLS_CONNECTION_GNUTLS_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GTlsServerConnectionGnutlsPrivate));
+
+ gobject_class->get_property = g_tls_server_connection_gnutls_get_property;
+ gobject_class->set_property = g_tls_server_connection_gnutls_set_property;
+
+ connection_gnutls_class->begin_handshake = g_tls_server_connection_gnutls_begin_handshake;
+ connection_gnutls_class->verify_peer = g_tls_server_connection_gnutls_verify_peer;
+ connection_gnutls_class->finish_handshake = g_tls_server_connection_gnutls_finish_handshake;
+
+ g_object_class_override_property (gobject_class, PROP_AUTHENTICATION_MODE, "authentication-mode");
+}
+
+static void
+g_tls_server_connection_gnutls_server_connection_interface_init (GTlsServerConnectionInterface *iface)
+{
+}
+
+static void
+g_tls_server_connection_gnutls_initable_interface_init (GInitableIface *iface)
+{
+ g_tls_server_connection_gnutls_parent_initable_iface = g_type_interface_peek_parent (iface);
+
+ iface->init = g_tls_server_connection_gnutls_initable_init;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]