domain attributes

29 messages Options
Embed this post
Permalink
1 2
Juha Heinanen

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jan Janak
Jan Janak writes:

 > mysql> describe domain_attrs;
 > +-------+------------------+------+-----+---------+-------+
 > | Field | Type             | Null | Key | Default | Extra |
 > +-------+------------------+------+-----+---------+-------+
 > | did   | varchar(64)      | YES  | MUL | NULL    |       |
 > | name  | varchar(32)      | NO   |     | NULL    |       |
 > | type  | int(11)          | NO   |     | 0       |       |
 > | value | varchar(255)     | YES  |     | NULL    |       |
 > | flags | int(10) unsigned | NO   |     | 0       |       |
 > +-------+------------------+------+-----+---------+-------+
 
if domain_attrs define attributes of domains, how can did be NULL?

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
On Jul 02, 2009 at 18:06, Juha Heinanen <[hidden email]> wrote:

> Andrei Pelinescu-Onciul writes:
>
>  > To make the same thing work for most ser modules, the fixup_* functions
>  > (e.g.: fixup_var_str_12 that is used by lookup_domain) from sr_module.c
>  > should be modified either in a similar way, or they should just try
>  > fix_param(FPARAM_AVP, param) if first fix_param(FPARAM_PVS, param)
>  > failed. One might need to remove the error messages printed by
>  > fix_param() if AVP or PVAR parsing fails (to allow for retrying with AVP
>  > or PVARs without filling the log with errors).
>
> in order to avoid unnecessary lookups, it should be possible (if not
> mandatory) to differentiate avps and pvars syntactically.  it is very
> bad, if "$fd" can be either an avp with name "fd" or a pseudo variable
> denoting domain of from uri.  in k, "fd" avp would be written as
> $avp("fd") and no double lookup would be needed.

They are looked twice but only at startup (fixup for the script and the
modules) so there shouldn't be any runtime performance hit because of
this.

I agree however that we should differentiate somehow, but for now we
have to support the legacy modes (ser & kamailio) to make initial
migration easier.

Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
Andrei Pelinescu-Onciul writes:

 > They are looked twice but only at startup (fixup for the script and the
 > modules) so there shouldn't be any runtime performance hit because of
 > this.

if i write in my script somewhere

$avp("fd") = "foo";

and in some other place reference $fd, how can double lookup during
runtime be avoided?

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
On Jul 02, 2009 at 18:20, Juha Heinanen <[hidden email]> wrote:

> Andrei Pelinescu-Onciul writes:
>
>  > They are looked twice but only at startup (fixup for the script and the
>  > modules) so there shouldn't be any runtime performance hit because of
>  > this.
>
> if i write in my script somewhere
>
> $avp("fd") = "foo";
>
> and in some other place reference $fd, how can double lookup during
> runtime be avoided?

At fixup time $fd is looked-up. If it's a pvar is replaced with a pv
spec. If it's not with an avp spec.
At runtime whatever is already "fixed-up" is resolved. In the $fd case
-> an avp ($avp("fd") is cleary a pvar, and $fd it can be a pvar or an
avp: if at fixup pvar lookup($fd) fails => its avp => it's marked as avp
an at runtime only avp search is used).


Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
Andrei Pelinescu-Onciul writes:

 > > if i write in my script somewhere
 > >
 > > $avp("fd") = "foo";
 > >
 > > and in some other place reference $fd, how can double lookup during
 > > runtime be avoided?
 >
 > At fixup time $fd is looked-up. If it's a pvar is replaced with a pv
 > spec. If it's not with an avp spec.

ok. does this fixup happen also when $fd is used in an expression, like

$var(foo) = $fd;

if i write

lookup_domain("$fd", "$fd");

the first $fd must be an avp, because lookup_domain expects an avp name
as first param and the second could be either a pvar or avp, but that
can be determined at fixup time.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
On Jul 02, 2009 at 18:53, Juha Heinanen <[hidden email]> wrote:

> Andrei Pelinescu-Onciul writes:
>
>  > > if i write in my script somewhere
>  > >
>  > > $avp("fd") = "foo";
>  > >
>  > > and in some other place reference $fd, how can double lookup during
>  > > runtime be avoided?
>  >
>  > At fixup time $fd is looked-up. If it's a pvar is replaced with a pv
>  > spec. If it's not with an avp spec.
>
> ok. does this fixup happen also when $fd is used in an expression, like
>
> $var(foo) = $fd;

Yes.

>
> if i write
>
> lookup_domain("$fd", "$fd");
>
> the first $fd must be an avp, because lookup_domain expects an avp name
> as first param and the second could be either a pvar or avp, but that
> can be determined at fixup time.

That does not work right now, but it would be very easy to make it work.

Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
Andrei Pelinescu-Onciul writes:

 > > lookup_domain("$fd", "$fd");
 > >
 > > the first $fd must be an avp, because lookup_domain expects an avp name
 > > as first param and the second could be either a pvar or avp, but that
 > > can be determined at fixup time.
 >
 > That does not work right now, but it would be very easy to make it work.

that and is_domain api function seem to be the conditions for adopting s
domain module.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Jan Janak

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
On 02-07 17:53, Juha Heinanen wrote:
> while comparing s and k domain module, i noticed that k domain module
> exports is_domain_local api function for other modules.  that would also
> need to be added and i have no clue on how to do that in s.

OK, this is easy, we have is_domain local function in the ser version of the
module, so I can export that one through an API to other modules.

   Jan.

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Jan Janak-2

Re: domain attributes

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
On Thu, Jul 2, 2009 at 5:09 PM, Juha Heinanen<[hidden email]> wrote:

> Jan Janak writes:
>
>  > mysql> describe domain_attrs;
>  > +-------+------------------+------+-----+---------+-------+
>  > | Field | Type             | Null | Key | Default | Extra |
>  > +-------+------------------+------+-----+---------+-------+
>  > | did   | varchar(64)      | YES  | MUL | NULL    |       |
>  > | name  | varchar(32)      | NO   |     | NULL    |       |
>  > | type  | int(11)          | NO   |     | 0       |       |
>  > | value | varchar(255)     | YES  |     | NULL    |       |
>  > | flags | int(10) unsigned | NO   |     | 0       |       |
>  > +-------+------------------+------+-----+---------+-------+
>
> if domain_attrs define attributes of domains, how can did be NULL?

This is a backward compatibility hack which allows to use the domain
table with the old domain module. In that case you just write all
domain names into the domain table and let did be NULL. In that case
they will all belong to one virtual domain.

One can enable/disable the use of domain attributes, in fact they are
disabled by default with load_domain_attrs domain module parameter.

  Jan.

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
1 2