apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: [PATCH] APR Socket IOL
Date Thu, 08 Nov 2001 20:28:42 GMT

> On Thursday 08 November 2001 07:32 am, Bill Stoddard wrote:
> > This patch is a first rough implementation of a socket iol in APR (from
> > discussions with Sander Striker a few months back).
> >
> > Public API Changes:
> > No new APIs were created.
> > apr_socket_create() has an extra parameter, a pointer to an
> > apr_socket_iol_t.
> >
> > New Public Structures:
> > apr_socket_iol_t - contains pointers to callback functions.
> >
> > Usage:
> > If you do not want to redirect socket calls and just use existing APR
> > calls, use apr_socket_create() thusly:
> > apr_socket_create(&new_sock, APR_INET, SOCKSTREAM, NULL, r->pool);
> >
> >


> > Comments?
> What is this supposed to be used for?  I'm still not sure that this is necessary.

Sander and I both have similar requirements.  Here are mine...

1. My SSL library implements socket style secure APIs (eg, secure_read, secure_write, et.
al). These APIs are semantically identical to BSD socket APIs.

2. I have this little kernel accellerator that, on windows, implements it's own BSD like
socket API. It implements calls like afpa_read, afpa_write, etc. Again, this API is
semantically identical to BSD sockets.

The socket IOL makes implementing my SSL and AFPA modules significantly cleaner. Without
iol, I am forced to modify the APR code. For every network i/o call in APR, I need to add
code that looks something like this:

if (sock->type == AFPA_SOCK) {
} else if (sock->type == SSL_SOCK) {

With the socket IOL, I can isolate all my modules code within my module and not touch the
rest of the server or APR. I think I may need a couple of additional APIs to push and pop
IOL's. For instance, my SSL code uses BSD accept() (nothing new there). In the
pre_connection hook, I can detect if the server is enabled for SSL and push the
appropriate IOL onto the socket for all subsequent network io calls.


View raw message