netif_utils: correctly close fd on read error
[project/ustp.git] / worker.h
1 /*
2 * ustp - OpenWrt STP/RSTP/MSTP daemon
3 * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14 #ifndef __WORKER_H
15 #define __WORKER_H
16
17 #include "mstp.h"
18
19 enum worker_event_type {
20 WORKER_EV_SHUTDOWN,
21 WORKER_EV_RECV_PACKET,
22 WORKER_EV_BRIDGE_EVENT,
23 WORKER_EV_BRIDGE_ADD,
24 WORKER_EV_BRIDGE_REMOVE,
25 WORKER_EV_ONE_SECOND,
26 };
27
28 struct worker_event {
29 enum worker_event_type type;
30
31 int bridge_idx;
32 CIST_BridgeConfig bridge_config;
33 };
34
35 int worker_init(void);
36 void worker_cleanup(void);
37 void worker_queue_event(struct worker_event *ev);
38
39 #endif