chiark / gitweb /
logind: refuse operations if the target unit is masked or unavailable
[elogind.git] / src / login / logind-action.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   This file is part of systemd.
6
7   Copyright 2012 Lennart Poettering
8
9   elogind is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as published by
11   the Free Software Foundation; either version 2.1 of the License, or
12   (at your option) any later version.
13
14   elogind is distributed in the hope that it will be useful, but
15   WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   Lesser General Public License for more details.
18
19   You should have received a copy of the GNU Lesser General Public License
20   along with elogind; If not, see <http://www.gnu.org/licenses/>.
21 ***/
22
23 typedef enum HandleAction {
24         HANDLE_IGNORE,
25         HANDLE_POWEROFF,
26         HANDLE_REBOOT,
27         HANDLE_HALT,
28         HANDLE_KEXEC,
29         HANDLE_SUSPEND,
30         HANDLE_HIBERNATE,
31         HANDLE_HYBRID_SLEEP,
32         HANDLE_SUSPEND_THEN_HIBERNATE,
33         HANDLE_LOCK,
34         _HANDLE_ACTION_MAX,
35         _HANDLE_ACTION_INVALID = -1
36 } HandleAction;
37
38 #include "logind-inhibit.h"
39 #include "logind.h"
40
41 int manager_handle_action(
42                 Manager *m,
43                 InhibitWhat inhibit_key,
44                 HandleAction handle,
45                 bool ignore_inhibited,
46                 bool is_edge);
47
48 const char* handle_action_to_string(HandleAction h) _const_;
49 HandleAction handle_action_from_string(const char *s) _pure_;
50
51 const char* manager_target_for_action(HandleAction handle);
52 int config_parse_handle_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);