Module: kamailio
Branch: master
Commit: d55d00b87276f0f53b6d72ac9c0c08121341e1da
URL:
https://github.com/kamailio/kamailio/commit/d55d00b87276f0f53b6d72ac9c0c081…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-06-10T09:19:59+02:00
auth_xkeys: exported functions to kemi framework
---
Modified: src/modules/auth_xkeys/auth_xkeys_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d55d00b87276f0f53b6d72ac9c0c081…
Patch:
https://github.com/kamailio/kamailio/commit/d55d00b87276f0f53b6d72ac9c0c081…
---
diff --git a/src/modules/auth_xkeys/auth_xkeys_mod.c
b/src/modules/auth_xkeys/auth_xkeys_mod.c
index 4930de4904..5432ebc3b1 100644
--- a/src/modules/auth_xkeys/auth_xkeys_mod.c
+++ b/src/modules/auth_xkeys/auth_xkeys_mod.c
@@ -32,6 +32,7 @@
#include "../../core/mod_fix.h"
#include "../../core/timer_proc.h"
#include "../../core/route_struct.h"
+#include "../../core/kemi.h"
#include "auth_xkeys.h"
@@ -108,6 +109,7 @@ static int child_init(int rank)
{
return 0;
}
+
/**
* destroy module function
*/
@@ -115,7 +117,9 @@ static void mod_destroy(void)
{
}
-
+/**
+ *
+ */
static int w_auth_xkeys_add(sip_msg_t* msg, char* hdr, char* key,
char* alg, char* data)
{
@@ -151,6 +155,21 @@ static int w_auth_xkeys_add(sip_msg_t* msg, char* hdr, char* key,
return 1;
}
+/**
+ *
+ */
+static int ki_auth_xkeys_add(sip_msg_t* msg, str *shdr, str *skey, str *salg,
+ str *sdata)
+{
+ if(auth_xkeys_add(msg, shdr, skey, salg, sdata)<0)
+ return -1;
+
+ return 1;
+}
+
+/**
+ *
+ */
static int w_auth_xkeys_check(sip_msg_t* msg, char* hdr, char* key,
char* alg, char* data)
{
@@ -186,6 +205,21 @@ static int w_auth_xkeys_check(sip_msg_t* msg, char* hdr, char* key,
return 1;
}
+/**
+ *
+ */
+static int ki_auth_xkeys_check(sip_msg_t* msg, str *shdr, str *skey, str *salg,
+ str *sdata)
+{
+ if(auth_xkeys_check(msg, shdr, skey, salg, sdata)<0)
+ return -1;
+
+ return 1;
+}
+
+/**
+ *
+ */
static int fixup_auth_xkeys_add(void** param, int param_no)
{
if(fixup_spve_null(param, 1)<0)
@@ -193,6 +227,9 @@ static int fixup_auth_xkeys_add(void** param, int param_no)
return 0;
}
+/**
+ *
+ */
static int fixup_auth_xkeys_check(void** param, int param_no)
{
if(fixup_spve_null(param, 1)<0)
@@ -200,6 +237,9 @@ static int fixup_auth_xkeys_check(void** param, int param_no)
return 0;
}
+/**
+ *
+ */
int authx_xkey_param(modparam_t type, void* val)
{
str s;
@@ -210,3 +250,32 @@ int authx_xkey_param(modparam_t type, void* val)
s.len = strlen(s.s);
return authx_xkey_add_params(&s);
}
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_auth_xkeys_exports[] = {
+ { str_init("auth_xkeys"), str_init("auth_xkeys_add"),
+ SR_KEMIP_INT, ki_auth_xkeys_add,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("auth_xkeys"), str_init("auth_xkeys_check"),
+ SR_KEMIP_INT, ki_auth_xkeys_check,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+ SR_KEMIP_STR, 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_auth_xkeys_exports);
+ return 0;
+}
\ No newline at end of file