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