[evolution-data-server/camel-socks-proxy] New method CamelTcpStream::get_file_desc()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/camel-socks-proxy] New method CamelTcpStream::get_file_desc()
- Date: Thu, 15 Jul 2010 02:22:44 +0000 (UTC)
commit e11a0ded4841a192a5f215688c5a859e32eddaca
Author: Federico Mena Quintero <federico novell com>
Date: Wed Jul 14 15:15:01 2010 -0500
New method CamelTcpStream::get_file_desc()
This returns a (PRFileDesc *). We will make CamelTcpStream derivates deal only
in PRFileDesc objects, instead of plain FDs. This will allow us to implement
TCP socket functionality only once, instead of twice - one for raw streams, one
for SSL streams. Mainly this will let us have a raw stream and then an
SSL stream overlaid on that one.
Signed-off-by: Federico Mena Quintero <federico novell com>
camel/camel-tcp-stream.c | 17 +++++++++++++++++
camel/camel-tcp-stream.h | 5 +++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index f61e179..28febf5 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -47,6 +47,7 @@ static gint tcp_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
static gint tcp_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
static struct sockaddr *tcp_get_local_address (CamelTcpStream *stream, socklen_t *len);
static struct sockaddr *tcp_get_remote_address (CamelTcpStream *stream, socklen_t *len);
+static PRFileDesc *tcp_get_file_desc (CamelTcpStream *stream);
static void
camel_tcp_stream_class_init (CamelTcpStreamClass *camel_tcp_stream_class)
@@ -61,6 +62,7 @@ camel_tcp_stream_class_init (CamelTcpStreamClass *camel_tcp_stream_class)
camel_tcp_stream_class->setsockopt = tcp_setsockopt;
camel_tcp_stream_class->get_local_address = tcp_get_local_address;
camel_tcp_stream_class->get_remote_address = tcp_get_remote_address;
+ camel_tcp_stream_class->get_file_desc = tcp_get_file_desc;
}
static void
@@ -185,6 +187,14 @@ camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *dat
return CTS_CLASS (stream)->setsockopt (stream, data);
}
+PRFileDesc *
+camel_tcp_stream_get_file_desc (CamelTcpStream *stream)
+{
+ g_return_val_if_fail (CAMEL_IS_TCP_STREAM (stream), NULL);
+
+ return CTS_CLASS (stream)->get_file_desc (stream);
+}
+
/**
* camel_tcp_stream_set_socks_proxy:
* @stream: a #CamelTcpStream object
@@ -265,6 +275,13 @@ tcp_get_remote_address (CamelTcpStream *stream, socklen_t *len)
return NULL;
}
+static PRFileDesc *
+tcp_get_file_desc (CamelTcpStream *stream)
+{
+ w(g_warning ("CamelTcpStream::get_file_desc called on default implementation"));
+ return NULL;
+}
+
/**
* camel_tcp_stream_get_remote_address:
* @stream: a #CamelTcpStream object
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index b3e5782..c58946e 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -37,6 +37,8 @@
#endif
#include <unistd.h>
+#include <prio.h>
+
#include <camel/camel-exception.h>
#include <camel/camel-stream.h>
@@ -107,6 +109,8 @@ typedef struct {
struct sockaddr * (*get_local_address) (CamelTcpStream *stream, socklen_t *len);
struct sockaddr * (*get_remote_address) (CamelTcpStream *stream, socklen_t *len);
+
+ PRFileDesc * (*get_file_desc) (CamelTcpStream *stream);
} CamelTcpStreamClass;
/* Standard Camel function */
@@ -116,6 +120,7 @@ CamelType camel_tcp_stream_get_type (void);
gint camel_tcp_stream_connect (CamelTcpStream *stream, const char *host, const char *service, gint fallback_port, CamelException *ex);
gint camel_tcp_stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
gint camel_tcp_stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
+PRFileDesc *camel_tcp_stream_get_file_desc (CamelTcpStream *stream);
/* Note about SOCKS proxies:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]