[evolution-data-server/camel-socks-proxy] Add a private struct to CamelTcpStream



commit d7551e5fded84686949d09210d7e06b07e617a61
Author: Federico Mena Quintero <federico novell com>
Date:   Wed May 19 15:03:52 2010 -0500

    Add a private struct to CamelTcpStream
    
    We will use it to store the info for the SOCKS host/port.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 camel/camel-tcp-stream.c |   30 ++++++++++++++++++++++++++++--
 camel/camel-tcp-stream.h |    1 +
 2 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index 686a0f0..2cf387e 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -30,6 +30,13 @@
 
 #define w(x)
 
+typedef struct _CamelTcpStreamPrivate CamelTcpStreamPrivate;
+
+struct _CamelTcpStreamPrivate {
+	gchar *socks_host;
+	gint socks_port;
+};
+
 static CamelStreamClass *parent_class = NULL;
 
 /* Returns the class for a CamelTcpStream */
@@ -59,7 +66,26 @@ camel_tcp_stream_class_init (CamelTcpStreamClass *camel_tcp_stream_class)
 static void
 camel_tcp_stream_init (gpointer o)
 {
-	;
+	CamelTcpStream *stream = o;
+	CamelTcpStreamPrivate *priv;
+
+	priv = g_slice_new0 (CamelTcpStreamPrivate);
+	stream->priv = priv;
+
+	priv->socks_host = NULL;
+	priv->socks_port = 0;
+}
+
+static void
+camel_tcp_stream_finalize (CamelTcpStream *stream)
+{
+	CamelTcpStreamPrivate *priv;
+
+	priv = stream->priv;
+	g_free (priv->socks_host);
+
+	g_slice_free (CamelTcpStreamPrivate, priv);
+	stream->priv = NULL;
 }
 
 CamelType
@@ -75,7 +101,7 @@ camel_tcp_stream_get_type (void)
 					    (CamelObjectClassInitFunc) camel_tcp_stream_class_init,
 					    NULL,
 					    (CamelObjectInitFunc) camel_tcp_stream_init,
-					    NULL);
+					    (CamelObjectFinalizeFunc) camel_tcp_stream_finalize);
 	}
 
 	return type;
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index d48ba81..cc71258 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -93,6 +93,7 @@ typedef struct _CamelSockOptData {
 struct _CamelTcpStream {
 	CamelStream parent_object;
 
+	struct _CamelTcpStreamPrivate *priv;
 };
 
 typedef struct {



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