[OpenSER-Devel] PV issues (was Re: discussion: issues with local_route)

Daniel-Constantin Mierla miconda at gmail.com
Mon Jun 23 10:24:15 CEST 2008


Hello Inaki,

On 06/23/08 11:00, Iñaki Baz Castillo wrote:
> El Monday 23 June 2008 09:30:35 Daniel-Constantin Mierla escribió:
>   
>> AVPs and VARs do not have null values
>>     
>
> Hi Daniel, what do you mean with "AVP's do not have null values"?
> I can do:
>
>   $avp(i:12) =null
>   if ! $avp(:12)
>     xlog("L_INFO", "avp(i:12) is null"
>   end
>
> But I cannot do that iwht a VAR. 

I mean that the avp is deleted (entire structure -- name and value) when 
you assign the null value. There is no avp in the list that has 'null' 
value -- it is just the PV engine that considers to be null.

If you compare with C:

int i;

you can do i = 0 but not i = null.

char *p;

you can do p = "abc" and p = null, but does not mean after the second 
the p variable is destroyed from the list of variables, just its value 
is set to null.

I wanted to underline that null functionality is very much specific to 
openser config , and may be something that someones may expect or not.

I have nothing against allowing null values for vars or avps. They use 
same structure to hold the value: the int_str union which is actually 
defined by the avps specifications -- see usr_avp.h:

typedef union {
    int  n;
    str s;
} int_str;

in script_var.h:

typedef struct script_val {
    int flags;
    int_str value;
} script_val_t, *script_val_p;


flags field can be used to signal that the value is neither int nor str, 
but null, and that can happen for both avps and vars.

Cheers,
Daniel

-- 
http://www.asipto.com




More information about the Devel mailing list