]>
Commit | Line | Data |
---|---|---|
e821075a 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 2013 Lennart Poettering | |
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 | typedef struct BusName BusName; | |
54d76c92 | 25 | typedef struct BusNamePolicy BusNamePolicy; |
e821075a LP |
26 | |
27 | #include "unit.h" | |
5369c77d | 28 | #include "bus-common.h" |
e821075a LP |
29 | |
30 | typedef enum BusNameState { | |
31 | BUSNAME_DEAD, | |
a4152e3f | 32 | BUSNAME_MAKING, |
5892a914 | 33 | BUSNAME_REGISTERED, |
e821075a LP |
34 | BUSNAME_LISTENING, |
35 | BUSNAME_RUNNING, | |
a4152e3f LP |
36 | BUSNAME_SIGTERM, |
37 | BUSNAME_SIGKILL, | |
e821075a LP |
38 | BUSNAME_FAILED, |
39 | _BUSNAME_STATE_MAX, | |
40 | _BUSNAME_STATE_INVALID = -1 | |
41 | } BusNameState; | |
42 | ||
43 | typedef enum BusNameResult { | |
44 | BUSNAME_SUCCESS, | |
45 | BUSNAME_FAILURE_RESOURCES, | |
a4152e3f LP |
46 | BUSNAME_FAILURE_TIMEOUT, |
47 | BUSNAME_FAILURE_EXIT_CODE, | |
48 | BUSNAME_FAILURE_SIGNAL, | |
49 | BUSNAME_FAILURE_CORE_DUMP, | |
e821075a LP |
50 | BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT, |
51 | _BUSNAME_RESULT_MAX, | |
52 | _BUSNAME_RESULT_INVALID = -1 | |
53 | } BusNameResult; | |
54 | ||
54d76c92 DM |
55 | typedef enum BusNamePolicyType { |
56 | BUSNAME_POLICY_TYPE_USER, | |
57 | BUSNAME_POLICY_TYPE_GROUP, | |
54d76c92 DM |
58 | _BUSNAME_POLICY_TYPE_MAX, |
59 | _BUSNAME_POLICY_TYPE_INVALID = -1 | |
60 | } BusNamePolicyType; | |
61 | ||
54d76c92 DM |
62 | struct BusNamePolicy { |
63 | BusNamePolicyType type; | |
5369c77d | 64 | BusPolicyAccess access; |
54d76c92 | 65 | |
a4152e3f | 66 | char *name; |
54d76c92 DM |
67 | |
68 | LIST_FIELDS(BusNamePolicy, policy); | |
e821075a LP |
69 | }; |
70 | ||
a4152e3f LP |
71 | struct BusName { |
72 | Unit meta; | |
73 | ||
74 | char *name; | |
75 | int starter_fd; | |
76 | ||
77 | bool activating; | |
78 | bool accept_fd; | |
79 | ||
80 | UnitRef service; | |
81 | ||
82 | BusNameState state, deserialized_state; | |
83 | BusNameResult result; | |
84 | ||
85 | usec_t timeout_usec; | |
86 | ||
87 | sd_event_source *starter_event_source; | |
88 | sd_event_source *timer_event_source; | |
89 | ||
90 | pid_t control_pid; | |
91 | ||
92 | LIST_HEAD(BusNamePolicy, policy); | |
5369c77d | 93 | BusPolicyAccess policy_world; |
a4152e3f LP |
94 | }; |
95 | ||
e821075a LP |
96 | extern const UnitVTable busname_vtable; |
97 | ||
98 | const char* busname_state_to_string(BusNameState i) _const_; | |
99 | BusNameState busname_state_from_string(const char *s) _pure_; | |
100 | ||
101 | const char* busname_result_to_string(BusNameResult i) _const_; | |
102 | BusNameResult busname_result_from_string(const char *s) _pure_; |