]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/session.h
Remove MirServer class and connect Mir sessions directly to UnitySystemCompositor
[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 typedef struct Session Session;
20
21 #include "session-config.h"
22 #include "display-server.h"
23 #include "accounts.h"
24 #include "x-authority.h"
25 #include "logger.h"
26 #include "log-file.h"
27
28 G_BEGIN_DECLS
29
30 #define SESSION_TYPE           (session_get_type())
31 #define SESSION(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE, Session))
32 #define SESSION_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass))
33 #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass))
34
35 #define SESSION_SIGNAL_GOT_MESSAGES            "got-messages"
36 #define SESSION_SIGNAL_AUTHENTICATION_COMPLETE "authentication-complete"
37 #define SESSION_SIGNAL_STOPPED                 "stopped"
38
39 typedef struct SessionPrivate SessionPrivate;
40
41 struct Session
42 {
43     GObject         parent_instance;
44     SessionPrivate *priv;
45 };
46
47 typedef struct
48 {
49     GObjectClass parent_class;
50
51     gboolean (*start)(Session *session);
52     void (*run)(Session *session);
53     void (*stop)(Session *session);
54
55     void (*got_messages)(Session *session);
56     void (*authentication_complete)(Session *session);
57     void (*stopped)(Session *session);
58 } SessionClass;
59
60 typedef enum
61 {
62     SESSION_TYPE_LOCAL,
63     SESSION_TYPE_REMOTE
64 } SessionType;
65
66 GType session_get_type (void);
67
68 Session *session_new (void);
69
70 void session_set_config (Session *session, SessionConfig *config);
71
72 SessionConfig *session_get_config (Session *session);
73
74 const gchar *session_get_session_type (Session *session);
75
76 void session_set_pam_service (Session *session, const gchar *pam_service);
77
78 void session_set_username (Session *session, const gchar *username);
79
80 void session_set_do_authenticate (Session *session, gboolean do_authenticate);
81
82 void session_set_is_interactive (Session *session, gboolean is_interactive);
83
84 void session_set_is_guest (Session *session, gboolean is_guest);
85
86 gboolean session_get_is_guest (Session *session);
87
88 void session_set_log_file (Session *session, const gchar *filename, LogMode log_mode);
89
90 void session_set_display_server (Session *session, DisplayServer *display_server);
91
92 DisplayServer *session_get_display_server (Session *session);
93
94 void session_set_tty (Session *session, const gchar *tty);
95
96 void session_set_xdisplay (Session *session, const gchar *xdisplay);
97
98 void session_set_x_authority (Session *session, XAuthority *authority, gboolean use_system_location);
99
100 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
101
102 void session_set_env (Session *session, const gchar *name, const gchar *value);
103
104 const gchar *session_get_env (Session *session, const gchar *name);
105
106 void session_unset_env (Session *session, const gchar *name);
107
108 void session_set_argv (Session *session, gchar **argv);
109
110 // FIXME: Remove
111 User *session_get_user (Session *session);
112
113 gboolean session_start (Session *session);
114
115 gboolean session_get_is_started (Session *session);
116
117 const gchar *session_get_username (Session *session);
118
119 const gchar *session_get_login1_session_id (Session *session);
120
121 const gchar *session_get_console_kit_cookie (Session *session);
122
123 void session_respond (Session *session, struct pam_response *response);
124
125 void session_respond_error (Session *session, int error);
126
127 int session_get_messages_length (Session *session);
128
129 const struct pam_message *session_get_messages (Session *session);
130
131 gboolean session_get_is_authenticated (Session *session);
132
133 int session_get_authentication_result (Session *session);
134
135 const gchar *session_get_authentication_result_string (Session *session);
136
137 void session_run (Session *session);
138
139 gboolean session_get_is_run (Session *session);
140
141 void session_lock (Session *session);
142
143 void session_unlock (Session *session);
144
145 void session_activate (Session *session);
146
147 void session_stop (Session *session);
148
149 gboolean session_get_is_stopping (Session *session);
150
151 G_END_DECLS
152
153 #endif /* SESSION_H_ */