getdns_return_t getdns_extension_set_libevent_base(getdns_context *context, struct event_base *base) { static getdns_eventloop_vmt getdns_libevent_vmt = { getdns_libevent_cleanup, getdns_libevent_schedule, getdns_libevent_clear, getdns_libevent_run, getdns_libevent_run_once }; getdns_libevent *ext; if (!context) return GETDNS_RETURN_BAD_CONTEXT; if (!base) return GETDNS_RETURN_INVALID_PARAMETER; ext = GETDNS_MALLOC(*priv_getdns_context_mf(context), getdns_libevent); if (!ext) return GETDNS_RETURN_MEMORY_ERROR; ext->vmt = &getdns_libevent_vmt; ext->base = base; ext->mf = *priv_getdns_context_mf(context); return getdns_context_set_eventloop(context, (getdns_eventloop *)ext); }
getdns_return_t getdns_extension_set_libuv_loop(getdns_context *context, uv_loop_t *loop) { static getdns_eventloop_vmt getdns_libuv_vmt = { getdns_libuv_cleanup, getdns_libuv_schedule, getdns_libuv_clear, getdns_libuv_run, getdns_libuv_run_once }; getdns_libuv *ext; if (!context) return GETDNS_RETURN_BAD_CONTEXT; if (!loop) return GETDNS_RETURN_INVALID_PARAMETER; ext = GETDNS_MALLOC(*priv_getdns_context_mf(context), getdns_libuv); if (!ext) return GETDNS_RETURN_MEMORY_ERROR; ext->vmt = &getdns_libuv_vmt; ext->loop = loop; ext->mf = *priv_getdns_context_mf(context); return getdns_context_set_eventloop(context, (getdns_eventloop *)ext); }