[sr-dev] git:master:829759af: maxfwd: exported is_maxfw_lt() to kemi framework

Daniel-Constantin Mierla miconda at gmail.com
Tue Feb 6 19:49:33 CET 2018


Module: kamailio
Branch: master
Commit: 829759afd6005b0f38a474ebc292404e9137c069
URL: https://github.com/kamailio/kamailio/commit/829759afd6005b0f38a474ebc292404e9137c069

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-02-06T17:45:20+01:00

maxfwd: exported is_maxfw_lt() to kemi framework

---

Modified: src/modules/maxfwd/maxfwd.c

---

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

---

diff --git a/src/modules/maxfwd/maxfwd.c b/src/modules/maxfwd/maxfwd.c
index e0812cd504..ac2342cd62 100644
--- a/src/modules/maxfwd/maxfwd.c
+++ b/src/modules/maxfwd/maxfwd.c
@@ -176,16 +176,11 @@ static int w_process_maxfwd_header(struct sip_msg *msg, char *str1, char *str2)
 /**
  *
  */
-static int is_maxfwd_lt(struct sip_msg *msg, char *slimit, char *foo)
+static int ki_is_maxfwd_lt(sip_msg_t *msg, int limit)
 {
 	str mf_value;
-	int limit = 70;
 	int val;
 
-	if(get_int_fparam(&limit, msg, (fparam_t *)slimit) < 0) {
-		LM_ERR("could not get param value\n");
-		return -1;
-	}
 	if(limit < 0 || limit > 255) {
 		LM_ERR("invalid param value: %d\n", limit);
 		return -1;
@@ -204,6 +199,21 @@ static int is_maxfwd_lt(struct sip_msg *msg, char *slimit, char *foo)
 	return 1;
 }
 
+
+/**
+ *
+ */
+static int is_maxfwd_lt(struct sip_msg *msg, char *slimit, char *foo)
+{
+	int limit = 70;
+
+	if(get_int_fparam(&limit, msg, (fparam_t *)slimit) < 0) {
+		LM_ERR("could not get param value\n");
+		return -1;
+	}
+	return ki_is_maxfwd_lt(msg, limit);
+}
+
 /**
  * @brief bind functions to MAXFWD API structure
  */
@@ -222,13 +232,19 @@ int bind_maxfwd(maxfwd_api_t *api)
  *
  */
 static sr_kemi_t sr_kemi_maxfwd_exports[] = {
-		{ str_init("maxfwd"), str_init("process_maxfwd"),
-		    SR_KEMIP_INT, process_maxfwd_header,
-			{ 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}}};
+	{ str_init("maxfwd"), str_init("process_maxfwd"),
+		SR_KEMIP_INT, process_maxfwd_header,
+		{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("maxfwd"), str_init("is_maxfwd_lt"),
+		SR_KEMIP_INT, ki_is_maxfwd_lt,
+		{ 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}}
+};
 
 /**
  *




More information about the sr-dev mailing list