*
* Copyright (C) 2019 and up by Alexander Pevzner (pzz@apevzner.com)
* See LICENSE for license terms and conditions
*
* Initialization/cleanup
*/
#include "airscan.h"
*/
static AIRSCAN_INIT_FLAGS airscan_init_flags;
*/
SANE_Status
airscan_init (AIRSCAN_INIT_FLAGS flags, const char *log_msg)
{
SANE_Status status;
airscan_init_flags = flags;
log_init();
trace_init();
if (log_msg != NULL) {
log_debug(NULL, "%s", log_msg);
}
if ((flags & AIRSCAN_INIT_NO_CONF) == 0) {
conf_load();
}
log_configure();
status = eloop_init();
if (status == SANE_STATUS_GOOD) {
status = rand_init();
}
if (status == SANE_STATUS_GOOD) {
status = http_init();
}
if (status == SANE_STATUS_GOOD) {
status = netif_init();
}
if (status == SANE_STATUS_GOOD) {
status = zeroconf_init();
}
if (status == SANE_STATUS_GOOD) {
status = mdns_init();
}
if (status == SANE_STATUS_GOOD) {
status = wsdd_init();
}
if (status != SANE_STATUS_GOOD) {
airscan_cleanup(NULL);
} else if ((flags & AIRSCAN_INIT_NO_THREAD) == 0) {
eloop_thread_start();
}
return status;
}
* If log_msg is not NULL, it is written to the log as late as possible
*/
void
airscan_cleanup (const char *log_msg)
{
mdns_cleanup();
wsdd_cleanup();
zeroconf_cleanup();
netif_cleanup();
http_cleanup();
rand_cleanup();
eloop_cleanup();
if (log_msg != NULL) {
log_debug(NULL, "%s", log_msg);
}
conf_unload();
trace_cleanup();
log_cleanup();
}
*/
AIRSCAN_INIT_FLAGS
airscan_get_init_flags (void)
{
return airscan_init_flags;
}
*/