glib: Improve documentation for g_strfreev()
[platform/upstream/glib.git] / gio / gdbusauthmechanism.h
1 /* GDBus - GLib D-Bus Library
2  *
3  * Copyright (C) 2008-2010 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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/>.
17  *
18  * Author: David Zeuthen <davidz@redhat.com>
19  */
20
21 #ifndef __G_DBUS_AUTH_MECHANISM_H__
22 #define __G_DBUS_AUTH_MECHANISM_H__
23
24 #if !defined (GIO_COMPILATION)
25 #error "gdbusauthmechanism.h is a private header file."
26 #endif
27
28 #include <gio/giotypes.h>
29
30 G_BEGIN_DECLS
31
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))
38
39 typedef struct _GDBusAuthMechanism        GDBusAuthMechanism;
40 typedef struct _GDBusAuthMechanismClass   GDBusAuthMechanismClass;
41 typedef struct _GDBusAuthMechanismPrivate GDBusAuthMechanismPrivate;
42
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;
50
51 struct _GDBusAuthMechanismClass
52 {
53   /*< private >*/
54   GObjectClass parent_class;
55
56   /*< public >*/
57
58   /* VTable */
59
60   /* TODO: server_initiate and client_initiate probably needs to have a
61    * GCredentials parameter...
62    */
63
64   gint                      (*get_priority)             (void);
65   const gchar              *(*get_name)                 (void);
66
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);
77
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);
90
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);
101 };
102
103 struct _GDBusAuthMechanism
104 {
105   GObject parent_instance;
106   GDBusAuthMechanismPrivate *priv;
107 };
108
109 GType                     _g_dbus_auth_mechanism_get_type                 (void) G_GNUC_CONST;
110
111 gint                      _g_dbus_auth_mechanism_get_priority             (GType                 mechanism_type);
112 const gchar              *_g_dbus_auth_mechanism_get_name                 (GType                 mechanism_type);
113
114 GIOStream                *_g_dbus_auth_mechanism_get_stream               (GDBusAuthMechanism   *mechanism);
115 GCredentials             *_g_dbus_auth_mechanism_get_credentials          (GDBusAuthMechanism   *mechanism);
116
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);
126
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);
138
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);
148
149
150 G_END_DECLS
151
152 #endif /* __G_DBUS_AUTH_MECHANISM_H__ */