Module: sip-router
Branch: master
Commit: b93c81421f53b6cc1620a01dc8937d92daac1be9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b93c814…
Author: Alex Hermann <alex(a)speakup.nl>
Committer: Alex Hermann <alex(a)speakup.nl>
Date: Mon Mar 7 14:36:27 2011 +0100
modules_k/permissions: allow_trusted(): Return number of matched entries.
---
modules_k/permissions/hash.c | 12 +++++++-----
modules_k/permissions/trusted.c | 15 ++++++++-------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/modules_k/permissions/hash.c b/modules_k/permissions/hash.c
index c24b94b..1261227 100644
--- a/modules_k/permissions/hash.c
+++ b/modules_k/permissions/hash.c
@@ -199,6 +199,7 @@ int hash_table_insert(struct trusted_list** table, char* src_ip,
* Check if an entry exists in hash table that has given src_ip and protocol
* value and pattern that matches to From URI. If an entry exists and tag_avp
* has been defined, tag of the entry is added as a value to tag_avp.
+ * Returns number of matches or -1 if none matched.
*/
int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
char *src_ip_c_str, int proto)
@@ -209,7 +210,7 @@ int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
struct trusted_list *np;
str src_ip;
int_str val;
- int rc = -1;
+ int count = 0;
src_ip.s = src_ip_c_str;
src_ip.len = strlen(src_ip.s);
@@ -245,13 +246,14 @@ int match_hash_table(struct trusted_list** table, struct sip_msg* msg,
LM_ERR("setting of tag_avp failed\n");
return -1;
}
- rc = 1;
- } else {
- return 1;
}
+ count++;
}
}
- return rc;
+ if (!count)
+ return -1;
+ else
+ return count;
}
diff --git a/modules_k/permissions/trusted.c b/modules_k/permissions/trusted.c
index 62fba29..32e1313 100644
--- a/modules_k/permissions/trusted.c
+++ b/modules_k/permissions/trusted.c
@@ -328,8 +328,8 @@ static inline int match_proto(const char *proto_string, int proto_int)
}
/*
- * Matches from uri against patterns returned from database. Returns 1 when
- * first pattern matches and -1 if none of the patterns match.
+ * Matches from uri against patterns returned from database. Returns number
+ * of matches or -1 if none of the patterns match.
*/
static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
{
@@ -340,7 +340,7 @@ static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
db_val_t* val;
regex_t preg;
int_str tag_avp, avp_val;
- int rc = -1;
+ int count = 0;
if (parse_from_header(msg) < 0) return -1;
uri = get_from(msg)->uri;
@@ -383,13 +383,14 @@ static int match_res(struct sip_msg* msg, int proto, db1_res_t* _r)
LM_ERR("failed to set of tag_avp failed\n");
return -1;
}
- rc = 1;
- } else {
- return 1;
}
+ count++;
}
}
- return rc;
+ if (!count)
+ return -1;
+ else
+ return count;
}
Module: sip-router
Branch: carstenbock/ims
Commit: 5479620417f017109985ee10d485a0da85588d81
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5479620…
Author: Carsten Bock <carsten(a)bock.info>
Committer: Carsten Bock <carsten(a)bock.info>
Date: Thu Mar 10 14:11:11 2011 +0100
- Updated Typo in the docs (thanks Klaus)
- added a note about reg_avp behaviour.
---
modules_k/registrar/doc/registrar_admin.xml | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/modules_k/registrar/doc/registrar_admin.xml b/modules_k/registrar/doc/registrar_admin.xml
index 13947d1..b809338 100644
--- a/modules_k/registrar/doc/registrar_admin.xml
+++ b/modules_k/registrar/doc/registrar_admin.xml
@@ -660,10 +660,13 @@ modparam("registrar", "reg_avp", "$avp(i:2)")
The function processes a REGISTER message. It can add, remove or
modify usrloc records depending on Contact and Expires HFs in the
REGISTER message. On success and when called from the REQUEST_ROUTE,
- 200 OK will be returned listing all contacts that are currently in
+ 200 OK will be returned listing all contacts that are currently in
usrloc. On an error, error message will be send with a short
description in reason phrase.
</para>
+ <para>
+ This function will save the AVP's for this contact.
+ </para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
@@ -715,6 +718,9 @@ save("location");
Same as <function>save()</function> but it accepts a set of flags for
controlling its behaviour.
</para>
+ <para>
+ This function will save the AVP's for this contact.
+ </para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
@@ -776,6 +782,9 @@ save("location","0x01");
the message (depending on append_branches parameter value).
</para>
<para>
+ This function will restore the AVP's for this contact.
+ </para>
+ <para>
If the method_filtering option is enabled, the lookup function
will return only the contacts that support the method of the
processed request.
@@ -837,7 +846,10 @@ switch ($retcode) {
The function returns true if the AOR in the Request-URI is
registered, false otherwise. The function does not modify the
message being processed, it neither rewrites the Request-URI if a
- contact is found not append branches.
+ contact is found nor appends branches.
+ </para>
+ <para>
+ This function will restore the AVP's for this contact.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
@@ -873,7 +885,10 @@ if (registered("location")) {
registered, false otherwise.
The function does not modify the
message being processed, it neither rewrites the Request-URI if a
- contact is found not append branches.
+ contact is found nor appends branches.
+ </para>
+ <para>
+ This function will restore the AVP's for this contact.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>