]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/bus-proxyd/proxy.h
Merge pull request #1668 from ssahani/net1
[thirdparty/systemd.git] / src / bus-proxyd / proxy.h
CommitLineData
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
28typedef struct Proxy Proxy;
11f254be
DH
29typedef struct ProxyActivation ProxyActivation;
30
31#define PROXY_ACTIVATIONS_MAX (16) /* max parallel activation requests */
c0395aeb
DH
32
33struct 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
53struct 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
60int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest);
61Proxy *proxy_free(Proxy *p);
62
c4bc1a84 63int proxy_set_policy(Proxy *p, SharedPolicy *policy, char **configuration);
c0395aeb 64int proxy_hello_policy(Proxy *p, uid_t original_uid);
e23bc0e7 65int proxy_match(sd_bus_message *m, void *userdata, sd_bus_error *error);
c0395aeb
DH
66int proxy_run(Proxy *p);
67
68DEFINE_TRIVIAL_CLEANUP_FUNC(Proxy*, proxy_free);