]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/journal-remote/journal-remote.h
journal-remote: split out µhttpd support and main() into a separate file
[thirdparty/systemd.git] / src / journal-remote / journal-remote.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2014 Zbigniew Jędrzejewski-Szmek
8 ***/
9
10 #include "sd-event.h"
11
12 #include "hashmap.h"
13 #include "journal-remote-parse.h"
14 #include "journal-remote-write.h"
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
27 struct RemoteServer {
28 RemoteSource **sources;
29 size_t sources_size;
30 size_t active;
31
32 sd_event *events;
33 sd_event_source *sigterm_event, *sigint_event, *listen_event;
34
35 Hashmap *writers;
36 Writer *_single_writer;
37 uint64_t event_count;
38
39 Hashmap *daemons;
40
41 const char *output; /* either the output file or directory */
42
43 JournalWriteSplitMode split_mode;
44 bool compress;
45 bool seal;
46 bool check_trust;
47 };
48 extern RemoteServer *journal_remote_server_global;
49
50 int journal_remote_server_init(
51 RemoteServer *s,
52 const char *output,
53 JournalWriteSplitMode split_mode,
54 bool compress,
55 bool seal);
56
57 int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer);
58
59 int journal_remote_add_source(RemoteServer *s, int fd, char* name, bool own_name);
60 int journal_remote_add_raw_socket(RemoteServer *s, int fd);
61
62 RemoteServer* journal_remote_server_destroy(RemoteServer *s);