Module: sip-router
Branch: master
Commit: 63701a5b082fa12e758518fae73fff7b80a9dc6d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=63701a5…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Mar 8 22:46:07 2009 +0100
destroy_avps kamailio compatiblity function.
The last parameter of the function controls if the function destroys
all avps with given name or just one. Returns the number of avps
destroyed.
---
usr_avp.c | 18 ++++++++++++++++++
usr_avp.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/usr_avp.c b/usr_avp.c
index b50ffbd..2a25dfd 100644
--- a/usr_avp.c
+++ b/usr_avp.c
@@ -1129,6 +1129,24 @@ error:
}
+int destroy_avps(avp_flags_t flags, avp_name_t name, int all)
+{
+ struct search_state st;
+ avp_t* avp;
+ int n;
+
+ n = 0;
+ avp = search_first_avp(flags, name, 0, &st);
+ while (avp) {
+ destroy_avp(avp);
+ n++;
+ if (!all) break;
+ avp = search_next_avp(&st, 0);
+ }
+ return n;
+}
+
+
void delete_avp(avp_flags_t flags, avp_name_t name)
{
struct search_state st;
diff --git a/usr_avp.h b/usr_avp.h
index a020394..d0f6cc6 100644
--- a/usr_avp.h
+++ b/usr_avp.h
@@ -169,6 +169,8 @@ int add_avp_list(avp_list_t* list, avp_flags_t flags, avp_name_t name,
avp_value
/* Delete avps with given type and name */
void delete_avp(avp_flags_t flags, avp_name_t name);
+int destroy_avps(avp_flags_t flags, avp_name_t name, int all);
+
/* search functions */
avp_t *search_first_avp( avp_flags_t flags, avp_name_t name,
avp_value_t *val, struct search_state* state);