[SR-Users] About setflag()'s parameter

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 6 10:24:22 CEST 2010


Hello,

On 7/6/10 10:16 AM, Alex Balashov wrote:
> Daniel,
>
> Based on this, I think I was erroneous in suggesting that plain flags 
> (setflag, isflagset) are transaction-associated.  They seem to be 
> message-associated, not transaction.  Is this right?

in first place is associated to message, then inherited to transaction 
(when that is created) and kept for the life of the transaction. So both 
associations are true, of course, a matter of whether the transaction 
was created or not at respective time.

Cheers,
Daniel

>
> Thanks,
>
> -- Alex
>
> On 07/06/2010 04:05 AM, Daniel-Constantin Mierla wrote:
>
>> Hello,
>>
>> here is a wiki page with some flag bitmask vector examples that might 
>> help:
>> http://www.kamailio.org/dokuwiki/doku.php/tutorials:openser-flag-operations 
>>
>>
>> The cfg file examples are for older kamailio versions.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 7/6/10 4:02 AM, Alex Balashov wrote:
>>> On 07/05/2010 09:59 PM, zhou tianjun wrote:
>>>
>>>> I'm in doubt of the means of setflag()'s parameter. I have looked for
>>>> it everywhere including internet and the ser source code, but no any
>>>> docs explained it in detail. can anybody tell me about it ?
>>>
>>> It sets bits in a 32-bit integer (it may be 64-bit on 64-bit
>>> platforms, of this I am not sure) that is bound to a transaction, so
>>> those "flags" may be accessed in requests and replies associated with
>>> a given transaction, or, further down in the execution flow of same
>>> message handler.
>>>
>>> It is precisely equivalent to the way bit vectors are used in
>>> general-purpose programming languages, e.g.
>>>
>>> int flags = 0;
>>>
>>> flags |= (1 << 4); /* Set bit 4 */
>>>
>>> if(flags & (1 << 4)) {
>>> printf("Bit 4 is set!\n");
>>> } else {
>>> printf("Bit 4 is not set!\n");
>>> }
>>>
>>> /* If bit 4 is set, unset it */
>>>
>>> if(flags & (1 << 4))
>>> flags &= ~(1 << 4);
>>>
>>>
>>
>
>

-- 
Daniel-Constantin Mierla
http://www.asipto.com/




More information about the sr-users mailing list