Module: kamailio
Branch: master
Commit: 74208c2160ffb6200dd6a8982fd4d94a2c00d879
URL: 
https://github.com/kamailio/kamailio/commit/74208c2160ffb6200dd6a8982fd4d94a2c00d879

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2017-12-06T11:43:38+01:00

ndb_mongodb: exported functions to kemi framework

---

Modified: src/modules/ndb_mongodb/ndb_mongodb_mod.c

---

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

---

diff --git a/src/modules/ndb_mongodb/ndb_mongodb_mod.c 
b/src/modules/ndb_mongodb/ndb_mongodb_mod.c
index 824d2aad07..73ca648977 100644
--- a/src/modules/ndb_mongodb/ndb_mongodb_mod.c
+++ b/src/modules/ndb_mongodb/ndb_mongodb_mod.c
@@ -29,6 +29,7 @@
 #include "../../core/dprint.h"
 #include "../../core/mod_fix.h"
 #include "../../core/trim.h"
+#include "../../core/kemi.h"
 
 #include "mongodb_client.h"
 #include "api.h"
@@ -177,6 +178,42 @@ static int w_mongodb_do_cmd(sip_msg_t* msg, char* ssrv, 
char *sdname, char *scna
        return 1;
 }
 
+/**
+ *
+ */
+static int ki_mongodbc_exec_simple(sip_msg_t* msg, str* ssrv, str *sdname,
+               str *scname, str* scmd, str* sres)
+{
+       return mongodbc_exec_simple(ssrv, sdname, scname, scmd, sres);
+}
+
+/**
+ *
+ */
+static int ki_mongodbc_exec(sip_msg_t* msg, str* ssrv, str *sdname,
+               str *scname, str* scmd, str* sres)
+{
+       return mongodbc_exec(ssrv, sdname, scname, scmd, sres);
+}
+
+/**
+ *
+ */
+static int ki_mongodbc_find(sip_msg_t* msg, str* ssrv, str *sdname,
+               str *scname, str* scmd, str* sres)
+{
+       return mongodbc_find(ssrv, sdname, scname, scmd, sres);
+}
+
+/**
+ *
+ */
+static int ki_mongodbc_find_one(sip_msg_t* msg, str* ssrv, str *sdname,
+               str *scname, str* scmd, str* sres)
+{
+       return mongodbc_find_one(ssrv, sdname, scname, scmd, sres);
+}
+
 /**
  *
  */
@@ -239,6 +276,16 @@ static int w_mongodb_free_reply(struct sip_msg* msg, char* 
res)
        return 1;
 }
 
+/**
+ *
+ */
+static int ki_mongodbc_free_reply(struct sip_msg* msg, str* name)
+{
+       if(mongodbc_free_reply(name)<0)
+               return -1;
+       return 1;
+}
+
 /**
  *
  */
@@ -257,6 +304,16 @@ static int w_mongodb_next_reply(struct sip_msg* msg, char* 
res)
        return 1;;
 }
 
+/**
+ *
+ */
+static int ki_mongodbc_next_reply(struct sip_msg* msg, str* name)
+{
+       if(mongodbc_next_reply(name)<0)
+               return -1;
+       return 1;;
+}
+
 /**
  *
  */
@@ -382,3 +439,49 @@ static int pv_get_mongodb(struct sip_msg *msg,  pv_param_t 
*param,
                        return pv_get_null(msg, param, res);
        }
 }
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_ndb_mongodb_exports[] = {
+       { str_init("ndb_mongodb"), str_init("exec_simple"),
+               SR_KEMIP_INT, ki_mongodbc_exec_simple,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE }
+       },
+       { str_init("ndb_mongodb"), str_init("exec"),
+               SR_KEMIP_INT, ki_mongodbc_exec,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE }
+       },
+       { str_init("ndb_mongodb"), str_init("find"),
+               SR_KEMIP_INT, ki_mongodbc_find,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE }
+       },
+       { str_init("ndb_mongodb"), str_init("find_one"),
+               SR_KEMIP_INT, ki_mongodbc_find_one,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE }
+       },
+       { str_init("ndb_mongodb"), str_init("free_reply"),
+               SR_KEMIP_INT, ki_mongodbc_free_reply,
+               { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+       { str_init("ndb_mongodb"), str_init("next_reply"),
+               SR_KEMIP_INT, ki_mongodbc_next_reply,
+               { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+                       SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
+
+       { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+/* clang-format on */
+
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+       sr_kemi_modules_add(sr_kemi_ndb_mongodb_exports);
+       return 0;
+}
\ No newline at end of file


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to