Add some more cases to the app-id unit tests
[glib.git] / gio / gdbusauthmechanism.h
blobf40aa99bc07c37fe73e6262afb892201a8784238
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, see <http://www.gnu.org/licenses/>.
18 * Author: David Zeuthen <davidz@redhat.com>
21 #ifndef __G_DBUS_AUTH_MECHANISM_H__
22 #define __G_DBUS_AUTH_MECHANISM_H__
24 #if !defined (GIO_COMPILATION)
25 #error "gdbusauthmechanism.h is a private header file."
26 #endif
28 #include <gio/giotypes.h>
30 G_BEGIN_DECLS
32 #define G_TYPE_DBUS_AUTH_MECHANISM (_g_dbus_auth_mechanism_get_type ())
33 #define G_DBUS_AUTH_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanism))
34 #define G_DBUS_AUTH_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanismClass))
35 #define G_DBUS_AUTH_MECHANISM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_AUTH_MECHANISM, GDBusAuthMechanismClass))
36 #define G_IS_DBUS_AUTH_MECHANISM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_AUTH_MECHANISM))
37 #define G_IS_DBUS_AUTH_MECHANISM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_AUTH_MECHANISM))
39 typedef struct _GDBusAuthMechanism GDBusAuthMechanism;
40 typedef struct _GDBusAuthMechanismClass GDBusAuthMechanismClass;
41 typedef struct _GDBusAuthMechanismPrivate GDBusAuthMechanismPrivate;
43 typedef enum {
44 G_DBUS_AUTH_MECHANISM_STATE_INVALID,
45 G_DBUS_AUTH_MECHANISM_STATE_WAITING_FOR_DATA,
46 G_DBUS_AUTH_MECHANISM_STATE_HAVE_DATA_TO_SEND,
47 G_DBUS_AUTH_MECHANISM_STATE_REJECTED,
48 G_DBUS_AUTH_MECHANISM_STATE_ACCEPTED,
49 } GDBusAuthMechanismState;
51 struct _GDBusAuthMechanismClass
53 /*< private >*/
54 GObjectClass parent_class;
56 /*< public >*/
58 /* VTable */
60 /* TODO: server_initiate and client_initiate probably needs to have a
61 * GCredentials parameter...
64 gint (*get_priority) (void);
65 const gchar *(*get_name) (void);
67 /* functions shared by server/client */
68 gboolean (*is_supported) (GDBusAuthMechanism *mechanism);
69 gchar *(*encode_data) (GDBusAuthMechanism *mechanism,
70 const gchar *data,
71 gsize data_len,
72 gsize *out_data_len);
73 gchar *(*decode_data) (GDBusAuthMechanism *mechanism,
74 const gchar *data,
75 gsize data_len,
76 gsize *out_data_len);
78 /* functions for server-side authentication */
79 GDBusAuthMechanismState (*server_get_state) (GDBusAuthMechanism *mechanism);
80 void (*server_initiate) (GDBusAuthMechanism *mechanism,
81 const gchar *initial_response,
82 gsize initial_response_len);
83 void (*server_data_receive) (GDBusAuthMechanism *mechanism,
84 const gchar *data,
85 gsize data_len);
86 gchar *(*server_data_send) (GDBusAuthMechanism *mechanism,
87 gsize *out_data_len);
88 gchar *(*server_get_reject_reason) (GDBusAuthMechanism *mechanism);
89 void (*server_shutdown) (GDBusAuthMechanism *mechanism);
91 /* functions for client-side authentication */
92 GDBusAuthMechanismState (*client_get_state) (GDBusAuthMechanism *mechanism);
93 gchar *(*client_initiate) (GDBusAuthMechanism *mechanism,
94 gsize *out_initial_response_len);
95 void (*client_data_receive) (GDBusAuthMechanism *mechanism,
96 const gchar *data,
97 gsize data_len);
98 gchar *(*client_data_send) (GDBusAuthMechanism *mechanism,
99 gsize *out_data_len);
100 void (*client_shutdown) (GDBusAuthMechanism *mechanism);
103 struct _GDBusAuthMechanism
105 GObject parent_instance;
106 GDBusAuthMechanismPrivate *priv;
109 GType _g_dbus_auth_mechanism_get_type (void) G_GNUC_CONST;
111 gint _g_dbus_auth_mechanism_get_priority (GType mechanism_type);
112 const gchar *_g_dbus_auth_mechanism_get_name (GType mechanism_type);
114 GIOStream *_g_dbus_auth_mechanism_get_stream (GDBusAuthMechanism *mechanism);
115 GCredentials *_g_dbus_auth_mechanism_get_credentials (GDBusAuthMechanism *mechanism);
117 gboolean _g_dbus_auth_mechanism_is_supported (GDBusAuthMechanism *mechanism);
118 gchar *_g_dbus_auth_mechanism_encode_data (GDBusAuthMechanism *mechanism,
119 const gchar *data,
120 gsize data_len,
121 gsize *out_data_len);
122 gchar *_g_dbus_auth_mechanism_decode_data (GDBusAuthMechanism *mechanism,
123 const gchar *data,
124 gsize data_len,
125 gsize *out_data_len);
127 GDBusAuthMechanismState _g_dbus_auth_mechanism_server_get_state (GDBusAuthMechanism *mechanism);
128 void _g_dbus_auth_mechanism_server_initiate (GDBusAuthMechanism *mechanism,
129 const gchar *initial_response,
130 gsize initial_response_len);
131 void _g_dbus_auth_mechanism_server_data_receive (GDBusAuthMechanism *mechanism,
132 const gchar *data,
133 gsize data_len);
134 gchar *_g_dbus_auth_mechanism_server_data_send (GDBusAuthMechanism *mechanism,
135 gsize *out_data_len);
136 gchar *_g_dbus_auth_mechanism_server_get_reject_reason (GDBusAuthMechanism *mechanism);
137 void _g_dbus_auth_mechanism_server_shutdown (GDBusAuthMechanism *mechanism);
139 GDBusAuthMechanismState _g_dbus_auth_mechanism_client_get_state (GDBusAuthMechanism *mechanism);
140 gchar *_g_dbus_auth_mechanism_client_initiate (GDBusAuthMechanism *mechanism,
141 gsize *out_initial_response_len);
142 void _g_dbus_auth_mechanism_client_data_receive (GDBusAuthMechanism *mechanism,
143 const gchar *data,
144 gsize data_len);
145 gchar *_g_dbus_auth_mechanism_client_data_send (GDBusAuthMechanism *mechanism,
146 gsize *out_data_len);
147 void _g_dbus_auth_mechanism_client_shutdown (GDBusAuthMechanism *mechanism);
150 G_END_DECLS
152 #endif /* __G_DBUS_AUTH_MECHANISM_H__ */