/* session.h - authenticates and authorizes users with system * * Copyright (C) 2006 Ray Strode * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef GDM_SESSION_H #define GDM_SESSION_H #include #include G_BEGIN_DECLS #define GDM_TYPE_SESSION (gdm_session_get_type ()) #define GDM_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDM_TYPE_SESSION, GdmSession)) #define GDM_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_SESSION, GdmSessionClass)) #define GDM_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDM_TYPE_SESSION)) #define GDM_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_SESSION)) #define GDM_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_SESSION, GdmSessionClass)) #define GDM_SESSION_ERROR (gdm_session_error_quark ()) typedef struct _GdmSession GdmSession; typedef struct _GdmSessionClass GdmSessionClass; typedef enum _GdmSessionError GdmSessionError; /* opaque types */ typedef struct _GdmSessionPrivate GdmSessionPrivate; typedef struct _GdmSessionSession GdmSessionSession; struct _GdmSession { GObject parent; /*< private > */ GdmSessionPrivate *priv; }; struct _GdmSessionClass { GObjectClass parent_class; /* signals */ void (* user_verified) (GdmSession *session); void (* user_verification_error) (GdmSession *session, GError *error); void (* info_query) (GdmSession *session, const gchar *query_text); void (* secret_info_query) (GdmSession *session, const gchar *query_text); void (* info) (GdmSession *session, const gchar *info); void (* problem) (GdmSession *session, const gchar *problem); void (* session_started) (GdmSession *session, GPid pid); void (* session_startup_error) (GdmSession *session, GError *error); void (* session_exited) (GdmSession *session, gint exit_code); void (* session_died) (GdmSession *session, gint signal_number); }; enum _GdmSessionError { GDM_SESSION_ERROR_GENERIC = 0, GDM_SESSION_ERROR_WITH_SESSION_COMMAND, GDM_SESSION_ERROR_FORKING, GDM_SESSION_ERROR_OPENING_MESSAGE_PIPE, GDM_SESSION_ERROR_COMMUNICATING, GDM_SESSION_ERROR_WORKER_DIED, GDM_SESSION_ERROR_AUTHENTICATING, GDM_SESSION_ERROR_AUTHORIZING, GDM_SESSION_ERROR_OPENING_LOG_FILE, GDM_SESSION_ERROR_OPENING_SESSION, GDM_SESSION_ERROR_GIVING_CREDENTIALS }; GType gdm_session_get_type (void); GQuark gdm_session_error_quark (void); GdmSession *gdm_session_new (void) G_GNUC_MALLOC; gboolean gdm_session_open (GdmSession *session, const gchar *service_name, const gchar *hostname, const gchar *console_name, gint standard_output_fd, gint standard_error_fd, GError **error); gboolean gdm_session_open_for_user (GdmSession *session, const gchar *service_name, const char *username, const gchar *hostname, const gchar *console_name, gint standard_output_fd, gint standard_error_fd, GError **error); void gdm_session_start_program (GdmSession *session, const gchar * const * args); void gdm_session_set_environment_variable (GdmSession *session, const gchar *key, const gchar *value); void gdm_session_answer_query (GdmSession *session, const gchar *answer); gchar *gdm_session_get_username (GdmSession *session); void gdm_session_close (GdmSession *session); gboolean gdm_session_is_running (GdmSession *session); G_END_DECLS #endif /* GDM_SESSION_H */