diff options
author | Pierre Ossman <ossman@cendio.se> | 2012-07-03 14:43:38 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2012-07-03 14:43:38 +0000 |
commit | fe48cd4d2427c0262cd58b30c74331a9fce756c7 (patch) | |
tree | 453992f3361da2899981bbfe360f3cbfa0a56e5e /common/rdr/TLSInStream.cxx | |
parent | ae60016b2aa97b7cf78dcb52a4ef8aa4ebb45a39 (diff) | |
download | tigervnc-fe48cd4d2427c0262cd58b30c74331a9fce756c7.tar.gz tigervnc-fe48cd4d2427c0262cd58b30c74331a9fce756c7.zip |
Refactor the TLS code so that the push/pull functions are aware of their
containing stream object. This is in preparation for supporting GnuTLS 3.x.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4921 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rdr/TLSInStream.cxx')
-rw-r--r-- | common/rdr/TLSInStream.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/common/rdr/TLSInStream.cxx b/common/rdr/TLSInStream.cxx index ddc99917..e553085f 100644 --- a/common/rdr/TLSInStream.cxx +++ b/common/rdr/TLSInStream.cxx @@ -36,10 +36,10 @@ using namespace rdr; enum { DEFAULT_BUF_SIZE = 16384 }; -ssize_t rdr::gnutls_InStream_pull(gnutls_transport_ptr str, void* data, - size_t size) +ssize_t TLSInStream::pull(gnutls_transport_ptr str, void* data, size_t size) { - InStream* in= (InStream*) str; + TLSInStream* self= (TLSInStream*) str; + InStream *in = self->in; try { if (!in->check(1, 1, false)) { @@ -63,11 +63,19 @@ ssize_t rdr::gnutls_InStream_pull(gnutls_transport_ptr str, void* data, TLSInStream::TLSInStream(InStream* _in, gnutls_session _session) : session(_session), in(_in), bufSize(DEFAULT_BUF_SIZE), offset(0) { + gnutls_transport_ptr recv, send; + ptr = end = start = new U8[bufSize]; + + gnutls_transport_set_pull_function(session, pull); + gnutls_transport_get_ptr2(session, &recv, &send); + gnutls_transport_set_ptr2(session, this, send); } TLSInStream::~TLSInStream() { + gnutls_transport_set_pull_function(session, NULL); + delete[] start; } |