Re: [sr-dev] [kamailio/kamailio] db_mongodb has a problem with projection (#1479)

2018-05-18 Thread Daniel-Constantin Mierla
It should, afaik. What do you get wrong?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1479#issuecomment-390199565___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] str_hash: Option to allocate hash in shm (#1535)

2018-05-18 Thread Alfonso Pinto
hi @henningw, I'm developing a module that requires to have a hash in memory to 
keep some user information it retrieves from another system via diameter.
The use case is similar to tsilo or domain modules, the information needs to be 
available for all processes and accesible through a key.
However, if you look at those modules (and I think there were others that I 
can't remember now) they all implement their own structures to handle the hash 
table, the collision slots, the entries, the linked lists, the accessor 
functions,... when it's not needed as kamailio already has a library that 
contains all of that. The only missing part is that until now it only worked in 
private memory

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1535#issuecomment-390129867___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:abf6039d: app_python3: added KSR.pv.getw(...)

2018-05-18 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: abf6039da53ba373c5e389e162d5b21a431fb3ee
URL: 
https://github.com/kamailio/kamailio/commit/abf6039da53ba373c5e389e162d5b21a431fb3ee

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2018-05-18T09:05:04+02:00

app_python3: added KSR.pv.getw(...)

---

Modified: src/modules/app_python3/apy_kemi.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/abf6039da53ba373c5e389e162d5b21a431fb3ee.diff
Patch: 
https://github.com/kamailio/kamailio/commit/abf6039da53ba373c5e389e162d5b21a431fb3ee.patch

---

diff --git a/src/modules/app_python3/apy_kemi.c 
b/src/modules/app_python3/apy_kemi.c
index ce6bc68733..cacd9067f4 100644
--- a/src/modules/app_python3/apy_kemi.c
+++ b/src/modules/app_python3/apy_kemi.c
@@ -662,7 +662,20 @@ static sr_kemi_t _sr_apy_kemi_test[] = {
 /**
  *
  */
-static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, PyObject *args)
+PyObject *sr_apy_kemi_return_none_mode(int rmode)
+{
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
+}
+
+/**
+ *
+ */
+static PyObject *sr_apy_kemi_f_pv_get_mode(PyObject *self, PyObject *args,
+   int rmode)
 {
str pvn;
pv_spec_t *pvs;
@@ -675,7 +688,7 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
 
if(env_P==NULL) {
LM_ERR("invalid Python environment attributes\n");
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(env_P->msg==NULL) {
lmsg = faked_msg_next();
@@ -685,12 +698,12 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
 
if(!PyArg_ParseTuple(args, "s:pv.get", )) {
LM_ERR("unable to retrieve str param\n");
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
 
if(pvn.s==NULL || lmsg==NULL) {
LM_ERR("invalid context attributes\n");
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
 
pvn.len = strlen(pvn.s);
@@ -698,21 +711,21 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
pl = pv_locate_name();
if(pl != pvn.len) {
LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len);
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
pvs = pv_cache_get();
if(pvs==NULL) {
LM_ERR("cannot get pv spec for [%s]\n", pvn.s);
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
memset(, 0, sizeof(pv_value_t));
if(pv_get_spec_value(lmsg, pvs, ) != 0)
{
LM_ERR("unable to get pv value for [%s]\n", pvn.s);
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(val.flags_VAL_NULL) {
-   return sr_apy_kemi_return_none();
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(val.flags_TYPE_INT) {
return sr_kemi_apy_return_int(NULL, val.ri);
@@ -720,6 +733,22 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
return sr_apy_kemi_return_str(NULL, val.rs.s, val.rs.len);
 }
 
+/**
+ *
+ */
+static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, PyObject *args)
+{
+   return sr_apy_kemi_f_pv_get_mode(self, args, 0);
+}
+
+/**
+ *
+ */
+static PyObject *sr_apy_kemi_f_pv_getw(PyObject *self, PyObject *args)
+{
+   return sr_apy_kemi_f_pv_get_mode(self, args, 1);
+}
+
 /**
  *
  */
@@ -951,6 +980,8 @@ static PyObject *sr_apy_kemi_f_pv_is_null(PyObject *self, 
PyObject *args)
 static PyMethodDef _sr_apy_kemi_pv_Methods[] = {
{"get", sr_apy_kemi_f_pv_get,   METH_VARARGS,
NAME " - pv get value"},
+   {"getw",sr_apy_kemi_f_pv_getw,  METH_VARARGS,
+   NAME " - pv get value or <>"},
{"seti",sr_apy_kemi_f_pv_seti,  METH_VARARGS,
NAME " - pv set int value"},
{"sets",sr_apy_kemi_f_pv_sets,  METH_VARARGS,


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:e8b434f1: app_python: added KSR.pv.getw() to kemi expors

2018-05-18 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e8b434f13f56b2f34d5b30bf728c4685c488e63c
URL: 
https://github.com/kamailio/kamailio/commit/e8b434f13f56b2f34d5b30bf728c4685c488e63c

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2018-05-18T09:03:04+02:00

app_python: added KSR.pv.getw() to kemi expors

- wrapper function for returning the value

---

Modified: src/modules/app_python/apy_kemi.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/e8b434f13f56b2f34d5b30bf728c4685c488e63c.diff
Patch: 
https://github.com/kamailio/kamailio/commit/e8b434f13f56b2f34d5b30bf728c4685c488e63c.patch

---

diff --git a/src/modules/app_python/apy_kemi.c 
b/src/modules/app_python/apy_kemi.c
index b7cca69bdf..6ea72e3d1c 100644
--- a/src/modules/app_python/apy_kemi.c
+++ b/src/modules/app_python/apy_kemi.c
@@ -657,6 +657,18 @@ static sr_kemi_t _sr_apy_kemi_test[] = {
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };
 
+/**
+ *
+ */
+PyObject *sr_apy_kemi_return_none_mode(int rmode)
+{
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
+}
+
 /**
  *
  */
@@ -674,11 +686,7 @@ static PyObject *sr_apy_kemi_f_pv_get_mode(PyObject *self, 
PyObject *args,
 
if(env_P==NULL) {
LM_ERR("invalid Python environment attributes\n");
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(env_P->msg==NULL) {
lmsg = faked_msg_next();
@@ -688,20 +696,12 @@ static PyObject *sr_apy_kemi_f_pv_get_mode(PyObject 
*self, PyObject *args,
 
if(!PyArg_ParseTuple(args, "s:pv.get", )) {
LM_ERR("unable to retrieve str param\n");
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
 
if(pvn.s==NULL || lmsg==NULL) {
LM_ERR("invalid context attributes\n");
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
 
pvn.len = strlen(pvn.s);
@@ -709,37 +709,21 @@ static PyObject *sr_apy_kemi_f_pv_get_mode(PyObject 
*self, PyObject *args,
pl = pv_locate_name();
if(pl != pvn.len) {
LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len);
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
pvs = pv_cache_get();
if(pvs==NULL) {
LM_ERR("cannot get pv spec for [%s]\n", pvn.s);
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
memset(, 0, sizeof(pv_value_t));
if(pv_get_spec_value(lmsg, pvs, ) != 0)
{
LM_ERR("unable to get pv value for [%s]\n", pvn.s);
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(val.flags_VAL_NULL) {
-   if(rmode) {
-   return sr_apy_kemi_return_str(NULL, "<>", 8);
-   } else {
-   return sr_apy_kemi_return_none();
-   }
+   return sr_apy_kemi_return_none_mode(rmode);
}
if(val.flags_TYPE_INT) {
return sr_kemi_apy_return_int(NULL, val.ri);
@@ -758,7 +742,7 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
 /**
  *
  */
-static PyObject *sr_apy_kemi_f_pv_get_w(PyObject *self, PyObject *args)
+static PyObject *sr_apy_kemi_f_pv_getw(PyObject *self, PyObject *args)
 {
return sr_apy_kemi_f_pv_get_mode(self, args, 1);
 }
@@ -994,6 +978,8 @@ static PyObject *sr_apy_kemi_f_pv_is_null(PyObject *self, 
PyObject *args)
 static PyMethodDef _sr_apy_kemi_pv_Methods[] = {
{"get", sr_apy_kemi_f_pv_get,   METH_VARARGS,
NAME " - pv get value"},
+   {"getw",sr_apy_kemi_f_pv_getw,  

[sr-dev] git:master:115fa38f: app_python: added KSR.pv.getw(...)

2018-05-18 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 115fa38f427b1bc3730add9078c44219b25960cb
URL: 
https://github.com/kamailio/kamailio/commit/115fa38f427b1bc3730add9078c44219b25960cb

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2018-05-18T08:48:37+02:00

app_python: added KSR.pv.getw(...)

---

Modified: src/modules/app_python/apy_kemi.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/115fa38f427b1bc3730add9078c44219b25960cb.diff
Patch: 
https://github.com/kamailio/kamailio/commit/115fa38f427b1bc3730add9078c44219b25960cb.patch

---

diff --git a/src/modules/app_python/apy_kemi.c 
b/src/modules/app_python/apy_kemi.c
index e9759d43d6..b7cca69bdf 100644
--- a/src/modules/app_python/apy_kemi.c
+++ b/src/modules/app_python/apy_kemi.c
@@ -660,7 +660,8 @@ static sr_kemi_t _sr_apy_kemi_test[] = {
 /**
  *
  */
-static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, PyObject *args)
+static PyObject *sr_apy_kemi_f_pv_get_mode(PyObject *self, PyObject *args,
+   int rmode)
 {
str pvn;
pv_spec_t *pvs;
@@ -673,7 +674,11 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
 
if(env_P==NULL) {
LM_ERR("invalid Python environment attributes\n");
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
if(env_P->msg==NULL) {
lmsg = faked_msg_next();
@@ -683,12 +688,20 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
 
if(!PyArg_ParseTuple(args, "s:pv.get", )) {
LM_ERR("unable to retrieve str param\n");
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
 
if(pvn.s==NULL || lmsg==NULL) {
LM_ERR("invalid context attributes\n");
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
 
pvn.len = strlen(pvn.s);
@@ -696,21 +709,37 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
pl = pv_locate_name();
if(pl != pvn.len) {
LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len);
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
pvs = pv_cache_get();
if(pvs==NULL) {
LM_ERR("cannot get pv spec for [%s]\n", pvn.s);
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
memset(, 0, sizeof(pv_value_t));
if(pv_get_spec_value(lmsg, pvs, ) != 0)
{
LM_ERR("unable to get pv value for [%s]\n", pvn.s);
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
if(val.flags_VAL_NULL) {
-   return sr_apy_kemi_return_none();
+   if(rmode) {
+   return sr_apy_kemi_return_str(NULL, "<>", 8);
+   } else {
+   return sr_apy_kemi_return_none();
+   }
}
if(val.flags_TYPE_INT) {
return sr_kemi_apy_return_int(NULL, val.ri);
@@ -718,6 +747,22 @@ static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, 
PyObject *args)
return sr_apy_kemi_return_str(NULL, val.rs.s, val.rs.len);
 }
 
+/**
+ *
+ */
+static PyObject *sr_apy_kemi_f_pv_get(PyObject *self, PyObject *args)
+{
+   return sr_apy_kemi_f_pv_get_mode(self, args, 0);
+}
+
+/**
+ *
+ */
+static PyObject *sr_apy_kemi_f_pv_get_w(PyObject *self, PyObject *args)
+{
+   return sr_apy_kemi_f_pv_get_mode(self, args, 1);
+}
+
 /**
  *
  */


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] str_hash: Option to allocate hash in shm (#1535)

2018-05-18 Thread Henning Westerholt
Thank you for the contribution. Just one question so far - what was your 
motivation in adding this functionality, where do you need this?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1535#issuecomment-390113748___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev