Browse Source

drouting: replace STR_PARAM with PARAM_STRING

Alekzander Spiridonov 11 years ago
parent
commit
4faa262958
1 changed files with 15 additions and 28 deletions
  1. 15 28
      modules/drouting/drouting.c

+ 15 - 28
modules/drouting/drouting.c

@@ -155,17 +155,17 @@ static cmd_export_t cmds[] = {
  * Exported parameters
  * Exported parameters
  */
  */
 static param_export_t params[] = {
 static param_export_t params[] = {
-	{"db_url",          STR_PARAM, &db_url.s        },
-	{"drd_table",       STR_PARAM, &drd_table.s     },
-	{"drr_table",       STR_PARAM, &drr_table.s     },
-	{"drg_table",       STR_PARAM, &drg_table.s     },
-	{"drl_table",       STR_PARAM, &drl_table.s     },
+	{"db_url",          PARAM_STR, &db_url        },
+	{"drd_table",       PARAM_STR, &drd_table     },
+	{"drr_table",       PARAM_STR, &drr_table     },
+	{"drg_table",       PARAM_STR, &drg_table     },
+	{"drl_table",       PARAM_STR, &drl_table     },
 	{"use_domain",      INT_PARAM, &use_domain      },
 	{"use_domain",      INT_PARAM, &use_domain      },
-	{"drg_user_col",    STR_PARAM, &drg_user_col.s  },
-	{"drg_domain_col",  STR_PARAM, &drg_domain_col.s},
-	{"drg_grpid_col",   STR_PARAM, &drg_grpid_col.s },
-	{"ruri_avp",        STR_PARAM, &ruri_avp_spec.s },
-	{"attrs_avp",       STR_PARAM, &attrs_avp_spec.s},
+	{"drg_user_col",    PARAM_STR, &drg_user_col  },
+	{"drg_domain_col",  PARAM_STR, &drg_domain_col},
+	{"drg_grpid_col",   PARAM_STR, &drg_grpid_col },
+	{"ruri_avp",        PARAM_STR, &ruri_avp_spec },
+	{"attrs_avp",       PARAM_STR, &attrs_avp_spec},
 	{"sort_order",      INT_PARAM, &sort_order      },
 	{"sort_order",      INT_PARAM, &sort_order      },
 	{"fetch_rows",      INT_PARAM, &dr_fetch_rows   },
 	{"fetch_rows",      INT_PARAM, &dr_fetch_rows   },
 	{"force_dns",       INT_PARAM, &dr_force_dns    },
 	{"force_dns",       INT_PARAM, &dr_force_dns    },
@@ -263,44 +263,33 @@ static int dr_init(void)
 	}
 	}
 
 
 	/* check the module params */
 	/* check the module params */
-	if (db_url.s==NULL || db_url.s[0]==0) {
+	if (db_url.s==NULL || db_url.len<=0) {
 		LM_CRIT("mandatory parameter \"DB_URL\" found empty\n");
 		LM_CRIT("mandatory parameter \"DB_URL\" found empty\n");
 		goto error;
 		goto error;
 	}
 	}
-	db_url.len = strlen(db_url.s);
 
 
-	drd_table.len = strlen(drd_table.s);
-	if (drd_table.s[0]==0) {
+	if (drd_table.len<=0) {
 		LM_CRIT("mandatory parameter \"DRD_TABLE\" found empty\n");
 		LM_CRIT("mandatory parameter \"DRD_TABLE\" found empty\n");
 		goto error;
 		goto error;
 	}
 	}
 
 
-	drr_table.len = strlen(drr_table.s);
-	if (drr_table.s[0]==0) {
+	if (drr_table.len<=0) {
 		LM_CRIT("mandatory parameter \"DRR_TABLE\" found empty\n");
 		LM_CRIT("mandatory parameter \"DRR_TABLE\" found empty\n");
 		goto error;
 		goto error;
 	}
 	}
 
 
-	drg_table.len = strlen(drg_table.s);
-	if (drg_table.s[0]==0) {
+	if (drg_table.len<=0) {
 		LM_CRIT("mandatory parameter \"DRG_TABLE\"  found empty\n");
 		LM_CRIT("mandatory parameter \"DRG_TABLE\"  found empty\n");
 		goto error;
 		goto error;
 	}
 	}
 
 
-	drl_table.len = strlen(drl_table.s);
-	if (drl_table.s[0]==0) {
+	if (drl_table.len<=0) {
 		LM_CRIT("mandatory parameter \"DRL_TABLE\"  found empty\n");
 		LM_CRIT("mandatory parameter \"DRL_TABLE\"  found empty\n");
 		goto error;
 		goto error;
 	}
 	}
 
 
-	drg_user_col.len = strlen(drg_user_col.s);
-	drg_domain_col.len = strlen(drg_domain_col.s);
-	drg_grpid_col.len = strlen(drg_grpid_col.s);
-
 	/* fix AVP spec */
 	/* fix AVP spec */
 	if (ruri_avp_spec.s) {
 	if (ruri_avp_spec.s) {
-		ruri_avp_spec.len = strlen(ruri_avp_spec.s);
-
 		if (pv_parse_spec( &ruri_avp_spec, &avp_spec)==0
 		if (pv_parse_spec( &ruri_avp_spec, &avp_spec)==0
 		|| avp_spec.type!=PVT_AVP) {
 		|| avp_spec.type!=PVT_AVP) {
 			LM_ERR("malformed or non AVP [%.*s] for RURI AVP definition\n",
 			LM_ERR("malformed or non AVP [%.*s] for RURI AVP definition\n",
@@ -316,8 +305,6 @@ static int dr_init(void)
 		}
 		}
 	}
 	}
 	if (attrs_avp_spec.s) {
 	if (attrs_avp_spec.s) {
-		attrs_avp_spec.len = strlen(attrs_avp_spec.s);
-
 		if (pv_parse_spec( &attrs_avp_spec, &avp_spec)==0
 		if (pv_parse_spec( &attrs_avp_spec, &avp_spec)==0
 		|| avp_spec.type!=PVT_AVP) {
 		|| avp_spec.type!=PVT_AVP) {
 			LM_ERR("malformed or non AVP [%.*s] for ATTRS AVP definition\n",
 			LM_ERR("malformed or non AVP [%.*s] for ATTRS AVP definition\n",