]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/session.h
Start work on Mir sessions
[sojka/lightdm.git] / src / session.h
1 /*
2  * Copyright (C) 2010-2011 Robert Ancell.
3  * Author: Robert Ancell <robert.ancell@canonical.com>
4  * 
5  * This program is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9  * license.
10  */
11
12 #ifndef SESSION_H_
13 #define SESSION_H_
14
15 #include <glib-object.h>
16
17 #include <security/pam_appl.h>
18
19 #include "accounts.h"
20 #include "xauthority.h"
21
22 G_BEGIN_DECLS
23
24 #define SESSION_TYPE           (session_get_type())
25 #define SESSION(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE, Session))
26 #define SESSION_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass))
27 #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass))
28
29 typedef struct SessionPrivate SessionPrivate;
30
31 typedef struct
32 {
33     GObject         parent_instance;
34     SessionPrivate *priv;
35 } Session;
36
37 typedef struct
38 {
39     GObjectClass parent_class;
40
41     void (*got_messages)(Session *session);
42     void (*authentication_complete)(Session *session);
43     void (*stopped)(Session *session);
44 } SessionClass;
45
46 typedef enum
47 {
48     SESSION_TYPE_LOCAL,
49     SESSION_TYPE_REMOTE,
50     SESSION_TYPE_MIR
51 } SessionType;
52
53 #define XDG_SESSION_CLASS_USER        "user"
54 #define XDG_SESSION_CLASS_GREETER     "greeter"
55 #define XDG_SESSION_CLASS_LOCK_SCREEN "lock-screen"
56
57 GType session_get_type (void);
58
59 void session_set_log_file (Session *session, const gchar *filename);
60
61 void session_set_class (Session *session, const gchar *class);
62
63 void session_set_tty (Session *session, const gchar *tty);
64
65 void session_set_xdisplay (Session *session, const gchar *xdisplay);
66
67 void session_set_xauthority (Session *session, XAuthority *authority, gboolean use_system_location);
68
69 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
70
71 void session_set_env (Session *session, const gchar *name, const gchar *value);
72
73 // FIXME: Remove
74 User *session_get_user (Session *session);
75
76 gboolean session_start (Session *session, const gchar *service, const gchar *username, gboolean do_authenticate, gboolean is_interactive, gboolean is_guest);
77
78 const gchar *session_get_username (Session *session);
79
80 const gchar *session_get_console_kit_cookie (Session *session);
81
82 void session_respond (Session *session, struct pam_response *response);
83
84 void session_respond_error (Session *session, int error);
85
86 int session_get_messages_length (Session *session);
87
88 const struct pam_message *session_get_messages (Session *session);
89
90 gboolean session_get_is_authenticated (Session *session);
91
92 int session_get_authentication_result (Session *session);
93
94 const gchar *session_get_authentication_result_string (Session *session);
95
96 void session_run (Session *session, gchar **argv);
97
98 void session_lock (Session *session);
99
100 void session_unlock (Session *session);
101
102 void session_stop (Session *session);
103
104 gboolean session_get_is_stopped (Session *session);
105
106 G_END_DECLS
107
108 #endif /* SESSION_H_ */