]> git.proxmox.com Git - systemd.git/blame - src/core/bus-policy.h
Imported Upstream version 228
[systemd.git] / src / core / bus-policy.h
CommitLineData
663996b3
MS
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
5eef597e 8 Copyright 2014 Daniel Mack
663996b3
MS
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
e735f4d4
MP
24#include "list.h"
25#include "macro.h"
26#include "kdbus.h"
27
28typedef struct BusNamePolicy BusNamePolicy;
29
5eef597e
MP
30typedef enum BusPolicyAccess {
31 BUS_POLICY_ACCESS_SEE,
32 BUS_POLICY_ACCESS_TALK,
33 BUS_POLICY_ACCESS_OWN,
34 _BUS_POLICY_ACCESS_MAX,
35 _BUS_POLICY_ACCESS_INVALID = -1
36} BusPolicyAccess;
60f067b4 37
e735f4d4
MP
38typedef enum BusNamePolicyType {
39 BUSNAME_POLICY_TYPE_USER,
40 BUSNAME_POLICY_TYPE_GROUP,
41 _BUSNAME_POLICY_TYPE_MAX,
42 _BUSNAME_POLICY_TYPE_INVALID = -1
43} BusNamePolicyType;
44
45struct BusNamePolicy {
46 BusNamePolicyType type;
47 BusPolicyAccess access;
48
49 char *name;
50
51 LIST_FIELDS(BusNamePolicy, policy);
52};
53
54int bus_kernel_translate_access(BusPolicyAccess access);
55int bus_kernel_translate_policy(const BusNamePolicy *policy, struct kdbus_item *item);
56
5eef597e
MP
57const char* bus_policy_access_to_string(BusPolicyAccess i) _const_;
58BusPolicyAccess bus_policy_access_from_string(const char *s) _pure_;
e735f4d4
MP
59
60int bus_kernel_make_starter(
61 int fd,
62 const char *name,
63 bool activating,
64 bool accept_fd,
65 BusNamePolicy *policy,
66 BusPolicyAccess world_policy);