diff --git a/contrib/spoa_server/spoa.c b/contrib/spoa_server/spoa.c index 3766c47e6..6645c8ca3 100644 --- a/contrib/spoa_server/spoa.c +++ b/contrib/spoa_server/spoa.c @@ -97,6 +97,13 @@ static const char *spoe_frm_err_reasons[SPOE_FRM_ERRS] = { bool debug = false; pthread_key_t worker_id; +static struct ps *ps_list = NULL; + +void ps_register(struct ps *ps) +{ + ps->next = ps_list; + ps_list = ps; +} static void check_ipv4_reputation(struct worker *w, struct in_addr *ipv4) @@ -925,10 +932,15 @@ spoa_worker(void *data) struct sockaddr_in client; int *info = (int *)data; int csock, lsock = info[0]; + struct ps *ps; signal(SIGPIPE, SIG_IGN); pthread_setspecific(worker_id, &info[1]); + /* Init registered processors */ + for (ps = ps_list; ps != NULL; ps = ps->next) + ps->init_worker(&w); + while (1) { socklen_t sz = sizeof(client); diff --git a/contrib/spoa_server/spoa.h b/contrib/spoa_server/spoa.h index 92c24ac55..c8f9861b9 100644 --- a/contrib/spoa_server/spoa.h +++ b/contrib/spoa_server/spoa.h @@ -80,9 +80,22 @@ struct spoe_data { union spoe_value u; /* spoe data value */ }; +struct spoe_kv { + struct chunk name; + struct spoe_data value; +}; + +struct ps { + struct ps *next; + char *ext; + int (*init_worker)(struct worker *w); +}; + extern bool debug; extern pthread_key_t worker_id; +void ps_register(struct ps *ps); + #define LOG(fmt, args...) \ do { \ struct timeval now; \