void Configurator_config(Dict* config, struct Sockaddr* sockAddr, String* adminPassword, struct EventBase* eventBase, struct Log* logger, struct Allocator* alloc) { struct Allocator* tempAlloc = Allocator_child(alloc); struct UDPAddrIface* udp = UDPAddrIface_new(eventBase, NULL, alloc, NULL, logger); struct AdminClient* client = AdminClient_new(&udp->generic, sockAddr, adminPassword, eventBase, logger, tempAlloc); struct Context ctx = { .logger = logger, .alloc = tempAlloc, .client = client, .base = eventBase, }; waitUntilPong(&ctx); List* authedPasswords = Dict_getList(config, String_CONST("authorizedPasswords")); if (authedPasswords) { authorizedPasswords(authedPasswords, &ctx); } Dict* ifaces = Dict_getDict(config, String_CONST("interfaces")); udpInterface(ifaces, &ctx); if (Defined(HAS_ETH_INTERFACE)) { ethInterface(ifaces, &ctx); } Dict* routerConf = Dict_getDict(config, String_CONST("router")); routerConfig(routerConf, tempAlloc, &ctx); List* secList = Dict_getList(config, String_CONST("security")); security(tempAlloc, secList, logger, &ctx); Log_debug(logger, "Cjdns started in the background"); Allocator_free(tempAlloc); }
void Configurator_config(Dict* config, struct Sockaddr* sockAddr, String* adminPassword, struct EventBase* eventBase, struct Log* logger, struct Allocator* alloc) { struct Except* eh = NULL; struct Allocator* tempAlloc = Allocator_child(alloc); struct AdminClient* client = AdminClient_new(sockAddr, adminPassword, eventBase, logger, tempAlloc); struct Context ctx = { .logger = logger, .alloc = tempAlloc, .client = client, .base = eventBase, }; List* authedPasswords = Dict_getList(config, String_CONST("authorizedPasswords")); if (authedPasswords) { authorizedPasswords(authedPasswords, &ctx); } Dict* ifaces = Dict_getDict(config, String_CONST("interfaces")); udpInterface(ifaces, &ctx); #ifdef HAS_ETH_INTERFACE ethInterface(ifaces, &ctx); #endif Dict* routerConf = Dict_getDict(config, String_CONST("router")); routerConfig(routerConf, tempAlloc, &ctx); List* securityList = Dict_getList(config, String_CONST("security")); security(securityList, tempAlloc, &ctx); Dict* dnsConf = Dict_getDict(config, String_CONST("dns")); dns(dnsConf, &ctx, eh); Allocator_free(tempAlloc); }