| 309 | extern struct custom_rule_table *custom_rule_tables; |
| 310 | |
| 311 | rt_data_t* dr_load_routing_info(struct head_db *part, |
| 312 | int persistent_state, str *rules_tables, int rules_tables_no,MD5_CTX* hash_ctx) |
| 313 | { |
| 314 | int int_vals[5]; |
| 315 | char * str_vals[7]; |
| 316 | str tmp; |
| 317 | db_func_t *dr_dbf = &part->db_funcs; |
| 318 | db_con_t* db_hdl = *part->db_con; |
| 319 | str *drd_table = &part->drd_table; |
| 320 | str *drc_table = &part->drc_table; |
| 321 | db_key_t columns[10]; |
| 322 | db_res_t* res; |
| 323 | db_row_t* row; |
| 324 | rt_info_t *ri; |
| 325 | rt_data_t *rdata; |
| 326 | tmrec_expr *time_rec; |
| 327 | int i, j, n; |
| 328 | int loaded_gw = 0, loaded_cr = 0, loaded_rl = 0; |
| 329 | int discarded_gw = 0, discarded_cr = 0, discarded_rl = 0; |
| 330 | int no_rows = 10; |
| 331 | int db_cols; |
| 332 | const struct socket_info *sock; |
| 333 | str s_sock, host; |
| 334 | int proto, port; |
| 335 | char id_buf[INT2STR_MAX_LEN]; |
| 336 | |
| 337 | res = 0; |
| 338 | ri = 0; |
| 339 | rdata = 0; |
| 340 | |
| 341 | sr_add_report( dr_srg, STR2CI(part->partition), |
| 342 | CHAR_INT("starting DB data loading"), 0 /*is_public*/); |
| 343 | |
| 344 | /* init new data structure */ |
| 345 | if ( (rdata=build_rt_data(part))==0 ) { |
| 346 | LM_ERR("failed to build rdata\n"); |
| 347 | goto error; |
| 348 | } |
| 349 | |
| 350 | /* read the destinations */ |
| 351 | if (dr_dbf->use_table( db_hdl, drd_table) < 0) { |
| 352 | LM_ERR("cannot select table \"%.*s\"\n", drd_table->len,drd_table->s); |
| 353 | goto error; |
| 354 | } |
| 355 | |
| 356 | columns[0] = &id_drd_col; |
| 357 | columns[1] = &gwid_drd_col; |
| 358 | columns[2] = &address_drd_col; |
| 359 | columns[3] = &strip_drd_col; |
| 360 | columns[4] = &prefix_drd_col; |
| 361 | columns[5] = &type_drd_col; |
| 362 | columns[6] = &attrs_drd_col; |
| 363 | columns[7] = &probe_drd_col; |
| 364 | columns[8] = &sock_drd_col; |
| 365 | if (persistent_state) { |
| 366 | columns[9] = &state_drd_col; |
| 367 | db_cols = 10; |
| 368 | } else { |
no test coverage detected