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