MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cachedb_bind_mod

Function cachedb_bind_mod

cachedb/cachedb.c:111–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111int cachedb_bind_mod(str *url,cachedb_funcs *funcs)
112{
113 char *mod_name,*grp_name;
114 int len;
115 str cachedb_name;
116 cachedb_engine *cde;
117
118
119 if (url == NULL || url->s == NULL || funcs == NULL) {
120 LM_ERR("NULL parameter provided\n");
121 return -1;
122 }
123
124 memset(funcs,0,sizeof(cachedb_funcs));
125
126 mod_name = memchr(url->s,':',url->len);
127 if (mod_name == NULL) {
128 LM_ERR("cannot extract cachedb type\n");
129 return -1;
130 }
131
132 len = mod_name - url->s;
133 cachedb_name.len = len;
134 cachedb_name.s = url->s;
135
136 /* no point in giving here the grp_name, but for the sake of uniform
137 * cachedb_urls in modules and for script, take in into account
138 * the presence of grp here too, and skip it */
139 grp_name=memchr(cachedb_name.s,':',cachedb_name.len);
140 if (grp_name)
141 cachedb_name.len = grp_name - cachedb_name.s;
142
143 cde = lookup_cachedb(&cachedb_name);
144 if (cde == NULL) {
145 LM_ERR("failed to bind to [%.*s] module. Is it loaded ?\n",
146 cachedb_name.len,cachedb_name.s);
147 return -1;
148 }
149
150 LM_DBG("Binded to mod %.*s\n",cachedb_name.len,cachedb_name.s);
151 *funcs = cde->cdb_func;
152 return 0;
153}
154
155int register_cachedb(cachedb_engine* cde_entry)
156{

Callers 9

db_cachedb_initFunction · 0.85
child_initFunction · 0.85
mod_initFunction · 0.85
ul_check_dbFunction · 0.85
init_cachedbFunction · 0.85
db_init_test_connFunction · 0.85
mod_initFunction · 0.85
init_cachedb_utilsFunction · 0.85
mod_initFunction · 0.85

Calls 1

lookup_cachedbFunction · 0.85

Tested by

no test coverage detected