Subject: stackable read/write (was Re: New read & write syscalls)
To: None <tech-kern@netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-kern
Date: 07/02/1999 12:01:00
Not quite the same thing I know, but I'd love to able to have stackable
read/write/close routines.  If done in a suitably generic maner, all sorts of 
possibilities errupt :-)

For example, my libsslfd provides read(),write() and close() calls that 
check whether the fd is associated with an SSL session and if so call the
appropriate routines in libssl - which in turn call read(), write() etc.
Obviously my read() etc need to check for and deal with the recursion.

The above all works swimingly on *nix that have syscall() or a libc.a from
which I can extract and hack read.o etc.  The upshot is that it typically
takes a couple of lines of code to add SSL support to an application that 
uses stdio.

Now, try and add SOCKS5 support and the above model breaks down very quickly.
But were it possible to chain read/write type calls it would be quite
simple to call a routine that "push"ed the SSL or SOCKS5 routines or both
onto the read/write path.  

Madness?

--sjg