Merge commit 'origin/ser_core_cvs'
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Fri, 20 Mar 2009 20:47:32 +0000 (21:47 +0100)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Fri, 20 Mar 2009 20:47:32 +0000 (21:47 +0100)
* commit 'origin/ser_core_cvs':
  tcp: minor optimization
  sercmd: minor makefile fix
  tcp internal: send timeout is now kept only in ticks
  core: typo fix
  tcp: typo & minor optimization
  Rename Contact parameter select 'method' to 'methods'
  Rename Contact parameter 'method' to 'methods'
  make install: avoid re-linking lib dependent modules
  build system: avoid libraries re-compiling
  fixing missing $ in ser_mysql.sh script
  Debian packaging - fixing path to mysql sql files in my_create.sh script
  The fixup function prototypes of the config variables have been
  Strip, prefix, rewriteuser, ... all the SET_* actions preserve the
  core: check & fix Content-Length when sending on tcp
  tcp: config option for the async write block size
  tcp: config option for the read buffer size
  tcp: dyn. config fix for tcp_con_lifetime
  tcp: diff. connect timeout for async & states cleanup

Conflicts:
Makefile.rules
action.c
cfg.lex
cfg.y
route_struct.h

15 files changed:
1  2 
Makefile.rules
NEWS
action.c
cfg.lex
cfg.y
core_cmd.c
dprint.c
dprint.h
modules/tm/t_fwd.c
msg_translator.c
parser/parse_param.c
parser/parse_param.h
receive.c
route_struct.h
select_core.c

diff --cc Makefile.rules
  # (if not rebuild everything)
  ifeq (,$(filter $(nodep_targets),$(MAKECMDGOALS)))
  -include makecfg.lst
 -ifneq ($(strip $(C_DEFS) $(DEFS)), $(strip $(CFG_DEFS)))
 -#$(warning different defs: <$(strip $(C_DEFS) $(DEFS))> != )
 +# if trying  to build a lib automatically and the lib is already compiled,
 +# don't rebuild it if the only differences in DEFS or INCLUDES are covered
 +# by LIB_NOREBUILD_DEFS/LIB_NOREBUILD_INCLUDES
- LIB_NOREBUILD_DEFS+= -DMOD_NAME% -D%_MOD_INTERFACE -DMOD_INTERFACE_% -DSR_%
++LIB_NOREBUILD_DEFS=
 +
 +# don't rebuild if the differences are covered by NOREBUILD_DEFS or 
 +# NOREBUILD_INCLUDES
- ifneq ($(filter-out $(NOREBUILD_DEFS),$(strip $(DEFS))), $(strip $(CFG_DEFS)))
++ifneq ($(strip $(filter-out $(NOREBUILD_DEFS),\
++              $(C_DEFS) $(DEFS))),$(strip $(CFG_DEFS)))
 +#$(warning different defs: <$(strip $(DEFS))> != )
  #$(warning               : <$(strip $(CFG_DEFS))>)
  $(shell rm -f makecfg.lst)
  endif
- ifneq ($(filter-out $(NOREBUILD_INCLUDES), $(strip $(INCLUDES))),\
-               $(strip $(CFG_INCLUDES)))
 -ifneq ($(strip $(C_INCLUDES) $(INCLUDES)), $(strip $(CFG_INCLUDES)))
++ifneq ($(strip $(filter-out $(NOREBUILD_INCLUDES),\
++                      $(C_INCLUDES) $(INCLUDES))),$(strip $(CFG_INCLUDES)))
  $(shell rm -f makecfg.lst)
  endif
  endif
@@@ -144,10 -138,10 +149,11 @@@ librpath.lst: $(ALLDEP
        @echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst
  
  makecfg.lst:
-       @echo CFG_DEFS:=$(subst ',\', $(subst ",\", \
-               $(filter-out $(NOREBUILD_DEFS), $(strip $(DEFS))))) >>$@
-       @echo CFG_INCLUDES:=$(subst ',\', $(subst ",\", \
-               $(filter-out $(NOREBUILD_INCLUDES), $(strip $(INCLUDES))))) >>$@
 -      @echo CFG_DEFS:=\
 -              $(subst ',\', $(subst ",\", $(strip $(C_DEFS) $(DEFS)))) >>$@
 -      @echo CFG_INCLUDES:=\
 -              $(subst ',\', $(subst ",\", $(strip $(C_INCLUDES) $(INCLUDES)))) >>$@
++      @echo CFG_DEFS:=$(subst ',\', $(subst ",\",$(strip \
++                      $(filter-out $(NOREBUILD_DEFS), $(C_DEFS) $(DEFS))))) >>$@
++      @echo CFG_INCLUDES:=$(subst ',\', $(subst ",\",$(strip \
++                      $(filter-out $(NOREBUILD_INCLUDES),\
++                              $(C_INCLUDES) $(INCLUDES))))) >>$@
  .PHONY: all
  all: $(NAME) modules
  
diff --cc NEWS
Simple merge
diff --cc action.c
+++ b/action.c
@@@ -112,17 -107,10 +112,17 @@@ int do_action(struct run_act_ctx* h, st
        struct sip_uri uri, next_hop;
        struct sip_uri *u;
        unsigned short port;
 -      unsigned short flags;
 -      int_str name, value;
        str* dst_host;
 +      int i, flags;
 +      struct switch_cond_table* sct;
 +      struct switch_jmp_table*  sjt;
 +      struct rval_expr* rve;
 +      struct match_cond_table* mct;
 +      struct rvalue* rv;
 +      struct rvalue* rv1;
 +      struct rval_cache c1;
 +      str s;
+       int orig_p2t;
  
        /* reset the value of error to E_UNSPEC so avoid unknowledgable
           functions to return with error (status<0) and not setting it
                                        memcpy(crt,tmp,len);crt+=len;
                                }
                                /* host */
-                               if (user || tmp){ /* add @ */
-                                       if(crt+1>end) goto error_uri;
-                                       *crt='@'; crt++;
-                               }
                                if ((a->type==SET_HOST_T)
                                                || (a->type==SET_HOSTPORT_T)
-                                               || (a->type==SET_HOSTPORTTRANS_T)) {
 +                                              || (a->type==SET_HOSTALL_T)
+                                               || (a->type==SET_HOSTPORTTRANS_T)
+                               ) {
                                        tmp=a->val[0].u.string;
                                        if (tmp) len = strlen(tmp);
                                        else len=0;
diff --cc cfg.lex
+++ b/cfg.lex
@@@ -75,8 -75,7 +75,9 @@@
   *  2007-11-28  added TCP_OPT_{FD_CACHE, DEFER_ACCEPT, DELAYED_ACK, SYNCNT,
   *              LINGER2, KEEPALIVE, KEEPIDLE, KEEPINTVL, KEEPCNT} (andrei)
   *  2008-01-24  added CFG_DESCRIPTION used by cfg_var (Miklos)
 + *  2008-11-28  added support for kamailio pvars and avp/pvar guessing (andrei)
 + *  2008-12-11  added support for "string1" "string2" (andrei)
+  *  2009-03-10  added SET_USERPHONE action (Miklos)
  */
  
  
diff --cc cfg.y
--- 1/cfg.y
--- 2/cfg.y
+++ b/cfg.y
   * 2007-11-28  added TCP_OPT_{FD_CACHE, DEFER_ACCEPT, DELAYED_ACK, SYNCNT,
   *              LINGER2, KEEPALIVE, KEEPIDLE, KEEPINTVL, KEEPCNT} (andrei)
   * 2008-01-24  added cfg_var definition (Miklos)
 + * 2008-11-18  support for variable parameter module functions (andrei)
 + * 2007-12-03  support for generalised lvalues and rvalues:
 + *               lval=rval_expr, where lval=avp|pvar  (andrei)
 + * 2007-12-06  expression are now evaluated in terms of rvalues;
 + *             NUMBER is now always positive; cleanup (andrei)
 + * 2009-01-26  case/switch() support (andrei)
+  * 2009-03-10  added SET_USERPHONE action (Miklos)
  */
  
  %{
@@@ -837,17 -792,20 +842,20 @@@ assign_stm
                #endif
        }
        | TCP_CONNECT_TIMEOUT EQUAL error { yyerror("number expected"); }
 -      | TCP_SEND_TIMEOUT EQUAL NUMBER {
 +      | TCP_SEND_TIMEOUT EQUAL intno {
                #ifdef USE_TCP
-                       tcp_default_cfg.send_timeout_s=$3;
+                       tcp_default_cfg.send_timeout=S_TO_TICKS($3);
                #else
                        warn("tcp support not compiled in");
                #endif
        }
        | TCP_SEND_TIMEOUT EQUAL error { yyerror("number expected"); }
 -      | TCP_CON_LIFETIME EQUAL NUMBER {
 +      | TCP_CON_LIFETIME EQUAL intno {
                #ifdef USE_TCP
-                       tcp_default_cfg.con_lifetime_s=$3;
+                       if ($3<0)
+                               tcp_default_cfg.con_lifetime=-1;
+                       else
+                               tcp_default_cfg.con_lifetime=S_TO_TICKS($3);
                #else
                        warn("tcp support not compiled in");
                #endif
diff --cc core_cmd.c
Simple merge
diff --cc dprint.c
Simple merge
diff --cc dprint.h
Simple merge
Simple merge
Simple merge
  #include "parse_param.h"
  
  
 +static inline void parse_event_dialog_class(param_hooks_t* h, param_t* p)
 +{
 +
 +      if (!p->name.s) {
 +              LOG(L_ERR, "ERROR: parse_event_dialog_class: empty value\n");
 +              return;
 +      }
 +      if (!h) {
 +              LOG(L_CRIT, "BUG: parse_event_dialog_class: NULL param hook pointer\n");
 +              return;
 +      }
 +      switch(p->name.s[0]) {
 +      case 'c':
 +      case 'C':
 +              if ((p->name.len == 7) &&
 +                  (!strncasecmp(p->name.s + 1, "all-id", 6))) {
 +                      p->type = P_CALL_ID;
 +                      h->event_dialog.call_id = p;
 +              }
 +              break;
 +
 +      case 'f':
 +      case 'F':
 +              if ((p->name.len == 8) &&
 +                  (!strncasecmp(p->name.s + 1, "rom-tag", 7))) {
 +                      p->type = P_FROM_TAG;
 +                      h->event_dialog.from_tag = p;
 +              }
 +              break;
 +
 +      case 't':
 +      case 'T':
 +              if ((p->name.len == 6) &&
 +                  (!strncasecmp(p->name.s + 1, "o-tag", 5))) {
 +                      p->type = P_TO_TAG;
 +                      h->event_dialog.to_tag = p;
 +              }
 +              break;
 +
 +      case 'i':
 +      case 'I':
 +              if ((p->name.len == 27) &&
 +                  (!strncasecmp(p->name.s + 1, "nclude-session-description", 26))) {
 +                      p->type = P_ISD;
 +                      h->event_dialog.include_session_description = p;
 +              }
 +              break;
 +
 +      case 's':
 +      case 'S':
 +              if ((p->name.len == 3) &&
 +                  (!strncasecmp(p->name.s + 1, "la", 2))) {
 +                      p->type = P_SLA;
 +                      h->event_dialog.sla = p;
 +              }
 +              break;
 +      }
 +}
 +
 +
  /*
   * Try to find out parameter name, recognized parameters
-  * are q, expires and method
+  * are q, expires and methods
   */
  static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
  {
Simple merge
diff --cc receive.c
Simple merge
diff --cc route_struct.h
@@@ -70,10 -70,8 +70,11 @@@ enum { METHOD_O=1, URI_O, FROM_URI_O, T
  
  enum { FORWARD_T=1, SEND_T, DROP_T, LOG_T, ERROR_T, ROUTE_T, EXEC_T,
                SET_HOST_T, SET_HOSTPORT_T, SET_USER_T, SET_USERPASS_T,
 -              SET_PORT_T, SET_URI_T, SET_HOSTPORTTRANS_T, SET_USERPHONE_T,
 -              IF_T, MODULE_T,
 +              SET_PORT_T, SET_URI_T, SET_HOSTPORTTRANS_T, SET_HOSTALL_T,
++              SET_USERPHONE_T,
 +              IF_T, SWITCH_T /* only until fixup*/,
 +              BLOCK_T, EVAL_T, SWITCH_JT_T, SWITCH_COND_T, MATCH_COND_T, WHILE_T,
 +              MODULE_T, MODULE3_T, MODULE4_T, MODULE5_T, MODULE6_T, MODULEX_T,
                SETFLAG_T, RESETFLAG_T, ISFLAGSET_T ,
                AVPFLAG_OPER_T,
                LEN_GT_T, PREFIX_T, STRIP_T,STRIP_TAIL_T,
diff --cc select_core.c
Simple merge