#include #include #include #include "config.h" #include "structs.h" typedef struct listen_local_priv LISTEN_LOCAL_PRIV; struct listen_local_priv { char *path; int fd; } ; extern LEP_OPS lep_ops_local; static int lep_local_add(CONFIG *cfg, LISTEN *l, const char *key, int keylen, const char *rest) { LEP *lep; LISTEN_LOCAL_PRIV *llp; if ((keylen != 5) || bcmp(key,"local",5)) return(0); if (! *rest) config_err(cfg,"missing path on `local' listen line"); llp = malloc(sizeof(LISTEN_LOCAL_PRIV)); llp->path = strdup(rest); llp->fd = -1; lep = malloc(sizeof(LEP)); lep->ops = &lep_ops_local; lep->priv = llp; lep->link = l->endpoints; l->endpoints = lep; return(1); } static void lep_local_free(void *pv) { LISTEN_LOCAL_PRIV *p; p = pv; free(p->path); if (p->fd >= 0) close(p->fd); free(p); } LEP_OPS lep_ops_local = LEP_OPS_INIT(local);