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

Function version_control

sr_module.c:206–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204
205
206static inline int version_control(const struct module_exports* exp, char *path)
207{
208 const char *hint = "(try `make clean all modules' and reinstall everything)";
209 const char *scm_nm = "version control system";
210 int len;
211 if ( !exp->ver_info.version ) {
212 LM_CRIT("BUG - version not defined in module <%s>\n", path );
213 return 0;
214 }
215 if ( !exp->ver_info.compile_flags ) {
216 LM_CRIT("BUG - compile flags not defined in module <%s>\n", path );
217 return 0;
218 }
219 if ( !exp->ver_info.scm.type ) {
220 LM_CRIT("BUG - %s type not defined in module <%s> %s\n",
221 scm_nm, path, hint );
222 return 0;
223 }
224 if ( !exp->ver_info.scm.rev ) {
225 LM_CRIT("BUG - %s revision not defined in module <%s> %s\n",
226 scm_nm, path, hint );
227 return 0;
228 }
229
230 if (strcmp(OPENSIPS_FULL_VERSION, exp->ver_info.version)!=0) {
231 LM_CRIT("module version mismatch for %s; core: %s; module: %s\n",
232 exp->name, OPENSIPS_FULL_VERSION, exp->ver_info.version );
233 return 0;
234 }
235 if (strcmp(OPENSIPS_COMPILE_FLAGS, exp->ver_info.compile_flags)!=0) {
236 LM_CRIT("module compile flags mismatch for %s "
237 " \ncore: %s \nmodule: %s\n", exp->name,
238 OPENSIPS_COMPILE_FLAGS, exp->ver_info.compile_flags);
239 return 0;
240 }
241 if (strcmp(core_scm_ver.type, exp->ver_info.scm.type) != 0) {
242 LM_CRIT("module %s type mismatch for %s "
243 " \ncore: %s \nmodule: %s %s\n", scm_nm, exp->name,
244 core_scm_ver.type, exp->ver_info.scm.type, hint);
245 return 0;
246 }
247 if (modload_check_rev) {
248 len = (strlen(core_scm_ver.rev) < strlen(exp->ver_info.scm.rev))?
249 strlen(core_scm_ver.rev): strlen(exp->ver_info.scm.rev);
250 if (strncmp(core_scm_ver.rev, exp->ver_info.scm.rev, len) != 0) {
251 LM_CRIT("module %s revision mismatch for %s "
252 " \ncore: %s \nmodule: %s %s\n", scm_nm, exp->name,
253 core_scm_ver.rev, exp->ver_info.scm.rev, hint);
254 return 0;
255 }
256 }
257 return 1;
258}
259
260
261

Callers 2

sr_load_moduleFunction · 0.85
load_static_moduleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected