Lines Matching full:env
49 void client_configure(struct env *);
53 int client_search_idm(struct env *, struct idm *, struct aldap *,
55 int client_try_idm(struct env *, struct idm *, struct ypldap_addr *);
136 struct env *env = p;
137 struct imsgev *iev = env->sc_iev_dns;
166 TAILQ_FOREACH(idm, &env->sc_idms, idm_entry)
206 TAILQ_FOREACH(idm, &env->sc_idms, idm_entry) {
208 if (client_try_idm(env, idm, h) == -1)
218 imsg_compose_event(env->sc_iev, IMSG_END_UPDATE, 0, 0, -1,
236 struct env *env = p;
237 struct imsgev *iev = env->sc_iev;
266 struct env params;
268 if (env->sc_flags & F_CONFIGURING) {
274 env->sc_flags |= F_CONFIGURING;
275 purge_config(env);
276 memcpy(&env->sc_conf_tv, ¶ms.sc_conf_tv,
277 sizeof(env->sc_conf_tv));
278 env->sc_flags |= params.sc_flags;
284 if (!(env->sc_flags & F_CONFIGURING))
289 idm->idm_env = env;
290 TAILQ_INSERT_TAIL(&env->sc_idms, idm, idm_entry);
294 env->sc_flags &= ~F_CONFIGURING;
296 client_configure(env);
332 struct env env;
344 memset(&env, 0, sizeof(env));
345 TAILQ_INIT(&env.sc_idms);
389 if ((env.sc_iev = calloc(1, sizeof(*env.sc_iev))) == NULL)
391 if ((env.sc_iev_dns = calloc(1, sizeof(*env.sc_iev_dns))) == NULL)
394 env.sc_iev->events = EV_READ;
395 env.sc_iev->data = &env;
396 if (imsgbuf_init(&env.sc_iev->ibuf, pipe_main2client[1]) == -1)
398 env.sc_iev->handler = client_dispatch_parent;
399 event_set(&env.sc_iev->ev, env.sc_iev->ibuf.fd, env.sc_iev->events,
400 env.sc_iev->handler, &env);
401 event_add(&env.sc_iev->ev, NULL);
403 env.sc_iev_dns->events = EV_READ;
404 env.sc_iev_dns->data = &env;
405 if (imsgbuf_init(&env.sc_iev_dns->ibuf, pipe_dns[0]) == -1)
407 env.sc_iev_dns->handler = client_dispatch_dns;
408 event_set(&env.sc_iev_dns->ev, env.sc_iev_dns->ibuf.fd,
409 env.sc_iev_dns->events, env.sc_iev_dns->handler, &env);
410 event_add(&env.sc_iev_dns->ev, NULL);
493 client_search_idm(struct env *env, struct idm *idm, struct aldap *al,
540 imsg_compose_event(env->sc_iev, type, 0, 0, -1,
560 client_try_idm(struct env *env, struct idm *idm, struct ypldap_addr *addr)
668 if (client_search_idm(env, idm, al, attrs,
685 if (client_search_idm(env, idm, al, attrs,
705 struct env *env = p;
712 TAILQ_FOREACH(idm, &env->sc_idms, idm_entry) {
722 imsg_compose_event(env->sc_iev, IMSG_TRASH_UPDATE, 0, 0, -1,
726 client_configure(env);
730 client_configure(struct env *env)
738 imsg_compose_event(env->sc_iev, IMSG_START_UPDATE, 0, 0, -1, NULL, 0);
741 TAILQ_FOREACH(idm, &env->sc_idms, idm_entry) {
743 imsg_compose_event(env->sc_iev_dns, IMSG_HOST_DNS, idm->idm_id,
747 tv.tv_sec = env->sc_conf_tv.tv_sec;
748 tv.tv_usec = env->sc_conf_tv.tv_usec;
749 evtimer_set(&env->sc_conf_ev, client_periodic_update, env);
750 evtimer_add(&env->sc_conf_ev, &tv);