blob: ea7a94e9755a8e86016ea02d02090c6a7be36ea4 [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 Carlier0f4df642017-06-06 10:20:51 +010023#undef LIST_HEAD
David CARLIER8abbd3d2017-05-03 10:23:08 +010024
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;