chiark / gitweb /
08994fe50227dc08d4a206a631655c994acc780e
[elogind.git] / src / bus-proxyd / proxy.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 <stdlib.h>
25 #include "sd-bus.h"
26 #include "bus-xml-policy.h"
27 #include "util.h"
28
29 typedef struct Proxy Proxy;
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 *dest_bus;
38
39         Set *owned_names;
40         Policy policy_buffer;
41         Policy *policy;
42
43         bool got_hello : 1;
44 };
45
46 int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest);
47 Proxy *proxy_free(Proxy *p);
48
49 int proxy_load_policy(Proxy *p, char **configuration);
50 int proxy_hello_policy(Proxy *p, uid_t original_uid);
51 int proxy_run(Proxy *p);
52
53 DEFINE_TRIVIAL_CLEANUP_FUNC(Proxy*, proxy_free);