Add a test for the previous fix
[glib.git] / gio / gdbusauthmechanism.h
blob44829c0e59e8ff3a4c23f41e6c2ae71726bd0452
1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: David Zeuthen <davidz@redhat.com>
23 #if !defined (GIO_COMPILATION)
24 #error "gdbusauthmechanism.h is a private header file."
25 #endif
27 #ifndef __G_DBUS_AUTH_MECHANISM_H__
28 #define __G_DBUS_AUTH_MECHANISM_H__
30 #include <gio/giotypes.h>
32 G_BEGIN_DECLS
34 #define G_TYPE_DBUS_AUTH_MECHANISM (_g_dbus_auth_mechanism_get_type ())
35 #define G_DBUS_AUTH_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanism))
36 #define G_DBUS_AUTH_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanismClass))
37 #define G_DBUS_AUTH_MECHANISM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanismClass))
38 #define G_IS_DBUS_AUTH_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_AUTH_MECHANISM))
39 #define G_IS_DBUS_AUTH_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_AUTH_MECHANISM))
41 typedef struct _GDBusAuthMechanism GDBusAuthMechanism;
42 typedef struct _GDBusAuthMechanismClass GDBusAuthMechanismClass;
43 typedef struct _GDBusAuthMechanismPrivate GDBusAuthMechanismPrivate;
45 typedef enum {
46 G_DBUS_AUTH_MECHANISM_STATE_INVALID,
47 G_DBUS_AUTH_MECHANISM_STATE_WAITING_FOR_DATA,
48 G_DBUS_AUTH_MECHANISM_STATE_HAVE_DATA_TO_SEND,
49 G_DBUS_AUTH_MECHANISM_STATE_REJECTED,
50 G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED,
51 } GDBusAuthMechanismState;
53 struct _GDBusAuthMechanismClass
55 /*< private >*/
56 GObjectClass parent_class;
58 /*< public >*/
60 /* VTable */
62 /* TODO: server_initiate and client_initiate probably needs to have a
63 * GCredentials parameter...
66 gint (*get_priority) (void);
67 const gchar *(*get_name) (void);
69 /* functions shared by server/client */
70 gboolean (*is_supported) (GDBusAuthMechanism *mechanism);
71 gchar *(*encode_data) (GDBusAuthMechanism *mechanism,
72 const gchar *data,
73 gsize data_len,
74 gsize *out_data_len);
75 gchar *(*decode_data) (GDBusAuthMechanism *mechanism,
76 const gchar *data,
77 gsize data_len,
78 gsize *out_data_len);
80 /* functions for server-side authentication */
81 GDBusAuthMechanismState (*server_get_state) (GDBusAuthMechanism *mechanism);
82 void (*server_initiate) (GDBusAuthMechanism *mechanism,
83 const gchar *initial_response,
84 gsize initial_response_len);
85 void (*server_data_receive) (GDBusAuthMechanism *mechanism,
86 const gchar *data,
87 gsize data_len);
88 gchar *(*server_data_send) (GDBusAuthMechanism *mechanism,
89 gsize *out_data_len);
90 gchar *(*server_get_reject_reason) (GDBusAuthMechanism *mechanism);
91 void (*server_shutdown) (GDBusAuthMechanism *mechanism);
93 /* functions for client-side authentication */
94 GDBusAuthMechanismState (*client_get_state) (GDBusAuthMechanism *mechanism);
95 gchar *(*client_initiate) (GDBusAuthMechanism *mechanism,
96 gsize *out_initial_response_len);
97 void (*client_data_receive) (GDBusAuthMechanism *mechanism,
98 const gchar *data,
99 gsize data_len);
100 gchar *(*client_data_send) (GDBusAuthMechanism *mechanism,
101 gsize *out_data_len);
102 void (*client_shutdown) (GDBusAuthMechanism *mechanism);
105 struct _GDBusAuthMechanism
107 GObject parent_instance;
108 GDBusAuthMechanismPrivate *priv;
111 GType _g_dbus_auth_mechanism_get_type (void) G_GNUC_CONST;
113 gint _g_dbus_auth_mechanism_get_priority (GType mechanism_type);
114 const gchar *_g_dbus_auth_mechanism_get_name (GType mechanism_type);
116 GIOStream *_g_dbus_auth_mechanism_get_stream (GDBusAuthMechanism *mechanism);
117 GCredentials *_g_dbus_auth_mechanism_get_credentials (GDBusAuthMechanism *mechanism);
119 gboolean _g_dbus_auth_mechanism_is_supported (GDBusAuthMechanism *mechanism);
120 gchar *_g_dbus_auth_mechanism_encode_data (GDBusAuthMechanism *mechanism,
121 const gchar *data,
122 gsize data_len,
123 gsize *out_data_len);
124 gchar *_g_dbus_auth_mechanism_decode_data (GDBusAuthMechanism *mechanism,
125 const gchar *data,
126 gsize data_len,
127 gsize *out_data_len);
129 GDBusAuthMechanismState _g_dbus_auth_mechanism_server_get_state (GDBusAuthMechanism *mechanism);
130 void _g_dbus_auth_mechanism_server_initiate (GDBusAuthMechanism *mechanism,
131 const gchar *initial_response,
132 gsize initial_response_len);
133 void _g_dbus_auth_mechanism_server_data_receive (GDBusAuthMechanism *mechanism,
134 const gchar *data,
135 gsize data_len);
136 gchar *_g_dbus_auth_mechanism_server_data_send (GDBusAuthMechanism *mechanism,
137 gsize *out_data_len);
138 gchar *_g_dbus_auth_mechanism_server_get_reject_reason (GDBusAuthMechanism *mechanism);
139 void _g_dbus_auth_mechanism_server_shutdown (GDBusAuthMechanism *mechanism);
141 GDBusAuthMechanismState _g_dbus_auth_mechanism_client_get_state (GDBusAuthMechanism *mechanism);
142 gchar *_g_dbus_auth_mechanism_client_initiate (GDBusAuthMechanism *mechanism,
143 gsize *out_initial_response_len);
144 void _g_dbus_auth_mechanism_client_data_receive (GDBusAuthMechanism *mechanism,
145 const gchar *data,
146 gsize data_len);
147 gchar *_g_dbus_auth_mechanism_client_data_send (GDBusAuthMechanism *mechanism,
148 gsize *out_data_len);
149 void _g_dbus_auth_mechanism_client_shutdown (GDBusAuthMechanism *mechanism);
152 G_END_DECLS
154 #endif /* __G_DBUS_AUTH_MECHANISM_H__ */