]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ | |
2 | #pragma once | |
3 | ||
4 | /*** | |
5 | Copyright © 2014 Zbigniew Jędrzejewski-Szmek | |
6 | ***/ | |
7 | ||
8 | #include "sd-event.h" | |
9 | ||
10 | #include "hashmap.h" | |
11 | #include "journal-remote-parse.h" | |
12 | #include "journal-remote-write.h" | |
13 | ||
14 | #if HAVE_MICROHTTPD | |
15 | #include "microhttpd-util.h" | |
16 | ||
17 | typedef struct MHDDaemonWrapper MHDDaemonWrapper; | |
18 | ||
19 | struct MHDDaemonWrapper { | |
20 | uint64_t fd; | |
21 | struct MHD_Daemon *daemon; | |
22 | ||
23 | sd_event_source *io_event; | |
24 | sd_event_source *timer_event; | |
25 | }; | |
26 | #endif | |
27 | ||
28 | struct RemoteServer { | |
29 | RemoteSource **sources; | |
30 | size_t sources_size; | |
31 | size_t active; | |
32 | ||
33 | sd_event *events; | |
34 | sd_event_source *sigterm_event, *sigint_event, *listen_event; | |
35 | ||
36 | Hashmap *writers; | |
37 | Writer *_single_writer; | |
38 | uint64_t event_count; | |
39 | ||
40 | #if HAVE_MICROHTTPD | |
41 | Hashmap *daemons; | |
42 | #endif | |
43 | const char *output; /* either the output file or directory */ | |
44 | ||
45 | JournalWriteSplitMode split_mode; | |
46 | bool compress; | |
47 | bool seal; | |
48 | bool check_trust; | |
49 | }; | |
50 | extern RemoteServer *journal_remote_server_global; | |
51 | ||
52 | int journal_remote_server_init( | |
53 | RemoteServer *s, | |
54 | const char *output, | |
55 | JournalWriteSplitMode split_mode, | |
56 | bool compress, | |
57 | bool seal); | |
58 | ||
59 | int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer); | |
60 | ||
61 | int journal_remote_add_source(RemoteServer *s, int fd, char* name, bool own_name); | |
62 | int journal_remote_add_raw_socket(RemoteServer *s, int fd); | |
63 | int journal_remote_handle_raw_source( | |
64 | sd_event_source *event, | |
65 | int fd, | |
66 | uint32_t revents, | |
67 | RemoteServer *s); | |
68 | ||
69 | RemoteServer* journal_remote_server_destroy(RemoteServer *s); |