diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-01-15 06:48:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-01-15 06:48:09 +0800 |
commit | 24a2d4baa8137fa990fff01b8e751538311d4de2 (patch) | |
tree | 9c6f87eac22ceed5b818425ef4598f0804373f54 /camel/camel-tcp-stream-ssl.c | |
parent | 80b2b2222ea67c50e0e3f9fdeb1797fb7874f862 (diff) | |
download | gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.tar.gz gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.tar.zst gsoc2013-evolution-24a2d4baa8137fa990fff01b8e751538311d4de2.zip |
Implemented. (stream_setsockopt): Implemented.
2001-01-14 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-ssl.c (stream_getsockopt): Implemented.
(stream_setsockopt): Implemented.
* camel-tcp-stream-raw.c (stream_getsockopt): Implemented.
(stream_setsockopt): Implemented.
* camel-tcp-stream.c (camel_tcp_stream_getsockopt): New method.
(camel_tcp_stream_setsockopt): Another new method. I think you get
the idea of what these are for so I won't explain them.
svn path=/trunk/; revision=7491
Diffstat (limited to 'camel/camel-tcp-stream-ssl.c')
-rw-r--r-- | camel/camel-tcp-stream-ssl.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c index e12d32251d..93b2e9da25 100644 --- a/camel/camel-tcp-stream-ssl.c +++ b/camel/camel-tcp-stream-ssl.c @@ -40,8 +40,10 @@ static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n); static int stream_flush (CamelStream *stream); static int stream_close (CamelStream *stream); -static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port); +static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port); static int stream_disconnect (CamelTcpStream *stream); +static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data); +static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data); static void camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *camel_tcp_stream_ssl_class) @@ -61,6 +63,8 @@ camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *camel_tcp_stream_ssl_cl camel_tcp_stream_class->connect = stream_connect; camel_tcp_stream_class->disconnect = stream_disconnect; + camel_tcp_stream_class->getsockopt = stream_getsockopt; + camel_tcp_stream_class->setsockopt = stream_setsockopt; } static void @@ -203,3 +207,33 @@ stream_disconnect (CamelTcpStream *stream) return PR_Close (((CamelTcpStreamSSL *)stream)->sockfd); } + +static int +stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data) +{ + PRSocketOptionData sodata; + + memset ((void *) &sodata, 0, sizeof (sodata)); + memcpy ((void *) &sodata, (void *) data, sizeof (CamelSockOptData)); + + if (PR_GetSocketOption (((CamelTcpStreamSSL *)stream)->sockfd, &sodata) == PR_FAILURE) + return -1; + + memcpy ((void *) data, (void *) &sodata, sizeof (CamelSockOptData)); + + return 0; +} + +static int +stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data) +{ + PRSocketOptionData sodata; + + memset ((void *) &sodata, 0, sizeof (sodata)); + memcpy ((void *) &sodata, (void *) data, sizeof (CamelSockOptData)); + + if (PR_SetSocketOption (((CamelTcpStreamRaw *)stream)->sockfd, &sodata) == PR_FAILURE) + return -1; + + return 0; +} |