version 1.13, 2016/05/18 15:18:10
|
version 1.16.6.1, 2025/08/19 10:42:28
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2016 | Copyright 2004 - 2025 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 71 cfg_tree_cmp(struct tagCfg *a, struct tagCfg *b)
|
Line 71 cfg_tree_cmp(struct tagCfg *a, struct tagCfg *b)
|
|
|
assert(a && b); |
assert(a && b); |
|
|
ret = ((AIT_KEY(&a->cfg_sec) << 16) | AIT_KEY(&a->cfg_attr)) - | ret = ((AIT_KEY(&a->cfg_sec) << 15) | AIT_KEY(&a->cfg_attr)) - |
((AIT_KEY(&b->cfg_sec) << 16) | AIT_KEY(&b->cfg_attr)); | ((AIT_KEY(&b->cfg_sec) << 15) | AIT_KEY(&b->cfg_attr)); |
|
|
if (ret < 0) |
if (ret < 0) |
return -1; |
return -1; |
Line 157 cfgEndConfig(cfg_root_t **pcfg)
|
Line 157 cfgEndConfig(cfg_root_t **pcfg)
|
} |
} |
|
|
/* |
/* |
|
* cfgInitConfigExt() - Init existed config root |
|
* |
|
* @cfg = Config root |
|
* return: NULL error or !=NULL inited config root |
|
*/ |
|
cfg_root_t * |
|
cfgInitConfigExt(cfg_root_t * __restrict cfg) |
|
{ |
|
if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg)) |
|
cfgUnloadConfig(cfg); |
|
|
|
memset(cfg, 0, sizeof(cfg_root_t)); |
|
|
|
pthread_mutex_init(&cfg->rc_mtx, NULL); |
|
|
|
TAILQ_INIT(cfg); |
|
RB_INIT(cfg); |
|
return cfg; |
|
} |
|
|
|
/* |
* cfgLoadConfig() - Load config from file |
* cfgLoadConfig() - Load config from file |
* |
* |
* @cfgName = Config filename |
* @cfgName = Config filename |
Line 173 cfgLoadConfig(const char *cfgName, cfg_root_t * __rest
|
Line 194 cfgLoadConfig(const char *cfgName, cfg_root_t * __rest
|
cfg_SetErr(EINVAL, "Invalid parameter(s)"); |
cfg_SetErr(EINVAL, "Invalid parameter(s)"); |
return -1; |
return -1; |
} else { |
} else { |
|
if (!TAILQ_EMPTY(cfg) || !RB_EMPTY(cfg)) |
|
cfgUnloadConfig(cfg); |
|
|
|
memset(cfg, 0, sizeof(cfg_root_t)); |
|
|
pthread_mutex_init(&cfg->rc_mtx, NULL); |
pthread_mutex_init(&cfg->rc_mtx, NULL); |
|
|
TAILQ_INIT(cfg); |
TAILQ_INIT(cfg); |
Line 257 cfgCreateConfig(const char *csConfigName, cfg_root_t *
|
Line 283 cfgCreateConfig(const char *csConfigName, cfg_root_t *
|
return -1; |
return -1; |
} |
} |
|
|
ret = cfgWriteConfig(f, cfg, whitespace); | ret = cfgWriteConfigRaw(f, cfg, whitespace); |
|
|
fclose(f); |
fclose(f); |
return ret; |
return ret; |
Line 321 cfgLoadPasswd(const char *pwdName, pwd_root_t * __rest
|
Line 347 cfgLoadPasswd(const char *pwdName, pwd_root_t * __rest
|
cfg_SetErr(EINVAL, "Invalid parameter(s)"); |
cfg_SetErr(EINVAL, "Invalid parameter(s)"); |
return -1; |
return -1; |
} else { |
} else { |
|
memset(pwd, 0, sizeof(pwd_root_t)); |
|
|
pthread_mutex_init(&pwd->pwd_mtx, NULL); |
pthread_mutex_init(&pwd->pwd_mtx, NULL); |
|
|
SLIST_INIT(pwd); |
SLIST_INIT(pwd); |