]> git.proxmox.com Git - systemd.git/blob - src/journal-remote/journal-remote.h
New upstream version 249~rc1
[systemd.git] / src / journal-remote / journal-remote.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
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 active;
27
28 sd_event *events;
29 sd_event_source *sigterm_event, *sigint_event, *listen_event;
30
31 Hashmap *writers;
32 Writer *_single_writer;
33 uint64_t event_count;
34
35 #if HAVE_MICROHTTPD
36 Hashmap *daemons;
37 #endif
38 const char *output; /* either the output file or directory */
39
40 JournalWriteSplitMode split_mode;
41 bool compress;
42 bool seal;
43 bool check_trust;
44 };
45 extern RemoteServer *journal_remote_server_global;
46
47 int journal_remote_server_init(
48 RemoteServer *s,
49 const char *output,
50 JournalWriteSplitMode split_mode,
51 bool compress,
52 bool seal);
53
54 int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer);
55
56 int journal_remote_add_source(RemoteServer *s, int fd, char* name, bool own_name);
57 int journal_remote_add_raw_socket(RemoteServer *s, int fd);
58 int journal_remote_handle_raw_source(
59 sd_event_source *event,
60 int fd,
61 uint32_t revents,
62 RemoteServer *s);
63
64 void journal_remote_server_destroy(RemoteServer *s);