Browse Source

ss7ops: exported functions to kemi framework

Daniel-Constantin Mierla 8 years ago
parent
commit
ee256fdd8b
1 changed files with 31 additions and 2 deletions
  1. 31 2
      src/modules/ss7ops/ss7ops_mod.c

+ 31 - 2
src/modules/ss7ops/ss7ops_mod.c

@@ -24,6 +24,7 @@
 #include "isup_parsed.h"
 #include "isup_parsed.h"
 #include "../../core/sr_module.h"
 #include "../../core/sr_module.h"
 #include "../../core/endianness.h"
 #include "../../core/endianness.h"
+#include "../../core/kemi.h"
 
 
 MODULE_VERSION
 MODULE_VERSION
 
 
@@ -315,10 +316,9 @@ static uint8_t *fetch_payload(struct sip_msg *_m, char *pname, int *len)
 	return (uint8_t *) pt.rs.s;
 	return (uint8_t *) pt.rs.s;
 }
 }
 
 
-static int w_isup_to_json(struct sip_msg *_m, char *param1, char *param2)
+static int ki_isup_to_json(sip_msg_t *_m, int proto)
 {
 {
 	struct isup_state isup_state = { 0, };
 	struct isup_state isup_state = { 0, };
-	int proto = atoi(param1);
 	const uint8_t *data;
 	const uint8_t *data;
 	int opc, dpc, mtp_type, int_len, rc;
 	int opc, dpc, mtp_type, int_len, rc;
 	size_t len;
 	size_t len;
@@ -372,6 +372,11 @@ static int w_isup_to_json(struct sip_msg *_m, char *param1, char *param2)
 	return 1;
 	return 1;
 }
 }
 
 
+static int w_isup_to_json(struct sip_msg *_m, char *param1, char *param2)
+{
+		return ki_isup_to_json(_m, atoi(param1));
+}
+
 #define UINT_OR_NULL(msg, param, res, node) \
 #define UINT_OR_NULL(msg, param, res, node) \
 		node ? pv_get_uintval(msg, param, res, node->valuedouble) : pv_get_null(msg, param, res)
 		node ? pv_get_uintval(msg, param, res, node->valuedouble) : pv_get_null(msg, param, res)
 
 
@@ -716,3 +721,27 @@ error:
 	LM_ERR("unknown isup input %.*s\n", in->len, in->s);
 	LM_ERR("unknown isup input %.*s\n", in->len, in->s);
 	return -1;
 	return -1;
 }
 }
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_ss7ops_exports[] = {
+	{ str_init("ss7ops"), str_init("isup_to_json"),
+		SR_KEMIP_INT, ki_isup_to_json,
+		{ SR_KEMIP_INT, 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_ss7ops_exports);
+	return 0;
+}