]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/journal-remote/journal-remote.h
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / src / journal-remote / journal-remote.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "sd-event.h"
5
6 #include "hashmap.h"
7 #include "journal-remote-parse.h"
8 #include "journal-remote-write.h"
9
10 #if HAVE_MICROHTTPD
11 #include "microhttpd-util.h"
12
13 typedef struct MHDDaemonWrapper MHDDaemonWrapper;
14
15 struct MHDDaemonWrapper {
16 uint64_t fd;
17 struct MHD_Daemon *daemon;
18
19 sd_event_source *io_event;
20 sd_event_source *timer_event;
21 };
22 #endif
23
24 struct RemoteServer {
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
36 #if HAVE_MICROHTTPD
37 Hashmap *daemons;
38 #endif
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;
45 };
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);
59 int journal_remote_handle_raw_source(
60 sd_event_source *event,
61 int fd,
62 uint32_t revents,
63 RemoteServer *s);
64
65 RemoteServer* journal_remote_server_destroy(RemoteServer *s);