Thierry FOURNIER | a5ec06d | 2017-04-10 23:47:23 +0200 | [diff] [blame] | 1 | /* |
| 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 CARLIER | 8abbd3d | 2017-05-03 10:23:08 +0100 | [diff] [blame] | 23 | #include <sys/queue.h> |
| 24 | |
Thierry FOURNIER | a5ec06d | 2017-04-10 23:47:23 +0200 | [diff] [blame] | 25 | #include <event2/util.h> |
| 26 | #include <event2/event.h> |
| 27 | #include <event2/event_struct.h> |
| 28 | #include <event2/thread.h> |
| 29 | |
| 30 | struct 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 | |
| 55 | extern struct worker null_worker; |