Re: AW: APR::BucketType bucket types?

[prev] [thread] [next] [Date index for 2005/04/05]

From: Stas Bekman
Subject: Re: AW: APR::BucketType bucket types?
Date: 15:51 on 05 Apr 2005
Dintelmann, Peter wrote:
>>-----Ursprüngliche Nachricht-----
>>Von: Stas Bekman [mailto:stas@xxxxxx.xxx]
>>Gesendet: Montag, 4. April 2005 18:47
>>An: Dintelmann, Peter
>>Cc: 'modperl@xxxx.xxxxxx.xxx'
>>Betreff: Re: APR::BucketType bucket types?
>>
>>
>>Dintelmann, Peter wrote:
>>
>>>I am looking for a list of the bucket types for APR::BucketType
>>>objects and their meanings. So far I have encountered the types 
>>>"FLUSH", "EOC" (end of connection?) and "mod_perl SV bucket".
>>>
>>>It seems that bucket type (names) are only available as strings.
>>>When looking for buckets of a particular type a comparison
>>>to an integer constant would be more efficient. Can we have
>>>some constants in APR::Const for this purpose and the bucket
>>>type name as a dual valued scalar?
>>
>>Peter, libapr identifies buckets only by their name. How do 
>>you suggest 
>>that we manage their numerical values? A new bucket type can 
>>be added any 
>>moment and we won't have an ID for it. APR::Const only 
>>provides a glue for 
>>the existing libapr's C-level constants. If you want a change of this 
>>kind, you will have to ensure that libapr provides that ID 
>>first and mp2 
>>will follow.
> 
> 
> 	ok; I didn't think about that...
> 	So what is the most efficient way to determine the 
> 	"standard" bucket types like EOS/EOC/FLUSH? 

with is_foo methods:
http://perl.apache.org/docs/2.0/api/APR/Bucket.html
though at the moment we expose just two of them. Which ones do you lack?

> How is is_eos() doing it?

APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_eos = {
     "EOS", 5, APR_BUCKET_METADATA,
     apr_bucket_destroy_noop,
     eos_bucket_read,
     apr_bucket_setaside_noop,
     apr_bucket_split_notimpl,
     apr_bucket_simple_copy
};

#define APR_BUCKET_IS_EOS(e)         ((e)->type == &apr_bucket_type_eos)

As you can see apr_bucket_type_eos is a struct, not a numerical value. I 
guess since it checks the address, it's possible to present it as a constant.

        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

AW: APR::BucketType bucket types?
Dintelmann, Peter 10:37 on 05 Apr 2005

Re: AW: APR::BucketType bucket types?
Stas Bekman 15:51 on 05 Apr 2005

Generated at 14:43 on 11 Apr 2005 by mariachi v0.52