]>
Commit | Line | Data |
---|---|---|
18d70381 LP |
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 Daniel Mack | |
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 "list.h" | |
25 | #include "macro.h" | |
26 | #include "kdbus.h" | |
27 | ||
28 | typedef struct BusNamePolicy BusNamePolicy; | |
29 | ||
30 | typedef 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; | |
37 | ||
38 | typedef 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 | ||
45 | struct BusNamePolicy { | |
46 | BusNamePolicyType type; | |
47 | BusPolicyAccess access; | |
48 | ||
49 | char *name; | |
50 | ||
51 | LIST_FIELDS(BusNamePolicy, policy); | |
52 | }; | |
53 | ||
54 | int bus_kernel_translate_access(BusPolicyAccess access); | |
55 | int bus_kernel_translate_policy(const BusNamePolicy *policy, struct kdbus_item *item); | |
56 | ||
57 | const char* bus_policy_access_to_string(BusPolicyAccess i) _const_; | |
58 | BusPolicyAccess bus_policy_access_from_string(const char *s) _pure_; | |
59 | ||
60 | int 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); |