]> git.proxmox.com Git - systemd.git/blame - src/core/bus-policy.h
Merge tag 'upstream/229'
[systemd.git] / src / core / bus-policy.h
CommitLineData
663996b3
MS
1#pragma once
2
3/***
4 This file is part of systemd.
5
5eef597e 6 Copyright 2014 Daniel Mack
663996b3
MS
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
4c89c718 22#include "kdbus.h"
e735f4d4
MP
23#include "list.h"
24#include "macro.h"
e735f4d4
MP
25
26typedef struct BusNamePolicy BusNamePolicy;
27
5eef597e
MP
28typedef enum BusPolicyAccess {
29 BUS_POLICY_ACCESS_SEE,
30 BUS_POLICY_ACCESS_TALK,
31 BUS_POLICY_ACCESS_OWN,
32 _BUS_POLICY_ACCESS_MAX,
33 _BUS_POLICY_ACCESS_INVALID = -1
34} BusPolicyAccess;
60f067b4 35
e735f4d4
MP
36typedef enum BusNamePolicyType {
37 BUSNAME_POLICY_TYPE_USER,
38 BUSNAME_POLICY_TYPE_GROUP,
39 _BUSNAME_POLICY_TYPE_MAX,
40 _BUSNAME_POLICY_TYPE_INVALID = -1
41} BusNamePolicyType;
42
43struct BusNamePolicy {
44 BusNamePolicyType type;
45 BusPolicyAccess access;
46
47 char *name;
48
49 LIST_FIELDS(BusNamePolicy, policy);
50};
51
52int bus_kernel_translate_access(BusPolicyAccess access);
53int bus_kernel_translate_policy(const BusNamePolicy *policy, struct kdbus_item *item);
54
5eef597e
MP
55const char* bus_policy_access_to_string(BusPolicyAccess i) _const_;
56BusPolicyAccess bus_policy_access_from_string(const char *s) _pure_;
e735f4d4
MP
57
58int bus_kernel_make_starter(
59 int fd,
60 const char *name,
61 bool activating,
62 bool accept_fd,
63 BusNamePolicy *policy,
64 BusPolicyAccess world_policy);