Browse code

- clean-up of common fixup functions

Jan Janak authored on 18/07/2006 11:54:44
Showing 2 changed files
... ...
@@ -45,6 +45,7 @@
45 45
 #include "mem/mem.h"
46 46
 #include "core_cmd.h"
47 47
 #include "ut.h"
48
+#include "re.h"
48 49
 #include "route_struct.h"
49 50
 #include "flags.h"
50 51
 #include "trim.h"
... ...
@@ -535,124 +536,6 @@ int init_modules(void)
535 535
 #endif
536 536
 
537 537
 
538
-/*
539
- * Common fixup functions shared across modules
540
- */
541
-
542
-int fixup_str_12(void** param, int param_no)
543
-{
544
-	str* s;
545
-
546
-	s = (str*)pkg_malloc(sizeof(str));
547
-	if (!s) {
548
-		LOG(L_ERR, "fixup_str_12: No memory left\n");
549
-		return E_UNSPEC;
550
-	}
551
-
552
-	s->s = (char*)*param;
553
-	s->len = strlen(s->s);
554
-	*param = (void*)s;
555
-	return 0;
556
-}
557
-
558
-
559
-int fixup_str_1(void** param, int param_no)
560
-{
561
-	if (param_no == 1) {
562
-		return fixup_str_12(param, param_no);
563
-	}
564
-
565
-	return 0;
566
-}
567
-
568
-
569
-int fixup_str_2(void** param, int param_no)
570
-{
571
-	if (param_no == 2) {
572
-		return fixup_str_12(param, param_no);
573
-	}
574
-
575
-	return 0;
576
-}
577
-
578
-
579
-int fixup_int_12(void** param, int param_no)
580
-{
581
-	unsigned long num;
582
-	int err;
583
-
584
-	num = str2s(*param, strlen(*param), &err);
585
-
586
-	if (err == 0) {
587
-		pkg_free(*param);
588
-		*param=(void*)num;
589
-	} else {
590
-		LOG(L_ERR, "fixup_int_12: Bad number <%s>\n",
591
-		    (char*)(*param));
592
-		return E_UNSPEC;
593
-	}
594
-
595
-	return 0;
596
-}
597
-
598
-
599
-int fixup_int_1(void** param, int param_no)
600
-{
601
-	if (param_no == 1) {
602
-		return fixup_int_12(param, param_no);
603
-	}
604
-
605
-	return 0;
606
-}
607
-
608
-
609
-int fixup_int_2(void** param, int param_no)
610
-{
611
-	if (param_no == 2) {
612
-		return fixup_int_12(param, param_no);
613
-	}
614
-
615
-	return 0;
616
-}
617
-
618
-
619
-int fixup_regex_12(void** param, int param_no)
620
-{
621
-	regex_t* re;
622
-
623
-	if ((re=pkg_malloc(sizeof(regex_t)))==0) return E_OUT_OF_MEM;
624
-	if (regcomp(re, *param, REG_EXTENDED|REG_ICASE|REG_NEWLINE) ){
625
-		pkg_free(re);
626
-		LOG(L_ERR, "ERROR: fixup_regex_12: Bad regular expression '%s'\n", (char*)*param);
627
-		return E_BAD_RE;
628
-	}
629
-	/* free string */
630
-	pkg_free(*param);
631
-	/* replace it with the compiled re */
632
-	*param=re;
633
-	return 0;
634
-}
635
-
636
-
637
-int fixup_regex_1(void** param, int param_no)
638
-{
639
-	if (param_no == 1) {
640
-		return fixup_regex_12(param, param_no);
641
-	}
642
-
643
-	return 0;
644
-}
645
-
646
-
647
-int fixup_regex_2(void** param, int param_no)
648
-{
649
-	if (param_no == 2) {
650
-		return fixup_regex_12(param, param_no);
651
-	}
652
-
653
-	return 0;
654
-}
655
-
656 538
 action_u_t *fixup_get_param(void **cur_param, int cur_param_no, int required_param_no) {
657 539
 	action_u_t *a, a2;
658 540
         /* cur_param points to a->u.string, get pointer to a */
... ...
@@ -724,6 +607,9 @@ int fix_flag( modparam_t type, void* val,
724 724
 	return 0;
725 725
 }
726 726
 
727
+/*
728
+ * Common function parameter fixups
729
+ */
727 730
 
728 731
 /*
729 732
  * Generic parameter fixup function which creates
... ...
@@ -732,105 +618,264 @@ int fix_flag( modparam_t type, void* val,
732 732
  */
733 733
 int fix_param(int type, void** param)
734 734
 {	
735
-	fparam_t* p;
736
-	str name;
737
-	unsigned long num;
738
-	int err;
735
+    fparam_t* p;
736
+    str name, s;
737
+    unsigned long num;
738
+    int err;
739
+    
740
+    p = (fparam_t*)pkg_malloc(sizeof(fparam_t));
741
+    if (!p) {
742
+	ERR("No memory left\n");
743
+	return E_OUT_OF_MEM;
744
+    }
745
+    memset(p, 0, sizeof(fparam_t));
746
+    p->orig = *param;
747
+    
748
+    switch(type) {
749
+    case FPARAM_UNSPEC:
750
+	ERR("Invalid type value\n");
751
+	goto error;
752
+	
753
+    case FPARAM_STRING:
754
+	p->v.asciiz = *param;
755
+	break;
756
+	
757
+    case FPARAM_STR:
758
+	p->v.str.s = (char*)*param;
759
+	p->v.str.len = strlen(p->v.str.s);
760
+	break;
761
+	
762
+    case FPARAM_INT:
763
+	num = str2s(*param, strlen(*param), &err);
764
+	if (err == 0) {
765
+	    p->v.i = num;
766
+	} else {
767
+		 /* Not a number */
768
+	    pkg_free(p);
769
+	    return 1;
770
+	}
771
+	break;
772
+	
773
+    case FPARAM_REGEX:
774
+	if ((p->v.regex = pkg_malloc(sizeof(regex_t))) == 0) {
775
+	    ERR("No memory left\n");
776
+	    goto error;
777
+	}
778
+	if (regcomp(p->v.regex, *param, REG_EXTENDED|REG_ICASE|REG_NEWLINE)) {
779
+	    pkg_free(p->v.regex);
780
+	    ERR("Bad regular expression '%s'\n", (char*)*param);
781
+	    goto error;
782
+	}
783
+	break;
784
+	
785
+    case FPARAM_AVP:
786
+	name.s = (char*)*param;
787
+	name.len = strlen(name.s);
788
+	trim(&name);
789
+	if (!name.len || name.s[0] != '$') {
790
+		 /* Not an AVP identifier */
791
+	    pkg_free(p);
792
+	    return 1;
793
+	}
794
+	name.s++;
795
+	name.len--;
796
+	
797
+	if (parse_avp_ident(&name, &p->v.avp) < 0) {
798
+	    ERR("Error while parsing attribute name\n");
799
+	    goto error;
800
+	}
801
+	break;
802
+	
803
+    case FPARAM_SELECT:
804
+	name.s = (char*)*param;
805
+	name.len = strlen(name.s);
806
+	trim(&name);
807
+	if (!name.len || name.s[0] != '@') {
808
+		 /* Not a select identifier */
809
+	    pkg_free(p);
810
+	    return 1;
811
+	}
812
+	
813
+	if (parse_select(&name.s, &p->v.select) < 0) {
814
+	    ERR("Error while parsing select identifier\n");
815
+	    goto error;
816
+	}
817
+	break;
739 818
 
740
-	p = (fparam_t*)pkg_malloc(sizeof(fparam_t));
741
-	if (!p) {
742
-		ERR("fix_param: No memory left\n");
743
-		return E_OUT_OF_MEM;
819
+    case FPARAM_SUBST:
820
+	s.s = *param;
821
+	s.len = strlen(s.s);
822
+	p->v.subst = subst_parser(&s);
823
+	if (!p->v.subst) {
824
+	    ERR("Error while parsing regex substitution\n");
825
+	    return -1;
744 826
 	}
745
-	memset(p, 0, sizeof(fparam_t));
746
-	p->orig = *param;
827
+	break;
828
+    }
829
+    
830
+    p->type = type;
831
+    *param = (void*)p;
832
+    return 0;
833
+    
834
+ error:
835
+    pkg_free(p);
836
+    return E_UNSPEC;
837
+}
747 838
 
748
-	switch(type) {
749
-	case FPARAM_UNSPEC:
750
-		ERR("fix_param: Invalid type value\n");
751
-		goto error;
752 839
 
753
-	case FPARAM_STRING:
754
-		p->v.asciiz = *param;
755
-		break;
756
-
757
-	case FPARAM_STR:
758
-		p->v.str.s = (char*)*param;
759
-		p->v.str.len = strlen(p->v.str.s);
760
-		break;
761
-
762
-	case FPARAM_INT:
763
-		num = str2s(*param, strlen(*param), &err);
764
-		if (err == 0) {
765
-			p->v.i = num;
766
-		} else {
767
-			     /* Not a number */
768
-			pkg_free(p);
769
-			return 1;
770
-		}
771
-		break;
840
+/*
841
+ * Fixup variable string, the parameter can be
842
+ * AVP, SELECT, or ordinary string. AVP and select
843
+ * identifiers will be resolved to their values during
844
+ * runtime
845
+ *
846
+ * The parameter value will be converted to fparam structure
847
+ * This function returns -1 on an error
848
+ */
849
+int fixup_var_str_12(void** param, int param_no)
850
+{
851
+    int ret;
852
+    if ((ret = fix_param(FPARAM_AVP, param)) <= 0) return ret;
853
+    if ((ret = fix_param(FPARAM_SELECT, param)) <= 0) return ret;
854
+    if ((ret = fix_param(FPARAM_STR, param)) <= 0) return ret;
855
+    ERR("Error while fixing parameter, AVP, SELECT, and str conversions failed\n");
856
+    return -1;
857
+}
772 858
 
773
-	case FPARAM_REGEX:
774
-		if ((p->v.regex = pkg_malloc(sizeof(regex_t))) == 0) {
775
-			ERR("No memory left\n");
776
-			goto error;
777
-		}
778
-		if (regcomp(p->v.regex, *param, REG_EXTENDED|REG_ICASE|REG_NEWLINE)) {
779
-			pkg_free(p->v.regex);
780
-			ERR("Bad regular expression '%s'\n", (char*)*param);
781
-		        goto error;
782
-		}
783
-		break;
784
-
785
-	case FPARAM_AVP:
786
-		name.s = (char*)*param;
787
-		name.len = strlen(name.s);
788
-		trim(&name);
789
-		if (!name.len || name.s[0] != '$') {
790
-			     /* Not an AVP identifier */
791
-			pkg_free(p);
792
-			return 1;
793
-		}
794
-		name.s++;
795
-		name.len--;
796
-		
797
-		if (parse_avp_ident(&name, &p->v.avp) < 0) {
798
-			ERR("Error while parsing attribute name\n");
799
-			goto error;
800
-		}
801
-		break;
802
-
803
-	case FPARAM_SELECT:
804
-		name.s = (char*)*param;
805
-		name.len = strlen(name.s);
806
-		trim(&name);
807
-		if (!name.len || name.s[0] != '@') {
808
-			     /* Not a select identifier */
809
-			pkg_free(p);
810
-			return 1;
811
-		}
859
+/* Same as fixup_var_str_12 but applies to the 1st parameter only */
860
+int fixup_var_str_1(void** param, int param_no)
861
+{
862
+    if (param_no == 1) return fixup_var_str_12(param, param_no);
863
+    else return 0;
864
+}
812 865
 
813
-		if (parse_select(&name.s, &p->v.select) < 0) {
814
-			ERR("Error while parsing select identifier\n");
815
-			goto error;
816
-		}
817
-		break;
818
-	}
866
+/* Same as fixup_var_str_12 but applies to the 2nd parameter only */
867
+int fixup_var_str_2(void** param, int param_no)
868
+{
869
+    if (param_no == 2) return fixup_var_str_12(param, param_no);
870
+    else return 0;
871
+}
819 872
 
820
-	p->type = type;
821
-	*param = (void*)p;
822
-	return 0;
823 873
 
824
- error:
825
-	pkg_free(p);
826
-	return E_UNSPEC;
874
+/*
875
+ * Fixup variable integer, the parameter can be
876
+ * AVP, SELECT, or ordinary integer. AVP and select
877
+ * identifiers will be resolved to their values and 
878
+ * converted to int if necessary during runtime
879
+ *
880
+ * The parameter value will be converted to fparam structure
881
+ * This function returns -1 on an error
882
+ */
883
+int fixup_var_int_12(void** param, int param_no)
884
+{
885
+    int ret;
886
+    if ((ret = fix_param(FPARAM_AVP, param)) <= 0) return ret;
887
+    if ((ret = fix_param(FPARAM_SELECT, param)) <= 0) return ret;
888
+    if ((ret = fix_param(FPARAM_INT, param)) <= 0) return ret;
889
+    ERR("Error while fixing parameter, AVP, SELECT, and int conversions failed\n");
890
+    return -1;
891
+}
892
+
893
+/* Same as fixup_var_int_12 but applies to the 1st parameter only */
894
+int fixup_var_int_1(void** param, int param_no)
895
+{
896
+    if (param_no == 1) return fixup_var_int_12(param, param_no);
897
+    else return 0;
898
+}
899
+
900
+/* Same as fixup_var_int_12 but applies to the 2nd parameter only */
901
+int fixup_var_int_2(void** param, int param_no)
902
+{
903
+    if (param_no == 2) return fixup_var_int_12(param, param_no);
904
+    else return 0;
905
+}
906
+
907
+
908
+/*
909
+ * The parameter must be a regular expression which must compile, the
910
+ * parameter will be converted to compiled regex
911
+ */
912
+int fixup_regex_12(void** param, int param_no)
913
+{
914
+    int ret;
915
+
916
+    if ((ret = fix_param(FPARAM_REGEX, param)) <= 0) return ret;
917
+    ERR("Error while compiling regex in function parameter\n");
918
+    return -1;
919
+}
920
+
921
+/* Same as fixup_regex_12 but applies to the 1st parameter only */
922
+int fixup_regex_1(void** param, int param_no)
923
+{
924
+    if (param_no == 1) return fixup_regex_12(param, param_no);
925
+    else return 0;
926
+}
927
+
928
+/* Same as fixup_regex_12 but applies to the 2nd parameter only */
929
+int fixup_regex_2(void** param, int param_no)
930
+{
931
+    if (param_no == 2) return fixup_regex_12(param, param_no);
932
+    else return 0;
933
+}
934
+
935
+/*
936
+ * The string parameter will be converted to integer
937
+ */
938
+int fixup_int_12(void** param, int param_no)
939
+{
940
+    int ret;
941
+
942
+    if ((ret = fix_param(FPARAM_INT, param)) <= 0) return ret;
943
+    ERR("Cannot function parameter to integer\n");
944
+    return -1;
945
+
946
+}
947
+
948
+/* Same as fixup_int_12 but applies to the 1st parameter only */
949
+int fixup_int_1(void** param, int param_no)
950
+{
951
+    if (param_no == 1) return fixup_int_12(param, param_no);
952
+    else return 0;
953
+}
954
+
955
+/* Same as fixup_int_12 but applies to the 2nd parameter only */
956
+int fixup_int_2(void** param, int param_no)
957
+{
958
+    if (param_no == 2) return fixup_int_12(param, param_no);
959
+    else return 0;
960
+}
961
+
962
+/*
963
+ * Parse the parameter as static string, do not resolve
964
+ * AVPs or selects, convert the parameter to str structure
965
+ */
966
+int fixup_str_12(void** param, int param_no)
967
+{
968
+    int ret;
969
+
970
+    if ((ret = fix_param(FPARAM_STR, param)) <= 0) return ret;
971
+    ERR("Cannot function parameter to integer\n");
972
+    return -1;
973
+}
974
+
975
+/* Same as fixup_str_12 but applies to the 1st parameter only */
976
+int fixup_str_1(void** param, int param_no)
977
+{
978
+    if (param_no == 1) return fixup_str_12(param, param_no);
979
+    else return 0;
980
+}
981
+
982
+/* Same as fixup_str_12 but applies to the 2nd parameter only */
983
+int fixup_str_2(void** param, int param_no)
984
+{
985
+    if (param_no == 2) return fixup_str_12(param, param_no);
986
+    else return 0;
827 987
 }
828 988
 
829 989
 
830 990
 /*
831 991
  * Get the function parameter value as string
832 992
  * Return values:  0 - Success
833
- *                 1 - Incompatible type (i.e. int)
834 993
  *                -1 - Cannot get value
835 994
  */
836 995
 int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
... ...
@@ -840,10 +885,10 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
840 840
     avp_t* avp;
841 841
 
842 842
     switch(param->type) {
843
-    case FPARAM_INT:
844 843
     case FPARAM_REGEX:
845 844
     case FPARAM_UNSPEC:
846
-	return 1;
845
+    case FPARAM_INT:
846
+	return -1;
847 847
 
848 848
     case FPARAM_STRING:
849 849
 	dst->s = param->v.asciiz;
... ...
@@ -856,11 +901,17 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
856 856
 
857 857
     case FPARAM_AVP:
858 858
 	avp = search_first_avp(param->v.avp.flags, param->v.avp.name, &val, 0);
859
-	if (avp && avp->flags & AVP_VAL_STR) {
859
+	if (!avp) {
860
+	    DBG("Could not find AVP from function parameter '%s'\n", param->orig);
861
+	    return -1;
862
+	}
863
+	if (avp->flags & AVP_VAL_STR) {
860 864
 	    *dst = val.s;
861 865
 	} else {
862
-	    DBG("Value for AVP function parameter '%s' not found or is not string\n", param->orig);
863
-	    return -1;
866
+		 /* The caller does not know of what type the AVP will be so
867
+		  * convert int AVPs into string here
868
+		  */
869
+	    dst->s = int2str(val.n, &dst->len);
864 870
 	}
865 871
 	break;
866 872
 
... ...
@@ -873,3 +924,55 @@ int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param)
873 873
     return 0;
874 874
 }
875 875
 
876
+
877
+/*
878
+ * Get the function parameter value as integer
879
+ * Return values:  0 - Success
880
+ *                -1 - Cannot get value
881
+ */
882
+int get_int_fparam(int* dst, struct sip_msg* msg, fparam_t* param)
883
+{
884
+    int_str val;
885
+    int ret;
886
+    avp_t* avp;
887
+    str tmp;
888
+
889
+    switch(param->type) {
890
+    case FPARAM_INT:
891
+	*dst = param->v.i;
892
+	return 0;
893
+	
894
+    case FPARAM_REGEX:
895
+    case FPARAM_UNSPEC:
896
+    case FPARAM_STRING:
897
+    case FPARAM_STR:
898
+	return -1;
899
+	
900
+    case FPARAM_AVP:
901
+	avp = search_first_avp(param->v.avp.flags, param->v.avp.name, &val, 0);
902
+	if (!avp) {
903
+	    DBG("Could not find AVP from function parameter '%s'\n", param->orig);
904
+	    return -1;
905
+	}
906
+	if (avp->flags & AVP_VAL_STR) {
907
+	    if (str2int(&val.s, (unsigned int*)dst) < 0) {
908
+		ERR("Could not convert AVP string value to int\n");
909
+		return -1;
910
+	    }
911
+	} else {
912
+	    *dst = val.n;
913
+	}
914
+	break;
915
+
916
+    case FPARAM_SELECT:
917
+	ret = run_select(&tmp, param->v.select, msg);
918
+	if (ret < 0 || ret > 0) return -1;
919
+	if (str2int(&tmp, (unsigned int*)dst) < 0) {
920
+	    ERR("Could not convert select result to int\n");
921
+	    return -1;
922
+	}
923
+	break;
924
+    }
925
+
926
+    return 0;
927
+}
... ...
@@ -119,21 +119,23 @@ enum {
119 119
 	FPARAM_REGEX  = (1 << 3),
120 120
 	FPARAM_AVP    = (1 << 5),
121 121
 	FPARAM_SELECT = (1 << 6),
122
+	FPARAM_SUBST  = (1 << 7)
122 123
 };
123 124
 
124 125
 /*
125 126
  * Function parameter
126 127
  */
127 128
 typedef struct fparam {
128
-        char* orig;                /* The original value */
129
-        int type;                  /* Type of parameter */
129
+        char* orig;                       /* The original value */
130
+        int type;                         /* Type of parameter */
130 131
         union {
131
-		char* asciiz;      /* Zero terminated ASCII string */
132
-		struct _str str;   /* pointer/len string */
133
-		int i;             /* Integer value */
134
-		regex_t* regex;    /* Compiled regular expression */
135
-		avp_ident_t avp;   /* AVP identifier */
136
-	        select_t* select;  /* select structure */ 
132
+		char* asciiz;             /* Zero terminated ASCII string */
133
+		struct _str str;          /* pointer/len string */
134
+		int i;                    /* Integer value */
135
+		regex_t* regex;           /* Compiled regular expression */
136
+		avp_ident_t avp;          /* AVP identifier */
137
+	        select_t* select;         /* select structure */ 
138
+	        struct subst_expr* subst; /* Regex substitution */
137 139
 	} v;
138 140
 } fparam_t;
139 141
 
... ...
@@ -200,58 +202,106 @@ void* find_param_export(struct sr_module* mod, char* name, modparam_t type_mask,
200 200
  */
201 201
 
202 202
 
203
+/* API function to get other parameters from fixup */
204
+action_u_t *fixup_get_param(void **cur_param, int cur_param_no, int required_param_no);
205
+int fixup_get_param_count(void **cur_param, int cur_param_no);
206
+
207
+int fix_flag( modparam_t type, void* val,
208
+					char* mod_name, char* param_name, int* flag);
209
+
210
+
203 211
 /*
204
- * Common fixup functions shared across modules
212
+ * Common function parameter fixups
205 213
  */
206 214
 
207
-/* Convert both parameters from char* to str* */
208
-int fixup_str_12(void** param, int param_no);
215
+/*
216
+ * Generic parameter fixup function which creates
217
+ * fparam_t structure. type parameter contains allowed
218
+ * parameter types
219
+ */
220
+int fix_param(int type, void** param);
209 221
 
210
-/* Convert first parameter from char* to str* */
211
-int fixup_str_1(void** param, int param_no);
222
+/*
223
+ * Fixup variable string, the parameter can be
224
+ * AVP, SELECT, or ordinary string. AVP and select
225
+ * identifiers will be resolved to their values during
226
+ * runtime
227
+ *
228
+ * The parameter value will be converted to fparam structure
229
+ * This function returns -1 on an error
230
+ */
231
+int fixup_var_str_12(void** param, int param_no);
212 232
 
213
-/* Convert second parameter from char* to str* */
214
-int fixup_str_2(void** param, int param_no);
233
+/* Same as fixup_var_str_12 but applies to the 1st parameter only */
234
+int fixup_var_str_1(void** param, int param_no);
215 235
 
216
-/* Convert both parameters from char* to long */
217
-int fixup_int_12(void** param, int param_no);
236
+/* Same as fixup_var_str_12 but applies to the 2nd parameter only */
237
+int fixup_var_str_2(void** param, int param_no);
218 238
 
219
-/* Convert first parameter from char* to long */
220
-int fixup_int_1(void** param, int param_no);
239
+/*
240
+ * Fixup variable integer, the parameter can be
241
+ * AVP, SELECT, or ordinary integer. AVP and select
242
+ * identifiers will be resolved to their values and 
243
+ * converted to int if necessary during runtime
244
+ *
245
+ * The parameter value will be converted to fparam structure
246
+ * This function returns -1 on an error
247
+ */
248
+int fixup_var_int_12(void** param, int param_no);
221 249
 
222
-/* Convert second parameter from char* to long */
223
-int fixup_int_2(void** param, int param_no);
250
+/* Same as fixup_var_int_12 but applies to the 1st parameter only */
251
+int fixup_var_int_1(void** param, int param_no);
224 252
 
225
-/* Compile regular expressions in both parameters */
253
+/* Same as fixup_var_int_12 but applies to the 2nd parameter only */
254
+int fixup_var_int_2(void** param, int param_no);
255
+
256
+/*
257
+ * The parameter must be a regular expression which must compile, the
258
+ * parameter will be converted to compiled regex
259
+ */
226 260
 int fixup_regex_12(void** param, int param_no);
227 261
 
228
-/* Compile regular expression in first parameter */
262
+/* Same as fixup_regex_12 but applies to the 1st parameter only */
229 263
 int fixup_regex_1(void** param, int param_no);
230 264
 
231
-/* Compile regular expression in second parameter */
265
+/* Same as fixup_regex_12 but applies to the 2nd parameter only */
232 266
 int fixup_regex_2(void** param, int param_no);
233 267
 
234 268
 /*
235
- * Generic parameter fixup function which creates
236
- * fparam_t structure. type parameter contains allowed
237
- * parameter types
269
+ * The string parameter will be converted to integer
238 270
  */
239
-int fix_param(int type, void** param);
271
+int fixup_int_12(void** param, int param_no);
272
+
273
+/* Same as fixup_int_12 but applies to the 1st parameter only */
274
+int fixup_int_1(void** param, int param_no);
275
+
276
+/* Same as fixup_int_12 but applies to the 2nd parameter only */
277
+int fixup_int_2(void** param, int param_no);
278
+
279
+/*
280
+ * Parse the parameter as static string, do not resolve
281
+ * AVPs or selects, convert the parameter to str structure
282
+ */
283
+int fixup_str_12(void** param, int param_no);
284
+
285
+/* Same as fixup_str_12 but applies to the 1st parameter only */
286
+int fixup_str_1(void** param, int param_no);
287
+
288
+/* Same as fixup_str_12 but applies to the 2nd parameter only */
289
+int fixup_str_2(void** param, int param_no);
240 290
 
241 291
 /*
242 292
  * Get the function parameter value as string
243 293
  * Return values:  0 - Success
244
- *                 1 - Incompatible type (i.e. int)
245 294
  *                -1 - Cannot get value
246 295
  */
247 296
 int get_str_fparam(str* dst, struct sip_msg* msg, fparam_t* param);
248 297
 
249
-
250
-/* API function to get other parameters from fixup */
251
-action_u_t *fixup_get_param(void **cur_param, int cur_param_no, int required_param_no);
252
-int fixup_get_param_count(void **cur_param, int cur_param_no);
253
-
254
-int fix_flag( modparam_t type, void* val,
255
-					char* mod_name, char* param_name, int* flag);
298
+/*
299
+ * Get the function parameter value as integer
300
+ * Return values:  0 - Success
301
+ *                -1 - Cannot get value
302
+ */
303
+int get_int_fparam(int* dst, struct sip_msg* msg, fparam_t* param);
256 304
 
257 305
 #endif /* sr_module_h */