Module: sip-router
Branch: master
Commit: 6b9d28ee105960c790dae46119430764c1241b3d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6b9d28e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri May 29 20:03:57 2009 +0300
kex: added K dst uri related functions
- setdsturi(uri)/resetdsturi()/isdsturiset()
---
modules_k/kex/kex_mod.c | 6 ++++++
modules_k/kex/km_core.c | 30 ++++++++++++++++++++++++++++++
modules_k/kex/km_core.h | 3 +++
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/modules_k/kex/kex_mod.c b/modules_k/kex/kex_mod.c
index 9baa48d..64f26a8 100644
--- a/modules_k/kex/kex_mod.c
+++ b/modules_k/kex/kex_mod.c
@@ -68,6 +68,12 @@ static cmd_export_t cmds[]={
0, REQUEST_ROUTE | FAILURE_ROUTE },
{"km_append_branch", (cmd_function)w_km_append_branch, 1, fixup_spve_null,
0, REQUEST_ROUTE | FAILURE_ROUTE },
+ {"setdsturi", (cmd_function)w_setdsturi, 1, 0,
+ 0, ANY_ROUTE },
+ {"resetdsturi", (cmd_function)w_resetdsturi, 0, 0,
+ 0, ANY_ROUTE },
+ {"isdsturiset", (cmd_function)w_isdsturiset, 0, 0,
+ 0, ANY_ROUTE },
{0,0,0,0,0,0}
};
diff --git a/modules_k/kex/km_core.c b/modules_k/kex/km_core.c
index beebb35..cea12ea 100644
--- a/modules_k/kex/km_core.c
+++ b/modules_k/kex/km_core.c
@@ -65,3 +65,33 @@ int w_km_append_branch(struct sip_msg *msg, char *uri, str *sq)
return ret;
}
+int w_setdsturi(struct sip_msg *msg, char *uri, str *s2)
+{
+ str s;
+
+ /* todo: fixup */
+ s.s = uri;
+ s.len = strlen(uri);
+
+ if(set_dst_uri(msg, &s)!=0)
+ return -1;
+ return 1;
+
+}
+
+int w_resetdsturi(struct sip_msg *msg, char *uri, str *s2)
+{
+ if(msg->dst_uri.s!=0)
+ pkg_free(msg->dst_uri.s);
+ msg->dst_uri.s = 0;
+ msg->dst_uri.len = 0;
+ return 1;
+}
+
+int w_isdsturiset(struct sip_msg *msg, char *uri, str *s2)
+{
+ if(msg->dst_uri.s==0 || msg->dst_uri.len<=0)
+ return -1;
+ return 1;
+}
+
diff --git a/modules_k/kex/km_core.h b/modules_k/kex/km_core.h
index a668c71..84fe5dd 100644
--- a/modules_k/kex/km_core.h
+++ b/modules_k/kex/km_core.h
@@ -26,5 +26,8 @@
#include "../../sr_module.h"
int w_km_append_branch(struct sip_msg *msg, char *uri, str *s2);
+int w_setdsturi(struct sip_msg *msg, char *uri, str *s2);
+int w_resetdsturi(struct sip_msg *msg, char *uri, str *s2);
+int w_isdsturiset(struct sip_msg *msg, char *uri, str *s2);
#endif