Browse code

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.

Jan Janak authored on 08/03/2009 21:46:07
Showing 2 changed files
... ...
@@ -1129,6 +1129,24 @@ error:
1129 1129
 }
1130 1130
 
1131 1131
 
1132
+int destroy_avps(avp_flags_t flags, avp_name_t name, int all)
1133
+{
1134
+	struct search_state st;
1135
+	avp_t* avp;
1136
+	int n;
1137
+	
1138
+	n = 0;
1139
+	avp = search_first_avp(flags, name, 0, &st);
1140
+	while (avp) {
1141
+		destroy_avp(avp);
1142
+		n++;
1143
+		if (!all) break;
1144
+		avp = search_next_avp(&st, 0);
1145
+	}
1146
+	return n;
1147
+}
1148
+
1149
+
1132 1150
 void delete_avp(avp_flags_t flags, avp_name_t name)
1133 1151
 {
1134 1152
 	struct search_state st;
... ...
@@ -169,6 +169,8 @@ int add_avp_list(avp_list_t* list, avp_flags_t flags, avp_name_t name, avp_value
169 169
 /* Delete avps with given type and name */
170 170
 void delete_avp(avp_flags_t flags, avp_name_t name);
171 171
 
172
+int destroy_avps(avp_flags_t flags, avp_name_t name, int all);
173
+
172 174
 /* search functions */
173 175
 avp_t *search_first_avp( avp_flags_t flags, avp_name_t name,
174 176
 			 avp_value_t *val, struct search_state* state);