logind-session.h revision c529695e7a30b300fdaa61ace4a8a4ed0e94ad1c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "list.h"
#include "util.h"
#include "logind.h"
#include "logind-seat.h"
#include "logind-session-device.h"
#include "logind-user.h"
#include "login-shared.h"
typedef enum SessionState {
SESSION_OPENING, /* Session scope is being created */
SESSION_ONLINE, /* Logged in */
SESSION_ACTIVE, /* Logged in and in the fg */
SESSION_CLOSING, /* Logged out, but scope is still there */
} SessionState;
typedef enum SessionClass {
} SessionClass;
typedef enum SessionType {
} SessionType;
enum KillWho {
_KILL_WHO_INVALID = -1
};
struct Session {
const char *id;
unsigned int pos;
char *state_file;
char *tty;
char *display;
bool remote;
char *remote_user;
char *remote_host;
char *service;
char *desktop;
char *scope;
char *scope_job;
unsigned int vtnr;
int vtfd;
int fifo_fd;
char *fifo_path;
bool idle_hint;
bool in_gc_queue:1;
bool started:1;
bool stopping:1;
char *controller;
};
void session_free(Session *s);
void session_add_to_gc_queue(Session *s);
int session_activate(Session *s);
bool session_is_active(Session *s);
void session_set_idle_hint(Session *s, bool b);
int session_create_fifo(Session *s);
int session_start(Session *s);
int session_finalize(Session *s);
void session_release(Session *s);
int session_save(Session *s);
int session_load(Session *s);
extern const sd_bus_vtable session_vtable[];
int session_node_enumerator(sd_bus *bus, const char *path,void *userdata, char ***nodes, sd_bus_error *error);
int session_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
char *session_bus_path(Session *s);
int session_prepare_vt(Session *s);
void session_restore_vt(Session *s);
void session_leave_vt(Session *s);
void session_drop_controller(Session *s);
int bus_session_method_activate(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
int bus_session_method_lock(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
int bus_session_method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
int bus_session_method_kill(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);