]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
0ef6f454 LP |
2 | #pragma once |
3 | ||
a812a881 | 4 | /*** |
96b2fb93 | 5 | Copyright © 2014 Zbigniew Jędrzejewski-Szmek |
a812a881 ZJS |
6 | ***/ |
7 | ||
9ff48d09 | 8 | #include "sd-event.h" |
9ff48d09 | 9 | |
71d35b6b | 10 | #include "hashmap.h" |
9ff48d09 | 11 | #include "journal-remote-parse.h" |
a812a881 | 12 | #include "journal-remote-write.h" |
63e2ebcd ZJS |
13 | |
14 | #if HAVE_MICROHTTPD | |
71d35b6b | 15 | #include "microhttpd-util.h" |
a812a881 ZJS |
16 | |
17 | typedef struct MHDDaemonWrapper MHDDaemonWrapper; | |
9ff48d09 | 18 | |
a812a881 | 19 | struct MHDDaemonWrapper { |
9ff48d09 ZJS |
20 | uint64_t fd; |
21 | struct MHD_Daemon *daemon; | |
22 | ||
5e38eb93 MS |
23 | sd_event_source *io_event; |
24 | sd_event_source *timer_event; | |
a812a881 | 25 | }; |
63e2ebcd | 26 | #endif |
9ff48d09 | 27 | |
a812a881 | 28 | struct RemoteServer { |
9ff48d09 ZJS |
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 | ||
63e2ebcd | 40 | #if HAVE_MICROHTTPD |
9ff48d09 | 41 | Hashmap *daemons; |
63e2ebcd | 42 | #endif |
c064d8db ZJS |
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; | |
a812a881 | 49 | }; |
c064d8db ZJS |
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); | |
864876ec ZJS |
63 | int journal_remote_handle_raw_source( |
64 | sd_event_source *event, | |
65 | int fd, | |
66 | uint32_t revents, | |
67 | RemoteServer *s); | |
c064d8db ZJS |
68 | |
69 | RemoteServer* journal_remote_server_destroy(RemoteServer *s); |