apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: buckets, brigades, md5
Date Sat, 26 May 2001 16:36:09 GMT
On Sat, May 26, 2001 at 03:22:45PM +0200, Sander Striker wrote:
> Hi,
> 
> I'm doing some snooping around the code in apr-util and
> I was wondering if someone can provide me with an example
> on how to use them. (I don't want to go through the apache
> code at the moment...) Maybe a testbucket program to fit
> in the apr-util/test directory? :-)

Buckets brigades are fairly straightforward (so I say).  Someone 
else (Roy or Ryan?) may have a more coherent explanation.  A bucket 
is some sort of data (heap, file, mmap, etc), while a brigade is a 
set of buckets.  But, you knew that.  

You can add buckets anywhere in the brigade (a brigade is typically
implemented as linked-list, IIRC).  There are certain types of buckets -
see the APR_BUCKET_IS_* #defines in apr_buckets.h.  Somewhere in 
apr_buckets.h is code for easily traversing a brigade (see 
APR_BRIGADE_FOREACH in apr_buckets.h and the comment above it describes 
how to traverse it).

Within httpd itself, filters contain bucket brigades.  I am not
currently aware of any other usage of bucket brigades outside of the
filter code.  IMHO, key files to look at in httpd-2.0 itself are 
server/util_filter.c and modules/http/http_protocol.c (see 
ap_http_filter).  mod_include and mod_tls also use filters.  Other
modules (such as my mod_mbox - see www.apachelabs.org) use them as well.
I tried to make the mod_mbox usage of filters fairly easy to understand
as I didn't find the mod_include code very easy to understand.  So, 
maybe the mod_mbox code might be easier to understand.

Rather than listen to me ramble, you might just be better off reading 
Roy's initial post on bucket brigades:

http://www.apachelabs.org/apache-mbox/199911.mbox/%3c199911122357.aa18914@gremlin-relay.ics.uci.edu%3e

I do know that what Roy described isn't exactly what was implemented, 
but it is close enough to get the general idea.

If you come up with a good example program, post it.  =)  I might
eventually add something, but no guarantees.  I have lots of things I
want to do first.  But, yeah, a program that easily showcases bucket
brigades outside of httpd-2.0 isn't a bad idea.  However, bucket
brigades are so tied into httpd-2.0, it is really hard to come up with
an example.

> Btw, I noticed Justin is planning on moving over md5 from
> apr to apr-util. Any chance md4 is added to the crypto/
> dir to?

Someone have reference code for md4?  I believe I'll be able to extract
md5 out of apr, but first I need something to implement randomness in 
APR.  Lots of dependencies at each step.  Baby steps...  -- justin


Mime
View raw message