]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind-session.h
update TODO
[thirdparty/systemd.git] / src / login / logind-session.h
CommitLineData
90821c93
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
c2f1db8f 3#pragma once
90821c93
LP
4
5/***
6 This file is part of systemd.
7
8 Copyright 2011 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
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
90821c93
LP
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
5430f7f2 18 Lesser General Public License for more details.
90821c93 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
90821c93
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24typedef struct Session Session;
25
26#include "list.h"
27#include "util.h"
28#include "logind.h"
29#include "logind-seat.h"
30#include "logind-user.h"
31
0604381b
LP
32typedef enum SessionState {
33 SESSION_ONLINE, /* Logged in */
34 SESSION_ACTIVE, /* Logged in and in the fg */
35 SESSION_CLOSING, /* Logged out, but processes still remain */
36 _SESSION_STATE_MAX,
37 _SESSION_STATE_INVALID = -1
38} SessionState;
39
90821c93 40typedef enum SessionType {
a91e4e53 41 SESSION_UNSPECIFIED,
3f49d45a 42 SESSION_TTY,
90821c93
LP
43 SESSION_X11,
44 _SESSION_TYPE_MAX,
45 _SESSION_TYPE_INVALID = -1
46} SessionType;
47
55efac6c
LP
48typedef enum SessionClass {
49 SESSION_USER,
50 SESSION_GREETER,
51 SESSION_LOCK_SCREEN,
52 _SESSION_CLASS_MAX,
53 _SESSION_CLASS_INVALID = -1
54} SessionClass;
55
de07ab16
LP
56typedef enum KillWho {
57 KILL_LEADER,
58 KILL_ALL,
59 _KILL_WHO_MAX,
60 _KILL_WHO_INVALID = -1
61} KillWho;
62
90821c93
LP
63struct Session {
64 Manager *manager;
65
66 char *id;
67 SessionType type;
55efac6c 68 SessionClass class;
90821c93
LP
69
70 char *state_file;
71
72 User *user;
73
74 dual_timestamp timestamp;
75
76 char *tty;
77 char *display;
78
79 bool remote;
3f49d45a 80 char *remote_user;
90821c93
LP
81 char *remote_host;
82
98a28fef
LP
83 char *service;
84
90821c93
LP
85 int vtnr;
86 Seat *seat;
87
88 pid_t leader;
3f49d45a 89 uint32_t audit_id;
90821c93 90
932e3ee7
LP
91 int fifo_fd;
92 char *fifo_path;
90821c93
LP
93
94 char *cgroup_path;
95 char **controllers, **reset_controllers;
96
a185c5aa
LP
97 bool idle_hint;
98 dual_timestamp idle_hint_timestamp;
99
3f49d45a 100 bool kill_processes;
14c3baca 101 bool in_gc_queue:1;
9418f147 102 bool started:1;
90821c93
LP
103
104 LIST_FIELDS(Session, sessions_by_user);
105 LIST_FIELDS(Session, sessions_by_seat);
14c3baca
LP
106
107 LIST_FIELDS(Session, gc_queue);
90821c93
LP
108};
109
110Session *session_new(Manager *m, User *u, const char *id);
111void session_free(Session *s);
4a4b033f 112int session_check_gc(Session *s, bool drop_not_started);
14c3baca 113void session_add_to_gc_queue(Session *s);
90821c93
LP
114int session_activate(Session *s);
115bool session_is_active(Session *s);
a185c5aa 116int session_get_idle_hint(Session *s, dual_timestamp *t);
bef422ae 117void session_set_idle_hint(Session *s, bool b);
932e3ee7
LP
118int session_create_fifo(Session *s);
119void session_remove_fifo(Session *s);
90821c93
LP
120int session_start(Session *s);
121int session_stop(Session *s);
122int session_save(Session *s);
123int session_load(Session *s);
de07ab16 124int session_kill(Session *s, KillWho who, int signo);
90821c93 125
3f49d45a
LP
126char *session_bus_path(Session *s);
127
0604381b
LP
128SessionState session_get_state(Session *u);
129
3f49d45a
LP
130extern const DBusObjectPathVTable bus_session_vtable;
131
da119395 132int session_send_signal(Session *s, bool new_session);
9418f147 133int session_send_changed(Session *s, const char *properties);
88e3dc90 134int session_send_lock(Session *s, bool lock);
7ba64386 135int session_send_lock_all(Manager *m, bool lock);
da119395 136
0604381b
LP
137const char* session_state_to_string(SessionState t);
138SessionState session_state_from_string(const char *s);
139
90821c93
LP
140const char* session_type_to_string(SessionType t);
141SessionType session_type_from_string(const char *s);
142
55efac6c
LP
143const char* session_class_to_string(SessionClass t);
144SessionClass session_class_from_string(const char *s);
145
de07ab16
LP
146const char *kill_who_to_string(KillWho k);
147KillWho kill_who_from_string(const char *s);