[Libdexter-commits] SF.net SVN: libdexter: [377]
Brought to you by:
pkovacs
|
From: <pk...@us...> - 2007-06-30 02:57:36
|
Revision: 377
http://svn.sourceforge.net/libdexter/?rev=377&view=rev
Author: pkovacs
Date: 2007-06-29 19:57:33 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
API changes for DexterChannel;
Gentoo ebuild changes
Modified Paths:
--------------
distro/portage/net-libs/dxt-plugins-audacious/dxt-plugins-audacious-0.999.ebuild
distro/portage/net-libs/dxt-plugins-sysinfo/dxt-plugins-sysinfo-0.999.ebuild
distro/portage/net-libs/libdexter/libdexter-0.999.ebuild
libdexter/trunk/dexter/dexter-channel-internal.h
libdexter/trunk/dexter/dexter-channel-object.c
libdexter/trunk/dexter/dexter-channel.c
libdexter/trunk/dexter/dexter-channel.h
libdexter/trunk/dexter/dexter-sampler.c
libdexter/trunk/dexter/dexter-timedsampler.c
Modified: distro/portage/net-libs/dxt-plugins-audacious/dxt-plugins-audacious-0.999.ebuild
===================================================================
--- distro/portage/net-libs/dxt-plugins-audacious/dxt-plugins-audacious-0.999.ebuild 2007-06-29 04:06:29 UTC (rev 376)
+++ distro/portage/net-libs/dxt-plugins-audacious/dxt-plugins-audacious-0.999.ebuild 2007-06-30 02:57:33 UTC (rev 377)
@@ -3,7 +3,7 @@
# Distributed under the terms of the GNU Lesser General Public License v2.1
# $Header:
-inherit flag-o-matic subversion
+inherit subversion
DESCRIPTION="dxt-plugins-audacious is an Audacious plugin for the libdexter distributed sampling library"
HOMEPAGE="http://www.libdexter.org"
Modified: distro/portage/net-libs/dxt-plugins-sysinfo/dxt-plugins-sysinfo-0.999.ebuild
===================================================================
--- distro/portage/net-libs/dxt-plugins-sysinfo/dxt-plugins-sysinfo-0.999.ebuild 2007-06-29 04:06:29 UTC (rev 376)
+++ distro/portage/net-libs/dxt-plugins-sysinfo/dxt-plugins-sysinfo-0.999.ebuild 2007-06-30 02:57:33 UTC (rev 377)
@@ -3,7 +3,7 @@
# Distributed under the terms of the GNU Lesser General Public License v2.1
# $Header:
-inherit flag-o-matic subversion
+inherit subversion
DESCRIPTION="dxt-plugins-sysinfo is an Audacious plugin for the libdexter distributed sampling library"
HOMEPAGE="http://www.libdexter.org"
Modified: distro/portage/net-libs/libdexter/libdexter-0.999.ebuild
===================================================================
--- distro/portage/net-libs/libdexter/libdexter-0.999.ebuild 2007-06-29 04:06:29 UTC (rev 376)
+++ distro/portage/net-libs/libdexter/libdexter-0.999.ebuild 2007-06-30 02:57:33 UTC (rev 377)
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU Lesser General Public License v2.1
# $Id$
-inherit flag-o-matic subversion
+inherit subversion
DESCRIPTION="Libdexter is a plugin-based, distributed sampling library"
HOMEPAGE="http://www.libdexter.org"
Modified: libdexter/trunk/dexter/dexter-channel-internal.h
===================================================================
--- libdexter/trunk/dexter/dexter-channel-internal.h 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-channel-internal.h 2007-06-30 02:57:33 UTC (rev 377)
@@ -56,6 +56,9 @@
GType dexter_channel_get_type (void) G_GNUC_INTERNAL G_GNUC_CONST;
+const DexterChannelSettings
+ *dexter_channel_get_settings (DexterChannel *channel) G_GNUC_INTERNAL;
+
gboolean dexter_channel_register_channel_object (DexterChannel *channel,
DexterChannelObject *channel_object,
gint wait_types) G_GNUC_INTERNAL;
Modified: libdexter/trunk/dexter/dexter-channel-object.c
===================================================================
--- libdexter/trunk/dexter/dexter-channel-object.c 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-channel-object.c 2007-06-30 02:57:33 UTC (rev 377)
@@ -65,8 +65,6 @@
static void
dexter_channel_object_init (DexterChannelObject *channel_object)
{
- gint timeout;
-
#ifdef G_ENABLE_DEBUG
g_message (G_STRFUNC);
#endif
@@ -76,19 +74,7 @@
channel_object->id = 0;
channel_object->mbox = NULL;
channel_object->wait_types = 0;
-
- if (!dexter_config_get_integer (__ICONFIG, "Main", "ChannelTimeoutMsecs",
- &timeout, NULL))
- {
- timeout = DEFAULT_CHANNEL_OBJECT_TIMEOUT_MSECS;
- }
- if (timeout <= 0)
- {
- timeout = DEFAULT_CHANNEL_OBJECT_TIMEOUT_MSECS;
- g_warning ("%s: ChannelTimeoutMsecs must be > 0. Using default %d msecs.", G_STRFUNC, timeout);
- }
-
- channel_object->wait_timeout = (glong)(1000 * timeout);
+ channel_object->wait_timeout = 0;
}
Modified: libdexter/trunk/dexter/dexter-channel.c
===================================================================
--- libdexter/trunk/dexter/dexter-channel.c 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-channel.c 2007-06-30 02:57:33 UTC (rev 377)
@@ -108,14 +108,12 @@
static void dexter_channel_settings_prepare (DexterChannelSettings *settings);
#ifdef HAVE_TLS
-#if 0
static DexterChannelTLSSettings
*dexter_channel_tls_settings_new (const gchar *cert_file,
const gchar *key_file,
const gchar *trust_file,
const gchar *crl_file,
gboolean verify_hostname);
-#endif
static void dexter_channel_tls_settings_free (DexterChannelTLSSettings *tls_settings);
#endif /* HAVE_TLS */
@@ -151,10 +149,6 @@
GAsyncQueue *cmd_queue; /* channel commands are queued up here */
DexterHashTable *object_hash; /* channel object hash by (peer) id */
-
-#ifdef HAVE_TLS
- DexterChannelTLSSettings *tls_settings; /* TLS settings */
-#endif
};
struct _DexterChannelClass
@@ -271,9 +265,6 @@
channel->cmd_queue = g_async_queue_new ();
channel->object_hash = dexter_hash_table_new_full (g_int_hash, g_int_equal,
NULL, (GDestroyNotify) _destroy_object_hash_entry);
-#ifdef HAVE_TLS
- channel->tls_settings = NULL;
-#endif
}
@@ -302,10 +293,6 @@
dexter_hash_table_destroy (channel->object_hash);
-#ifdef HAVE_TLS
- dexter_channel_tls_settings_free (channel->tls_settings);
-#endif
-
/* chain up */
G_OBJECT_CLASS (dexter_channel_parent_class)->finalize (object);
}
@@ -615,15 +602,54 @@
}
else
{
+#ifndef HAVE_TLS
+ /* TLS not enabled */
+ g_set_error (error,
+ DEXTER_CHANNEL_ERROR, DEXTER_CHANNEL_ERROR_TLS_NOT_ENABLED,
+ "%s: TLS not enabled", G_STRFUNC);
+#else
DexterChannel *channel = DEXTER_CHANNEL (channel_object);
- /* start TLS handshake, with default parameters */
- dexter_network_session_client_starttls (channel->session,
- channel->tls_settings->cert_file,
- channel->tls_settings->key_file,
- channel->tls_settings->trust_file,
- channel->tls_settings->crl_file,
- channel->tls_settings->verify_hostname,
- error);
+
+ /* if specified, issue callback to finalize TLS parameters */
+ if (channel->settings->tls_start_callback)
+ {
+ /* copy TLS parameters */
+ DexterChannelTLSSettings *tls_settings =
+ dexter_channel_tls_settings_new (channel->settings->tls_cert_file,
+ channel->settings->tls_key_file,
+ channel->settings->tls_trust_file,
+ channel->settings->tls_crl_file,
+ channel->settings->tls_verify_hostname);
+
+ /* perform the callback */
+ (*channel->settings->tls_start_callback) (channel,
+ dexter_network_session_peer_addr (channel->session),
+ dexter_network_session_peer_addrlen (channel->session),
+ tls_settings);
+
+ /* start TLS handshake, with adjusted parameters */
+ dexter_network_session_client_starttls (channel->session,
+ tls_settings->cert_file,
+ tls_settings->key_file,
+ tls_settings->trust_file,
+ tls_settings->crl_file,
+ tls_settings->verify_hostname,
+ error);
+
+ dexter_channel_tls_settings_free (tls_settings);
+ }
+ else
+ {
+ /* start TLS handshake, with default parameters */
+ dexter_network_session_client_starttls (channel->session,
+ channel->settings->tls_cert_file,
+ channel->settings->tls_key_file,
+ channel->settings->tls_trust_file,
+ channel->settings->tls_crl_file,
+ channel->settings->tls_verify_hostname,
+ error);
+ }
+#endif
}
break;
}
@@ -869,7 +895,6 @@
#ifdef HAVE_TLS
-#if 0
static DexterChannelTLSSettings *
dexter_channel_tls_settings_new (const gchar *cert_file,
const gchar *key_file,
@@ -887,8 +912,8 @@
return tls_settings;
}
-#endif
+
static void
dexter_channel_tls_settings_free (DexterChannelTLSSettings *tls_settings)
{
@@ -1070,12 +1095,14 @@
dexter_channel_new (const DexterChannelSettings *settings)
{
DexterChannel *channel;
+ DexterChannelObject *channel_object;
#ifdef G_ENABLE_DEBUG
g_message (G_STRFUNC);
#endif
channel = g_object_new (DEXTER_TYPE_CHANNEL, NULL);
+ channel_object = DEXTER_CHANNEL_OBJECT (channel);
if (settings)
{
@@ -1089,7 +1116,8 @@
dexter_channel_settings_prepare (channel->settings);
/* register the channel as an object capable of receiving server messages */
- dexter_channel_register_channel_object (channel, DEXTER_CHANNEL_OBJECT (channel), DEXTER_MESSAGE_REPLY);
+ channel_object->wait_timeout = (glong)(1000 * channel->settings->timeout_msecs);
+ dexter_channel_register_channel_object (channel, channel_object, DEXTER_MESSAGE_REPLY);
return channel;
}
@@ -1413,51 +1441,6 @@
return FALSE;
}
- /* if specified, issue callback to finalize TLS parameters
- if (starttls_callback)
- {
- / copy default TLS parameters
- DexterChannelTLSParameters *tls_parameters =
- dexter_channel_tls_parameters_dup (channel->tls_parameters);
-
- / perform the callback
- (*starttls_callback) (channel,
- dexter_network_session_peer_addr (channel->session),
- dexter_network_session_peer_addrlen (channel->session),
- tls_parameters);
-
- / check the parameters
- dexter_channel_tls_parameters_check (tls_parameters);
-
- / start TLS handshake, with adjusted parameters
- dexter_network_session_client_starttls (channel->session,
- tls_parameters->cert_file,
- tls_parameters->key_file,
- tls_parameters->trust_file,
- tls_parameters->crl_file,
- tls_parameters->verify_hostname,
- &local_error);
- dexter_channel_tls_parameters_free (tls_parameters);
- }
- else
- {
- / start TLS handshake, with default parameters
- dexter_network_session_client_starttls (channel->session,
- channel->tls_parameters->cert_file,
- channel->tls_parameters->key_file,
- channel->tls_parameters->trust_file,
- channel->tls_parameters->crl_file,
- channel->tls_parameters->verify_hostname,
- &local_error);
- }
- if (local_error)
- {
- g_propagate_error (error, local_error);
- g_object_unref (channel);
- return FALSE;
- }
- */
-
g_object_unref (channel);
return TRUE;
@@ -1555,6 +1538,23 @@
}
+const DexterChannelSettings *
+dexter_channel_get_settings (DexterChannel *channel)
+{
+ const DexterChannelSettings *settings;
+
+ g_return_val_if_fail (DEXTER_IS_CHANNEL (channel), FALSE);
+
+ g_object_ref (channel);
+
+ settings = channel->settings;
+
+ g_object_unref (channel);
+
+ return settings;
+}
+
+
gboolean
dexter_channel_register_channel_object (DexterChannel *channel,
DexterChannelObject *channel_object,
Modified: libdexter/trunk/dexter/dexter-channel.h
===================================================================
--- libdexter/trunk/dexter/dexter-channel.h 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-channel.h 2007-06-30 02:57:33 UTC (rev 377)
@@ -126,8 +126,8 @@
* @crl_file: full path to X.509 certificate revocation list file in PEM format.
* @verify_hostname: verify that the hostname of server matches its X.509 certificate.
*
- * Parameters that the channel will use when starting TLS. The config file is used to specify
- * default values.
+ * TLS settings that the channel will use when starting TLS. They are copied from the
+ * #DexterChannelSettings structure provided to dexter_channel_new ().
*
* When this structure is seen within the context of a #DexterChannelTLSStartCallback,
* you may change the elements as needed. For any non-%NULL %gchar elements that you want
Modified: libdexter/trunk/dexter/dexter-sampler.c
===================================================================
--- libdexter/trunk/dexter/dexter-sampler.c 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-sampler.c 2007-06-30 02:57:33 UTC (rev 377)
@@ -336,9 +336,11 @@
if (channel)
{
+ DexterChannelObject *channel_object = DEXTER_CHANNEL_OBJECT (sampler);
+
/* register sampler as an object capable of receiving server messages */
- dexter_channel_register_channel_object (channel, DEXTER_CHANNEL_OBJECT (sampler),
- DEXTER_MESSAGE_REPLY | DEXTER_MESSAGE_DATA);
+ channel_object->wait_timeout = (glong)(1000 * dexter_channel_get_settings (channel) -> timeout_msecs);
+ dexter_channel_register_channel_object (channel, channel_object, DEXTER_MESSAGE_REPLY|DEXTER_MESSAGE_DATA);
g_object_unref (channel);
}
return sampler;
Modified: libdexter/trunk/dexter/dexter-timedsampler.c
===================================================================
--- libdexter/trunk/dexter/dexter-timedsampler.c 2007-06-29 04:06:29 UTC (rev 376)
+++ libdexter/trunk/dexter/dexter-timedsampler.c 2007-06-30 02:57:33 UTC (rev 377)
@@ -435,9 +435,11 @@
if (channel)
{
+ DexterChannelObject *channel_object = DEXTER_CHANNEL_OBJECT (timed_sampler);
+
/* register sampler as an object capable of receiving server messages */
- dexter_channel_register_channel_object (channel, DEXTER_CHANNEL_OBJECT (timed_sampler),
- DEXTER_MESSAGE_REPLY);
+ channel_object->wait_timeout = (glong)(1000 * dexter_channel_get_settings (channel) -> timeout_msecs);
+ dexter_channel_register_channel_object (channel, channel_object, DEXTER_MESSAGE_REPLY);
g_object_unref (channel);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|