Re: [OpenSER-Devel] returning 0 from function

2008-03-04 Thread Bogdan-Andrei Iancu
Hi Henning,

We need to consider the user (script writer) experience also. As Klaus 
stated, there are many function just breaking script (returning script) 
because the user should not do anything further.
The best example is t_newtran() or t_check_trans() - if a retransmission 
is detected, TM module will automatically handle this is the correct way 
(according to RFC 3261) and exist - this is something the user should 
not care about how to handle

So, disregarding the implementation details, I strongly consider that we 
need to keep the possibility for a function to break the script execution.

Regards,
Bogdan

Henning Westerholt wrote:
 On Monday 03 March 2008, Juha Heinanen wrote:
   
 Dan Pascu writes:
   AFAIK, there are functions in tm that rely on this, including t_relay if
   I'm not mistaken. I'd say that until a list of the module functions that
   use this behavior is made so we can draw a conclusion, it's premature to
   assume this will be easy to change, or that is even possible to give up
   on the behavior without major code restructuring.

 in my openser.cfg i do call exit also after t_relay.  i think is it is
 very bad programming practice to relay certain functions to exit the
 script implicitly.  in my opinion, no module function should cause the
 script to exit.  it should be always the decision of script writer.
 

 Hi Juha,

 yes, i've also the same opinion. But there will be probably many configs out 
 there that do rely on this behaviour, and will break if we change this. So i 
 also think this is not something that we should treat lightly.

 Cheers,

 Henning

 ___
 Devel mailing list
 Devel@lists.openser.org
 http://lists.openser.org/cgi-bin/mailman/listinfo/devel

   


___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Daniel-Constantin Mierla


On 03/03/08 06:21, Juha Heinanen wrote:
 i noticed that if allow_source_address_from_group() returns group value
 0, statement

 $var(group) = allow_source_address_from_group();

 never returns.  is this intentional, i.e., are functions disallowed to
 return value 0?
   
by returning 0, the execution of the script is interrupted -- same 
behavior as 'exit'.

Cheers,
Daniel

 -- juha

 ___
 Devel mailing list
 Devel@lists.openser.org
 http://lists.openser.org/cgi-bin/mailman/listinfo/devel
   

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

  by returning 0, the execution of the script is interrupted -- same 
  behavior as 'exit'.

that is what i suspected.  in my opinion there is too much under cover
things happening here.  it would be easier to debug and understand
things if script would not terminate implicitly like this, but only if
explicitly terminated by 'exit' or running out from the last route
block.

-- juha

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Juha Heinanen
Daniel-Constantin Mierla writes:

  perhaps going to clear return codes handling will be better. Since the 
  beginning of ser, the meaning of return codes was:
  - greater than 0  was considered true
  - less than 0 was considered false
  - 0 was considered exit.
  
  Now it is about backward compatibility on a hand and clear and better 
  understanding return code handling on the other hand. Perhaps a debate 
  on devel/users will make decision easier.

my vote is to remove the 0 equals exit option.

-- juha

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Iñaki Baz Castillo
El Monday 03 March 2008 09:54:23 Juha Heinanen escribió:
 Daniel-Constantin Mierla writes:
   perhaps going to clear return codes handling will be better. Since the
   beginning of ser, the meaning of return codes was:
   - greater than 0  was considered true
   - less than 0 was considered false
   - 0 was considered exit.
  
   Now it is about backward compatibility on a hand and clear and better
   understanding return code handling on the other hand. Perhaps a debate
   on devel/users will make decision easier.

 my vote is to remove the 0 equals exit option.

I don't like that 0 equals exit at all.


-- 
Iñaki Baz Castillo
[EMAIL PROTECTED]

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Dan Pascu
On Monday 03 March 2008, Juha Heinanen wrote:
 Daniel-Constantin Mierla writes:
   perhaps going to clear return codes handling will be better. Since
   the beginning of ser, the meaning of return codes was:
   - greater than 0  was considered true
   - less than 0 was considered false
   - 0 was considered exit.
  
   Now it is about backward compatibility on a hand and clear and
   better understanding return code handling on the other hand. Perhaps
   a debate on devel/users will make decision easier.

 my vote is to remove the 0 equals exit option.

My guess is that this will not be easy to do as there are currently 
functions that rely on this to stop processing the message and they do so 
based on some internal checks/conditions that are not testable from the 
script. Besides I personally do not want to fill up my script with lots 
of checks after each function call, just  to find out if I'm to continue 
or not. For this reason, I believe that a return value that indicates 
that the processing should stop there is necessary. Should that not be 0 
because 0 is such a common value that may be useful to return from 
functions, that is a different story.

-- 
Dan

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Juha Heinanen
Dan Pascu writes:

  My guess is that this will not be easy to do as there are currently 
  functions that rely on this to stop processing the message and they do so 
  based on some internal checks/conditions that are not testable from the 
  script. 

are you saying that you have lots of functions you call that can as side
effect terminate processing of the script?  what standard openser module
functions are such?

-- juha


___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Dan Pascu
On Monday 03 March 2008, Juha Heinanen wrote:
 Dan Pascu writes:
   My guess is that this will not be easy to do as there are currently
   functions that rely on this to stop processing the message and they
   do so based on some internal checks/conditions that are not testable
   from the script.

 are you saying that you have lots of functions you call that can as
 side effect terminate processing of the script?  what standard openser
 module functions are such?

AFAIK, there are functions in tm that rely on this, including t_relay if 
I'm not mistaken. I'd say that until a list of the module functions that 
use this behavior is made so we can draw a conclusion, it's premature to 
assume this will be easy to change, or that is even possible to give up 
on the behavior without major code restructuring.

-- 
Dan

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Juha Heinanen
Dan Pascu writes:

  AFAIK, there are functions in tm that rely on this, including t_relay if 
  I'm not mistaken. I'd say that until a list of the module functions that 
  use this behavior is made so we can draw a conclusion, it's premature to 
  assume this will be easy to change, or that is even possible to give up 
  on the behavior without major code restructuring.

in my openser.cfg i do call exit also after t_relay.  i think is it is
very bad programming practice to relay certain functions to exit the
script implicitly.  in my opinion, no module function should cause the
script to exit.  it should be always the decision of script writer.

-- juha

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Henning Westerholt
On Monday 03 March 2008, Juha Heinanen wrote:
 Dan Pascu writes:
   AFAIK, there are functions in tm that rely on this, including t_relay if
   I'm not mistaken. I'd say that until a list of the module functions that
   use this behavior is made so we can draw a conclusion, it's premature to
   assume this will be easy to change, or that is even possible to give up
   on the behavior without major code restructuring.

 in my openser.cfg i do call exit also after t_relay.  i think is it is
 very bad programming practice to relay certain functions to exit the
 script implicitly.  in my opinion, no module function should cause the
 script to exit.  it should be always the decision of script writer.

Hi Juha,

yes, i've also the same opinion. But there will be probably many configs out 
there that do rely on this behaviour, and will break if we change this. So i 
also think this is not something that we should treat lightly.

Cheers,

Henning

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Juha Heinanen
Henning Westerholt writes:

  yes, i've also the same opinion. But there will be probably many
  configs out there that do rely on this behaviour, and will break if
  we change this. So i also think this is not something that we should
  treat lightly.

in that case perhaps we can add a config variable allow_implicit_exit
which defaults to YES.

-- juha

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Dan Pascu
On Monday 03 March 2008, Juha Heinanen wrote:
 Dan Pascu writes:
   AFAIK, there are functions in tm that rely on this, including
   t_relay if I'm not mistaken. I'd say that until a list of the module
   functions that use this behavior is made so we can draw a
   conclusion, it's premature to assume this will be easy to change, or
   that is even possible to give up on the behavior without major code
   restructuring.

 in my openser.cfg i do call exit also after t_relay.  i think is it is
 very bad programming practice to relay certain functions to exit the
 script implicitly.  in my opinion, no module function should cause the
 script to exit.  it should be always the decision of script writer.

I do not debate here the good or bad programming practices of doing this, 
I only highlighted the fact that it may not be so easy to change this 
given how intricate interaction between the many involved entities.
Anyway, even if you are to take that decision, you will do it based on 
something the function has returned, so in the end a value to indicate 
this would be required, even if it's not 0.

-- 
Dan

___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSER-Devel] returning 0 from function

2008-03-03 Thread Klaus Darilion
Juha Heinanen wrote:
 Dan Pascu writes:
 
   My guess is that this will not be easy to do as there are currently 
   functions that rely on this to stop processing the message and they do so 
   based on some internal checks/conditions that are not testable from the 
   script. 
 
 are you saying that you have lots of functions you call that can as side
 effect terminate processing of the script?  what standard openser module
 functions are such?

t_check_trans() does, also the ..._challenge() functions do.

regards
klaus



___
Devel mailing list
Devel@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/devel