2 * Copyright (C) 2010-2011 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
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
15 #include <glib-object.h>
17 #include <security/pam_appl.h>
19 #include "display-server.h"
21 #include "xauthority.h"
25 #define SESSION_TYPE (session_get_type())
26 #define SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SESSION_TYPE, Session))
27 #define SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass))
28 #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass))
30 typedef struct SessionPrivate SessionPrivate;
34 GObject parent_instance;
40 GObjectClass parent_class;
42 void (*got_messages)(Session *session);
43 void (*authentication_complete)(Session *session);
44 void (*stopped)(Session *session);
45 void (*set_display_server)(Session *session, DisplayServer *display_server);
54 #define XDG_SESSION_CLASS_USER "user"
55 #define XDG_SESSION_CLASS_GREETER "greeter"
56 #define XDG_SESSION_CLASS_LOCK_SCREEN "lock-screen"
58 GType session_get_type (void);
60 void session_set_log_file (Session *session, const gchar *filename);
62 void session_set_class (Session *session, const gchar *class);
64 void session_set_display_server (Session *session, DisplayServer *display_server);
66 void session_set_tty (Session *session, const gchar *tty);
68 void session_set_xdisplay (Session *session, const gchar *xdisplay);
70 void session_set_xauthority (Session *session, XAuthority *authority, gboolean use_system_location);
72 void session_set_remote_host_name (Session *session, const gchar *remote_host_name);
74 void session_set_env (Session *session, const gchar *name, const gchar *value);
77 User *session_get_user (Session *session);
79 gboolean session_start (Session *session, const gchar *service, const gchar *username, gboolean do_authenticate, gboolean is_interactive, gboolean is_guest);
81 const gchar *session_get_username (Session *session);
83 const gchar *session_get_console_kit_cookie (Session *session);
85 void session_respond (Session *session, struct pam_response *response);
87 void session_respond_error (Session *session, int error);
89 int session_get_messages_length (Session *session);
91 const struct pam_message *session_get_messages (Session *session);
93 gboolean session_get_is_authenticated (Session *session);
95 int session_get_authentication_result (Session *session);
97 const gchar *session_get_authentication_result_string (Session *session);
99 void session_run (Session *session, gchar **argv);
101 void session_lock (Session *session);
103 void session_unlock (Session *session);
105 void session_stop (Session *session);
107 gboolean session_get_is_stopped (Session *session);
111 #endif /* SESSION_H_ */