-
Eric Vidal authored
add servicedir entry at live addon. Add enabled at configuration group entry. Move status entry from path to live addon
Eric Vidal authoredadd servicedir entry at live addon. Add enabled at configuration group entry. Move status entry from path to live addon
service_resolve_read_cdb.c 8.62 KiB
/*
* service_resolve_read_cdb.c
*
* Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org>
*
* All rights reserved.
*
* This file is part of Obarun. It is subject to the license terms in
* the LICENSE file found in the top-level directory of this
* distribution.
* This file may not be copied, modified, propagated, or distributed
* except according to the terms contained in the LICENSE file./
*/
#include <stdint.h>
#include <stdlib.h>//free
#include <oblibs/log.h>
#include <skalibs/stralloc.h>
#include <skalibs/cdb.h>
#include <66/resolve.h>
#include <66/service.h>
int service_resolve_read_cdb(cdb *c, resolve_service_t *res)
{
log_flow() ;
stralloc tmp = STRALLOC_ZERO ;
resolve_wrapper_t_ref wres ;
uint32_t x ;
wres = resolve_set_struct(DATA_SERVICE, res) ;
/* configuration */
resolve_find_cdb(&tmp,c,"name") ;
res->name = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"description") ;
res->description = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"version") ;
res->version = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
x = resolve_find_cdb(&tmp,c,"type") ;
res->type = x ;
x = resolve_find_cdb(&tmp,c,"notify") ;
res->notify = x ;
x = resolve_find_cdb(&tmp,c,"maxdeath") ;
res->maxdeath = x ;
x = resolve_find_cdb(&tmp,c,"earlier") ;
res->earlier = x ;
resolve_find_cdb(&tmp,c,"hiercopy") ;
res->hiercopy = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"intree") ;
res->intree = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"ownerstr") ;
res->ownerstr = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
x = resolve_find_cdb(&tmp,c,"owner") ;
res->owner = x ;
resolve_find_cdb(&tmp,c,"treename") ;
res->treename = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"user") ;
res->user = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
resolve_find_cdb(&tmp,c,"inmodule") ;
res->inmodule = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;
x = resolve_find_cdb(&tmp,c,"enabled") ;
res->enabled = x ;
/* path configuration */
resolve_find_cdb(&tmp,c,"home") ;
res->path.home = tmp.len ? resolve_add_string(wres,tmp.s) : 0 ;