[Help-gnutls] Re: Equivalent to fdopen?

Simon Josefsson simon at josefsson.org
Tue Aug 19 01:11:23 CEST 2008


Florian Weimer <fweimer at bfk.de> writes:

> * Simon Josefsson:
>
>> There is no such equivalent now.  If it is possible to implement it, it
>> would be a cool feature.  But is it possible to implement it?  I dunno.
>> Seems like you need some hooks into the f* buffering structures used by
>> libc.  It doesn't sound trivial to do.
>
> You could use socketpair() and threads.  But it's certainly not a nice
> approach.

Right, and since it would be good to avoid thread stuff in libgnutls, I
think it cannot be made part of libgnutls.  But if someone wants to
provide code for this, putting it in a libgnutls-stream library or
similar could be done, and may be useful.

I suspect rewriting code to use normal read+write instead of buffered f*
function is simpler and more reliable though.  TLS has some semantic
differences compared to network streams that may be difficult to
simulate (e.g., re-handshakes and alert messages).

/Simon





More information about the Gnutls-help mailing list