Browse code

siputils: functions to compare uri and aor exported to kemi

Daniel-Constantin Mierla authored on 02/08/2021 07:01:46
Showing 3 changed files
... ...
@@ -40,6 +40,18 @@
40 40
 
41 41
 #include "sipops.h"
42 42
 
43
+int ki_cmp_uri(sip_msg_t *msg, str *uri1, str *uri2)
44
+{
45
+	int ret;
46
+
47
+	ret = cmp_uri_str(uri1, uri2);
48
+	if(ret==0)
49
+		return 1;
50
+	if(ret>0)
51
+		return -1;
52
+	return -2;
53
+}
54
+
43 55
 int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2)
44 56
 {
45 57
 	str s1;
... ...
@@ -64,6 +76,18 @@ int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2)
64 76
 	return -2;
65 77
 }
66 78
 
79
+int ki_cmp_aor(sip_msg_t *msg, str *uri1, str *uri2)
80
+{
81
+	int ret;
82
+
83
+	ret = cmp_aor_str(uri1, uri2);
84
+	if(ret==0)
85
+		return 1;
86
+	if(ret>0)
87
+		return -1;
88
+	return -2;
89
+}
90
+
67 91
 int w_cmp_aor(struct sip_msg *msg, char *uri1, char *uri2)
68 92
 {
69 93
 	str s1;
... ...
@@ -34,7 +34,9 @@
34 34
 
35 35
 #include "../../core/parser/msg_parser.h"
36 36
 
37
+int ki_cmp_uri(sip_msg_t *msg, str *uri1, str *uri2);
37 38
 int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2);
39
+int ki_cmp_aor(sip_msg_t *msg, str *uri1, str *uri2);
38 40
 int w_cmp_aor(struct sip_msg *msg, char *uri1, char *uri2);
39 41
 int ki_cmp_hdr_name(sip_msg_t *msg, str *shname1, str *shname2);
40 42
 int w_cmp_hdr_name(sip_msg_t *msg, char *hname1, char *hname2);
... ...
@@ -740,6 +740,16 @@ static sr_kemi_t sr_kemi_siputils_exports[] = {
740 740
 		{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
741 741
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
742 742
 	},
743
+	{ str_init("siputils"), str_init("cmp_uri"),
744
+		SR_KEMIP_INT, ki_cmp_uri,
745
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
746
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
747
+	},
748
+	{ str_init("siputils"), str_init("cmp_aor"),
749
+		SR_KEMIP_INT, ki_cmp_aor,
750
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
751
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
752
+	},
743 753
 	{ str_init("siputils"), str_init("cmp_hdr_name"),
744 754
 		SR_KEMIP_INT, ki_cmp_hdr_name,
745 755
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,