Merge branch 'ser_core_cvs'
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Fri, 20 Feb 2009 16:22:16 +0000 (17:22 +0100)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Fri, 20 Feb 2009 16:22:16 +0000 (17:22 +0100)
* ser_core_cvs:
  tcp: fix compilation problem on solaris (FIONREAD)
  core: fix bad level name in new LOG()
  t_check_status() checks also the blind UACs if t_pick_branch()
  Documenting t_lookup_cancel() script function.
  Removing set_t() from t_lookup_cancel() function, and introducing
  updated udp_mtu handling code - fixes SER-433
  documenting t_is_expired() function
  t_is_expired() script function is introduced.
  * logging API updated (see doc/logging-api.txt for details)
  - AS support disabled by default.
  When building the route set of ACKs for local UACs, only the reply is now
  In case the AVP is a regexp, an allocation is required to build an AVP
  Currently, SER matches E2E ACKs only if there is an equality between From HF
  The calculate_routeset_length() produces an invalid result in the case
  'memapp' and 'append_mem_block' are now both only used in source
  "Route :" prefix (and separator) is used some more time across the
  script: udp_mtu fallback script config & commands
  core: forward: tcp fallback for big udp packets

Conflicts:
action.c
cfg.y
cfg_core.c
cfg_core.h
dprint.h   - updated to the new logging api from ser, while
             keeping the kamailio compatibility macros and
              CRIT().
usr_avp.h

14 files changed:
1  2 
NEWS
action.c
cfg.lex
cfg.y
cfg_core.c
cfg_core.h
config.h
dprint.c
dprint.h
main.c
route.c
route_struct.h
usr_avp.c
usr_avp.h

diff --cc NEWS
Simple merge
diff --cc action.c
+++ b/action.c
   *  2006-07-27  dns cache and dns based send address failover support (andrei)
   *  2006-12-06  on popular request last_retcode set also by module functions
   *              (andrei)
-  *  2007-06-14  run_actions & do_action need a ctx or handle now, no more 
+  *  2007-06-14  run_actions & do_action need a ctx or handle now, no more
   *               static vars (andrei)
 + *  2008-11-18  support for variable parameter module functions (andrei)
 + *  2008-12-03  use lvalues/rvalues for assignments (andrei)
+  *  2008-12-17  added UDP_MTU_TRY_PROTO_T (andrei)
   */
  
  
@@@ -993,16 -794,121 +998,16 @@@ sw_jt_def
                        ret=1; /* continue processing */
                        break;
  
-        case ADD_T:
-       case ASSIGN_T:
+               case ADD_T:
+               case ASSIGN_T:
 -
 -                      /* If the left attr was specified without indexing brackets delete
 -                       * existing AVPs before adding new ones
 -                       */
 -                      if ((a->val[0].u.attr->type & AVP_INDEX_ALL) != AVP_INDEX_ALL) delete_avp(a->val[0].u.attr->type, a->val[0].u.attr->name);
 -
 -                      if (a->val[1].type == STRING_ST) {
 -                              value.s = a->val[1].u.str;
 -                              flags = a->val[0].u.attr->type | AVP_VAL_STR;
 -                              name = a->val[0].u.attr->name;
 -                              ret = 1;
 -                      } else if (a->val[1].type == NUMBER_ST) {
 -                              value.n = a->val[1].u.number;
 -                              flags = a->val[0].u.attr->type;
 -                              name = a->val[0].u.attr->name;
 -                              ret = 1;
 -                      } else if (a->val[1].type == ACTION_ST) {
 -                              flags = a->val[0].u.attr->type;
 -                              name = a->val[0].u.attr->name;
 -                              if (a->val[1].u.data) {
 -                                      value.n = run_actions(h, (struct action*)a->val[1].u.data,
 -                                                                                      msg);
 -                              } else {
 -                                      value.n = -1;
 -                              }
 -                              ret = value.n;
 -                      } else if(a->val[1].type == EXPR_ST && a->val[1].u.data) {
 -                              v = eval_expr(h, (struct expr*)a->val[1].u.data, msg);
 -                              if (v < 0) {
 -                                      if (v == EXPR_DROP){ /* hack to quit on DROP*/
 -                                              ret = 0;
 -                                              break;
 -                                      } else {
 -                                              LOG(L_WARN,"WARNING: do_action: error in expression\n");
 -                                              v = 0; /* error is treated as false (Miklos) */
 -                                      }
 -                              }
 -
 -                              flags = a->val[0].u.attr->type;
 -                              name = a->val[0].u.attr->name;
 -                              value.n = v;
 -                      } else if (a->val[1].type == AVP_ST) {
 -                              struct search_state st;
 -                              avp_t* avp;
 -                              avp_t* avp_mark;
 -
 -                              avp_mark = NULL;
 -                              if ((a->val[1].u.attr->type & AVP_INDEX_ALL) == AVP_INDEX_ALL) {
 -                                      avp = search_first_avp(a->val[1].u.attr->type, a->val[1].u.attr->name, &value, &st);
 -                                      while(avp) {
 -                                                   /* We take only the type of value and name from the source avp
 -                                                    * and reset class and track flags
 -                                                    */
 -                                              flags = (a->val[0].u.attr->type & ~AVP_INDEX_ALL) | (avp->flags & ~(AVP_CLASS_ALL|AVP_TRACK_ALL));
 -
 -                                              if (add_avp_before(avp_mark, flags, a->val[0].u.attr->name, value) < 0) {
 -                                                      LOG(L_CRIT, "ERROR: Failed to assign value to attribute\n");
 -                                                      ret=E_UNSPEC;
 -                                                      break;
 -                                              }
 -
 -                                              /* move the mark, so the next found AVP will come before the one currently added
 -                                               * so they will have the same order as in the source list
 -                                               */
 -                                              if (avp_mark) {
 -                                                      avp_mark=avp_mark->next;
 -                                              } else {
 -                                                      avp_mark=search_first_avp(flags, a->val[0].u.attr->name, NULL, NULL);
 -                                              }
 -
 -                                              avp = search_next_avp(&st, &value);
 -                                      }
 -                                      ret = 1;
 -                                      break;
 -                              } else {
 -                                      avp = search_avp_by_index(a->val[1].u.attr->type, a->val[1].u.attr->name, &value, a->val[1].u.attr->index);
 -                                      if (avp) {
 -                                              flags = a->val[0].u.attr->type | (avp->flags & ~(AVP_CLASS_ALL|AVP_TRACK_ALL));
 -                                              name = a->val[0].u.attr->name;
 -                                              ret = 1;
 -                                      } else {
 -                                              ret = E_UNSPEC;
 -                                              break;
 -                                      }
 -                              }
 -                      } else if (a->val[1].type == SELECT_ST) {
 -                              int r;
 -                              r = run_select(&value.s, a->val[1].u.select, msg);
 -                              if (r < 0) {
 -                                      ret=E_UNSPEC;
 -                                      break;
 -                              } else if (r > 0) {
 -                                      value.s.s = "";
 -                                      value.s.len = 0;
 -                              }
 -
 -                              flags = a->val[0].u.attr->type | AVP_VAL_STR;
 -                              name = a->val[0].u.attr->name;
 +                      v=lval_assign(h, msg, (struct lvalue*)a->val[0].u.data,
 +                                                                (struct rval_expr*)a->val[1].u.data);
-                       if (likely(v>=0)) 
++                      if (likely(v>=0))
                                ret = 1;
 -                      } else {
 -                              LOG(L_CRIT, "BUG: do_action: Bad right side of avp assignment\n");
 -                              ret=E_BUG;
 -                              break;
 -                      }
 -
 -                      /* If the action is assign then remove the old avp value
 -                       * before adding new ones */
 -/*                    if ((unsigned char)a->type == ASSIGN_T) delete_avp(flags, name); */
 -                      if (add_avp(flags & ~AVP_INDEX_ALL, name, value) < 0) {
 -                              LOG(L_CRIT, "ERROR: Failed to assign value to attribute\n");
 -                              ret=E_UNSPEC;
 -                              break;
 -                      }
 +                      else if (unlikely (v == EXPR_DROP)) /* hack to quit on DROP*/
 +                              ret=0;
 +                      else
 +                              ret=v;
                        break;
  
                default:
diff --cc cfg.lex
Simple merge
diff --cc cfg.y
--- 1/cfg.y
--- 2/cfg.y
+++ b/cfg.y
  #include "tcp_init.h"
  #include "tcp_options.h"
  #include "sctp_options.h"
 +#include "pvar.h"
 +#include "lvalue.h"
 +#include "rvalue.h"
 +#include "sr_compat.h"
+ #include "msg_translator.h"
  
  #include "config.h"
  #include "cfg_core.h"
diff --cc cfg_core.c
@@@ -88,7 -89,9 +89,10 @@@ struct cfg_group_core default_core_cfg 
  #ifdef SHM_MEM
        0, /* mem_dump_shm */
  #endif
 +      DEFAULT_MAX_WHILE_LOOPS, /* max_while_loops */
+       0, /* udp_mtu (disabled by default) */
+       0, /* udp_mtu_try_proto -> default disabled */
+       0  /* force_rport */ 
  };
  
  void  *core_cfg = &default_core_cfg;
@@@ -178,7 -181,12 +182,14 @@@ cfg_def_t core_cfg_def[] = 
        {"mem_dump_shm",        CFG_VAR_INT,    0, 0, mem_dump_shm_fixup, 0,
                "dump shared memory status"},
  #endif
 +      {"max_while_loops",     CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
 +              "maximum iterations allowed for a while loop" },
+       {"udp_mtu",     CFG_VAR_INT|CFG_ATOMIC, 0, 65535, 0, 0,
+               "fallback to a congestion controlled protocol if send size"
+                       " exceeds udp_mtu"},
+       {"udp_mtu_try_proto", CFG_VAR_INT, 1, 4, 0, fix_global_req_flags,
+               "if send size > udp_mtu use proto (1 udp, 2 tcp, 3 tls, 4 sctp)"},
+       {"force_rport",     CFG_VAR_INT, 0, 1,  0, fix_global_req_flags,
+               "force rport for all the received messages" },
        {0, 0, 0, 0, 0, 0}
  };
diff --cc cfg_core.h
@@@ -85,7 -85,9 +85,10 @@@ struct cfg_group_core 
  #ifdef SHM_MEM
        int mem_dump_shm;
  #endif
 +      int max_while_loops;
+       int udp_mtu; /**< maximum send size for udp, if > try another protocol*/
+       int udp_mtu_try_proto; /**< if packet> udp_mtu, try proto (e.g. TCP) */
+       int force_rport; /**< if set rport will always be forced*/
  };
  
  extern struct cfg_group_core default_core_cfg;
diff --cc config.h
Simple merge
diff --cc dprint.c
+++ b/dprint.c
  #include <stdio.h>
  #include <strings.h>
  
- volatile int dprint_crit=0; /* signal protection: !=0 when dprint/LOG/DBG are
-                                                               printing */
+ #ifndef NO_SIG_DEBUG
+ /* signal protection: !=0 when LOG/DBG/... are printing */
+ volatile int dprint_crit = 0; 
+ #endif
  
  static char* str_fac[]={"LOG_AUTH","LOG_CRON","LOG_DAEMON",
-                                       "LOG_KERN","LOG_LOCAL0","LOG_LOCAL1",
-                                       "LOG_LOCAL2","LOG_LOCAL3","LOG_LOCAL4","LOG_LOCAL5",
-                                       "LOG_LOCAL6","LOG_LOCAL7","LOG_LPR","LOG_MAIL",
-                                       "LOG_NEWS","LOG_USER","LOG_UUCP",
+                       "LOG_KERN","LOG_LOCAL0","LOG_LOCAL1",
+                       "LOG_LOCAL2","LOG_LOCAL3","LOG_LOCAL4","LOG_LOCAL5",
+                       "LOG_LOCAL6","LOG_LOCAL7","LOG_LPR","LOG_MAIL",
+                       "LOG_NEWS","LOG_USER","LOG_UUCP",
  #ifndef __OS_solaris
-                                       "LOG_AUTHPRIV","LOG_FTP","LOG_SYSLOG",
+                       "LOG_AUTHPRIV","LOG_FTP","LOG_SYSLOG",
  #endif
-                                       0};
+                       0};
+                       
  static int int_fac[]={LOG_AUTH ,  LOG_CRON , LOG_DAEMON ,
-                                       LOG_KERN , LOG_LOCAL0 , LOG_LOCAL1 ,
-                                       LOG_LOCAL2 , LOG_LOCAL3 , LOG_LOCAL4 , LOG_LOCAL5 ,
-                                       LOG_LOCAL6 , LOG_LOCAL7 , LOG_LPR , LOG_MAIL ,
-                                       LOG_NEWS , LOG_USER , LOG_UUCP
+                     LOG_KERN , LOG_LOCAL0 , LOG_LOCAL1 ,
+                     LOG_LOCAL2 , LOG_LOCAL3 , LOG_LOCAL4 , LOG_LOCAL5 ,
+                     LOG_LOCAL6 , LOG_LOCAL7 , LOG_LPR , LOG_MAIL ,
+                     LOG_NEWS , LOG_USER , LOG_UUCP,
  #ifndef __OS_solaris
-                                       ,LOG_AUTHPRIV,LOG_FTP,LOG_SYSLOG
+                     LOG_AUTHPRIV,LOG_FTP,LOG_SYSLOG,
  #endif
-                                       };
- void dprint(char * format, ...)
- {
-       va_list ap;
-       fprintf(stderr, "%2d(%d) ", process_no, my_pid());
-       va_start(ap, format);
-       vfprintf(stderr,format,ap);
-       fflush(stderr);
-       va_end(ap);
- }
+                     0};
  
+ struct log_level_info log_level_info[] = {
+       {"ALERT", LOG_ALERT},     /* L_ALERT */
++      {"CRITICAL", LOG_CRIT},   /* L_CRIT2 */
+       {"BUG", LOG_CRIT},        /* L_CRIT */
+       {"ERROR", LOG_ERR},       /* L_ERR */
+       {"WARNING", LOG_WARNING}, /* L_WARN */
+       {"NOTICE", LOG_NOTICE},   /* L_NOTICE */
+       {"INFO", LOG_INFO},       /* L_INFO */
+       {"DEBUG", LOG_DEBUG}      /* L_DBG */
+ };
  
  int str2facility(char *s)
  {
diff --cc dprint.h
+++ b/dprint.h
  
  /* C >= 99 has __func__, older gcc versions have __FUNCTION__ */
  #if __STDC_VERSION__ < 199901L
- # if __GNUC__ >= 2
- #  define _FUNC_NAME_ __FUNCTION__
- # else
- #  define _FUNC_NAME_ ""
- # endif
+ #     if __GNUC__ >= 2
+ #             define _FUNC_NAME_ __FUNCTION__
+ #     else
+ #             define _FUNC_NAME_ ""
+ #     endif
  #else
- # define _FUNC_NAME_ __func__
+ #     define _FUNC_NAME_ __func__
  #endif
  
+ #ifdef NO_DEBUG
+ #     ifdef MOD_NAME
+ #             define LOC_INFO         MOD_NAME ": "
+ #     else
+ #             define LOC_INFO         "<core>: "
+ #     endif
+ #else
+ #     define XCT2STR(i) #i
+ #     define CT2STR(l)  XCT2STR(l)
+ #
+ #     ifdef MOD_NAME
+ #             define LOC_INFO         MOD_NAME " [" __FILE__ ":" CT2STR(__LINE__) "]: "
+ #     else
+ #             define LOC_INFO         "<core> [" __FILE__ ":" CT2STR(__LINE__) "]: "
+ #     endif
+ #
+ #     ifdef NO_LOG
+ #             undef NO_LOG
+ #     endif
+ #endif /* NO_DEBUG */
  
- #define XCT2STR(i) #i
- #define CT2STR(l) XCT2STR(l)
  
- #define LOC_INFO      __FILE__ ":" CT2STR(__LINE__) ": "
+ /*
+  * Log levels
+  */
 -#define L_ALERT               -3
 -#define L_CRIT        -2
++#define L_ALERT               -4
++#define L_CRIT2               -3  /* like L_CRIT, but not used for BUGs */
++#define L_CRIT        -2  /* used only for BUG */
+ #define L_ERR         -1
+ #define L_WARN        0
+ #define L_NOTICE      1
+ #define L_INFO        2
+ #define L_DBG         3
+ #define LOG_LEVEL2NAME(level) (log_level_info[(level) - (L_ALERT)].name)
+ #define LOG2SYSLOG_LEVEL(level) \
+       (log_level_info[(level) - (L_ALERT)].syslog_level)
+ /* my_pid(), process_no are from pt.h but we cannot #include it here
+    because of circular dependencies */
+ extern int process_no;
+ extern int my_pid();
+ /* non-zero if logging to stderr instead to the syslog */
+ extern int log_stderr;
  
+ /* maps log levels to their string name and corresponding syslog level */
  
- #define is_printable(level) (cfg_get(core, core_cfg, debug)>=(level))
+ struct log_level_info {
+       char *name;
+       int syslog_level;
+ };
  
- #ifdef NO_DEBUG
-       #ifdef __SUNPRO_C
-               #define DPrint(...)
-       #else
-               #define DPrint(fmt, args...)
-       #endif
- #else
-       #ifdef __SUNPRO_C
-               #define DPrint( ...) \
-                       do{ \
-                               if ((cfg_get(core, core_cfg, debug)>=DPRINT_LEV) && DPRINT_NON_CRIT){ \
-                                       DPRINT_CRIT_ENTER; \
-                                       if (log_stderr){ \
-                                               dprint (__VA_ARGS__); \
-                                       }else{ \
-                                               syslog(DPRINT_LEV|cfg_get(core, core_cfg, log_facility), \
-                                                       __VA_ARGS__); \
-                                       }\
-                                       DPRINT_CRIT_EXIT; \
-                               } \
-                       }while(0)
-       #else
-                       #define DPrint(fmt,args...) \
-                       do{ \
-                               if ((cfg_get(core, core_cfg, debug)>=DPRINT_LEV) && DPRINT_NON_CRIT){ \
-                                       DPRINT_CRIT_ENTER; \
-                                       if (log_stderr){ \
-                                               dprint (fmt, ## args); \
-                                       }else{ \
-                                               syslog(DPRINT_LEV|cfg_get(core, core_cfg, log_facility), \
-                                                       fmt, ## args); \
-                                       }\
-                                       DPRINT_CRIT_EXIT; \
-                               } \
-                       }while(0)
-       #endif
++#define is_printable(level) (cfg_get(core, core_cfg, debug)>=(level))
+ extern struct log_level_info log_level_info[];
  
+ #ifndef NO_SIG_DEBUG
+ /* protection against "simultaneous" printing from signal handlers */
+ extern volatile int dprint_crit; 
  #endif
  
- #ifndef NO_DEBUG
-       #undef NO_LOG
- #endif
+ int str2facility(char *s);
+ int log_facility_fixup(void *handle, str *name, void **val);
  
+ /*
+  * General logging macros
+  *
+  * LOG_(level, prefix, fmt, ...) prints "printf"-formatted log message to
+  * stderr (if `log_stderr' is non-zero) or to syslog.  Note that `fmt' must
+  * be constant. `prefix' is added to the beginning of the message.
+  *
+  * LOG(level, fmt, ...) is same as LOG_() with LOC_INFO prefix.
+  */
  #ifdef NO_LOG
-       #ifdef __SUNPRO_C
-               #define LOG(lev, ...)
-       #else
-               #define LOG(lev, fmt, args...)
-       #endif
+ #     ifdef __SUNPRO_C
+ #             define LOG_(level, prefix, fmt, ...)
+ #             define LOG(level, fmt, ...)
+ #     else
+ #             define LOG_(level, prefix, fmt, args...)
+ #             define LOG(level, fmt, args...)
+ #     endif
  #else
-       #ifdef __SUNPRO_C
-               #define LOG(lev, ...) \
+ #     ifdef NO_SIG_DEBUG
+ #             define DPRINT_NON_CRIT          (1)
+ #             define DPRINT_CRIT_ENTER
+ #             define DPRINT_CRIT_EXIT
+ #     else
+ #             define DPRINT_NON_CRIT          (dprint_crit==0)
+ #             define DPRINT_CRIT_ENTER        (dprint_crit++)
+ #             define DPRINT_CRIT_EXIT         (dprint_crit--)
+ #     endif
+ #     ifdef __SUNPRO_C
+ #             define LOG_(level, prefix, fmt, ...) \
                        do { \
-                               if ((cfg_get(core, core_cfg, debug)>=(lev)) && DPRINT_NON_CRIT){ \
+                               if (cfg_get(core, core_cfg, debug) >= (level) && \
+                                               DPRINT_NON_CRIT) { \
                                        DPRINT_CRIT_ENTER; \
-                                       if (log_stderr) dprint (__VA_ARGS__); \
-                                       else { \
-                                               switch(lev){ \
-                                                       case L_CRIT: \
-                                                               syslog(LOG_CRIT|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                                       case L_ALERT: \
-                                                               syslog(LOG_ALERT|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                                       case L_ERR: \
-                                                               syslog(LOG_ERR|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                                       case L_WARN: \
-                                                               syslog(LOG_WARNING|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__);\
-                                                               break; \
-                                                       case L_NOTICE: \
-                                                               syslog(LOG_NOTICE|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                                       case L_INFO: \
-                                                               syslog(LOG_INFO|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                                       case L_DBG: \
-                                                               syslog(LOG_DEBUG|cfg_get(core, core_cfg, log_facility), \
-                                                                       __VA_ARGS__); \
-                                                               break; \
-                                               } \
+                                       assert(((level) >= L_ALERT) && ((level) <= L_DBG)); \
+                                       if (log_stderr) { \
+                                               fprintf(stderr, "%2d(%d) %s: %s" fmt, \
+                                                               process_no, my_pid(), LOG_LEVEL2NAME(level),\
+                                                               (prefix), __VA_ARGS__); \
+                                       } else { \
+                                               syslog(LOG2SYSLOG_LEVEL(level) | \
+                                                                       cfg_get(core, core_cfg, log_facility), \
+                                                               "%s: %s" fmt, LOG_LEVEL2NAME(level),\
+                                                               (prefix), __VA_ARGS__); \
                                        } \
                                        DPRINT_CRIT_EXIT; \
                                } \
                                        } \
                                        DPRINT_CRIT_EXIT; \
                                } \
-                       }while(0)
-       #endif /*SUN_PRO_C*/
- #endif
+                       } while(0)
+                       
+ #             define LOG(level, fmt, args...)  LOG_((level), LOC_INFO, fmt, ## args)
+               
+ #     endif /* __SUNPRO_C */
+ #endif /* NO_LOG */
  
- #ifdef NO_DEBUG
-       #ifdef __SUNPRO_C
-               #define DBG(...)
-       #else
-               #define DBG(fmt, args...)
-       #endif
- #else
-       #ifdef __SUNPRO_C
-               #define DBG(...) LOG(L_DBG, __VA_ARGS__)
-       #else
-               #define DBG(fmt, args...) LOG(L_DBG, fmt, ## args)
-       #endif
- #endif
  
+ /*
+  * Simplier, prefered logging macros for constant log level
+  */
  #ifdef __SUNPRO_C
-               #define DEBUG(...) DBG("DEBUG: "          LOC_INFO __VA_ARGS__)
-               #define ERR(...)  LOG(L_ERR, "ERROR: "    LOC_INFO __VA_ARGS__)
-               #define WARN(...) LOG(L_WARN, "WARNING: " LOC_INFO __VA_ARGS__)
-               #define INFO(...) LOG(L_INFO, "INFO: "    LOC_INFO __VA_ARGS__)
-               #define BUG(...) LOG(L_CRIT, "BUG: "      LOC_INFO __VA_ARGS__)
-               #define NOTICE(...) LOG(L_NOTICE, "NOTICE: " LOC_INFO __VA_ARGS__)
-               #define ALERT(...) LOG(L_ALERT, "ALERT: " LOC_INFO __VA_ARGS__)
-               #define CRIT(...) LOG(L_CRIT, "CRITICAL: " LOC_INFO __VA_ARGS__)
- #else
-               #define DEBUG(fmt, args...) DBG("DEBUG: "       LOC_INFO fmt, ## args)
-               #define ERR(fmt, args...) LOG(L_ERR, "ERROR: "  LOC_INFO fmt, ## args)
-               #define WARN(fmt, args...) LOG(L_WARN, "WARN: " LOC_INFO fmt, ## args)
-               #define INFO(fmt, args...) LOG(L_INFO, "INFO: " LOC_INFO fmt, ## args)
-               #define BUG(fmt, args...) LOG(L_CRIT, "BUG: "   LOC_INFO fmt, ## args)
-               #define NOTICE(fmt, args...) \
-                       LOG(L_NOTICE, "NOTICE: " LOC_INFO fmt, ## args)
-               #define ALERT(fmt, args...) \
-                       LOG(L_ALERT, "ALERT: " LOC_INFO fmt, ## args)
-               #define CRIT(fmt, args...) \
-                       LOG(L_CRIT, "CRITICAL: " LOC_INFO fmt, ## args)
- #endif
+ #     define ALERT(...)  LOG(L_ALERT,  __VA_ARGS__)
+ #     define BUG(...)    LOG(L_CRIT,   __VA_ARGS__)
+ #     define ERR(...)    LOG(L_ERR,    __VA_ARGS__)
+ #     define WARN(...)   LOG(L_WARN,   __VA_ARGS__)
+ #     define NOTICE(...) LOG(L_NOTICE, __VA_ARGS__)
+ #     define INFO(...)   LOG(L_INFO,   __VA_ARGS__)
++#     define CRIT(...)    LOG(L_CRIT2,   __VA_ARGS__)
+ #     ifdef NO_DEBUG
+ #             define DBG(...)
+ #     else
+ #             define DBG(...)    LOG(L_DBG, __VA_ARGS__)
+ #     endif           
+ /* obsolete, do not use */
+ #     define DEBUG(...) DBG(__VA_ARGS__)
 -              
 -#else
++
++#else /* ! __SUNPRO_C */
+ #     define ALERT(fmt, args...)  LOG(L_ALERT,  fmt, ## args)
+ #     define BUG(fmt, args...)    LOG(L_CRIT,   fmt, ## args)
+ #     define ERR(fmt, args...)    LOG(L_ERR,    fmt, ## args)
+ #     define WARN(fmt, args...)   LOG(L_WARN,   fmt, ## args)
+ #     define NOTICE(fmt, args...) LOG(L_NOTICE, fmt, ## args)
+ #     define INFO(fmt, args...)   LOG(L_INFO,   fmt, ## args)
++#     define CRIT(fmt, args...)   LOG(L_CRIT2,   fmt, ## args)
+ #     ifdef NO_DEBUG
+ #             define DBG(fmt, args...)
+ #     else
+ #             define DBG(fmt, args...)    LOG(L_DBG, fmt, ## args)
+ #     endif           
+ /* obsolete, do not use */
+ #     define DEBUG(fmt, args...) DBG(fmt, ## args)
+               
+ #endif /* __SUNPRO_C */
  
- #endif /* ifndef dprint_h */
 +/* kamailio/openser compatibility */
 +
 +#define LM_GEN1 LOG
 +
 +#define LM_ALERT ALERT
 +#define LM_CRIT  CRIT
 +#define LM_ERR ERR
 +#define LM_WARN WARN
 +#define LM_NOTICE
 +#define LM_INFO INFO
 +#define LM_DBG DEBUG
 +
+ #endif /* !dprint_h */
diff --cc main.c
Simple merge
diff --cc route.c
Simple merge
diff --cc route_struct.h
Simple merge
diff --cc usr_avp.c
Simple merge
diff --cc usr_avp.h
+++ b/usr_avp.h
@@@ -203,7 -203,10 +203,9 @@@ int add_avp_galias(str *alias, int type
  int parse_avp_ident( str *name, avp_ident_t* attr);
  int parse_avp_name( str *name, int *type, int_str *avp_name, int *index);
  int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index);
 -/* TODO: is there any client for this function? */
 -void free_avp_name( int *type, int_str *avp_name);
 +void free_avp_name( avp_flags_t *type, int_str *avp_name);
+ /* Free an ident obtained with parse_avp_ident() */
+ void free_avp_ident(avp_ident_t* attr);
  
  /* AVP flags functions */
  #define MAX_AVPFLAG  ((unsigned int)( sizeof(avp_flags_t) * CHAR_BIT - 1 - AVP_CUSTOM_FLAGS))