Module: kamailio
Branch: master
Commit: 77bf2478893bb935e0ca09d93df75b404417d3bd
URL:
https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-01-21T19:49:47+01:00
core: select - added function to print select for error purposes
---
Modified: src/core/select.c
Modified: src/core/select.h
---
Diff:
https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
Patch:
https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
---
diff --git a/src/core/select.c b/src/core/select.c
index 1bf1e6a..bf3e567 100644
--- a/src/core/select.c
+++ b/src/core/select.c
@@ -428,18 +428,28 @@ int run_select(str* res, select_t* s, struct sip_msg* msg)
return ret;
}
-void print_select(select_t* s)
+void log_select(select_t* s, int level)
{
int i;
- DBG("select(");
+ LOG(level, "select(");
for(i = 0; i < s->n; i++) {
if (s->params[i].type == SEL_PARAM_INT) {
- DBG("%d,", s->params[i].v.i);
+ LOG(level, "%d,", s->params[i].v.i);
} else {
- DBG("%.*s,", s->params[i].v.s.len, s->params[i].v.s.s);
+ LOG(level, "%.*s,", s->params[i].v.s.len, s->params[i].v.s.s);
}
}
- DBG(")\n");
+ LOG(level, ")\n");
+}
+
+void print_select(select_t* s)
+{
+ log_select(s, L_DBG);
+}
+
+void err_select(select_t* s)
+{
+ log_select(s, L_ERR);
}
int register_select_table(select_row_t* mod_tab)
diff --git a/src/core/select.h b/src/core/select.h
index 5d639d6..74c68e4 100644
--- a/src/core/select.h
+++ b/src/core/select.h
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@@ -26,7 +26,7 @@
* Module: \ref core
*/
-
+
#ifndef _SELECT_H
#define _SELECT_H
@@ -36,7 +36,7 @@
#define MAX_SELECT_PARAMS 32
#define MAX_NESTED_CALLS 4
-/* Flags for parser table FLAG bitfiels
+/* Flags for parser table FLAG bitfiels
*/
#define DIVERSION_MASK 0x00FF
@@ -75,12 +75,12 @@
/* left function is noted to be called
* rigth function continues in resolution
- * NOTE: the parameter is not consumed for PARENT,
+ * NOTE: the parameter is not consumed for PARENT,
* so you can leave it as ..,SEL_PARAM_INT, 0,..
*
* run_select then calls all functions with PARENT flag
- * in the order of resolution until the final call or
- * the result is != 0 (<0 error, 1 null str)
+ * in the order of resolution until the final call or
+ * the result is != 0 (<0 error, 1 null str)
* the only one parameter passed between nested calls
* is the result str*
*/
@@ -102,13 +102,13 @@ typedef enum {
SEL_PARAM_DIV, /* Integer value got from parsing table */
SEL_PARAM_PTR /* void* data got from e.g. fixup call */
} select_param_type_t;
-
+
typedef union {
int i; /* Integer value */
str s; /* String value */
void* p;/* Any data ptr */
} select_param_value_t;
-
+
typedef struct sel_param {
select_param_type_t type;
select_param_value_t v;
@@ -164,11 +164,16 @@ int resolve_select(select_t* s);
int run_select(str* res, select_t* s, struct sip_msg* msg);
/*
- * Print select for debugging purposes
+ * Print select for debugging purposes
*/
void print_select(select_t* s);
/*
+ * Print select for error purposes
+ */
+void err_select(select_t* s);
+
+/*
* Register modules' own select parser table
*/
int register_select_table(select_row_t *table);
@@ -191,7 +196,7 @@ int parse_select (char** p, select_t** s);
void free_select(select_t *s);
/*
* Select parser, result is stored in SHARED memory
- *
+ *
* If you call this, you must ensure, that the string which
* is beeing parsed MUST be at the same place for all child
* processes, e.g. allocated in the shared memory as well