This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | dlr_entry |
| struct | dlr_storage |
| struct | dlr_db_fields |
Defines | |
| #define | DLR_P_H 1 |
| #define | DLR_TRACE 1 |
Functions | |
| dlr_entry * | dlr_entry_create (void) |
| void | dlr_entry_destroy (struct dlr_entry *dlr) |
| dlr_entry * | dlr_entry_duplicate (const struct dlr_entry *dlr) |
| dlr_db_fields * | dlr_db_fields_create (CfgGroup *grp) |
| void | dlr_db_fields_destroy (struct dlr_db_fields *fields) |
| dlr_storage * | dlr_init_mem (Cfg *cfg) |
| dlr_storage * | dlr_init_mysql (Cfg *cfg) |
| dlr_storage * | dlr_init_sdb (Cfg *cfg) |
| dlr_storage * | dlr_init_oracle (Cfg *cfg) |
| dlr_storage * | dlr_init_pgsql (Cfg *cfg) |
|
|
|
|
|
|
|
|
Definition at line 166 of file dlr.c. References cfg_get, gw_assert, octstr_imm(), and panic. Referenced by dlr_init_mysql(), and dlr_init_pgsql(). 00167 {
00168 struct dlr_db_fields *ret = NULL;
00169
00170 ret = gw_malloc(sizeof(*ret));
00171 gw_assert(ret != NULL);
00172 memset(ret, 0, sizeof(*ret));
00173
00174 if (!(ret->table = cfg_get(grp, octstr_imm("table"))))
00175 panic(0, "DLR: DB: directive 'table' is not specified!");
00176 if (!(ret->field_smsc = cfg_get(grp, octstr_imm("field-smsc"))))
00177 panic(0, "DLR: DB: directive 'field-smsc' is not specified!");
00178 if (!(ret->field_ts = cfg_get(grp, octstr_imm("field-timestamp"))))
00179 panic(0, "DLR: DB: directive 'field-timestamp' is not specified!");
00180 if (!(ret->field_src = cfg_get(grp, octstr_imm("field-source"))))
00181 panic(0, "DLR: DB: directive 'field-source' is not specified!");
00182 if (!(ret->field_dst = cfg_get(grp, octstr_imm("field-destination"))))
00183 panic(0, "DLR: DB: directive 'field-destination' is not specified!");
00184 if (!(ret->field_serv = cfg_get(grp, octstr_imm("field-service"))))
00185 panic(0, "DLR: DB: directive 'field-service' is not specified!");
00186 if (!(ret->field_url = cfg_get(grp, octstr_imm("field-url"))))
00187 panic(0, "DLR: DB: directive 'field-url' is not specified!");
00188 if (!(ret->field_mask = cfg_get(grp, octstr_imm("field-mask"))))
00189 panic(0, "DLR: DB: directive 'field-mask' is not specified!");
00190 if (!(ret->field_status = cfg_get(grp, octstr_imm("field-status"))))
00191 panic(0, "DLR: DB: directive 'field-status' is not specified!");
00192 if (!(ret->field_boxc = cfg_get(grp, octstr_imm("field-boxc-id"))))
00193 panic(0, "DLR: DB: directive 'field-boxc-id' is not specified!");
00194
00195 return ret;
00196 }
|
Here is the call graph for this function:

|
|
Definition at line 198 of file dlr.c. References dlr_db_fields::field_boxc, dlr_db_fields::field_dst, dlr_db_fields::field_mask, dlr_db_fields::field_serv, dlr_db_fields::field_smsc, dlr_db_fields::field_src, dlr_db_fields::field_status, dlr_db_fields::field_ts, dlr_db_fields::field_url, fields, O_DELETE, and dlr_db_fields::table. Referenced by dlr_mysql_shutdown(), and dlr_pgsql_shutdown(). 00199 {
00200 /* sanity check */
00201 if (fields == NULL)
00202 return;
00203
00204 #define O_DELETE(a) { if (a) octstr_destroy(a); a = NULL; }
00205
00206 O_DELETE(fields->table);
00207 O_DELETE(fields->field_smsc);
00208 O_DELETE(fields->field_ts);
00209 O_DELETE(fields->field_src);
00210 O_DELETE(fields->field_dst);
00211 O_DELETE(fields->field_serv);
00212 O_DELETE(fields->field_url);
00213 O_DELETE(fields->field_mask);
00214 O_DELETE(fields->field_status);
00215 O_DELETE(fields->field_boxc);
00216
00217 #undef O_DELETE
00218
00219 gw_free(fields);
00220 }
|
|
|
Definition at line 100 of file dlr.c. References gw_assert. Referenced by dlr_add(), dlr_entry_duplicate(), dlr_mysql_get(), and dlr_pgsql_get(). 00101 {
00102 struct dlr_entry *dlr;
00103
00104 dlr = gw_malloc(sizeof(*dlr));
00105 gw_assert(dlr != NULL);
00106
00107 /* set all values to NULL */
00108 memset(dlr, 0, sizeof(*dlr));
00109
00110 return dlr;
00111 }
|
|
|
Definition at line 139 of file dlr.c. References dlr_entry::boxc_id, dlr_entry::destination, dlr_entry::mask, O_DELETE, dlr_entry::service, dlr_entry::smsc, dlr_entry::source, dlr_entry::timestamp, and dlr_entry::url. Referenced by dlr_find(), dlr_mem_remove(), dlr_mem_shutdown(), dlr_mysql_add(), and dlr_pgsql_add(). 00140 {
00141 /* sanity check */
00142 if (dlr == NULL)
00143 return;
00144
00145 #define O_DELETE(a) { if (a) octstr_destroy(a); a = NULL; }
00146
00147 O_DELETE(dlr->smsc);
00148 O_DELETE(dlr->timestamp);
00149 O_DELETE(dlr->source);
00150 O_DELETE(dlr->destination);
00151 O_DELETE(dlr->service);
00152 O_DELETE(dlr->url);
00153 O_DELETE(dlr->boxc_id);
00154
00155 #undef O_DELETE
00156
00157 dlr->mask = 0;
00158 gw_free(dlr);
00159 }
|
|
|
Definition at line 116 of file dlr.c. References dlr_entry::boxc_id, dlr_entry::destination, dlr_entry_create(), dlr_entry::mask, octstr_duplicate, dlr_entry::service, dlr_entry::smsc, dlr_entry::source, dlr_entry::timestamp, and dlr_entry::url. Referenced by dlr_mem_get(). 00117 {
00118 struct dlr_entry *ret;
00119
00120 if (dlr == NULL)
00121 return NULL;
00122
00123 ret = dlr_entry_create();
00124 ret->smsc = octstr_duplicate(dlr->smsc);
00125 ret->timestamp = octstr_duplicate(dlr->timestamp);
00126 ret->source = octstr_duplicate(dlr->source);
00127 ret->destination = octstr_duplicate(dlr->destination);
00128 ret->service = octstr_duplicate(dlr->service);
00129 ret->url = octstr_duplicate(dlr->url);
00130 ret->boxc_id = octstr_duplicate(dlr->boxc_id);
00131 ret->mask = dlr->mask;
00132
00133 return ret;
00134 }
|
Here is the call graph for this function:

|
|
Definition at line 195 of file dlr_mem.c. References dlr_waiting_list, gw_rwlock_init_static(), gwlist_create, and rwlock. Referenced by dlr_init(). 00196 {
00197 dlr_waiting_list = gwlist_create();
00198 gw_rwlock_init_static(&rwlock);
00199
00200 return &handles;
00201 }
|
Here is the call graph for this function:

|
|
Definition at line 302 of file dlr_mysql.c. References cfg_get, cfg_get_integer(), cfg_get_multi_group(), cfg_get_single_group(), MySQLConf::database, dbpool_conn_count(), dbpool_create(), DBPOOL_MYSQL, dlr_db_fields_create(), fields, gw_assert, gwlist_destroy(), gwlist_extract_first(), MySQLConf::host, DBConf::mysql, octstr_compare(), octstr_destroy(), octstr_get_cstr, octstr_imm(), panic, MySQLConf::password, pool, MySQLConf::port, and MySQLConf::username. Referenced by dlr_init(). 00303 {
00304 CfgGroup *grp;
00305 List *grplist;
00306 Octstr *mysql_host, *mysql_user, *mysql_pass, *mysql_db, *mysql_id;
00307 long mysql_port = 0;
00308 Octstr *p = NULL;
00309 long pool_size;
00310 DBConf *db_conf = NULL;
00311
00312 /*
00313 * check for all mandatory directives that specify the field names
00314 * of the used MySQL table
00315 */
00316 if (!(grp = cfg_get_single_group(cfg, octstr_imm("dlr-db"))))
00317 panic(0, "DLR: MySQL: group 'dlr-db' is not specified!");
00318
00319 if (!(mysql_id = cfg_get(grp, octstr_imm("id"))))
00320 panic(0, "DLR: MySQL: directive 'id' is not specified!");
00321
00322 fields = dlr_db_fields_create(grp);
00323 gw_assert(fields != NULL);
00324
00325 /*
00326 * now grap the required information from the 'mysql-connection' group
00327 * with the mysql-id we just obtained
00328 *
00329 * we have to loop through all available MySQL connection definitions
00330 * and search for the one we are looking for
00331 */
00332
00333 grplist = cfg_get_multi_group(cfg, octstr_imm("mysql-connection"));
00334 while (grplist && (grp = gwlist_extract_first(grplist)) != NULL) {
00335 p = cfg_get(grp, octstr_imm("id"));
00336 if (p != NULL && octstr_compare(p, mysql_id) == 0) {
00337 goto found;
00338 }
00339 if (p != NULL) octstr_destroy(p);
00340 }
00341 panic(0, "DLR: MySQL: connection settings for id '%s' are not specified!",
00342 octstr_get_cstr(mysql_id));
00343
00344 found:
00345 octstr_destroy(p);
00346 gwlist_destroy(grplist, NULL);
00347
00348 if (cfg_get_integer(&pool_size, grp, octstr_imm("max-connections")) == -1 || pool_size == 0)
00349 pool_size = 1;
00350
00351 if (!(mysql_host = cfg_get(grp, octstr_imm("host"))))
00352 panic(0, "DLR: MySQL: directive 'host' is not specified!");
00353 if (!(mysql_user = cfg_get(grp, octstr_imm("username"))))
00354 panic(0, "DLR: MySQL: directive 'username' is not specified!");
00355 if (!(mysql_pass = cfg_get(grp, octstr_imm("password"))))
00356 panic(0, "DLR: MySQL: directive 'password' is not specified!");
00357 if (!(mysql_db = cfg_get(grp, octstr_imm("database"))))
00358 panic(0, "DLR: MySQL: directive 'database' is not specified!");
00359 cfg_get_integer(&mysql_port, grp, octstr_imm("port")); /* optional */
00360
00361 /*
00362 * ok, ready to connect to MySQL
00363 */
00364 db_conf = gw_malloc(sizeof(DBConf));
00365 gw_assert(db_conf != NULL);
00366
00367 db_conf->mysql = gw_malloc(sizeof(MySQLConf));
00368 gw_assert(db_conf->mysql != NULL);
00369
00370 db_conf->mysql->host = mysql_host;
00371 db_conf->mysql->port = mysql_port;
00372 db_conf->mysql->username = mysql_user;
00373 db_conf->mysql->password = mysql_pass;
00374 db_conf->mysql->database = mysql_db;
00375
00376 pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
00377 gw_assert(pool != NULL);
00378
00379 /*
00380 * XXX should a failing connect throw panic?!
00381 */
00382 if (dbpool_conn_count(pool) == 0)
00383 panic(0,"DLR: MySQL: database pool has no connections!");
00384
00385 octstr_destroy(mysql_id);
00386
00387 return &handles;
00388 }
|
Here is the call graph for this function:

|
|
Definition at line 394 of file dlr_oracle.c. Referenced by dlr_init(). 00395 {
00396 return NULL;
00397 }
|
|
|
Definition at line 298 of file dlr_pgsql.c. References cfg_get, cfg_get_integer(), cfg_get_multi_group(), cfg_get_single_group(), PgSQLConf::database, dbpool_conn_count(), dbpool_create(), DBPOOL_PGSQL, dlr_db_fields_create(), fields, gw_assert, gwlist_destroy(), gwlist_extract_first(), PgSQLConf::host, octstr_compare(), octstr_destroy(), octstr_get_cstr, octstr_imm(), panic, PgSQLConf::password, DBConf::pgsql, pool, PgSQLConf::port, and PgSQLConf::username. Referenced by dlr_init(). 00299 {
00300 CfgGroup *grp;
00301 List *grplist;
00302 Octstr *pgsql_host, *pgsql_user, *pgsql_pass, *pgsql_db, *pgsql_id;
00303 long pgsql_port = 0;
00304 Octstr *p = NULL;
00305 long pool_size;
00306 DBConf *db_conf = NULL;
00307
00308 /*
00309 * check for all mandatory directives that specify the field names
00310 * of the table used
00311 */
00312 if (!(grp = cfg_get_single_group(cfg, octstr_imm("dlr-db"))))
00313 panic(0, "DLR: PgSQL: group 'dlr-db' is not specified!");
00314
00315 if (!(pgsql_id = cfg_get(grp, octstr_imm("id"))))
00316 panic(0, "DLR: PgSQL: directive 'id' is not specified!");
00317
00318 fields = dlr_db_fields_create(grp);
00319 gw_assert(fields != NULL);
00320
00321 /*
00322 * now grap the required information from the 'pgsql-connection' group
00323 * with the pgsql-id we just obtained
00324 *
00325 * we have to loop through all available PostgreSQL connection definitions
00326 * and search for the one we are looking for
00327 */
00328
00329 grplist = cfg_get_multi_group(cfg, octstr_imm("pgsql-connection"));
00330 while (grplist && (grp = gwlist_extract_first(grplist)) != NULL) {
00331 p = cfg_get(grp, octstr_imm("id"));
00332 if (p != NULL && octstr_compare(p, pgsql_id) == 0) {
00333 goto found;
00334 }
00335 if (p != NULL)
00336 octstr_destroy(p);
00337 }
00338 panic(0, "DLR: PgSQL: connection settings for id '%s' are not specified!",
00339 octstr_get_cstr(pgsql_id));
00340
00341 found:
00342 octstr_destroy(p);
00343 gwlist_destroy(grplist, NULL);
00344
00345 if (cfg_get_integer(&pool_size, grp, octstr_imm("max-connections")) == -1 || pool_size == 0)
00346 pool_size = 1;
00347
00348 if (!(pgsql_host = cfg_get(grp, octstr_imm("host"))))
00349 panic(0, "DLR: PgSQL: directive 'host' is not specified!");
00350 if (!(pgsql_user = cfg_get(grp, octstr_imm("username"))))
00351 panic(0, "DLR: PgSQL: directive 'username' is not specified!");
00352 if (!(pgsql_pass = cfg_get(grp, octstr_imm("password"))))
00353 panic(0, "DLR: PgSQL: directive 'password' is not specified!");
00354 if (!(pgsql_db = cfg_get(grp, octstr_imm("database"))))
00355 panic(0, "DLR: PgSQL: directive 'database' is not specified!");
00356 cfg_get_integer(&pgsql_port, grp, octstr_imm("port")); /* optional */
00357
00358 /*
00359 * ok, ready to connect to the database
00360 */
00361 db_conf = gw_malloc(sizeof(DBConf));
00362 gw_assert(db_conf != NULL);
00363
00364 db_conf->pgsql = gw_malloc(sizeof(PgSQLConf));
00365 gw_assert(db_conf->pgsql != NULL);
00366
00367 db_conf->pgsql->host = pgsql_host;
00368 db_conf->pgsql->port = pgsql_port;
00369 db_conf->pgsql->username = pgsql_user;
00370 db_conf->pgsql->password = pgsql_pass;
00371 db_conf->pgsql->database = pgsql_db;
00372
00373 pool = dbpool_create(DBPOOL_PGSQL, db_conf, pool_size);
00374 gw_assert(pool != NULL);
00375
00376 /*
00377 * XXX should a failing connect throw panic?!
00378 */
00379 if (dbpool_conn_count(pool) == 0)
00380 panic(0,"DLR: PgSQL: database pool has no connections!");
00381
00382 octstr_destroy(pgsql_id);
00383
00384 return &handles;
00385 }
|
Here is the call graph for this function:

|
|
Definition at line 455 of file dlr_sdb.c. Referenced by dlr_init(). 00456 {
00457 return NULL;
00458 }
|