]> git.proxmox.com Git - systemd.git/blob - src/bus-proxyd/proxy.h
Merge tag 'upstream/229'
[systemd.git] / src / bus-proxyd / proxy.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2014 David Herrmann
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include "sd-bus.h"
23
24 #include "bus-xml-policy.h"
25
26 typedef struct Proxy Proxy;
27 typedef struct ProxyActivation ProxyActivation;
28
29 #define PROXY_ACTIVATIONS_MAX (16) /* max parallel activation requests */
30
31 struct Proxy {
32 sd_bus *local_bus;
33 struct ucred local_creds;
34 int local_in;
35 int local_out;
36
37 sd_bus *destination_bus;
38
39 Set *owned_names;
40 SharedPolicy *policy;
41
42 LIST_HEAD(ProxyActivation, activations);
43 size_t n_activations;
44
45 bool got_hello : 1;
46 bool queue_overflow : 1;
47 bool message_matched : 1;
48 bool synthetic_matched : 1;
49 };
50
51 struct ProxyActivation {
52 LIST_FIELDS(ProxyActivation, activations_by_proxy);
53 Proxy *proxy;
54 sd_bus_message *request;
55 sd_bus_slot *slot;
56 };
57
58 int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest);
59 Proxy *proxy_free(Proxy *p);
60
61 int proxy_set_policy(Proxy *p, SharedPolicy *policy, char **configuration);
62 int proxy_hello_policy(Proxy *p, uid_t original_uid);
63 int proxy_match(sd_bus_message *m, void *userdata, sd_bus_error *error);
64 int proxy_run(Proxy *p);
65
66 DEFINE_TRIVIAL_CLEANUP_FUNC(Proxy*, proxy_free);