Browse code

carrierroute: replace STR_PARAM with PARAM_STR

Alekzander Spiridonov authored on 28/07/2014 13:26:19
Showing 3 changed files
... ...
@@ -108,13 +108,13 @@ static param_export_t params[]= {
108 108
 	carrierfailureroute_DB_COLS
109 109
 	carrier_name_DB_COLS
110 110
 	domain_name_DB_COLS
111
-	{"subscriber_table",       STR_PARAM, &subscriber_table.s },
112
-	{"subscriber_user_col",    STR_PARAM, &subscriber_username_col.s },
113
-	{"subscriber_domain_col",  STR_PARAM, &subscriber_domain_col.s },
114
-	{"subscriber_carrier_col", STR_PARAM, &cr_preferred_carrier_col.s },
115
-	{"config_source",          STR_PARAM, &config_source },
116
-	{"default_tree",           STR_PARAM, &default_tree.s },
117
-	{"config_file",            STR_PARAM, &config_file },
111
+	{"subscriber_table",       PARAM_STR, &subscriber_table },
112
+	{"subscriber_user_col",    PARAM_STR, &subscriber_username_col },
113
+	{"subscriber_domain_col",  PARAM_STR, &subscriber_domain_col },
114
+	{"subscriber_carrier_col", PARAM_STR, &cr_preferred_carrier_col },
115
+	{"config_source",          PARAM_STRING, &config_source },
116
+	{"default_tree",           PARAM_STR, &default_tree },
117
+	{"config_file",            PARAM_STRING, &config_file },
118 118
 	{"use_domain",             INT_PARAM, &default_carrierroute_cfg.use_domain },
119 119
 	{"fallback_default",       INT_PARAM, &default_carrierroute_cfg.fallback_default },
120 120
 	{"fetch_rows",             INT_PARAM, &default_carrierroute_cfg.fetch_rows },
... ...
@@ -175,14 +175,6 @@ static int mod_init(void) {
175 175
 		return -1;
176 176
 	}
177 177
 
178
-	subscriber_table.len = strlen(subscriber_table.s);
179
-	subscriber_username_col.len = strlen(subscriber_username_col.s);
180
-	subscriber_domain_col.len = strlen(subscriber_domain_col.s);
181
-	cr_preferred_carrier_col.len = strlen(cr_preferred_carrier_col.s);
182
-	default_tree.len = strlen(default_tree.s);
183
-
184
-	carrierroute_db_vars();
185
-
186 178
 	if (cr_match_mode != 10 && cr_match_mode != 128) {
187 179
 		LM_ERR("invalid matching mode %d specific, please use 10 or 128\n", cr_match_mode);
188 180
 		return -1;
... ...
@@ -144,42 +144,3 @@ int carrierroute_db_open(void) {
144 144
 	return 0;
145 145
 }
146 146
 
147
-
148
-/*!
149
- * Update the variable length after eventual assignments from the config script.
150
- * This is necessary because we're using the 'str' type.
151
- */
152
-void carrierroute_db_vars(void) {
153
-	if (carrierroute_db_url.s) carrierroute_db_url.len = strlen(carrierroute_db_url.s);
154
-	carrierroute_table.len = strlen(carrierroute_table.s);
155
-	carrierroute_id_col.len = strlen(carrierroute_id_col.s);
156
-	carrierroute_carrier_col.len = strlen(carrierroute_carrier_col.s);
157
-	carrierroute_domain_col.len = strlen(carrierroute_domain_col.s);
158
-	carrierroute_scan_prefix_col.len = strlen(carrierroute_scan_prefix_col.s);
159
-	carrierroute_flags_col.len = strlen(carrierroute_flags_col.s);
160
-	carrierroute_mask_col.len = strlen(carrierroute_mask_col.s);
161
-	carrierroute_prob_col.len = strlen(carrierroute_prob_col.s);
162
-	carrierroute_strip_col.len = strlen(carrierroute_strip_col.s);
163
-	carrierroute_rewrite_host_col.len = strlen(carrierroute_rewrite_host_col.s);
164
-	carrierroute_rewrite_prefix_col.len = strlen(carrierroute_rewrite_prefix_col.s);
165
-	carrierroute_rewrite_suffix_col.len = strlen(carrierroute_rewrite_suffix_col.s);
166
-	carrierroute_description_col.len = strlen(carrierroute_description_col.s);
167
-	carrierfailureroute_table.len = strlen(carrierfailureroute_table.s);
168
-	carrierfailureroute_id_col.len = strlen(carrierfailureroute_id_col.s);
169
-	carrierfailureroute_carrier_col.len = strlen(carrierfailureroute_carrier_col.s);
170
-	carrierfailureroute_domain_col.len = strlen(carrierfailureroute_domain_col.s);
171
-	carrierfailureroute_scan_prefix_col.len = strlen(carrierfailureroute_scan_prefix_col.s);
172
-	carrierfailureroute_host_name_col.len = strlen(carrierfailureroute_host_name_col.s);
173
-	carrierfailureroute_reply_code_col.len = strlen(carrierfailureroute_reply_code_col.s);
174
-	carrierfailureroute_flags_col.len = strlen(carrierfailureroute_flags_col.s);
175
-	carrierfailureroute_mask_col.len = strlen(carrierfailureroute_mask_col.s);
176
-	carrierfailureroute_next_domain_col.len = strlen(carrierfailureroute_next_domain_col.s);
177
-	carrierfailureroute_description_col.len = strlen(carrierfailureroute_description_col.s);
178
-	carrier_name_table.len = strlen(carrier_name_table.s);
179
-	carrier_name_id_col.len = strlen(carrier_name_id_col.s);
180
-	carrier_name_carrier_col.len = strlen(carrier_name_carrier_col.s);
181
-	domain_name_table.len = strlen(domain_name_table.s);
182
-	domain_name_id_col.len = strlen(domain_name_id_col.s);
183
-	domain_name_domain_col.len = strlen(domain_name_domain_col.s);
184
-}
185
-
... ...
@@ -35,9 +35,9 @@ extern str carrierroute_db_url;
35 35
 extern db1_con_t * carrierroute_dbh;
36 36
 extern db_func_t carrierroute_dbf;
37 37
 
38
-#define carrierroute_DB_URL { "db_url", STR_PARAM, &carrierroute_db_url.s },
38
+#define carrierroute_DB_URL { "db_url", PARAM_STR, &carrierroute_db_url },
39 39
 
40
-#define carrierroute_DB_TABLE { "carrierroute_table", STR_PARAM, &carrierroute_table.s },
40
+#define carrierroute_DB_TABLE { "carrierroute_table", PARAM_STR, &carrierroute_table },
41 41
 
42 42
 extern str carrierroute_table;
43 43
 
... ...
@@ -55,23 +55,23 @@ extern str carrierroute_rewrite_prefix_col;
55 55
 extern str carrierroute_rewrite_suffix_col;
56 56
 extern str carrierroute_description_col;
57 57
 #define carrierroute_DB_COLS \
58
-{ "carrierroute_id_col", STR_PARAM, &carrierroute_id_col.s }, \
59
-{ "carrierroute_carrier_col", STR_PARAM, &carrierroute_carrier_col.s }, \
60
-{ "carrierroute_domain_col", STR_PARAM, &carrierroute_domain_col.s }, \
61
-{ "carrierroute_scan_prefix_col", STR_PARAM, &carrierroute_scan_prefix_col.s }, \
62
-{ "carrierroute_flags_col", STR_PARAM, &carrierroute_flags_col.s }, \
63
-{ "carrierroute_mask_col", STR_PARAM, &carrierroute_mask_col.s }, \
64
-{ "carrierroute_prob_col", STR_PARAM, &carrierroute_prob_col.s }, \
65
-{ "carrierroute_strip_col", STR_PARAM, &carrierroute_strip_col.s }, \
66
-{ "carrierroute_rewrite_host_col", STR_PARAM, &carrierroute_rewrite_host_col.s }, \
67
-{ "carrierroute_rewrite_prefix_col", STR_PARAM, &carrierroute_rewrite_prefix_col.s }, \
68
-{ "carrierroute_rewrite_suffix_col", STR_PARAM, &carrierroute_rewrite_suffix_col.s }, \
69
-{ "carrierroute_description_col", STR_PARAM, &carrierroute_description_col.s }, \
58
+{ "carrierroute_id_col", PARAM_STR, &carrierroute_id_col }, \
59
+{ "carrierroute_carrier_col", PARAM_STR, &carrierroute_carrier_col }, \
60
+{ "carrierroute_domain_col", PARAM_STR, &carrierroute_domain_col }, \
61
+{ "carrierroute_scan_prefix_col", PARAM_STR, &carrierroute_scan_prefix_col }, \
62
+{ "carrierroute_flags_col", PARAM_STR, &carrierroute_flags_col }, \
63
+{ "carrierroute_mask_col", PARAM_STR, &carrierroute_mask_col }, \
64
+{ "carrierroute_prob_col", PARAM_STR, &carrierroute_prob_col }, \
65
+{ "carrierroute_strip_col", PARAM_STR, &carrierroute_strip_col }, \
66
+{ "carrierroute_rewrite_host_col", PARAM_STR, &carrierroute_rewrite_host_col }, \
67
+{ "carrierroute_rewrite_prefix_col", PARAM_STR, &carrierroute_rewrite_prefix_col }, \
68
+{ "carrierroute_rewrite_suffix_col", PARAM_STR, &carrierroute_rewrite_suffix_col }, \
69
+{ "carrierroute_description_col", PARAM_STR, &carrierroute_description_col }, \
70 70
 
71 71
 /* table version */
72 72
 extern const unsigned int carrierroute_version;
73 73
 
74
-#define carrierfailureroute_DB_TABLE { "carrierfailureroute_table", STR_PARAM, &carrierfailureroute_table.s },
74
+#define carrierfailureroute_DB_TABLE { "carrierfailureroute_table", PARAM_STR, &carrierfailureroute_table },
75 75
 
76 76
 extern str carrierfailureroute_table;
77 77
 
... ...
@@ -87,21 +87,21 @@ extern str carrierfailureroute_mask_col;
87 87
 extern str carrierfailureroute_next_domain_col;
88 88
 extern str carrierfailureroute_description_col;
89 89
 #define carrierfailureroute_DB_COLS \
90
-{ "carrierfailureroute_id_col", STR_PARAM, &carrierfailureroute_id_col.s }, \
91
-{ "carrierfailureroute_carrier_col", STR_PARAM, &carrierfailureroute_carrier_col.s }, \
92
-{ "carrierfailureroute_domain_col", STR_PARAM, &carrierfailureroute_domain_col.s }, \
93
-{ "carrierfailureroute_scan_prefix_col", STR_PARAM, &carrierfailureroute_scan_prefix_col.s }, \
94
-{ "carrierfailureroute_host_name_col", STR_PARAM, &carrierfailureroute_host_name_col.s }, \
95
-{ "carrierfailureroute_reply_code_col", STR_PARAM, &carrierfailureroute_reply_code_col.s }, \
96
-{ "carrierfailureroute_flags_col", STR_PARAM, &carrierfailureroute_flags_col.s }, \
97
-{ "carrierfailureroute_mask_col", STR_PARAM, &carrierfailureroute_mask_col.s }, \
98
-{ "carrierfailureroute_next_domain_col", STR_PARAM, &carrierfailureroute_next_domain_col.s }, \
99
-{ "carrierfailureroute_description_col", STR_PARAM, &carrierfailureroute_description_col.s }, \
90
+{ "carrierfailureroute_id_col", PARAM_STR, &carrierfailureroute_id_col }, \
91
+{ "carrierfailureroute_carrier_col", PARAM_STR, &carrierfailureroute_carrier_col }, \
92
+{ "carrierfailureroute_domain_col", PARAM_STR, &carrierfailureroute_domain_col }, \
93
+{ "carrierfailureroute_scan_prefix_col", PARAM_STR, &carrierfailureroute_scan_prefix_col }, \
94
+{ "carrierfailureroute_host_name_col", PARAM_STR, &carrierfailureroute_host_name_col }, \
95
+{ "carrierfailureroute_reply_code_col", PARAM_STR, &carrierfailureroute_reply_code_col }, \
96
+{ "carrierfailureroute_flags_col", PARAM_STR, &carrierfailureroute_flags_col }, \
97
+{ "carrierfailureroute_mask_col", PARAM_STR, &carrierfailureroute_mask_col }, \
98
+{ "carrierfailureroute_next_domain_col", PARAM_STR, &carrierfailureroute_next_domain_col }, \
99
+{ "carrierfailureroute_description_col", PARAM_STR, &carrierfailureroute_description_col }, \
100 100
 
101 101
 /* table version */
102 102
 extern const unsigned int carrierfailureroute_version;
103 103
 
104
-#define carrier_name_DB_TABLE { "carrier_name_table", STR_PARAM, &carrier_name_table.s },
104
+#define carrier_name_DB_TABLE { "carrier_name_table", PARAM_STR, &carrier_name_table },
105 105
 
106 106
 extern str carrier_name_table;
107 107
 
... ...
@@ -109,13 +109,13 @@ extern str carrier_name_table;
109 109
 extern str carrier_name_id_col;
110 110
 extern str carrier_name_carrier_col;
111 111
 #define carrier_name_DB_COLS \
112
-{ "carrier_name_id_col", STR_PARAM, &carrier_name_id_col.s }, \
113
-{ "carrier_name_carrier_col", STR_PARAM, &carrier_name_carrier_col.s }, \
112
+{ "carrier_name_id_col", PARAM_STR, &carrier_name_id_col }, \
113
+{ "carrier_name_carrier_col", PARAM_STR, &carrier_name_carrier_col }, \
114 114
 
115 115
 /* table version */
116 116
 extern const unsigned int carrier_name_version;
117 117
 
118
-#define domain_name_DB_TABLE { "domain_name_table", STR_PARAM, &domain_name_table.s },
118
+#define domain_name_DB_TABLE { "domain_name_table", PARAM_STR, &domain_name_table },
119 119
 
120 120
 extern str domain_name_table;
121 121
 
... ...
@@ -123,8 +123,8 @@ extern str domain_name_table;
123 123
 extern str domain_name_id_col;
124 124
 extern str domain_name_domain_col;
125 125
 #define domain_name_DB_COLS \
126
-{ "domain_name_id_col", STR_PARAM, &domain_name_id_col.s }, \
127
-{ "domain_name_domain_col", STR_PARAM, &domain_name_domain_col.s }, \
126
+{ "domain_name_id_col", PARAM_STR, &domain_name_id_col }, \
127
+{ "domain_name_domain_col", PARAM_STR, &domain_name_domain_col }, \
128 128
 
129 129
 /* table version */
130 130
 extern const unsigned int domain_name_version;
... ...
@@ -152,10 +152,4 @@ int carrierroute_db_init(void);
152 152
  */
153 153
 int carrierroute_db_open(void);
154 154
 
155
-/*!
156
- * Update the variable length after eventual assignments from the config script.
157
- * This is necessary because we're using the 'str' type.
158
- */
159
-void carrierroute_db_vars(void);
160
-
161 155
 #endif