Browse Source

pua: exported functions to kemi framework

Daniel-Constantin Mierla 8 years ago
parent
commit
5b0449b583
3 changed files with 37 additions and 6 deletions
  1. 6 1
      src/modules/pua/hash.c
  2. 2 1
      src/modules/pua/hash.h
  3. 29 4
      src/modules/pua/pua.c

+ 6 - 1
src/modules/pua/hash.c

@@ -504,7 +504,7 @@ int is_dialog(ua_pres_t* dialog)
 
 }
 
-int update_contact(struct sip_msg* msg, char* str1, char* str2)
+int ki_pua_update_contact(struct sip_msg* msg)
 {
 	ua_pres_t* p, hentity;
 	str contact;
@@ -636,6 +636,11 @@ error:
 	return -1;
 }
 
+int w_pua_update_contact(struct sip_msg* msg, char* str1, char* str2)
+{
+	return ki_pua_update_contact(msg);
+}
+
 list_entry_t *get_subs_list(str *did)
 {
 	int i;

+ 2 - 1
src/modules/pua/hash.h

@@ -178,6 +178,7 @@ static inline int get_event_flag(str* event)
     return -1;
 }
 
-int update_contact(struct sip_msg* msg, char* str1, char* str2);
+int w_pua_update_contact(struct sip_msg* msg, char* str1, char* str2);
+int ki_pua_update_contact(struct sip_msg* msg);
 
 #endif

+ 29 - 4
src/modules/pua/pua.c

@@ -36,6 +36,7 @@
 #include "../../core/str.h"
 #include "../../core/mem/mem.h"
 #include "../../core/pt.h"
+#include "../../core/kemi.h"
 #include "../../core/rpc.h"
 #include "../../core/rpc_lookup.h"
 #include "../../lib/srdb1/db.h"
@@ -114,10 +115,10 @@ static int pua_rpc_init(void);
 
 static cmd_export_t cmds[]=
 {
-	{"bind_libxml_api",          (cmd_function)bind_libxml_api, 1, 0, 0, 0},
-	{"bind_pua",                 (cmd_function)bind_pua, 1, 0, 0, 0},
-	{"pua_update_contact",       (cmd_function)update_contact, 0, 0, 0, REQUEST_ROUTE},
-	{0,                          0,	0, 0, 0, 0}
+	{"pua_update_contact",  (cmd_function)w_pua_update_contact, 0, 0, 0, REQUEST_ROUTE},
+	{"bind_libxml_api",     (cmd_function)bind_libxml_api, 1, 0, 0, 0},
+	{"bind_pua",            (cmd_function)bind_pua, 1, 0, 0, 0},
+	{0,                     0, 0, 0, 0, 0}
 };
 
 static param_export_t params[]={
@@ -1231,3 +1232,27 @@ static int pua_rpc_init(void)
 	}
 	return 0;
 }
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_pua_exports[] = {
+	{ str_init("pua"), str_init("pua_update_contact"),
+		SR_KEMIP_INT, ki_pua_update_contact,
+		{ SR_KEMIP_NONE, 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_pua_exports);
+	return 0;
+}