13 #ifndef MIDDLEWARES_LIST_H
14 #define MIDDLEWARES_LIST_H
65 static inline int init_middlewares(UT_array *handlers, sqlite3 *db,
66 char *db_path,
struct eloop_data *eloop,
73 handler->
context = handler->
f.
init(db, db_path, eloop, pc, params);
89 static inline void free_middlewares(UT_array *handlers) {
92 if (handlers == NULL) {
102 utarray_free(handlers);
116 static inline void process_middlewares(UT_array *handlers,
char *ltype,
117 struct pcap_pkthdr *header,
118 uint8_t *packet,
char *ifname) {
123 if (handler->
f.
process(handler->
context, ltype, header, packet, ifname) <
#define log_error(...)
Logs an error message. Do not use this for if you want to log errno, instead use log_errno for this.
Definition: log.h:68
#define log_trace(...)
Definition: log.h:57
File containing the definition of a generic middleware.
UT_array * assign_middlewares(void)
Constructs the list of middlewares to use.
Structure describing a middleware for the EDGESec capture service.
Definition: middleware.h:41
void(*const free)(struct middleware_context *context)
Frees the middleware context.
Definition: middleware.h:77
int(*const process)(struct middleware_context *context, const char *ltype, struct pcap_pkthdr *header, uint8_t *packet, char *ifname)
Runs the middleware.
Definition: middleware.h:68
const char *const name
Human readable name for middleware.
Definition: middleware.h:84
struct middleware_context *(*const init)(sqlite3 *db, char *db_path, struct eloop_data *eloop, struct pcap_context *pc, char *params)
Initialises the middleware.
Definition: middleware.h:52
Definition: middleware.h:22
Generic middleware context and functions.
Definition: middlewares_list.h:25
const struct capture_middleware f
The implementation of the middleware functions.
Definition: middlewares_list.h:29
struct middleware_context * context
The storage of the middleware. This should be created by capture_middleware::init() and freed with ca...
Definition: middlewares_list.h:35
Pcap context structure definition.
Definition: pcap_service.h:29