blob: d618f9bbe2e1a6eda0f3c14a046816e03c4dc017 [file] [log] [blame]
Thierry FOURNIERa5ec06d2017-04-10 23:47:23 +02001/*
2 * Modsecurity wrapper for haproxy
3 *
4 * This file contains the headers of the bootstrap for laucnching and scheduling
5 * modsecurity for working with HAProxy SPOE protocol.
6 *
7 * Copyright 2016 OZON, Thierry Fournier <thierry.fournier@ozon.io>
8 *
9 * This file is inherited from "A Random IP reputation service acting as a Stream
10 * Processing Offload Agent"
11 *
12 * Copyright 2016 HAProxy Technologies, Christopher Faulet <cfaulet@haproxy.com>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 *
19 */
20#ifndef __SPOA_H__
21#define __SPOA_H__
22
David CARLIER8abbd3d2017-05-03 10:23:08 +010023#include <sys/queue.h>
24
Thierry FOURNIERa5ec06d2017-04-10 23:47:23 +020025#include <event2/util.h>
26#include <event2/event.h>
27#include <event2/event_struct.h>
28#include <event2/thread.h>
29
30struct worker {
31 pthread_t thread;
32 int id;
33 struct event_base *base;
34 struct event *monitor_event;
35
36 struct list engines;
37
38 unsigned int nbclients;
39 struct list clients;
40
41 struct list frames;
42};
43
44#define LOG(worker, fmt, args...) \
45 do { \
46 struct timeval now; \
47 \
48 gettimeofday(&now, NULL); \
49 fprintf(stderr, "%ld.%06ld [%02d] " fmt "\n", \
50 now.tv_sec, now.tv_usec, (worker)->id, ##args); \
51 } while (0)
52
53#endif /* __SPOA_H__ */
54
55extern struct worker null_worker;