コード例 #1
0
ファイル: Configurator.c プロジェクト: TrueShiftBlue/cjdns
void Configurator_config(Dict* config,
                         struct sockaddr_storage* addr,
                         int addrLen,
                         String* adminPassword,
                         struct event_base* eventBase,
                         struct Log* logger,
                         struct Allocator* alloc)
{
    struct Allocator* tempAlloc = alloc->child(alloc);
    struct AdminClient* client =
        AdminClient_new(addr, addrLen, adminPassword, eventBase, logger, tempAlloc);

    struct Context ctx = { .logger = logger, .alloc = tempAlloc, .client = client };

    List* authedPasswords = Dict_getList(config, String_CONST("authorizedPasswords"));
    if (authedPasswords) {
        authorizedPasswords(authedPasswords, &ctx);
    }

    Dict* ifaces = Dict_getDict(config, String_CONST("interfaces"));
    udpInterface(ifaces, &ctx);

    Dict* routerConf = Dict_getDict(config, String_CONST("router"));
    Dict* iface = Dict_getDict(routerConf, String_CONST("interface"));
    tunInterface(iface, tempAlloc, &ctx);

    List* securityList = Dict_getList(config, String_CONST("security"));
    security(securityList, tempAlloc, &ctx);

    tempAlloc->free(tempAlloc);
}
コード例 #2
0
ファイル: Configurator.c プロジェクト: guworks/cjdns
static void routerConfig(Dict* routerConf, struct Allocator* tempAlloc, struct Context* ctx)
{
    tunInterface(Dict_getDict(routerConf, String_CONST("interface")), tempAlloc, ctx);
    ipTunnel(Dict_getDict(routerConf, String_CONST("ipTunnel")), tempAlloc, ctx);
}