Prechádzať zdrojové kódy

New texops function added: remove_hf_re("regexp") to filter message headers out
by matching the header name field against a regular expression.

Closes SER-340.

Bogdan Pintea 17 rokov pred
rodič
commit
44c6540472
3 zmenil súbory, kde vykonal 28 pridanie a 0 odobranie
  1. 4 0
      NEWS
  2. 18 0
      sr_module.c
  3. 6 0
      sr_module.h

+ 4 - 0
NEWS

@@ -8,6 +8,10 @@ $Id$
 2.1.0 changes
 
 modules:
+ - textops   - functions:
+                        - remove_hf_re("regexp") -- filter message headers out
+                          by matching the header name field against a regular
+                          expression.
  - avp       - export new selects table to allow dissecting the content of an
                attribute by interpreting it as a "name-addr" value 
  - auth      - added extra authentication checks support, to protect

+ 18 - 0
sr_module.c

@@ -1088,3 +1088,21 @@ int get_int_fparam(int* dst, struct sip_msg* msg, fparam_t* param)
 
     return 0;
 }
+
+/**
+ * Retrieve the compiled RegExp.
+ * @return: 0 for success, negative on error.
+ */
+int get_regex_fparam(regex_t *dst, struct sip_msg* msg, fparam_t* param)
+{
+	switch (param->type) {
+		case FPARAM_REGEX:
+			*dst = *param->v.regex;
+			return 0;
+
+		default:
+			ERR("unexpected parameter type (%d), instead of regexp.\n", 
+					param->type);
+	}
+	return -1;
+}

+ 6 - 0
sr_module.h

@@ -323,4 +323,10 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param);
  */
 int get_int_fparam(int* dst, struct sip_msg* msg, fparam_t* param);
 
+
+/**
+ * Retrieve the compiled RegExp.
+ * @return: 0 for success, negative on error.
+ */
+int get_regex_fparam(regex_t *dst, struct sip_msg* msg, fparam_t* param);
 #endif /* sr_module_h */