chiark / gitweb /
6aac650ac93a8e469e3cadfc97f51d34b756a99b
[elogind.git] / src / libelogind / sd-bus / bus-introspect.h
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
24 #include "sd-bus.h"
25 #include "bus-xml-policy.h"
26
27 typedef struct Proxy Proxy;
28 typedef struct ProxyActivation ProxyActivation;
29
30 #define PROXY_ACTIVATIONS_MAX (16) /* max parallel activation requests */
31
32 struct Proxy {
33         sd_bus *local_bus;
34         struct ucred local_creds;
35         int local_in;
36         int local_out;
37
38         sd_bus *destination_bus;
39
40         Set *owned_names;
41         SharedPolicy *policy;
42
43         LIST_HEAD(ProxyActivation, activations);
44         size_t n_activations;
45
46         bool got_hello : 1;
47         bool queue_overflow : 1;
48         bool message_matched : 1;
49         bool synthetic_matched : 1;
50 };
51
52 struct ProxyActivation {
53         LIST_FIELDS(ProxyActivation, activations_by_proxy);
54         Proxy *proxy;
55         sd_bus_message *request;
56         sd_bus_slot *slot;
57 };
58
59 int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest);
60 Proxy *proxy_free(Proxy *p);
61
62 int proxy_set_policy(Proxy *p, SharedPolicy *policy, char **configuration);
63 int proxy_hello_policy(Proxy *p, uid_t original_uid);
64 int proxy_match(sd_bus_message *m, void *userdata, sd_bus_error *error);
65 int proxy_run(Proxy *p);
66
67 DEFINE_TRIVIAL_CLEANUP_FUNC(Proxy*, proxy_free);