예제 #1
0
파일: Core_admin.c 프로젝트: CSRedRat/cjdns
static void initTunnel(Dict* args, void* vcontext, String* txid)
{
    struct Context* const ctx = (struct Context*) vcontext;
    #define BUFFERSZ 1024
    uint8_t buffer[BUFFERSZ];
    struct Allocator* const alloc = BufferAllocator_new(buffer, BUFFERSZ);

    struct Jmp jmp;
    Jmp_try(jmp) {
        Core_initTunnel(Dict_getString(args, String_CONST("desiredTunName")),
                        ctx->ipAddr,
                        8,
                        ctx->ducttape,
                        ctx->logger,
                        ctx->ipTunnel,
                        ctx->eventBase,
                        ctx->alloc,
                        &jmp.handler);
    } Jmp_catch {
        String* error = String_printf(alloc, "Failed to configure tunnel [%s]", jmp.message);
        sendResponse(error, ctx->admin, txid, alloc);
        return;
    }

    sendResponse(String_CONST("none"), ctx->admin, txid, alloc);
}
예제 #2
0
파일: Core.c 프로젝트: AdUser/cjdns
static void initTunnel(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
{
    struct Core_Context* const ctx = (struct Core_Context*) vcontext;

    struct Jmp jmp;
    Jmp_try(jmp) {
        Core_initTunnel(Dict_getString(args, String_CONST("desiredTunName")),
                        ctx->ipAddr,
                        8,
                        ctx->ducttape,
                        ctx->logger,
                        ctx->ipTunnel,
                        ctx->eventBase,
                        ctx->alloc,
                        &jmp.handler);
    } Jmp_catch {
        String* error = String_printf(requestAlloc, "Failed to configure tunnel [%s]", jmp.message);
        sendResponse(error, ctx->admin, txid, requestAlloc);
        return;
    }

    sendResponse(String_CONST("none"), ctx->admin, txid, requestAlloc);
}