ftp://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/gnome-vfs2-2.3.8-1.src.rpm
[gnome-vfs-httpcaptive.git] / libgnomevfs / gnome-vfs-standard-callbacks.h
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3
4    Copyright (C) 2001 Eazel, Inc
5    Copyright (C) 2002 Seth Nickell
6
7    The Gnome Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11
12    The Gnome Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
16
17    You should have received a copy of the GNU Library General Public
18    License along with the Gnome Library; see the file COPYING.LIB.  If not,
19    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.
21
22    Author: Michael Fleming <mfleming@eazel.com>
23            Seth Nickell <snickell@stanford.edu>
24 */
25
26 #ifndef GNOME_VFS_STANDARD_CALLBACKS_H
27 #define GNOME_VFS_STANDARD_CALLBACKS_H
28
29 #include <glib/gtypes.h>
30 #include <libgnomevfs/gnome-vfs-uri.h>
31
32 G_BEGIN_DECLS
33
34 /*
35  * defined callback structures
36  */
37
38 /*
39  * hook name: "simple-authentication"
40  * In arg: GnomeVFSModuleCallbackAuthenticationIn *
41  * Out arg: GnomeVFSModuleCallbacAuthenticationOut *
42  * 
43  * Called when access to a URI requires a username/password
44  */
45 #define GNOME_VFS_MODULE_CALLBACK_AUTHENTICATION "simple-authentication"
46
47 /*
48  * hook name: "http:proxy-authentication"
49  * In arg: GnomeVFSModuleCallbackAuthenticationIn *
50  * Out arg: GnomeVFSModuleCallbackAuthenticationOut *
51  * 
52  * Called when access to an HTTP proxy requires a username/password
53  */
54 #define GNOME_VFS_MODULE_CALLBACK_HTTP_PROXY_AUTHENTICATION "http:proxy-authentication"
55
56 typedef struct {
57         char *uri;              /* Full URI of operation */
58         char *realm;            /* for HTTP auth, NULL for others */
59         gboolean previous_attempt_failed;
60                                 /* TRUE if there were credentials specified
61                                  * for this request, but they resulted in
62                                  * an authorization error. 
63                                  * ("you gave me the wrong pw!")
64                                  * 
65                                  * FALSE if there were no credentials specified
66                                  * but they are required to continue
67                                  * 
68                                  */
69         enum {
70                 AuthTypeBasic,  /* Password will be transmitted unencrypted */
71                 AuthTypeDigest  /* Digest is transferred, not plaintext credentials */          
72         } auth_type;
73
74         /* Reserved "padding" to avoid future breaks in ABI compatibility */
75         void *reserved1;
76         void *reserved2;
77
78 } GnomeVFSModuleCallbackAuthenticationIn;
79
80 typedef struct {
81         char *username;         /* will be freed by g_free,
82                                  * NULL indicates no auth should be provided;
83                                  * if the request requires authn, the operation
84                                  * will fail with a GNOME_VFS_ERROR_ACCESS_DENIED
85                                  * code
86                                  */
87         char *password;         /* will be freed by g_free */
88
89         /* Reserved "padding" to avoid future breaks in ABI compatibility */
90         void *reserved1;
91         void *reserved2;
92
93 } GnomeVFSModuleCallbackAuthenticationOut;
94
95 /*
96  * hook name: "http:send-additional-headers"
97  * In arg: GnomeVFSModuleCallbackAdditionalHeadersIn *
98  * Out arg: GnomeVFSModuleCallbackAdditionalHeadersOut *
99  *
100  * Called before sending headers to an HTTP server.
101  */
102
103 #define GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS "http:send-additional-headers"
104
105 typedef struct {
106         GnomeVFSURI *uri;               /* URI of operation */
107
108         /* Reserved "padding" to avoid future breaks in ABI compatibility */
109         void *reserved1;
110         void *reserved2;
111 } GnomeVFSModuleCallbackAdditionalHeadersIn;
112
113 typedef struct {
114         GList *headers;                 /* list of headers, will be freeed */
115
116         /* Reserved "padding" to avoid future breaks in ABI compatibility */
117         void *reserved1;
118         void *reserved2;
119 } GnomeVFSModuleCallbackAdditionalHeadersOut;
120
121 /*
122  * hook name: "http:received-headers"
123  * In arg: GnomeVFSModuleCallbackReceivedHeadersIn *
124  * Out arg: GnomeVFSModuleCallbackReceivedHeadersOut *
125  *
126  * Called after receiving the HTTP headers from the server.
127  */
128
129 #define GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS "http:received-headers"
130
131 typedef struct {
132         GnomeVFSURI *uri;               /* URI of operation */
133         GList *headers;                 /* list of headers */
134
135         /* Reserved "padding" to avoid future breaks in ABI compatibility */
136         void *reserved1;
137         void *reserved2;
138 } GnomeVFSModuleCallbackReceivedHeadersIn;
139
140 typedef struct {
141         int dummy;
142
143         /* Reserved "padding" to avoid future breaks in ABI compatibility */
144         void *reserved1;
145         void *reserved2;
146 } GnomeVFSModuleCallbackReceivedHeadersOut;
147
148 /*
149  * hook name: "status-message"
150  * In arg: GnomeVFSModuleCallbackStatusMessageIn *
151  * Out arg: GnomeVFSModuleCallbackStatusMessageOut *
152  * 
153  * Called when a GnomeVFS API or module has a status message to return to
154  * the user.
155  */
156
157 #define GNOME_VFS_MODULE_CALLBACK_STATUS_MESSAGE "status-message"
158
159 typedef struct {
160         char *uri;              /* Full URI of operation */
161         char *message;          /* A message indicating the current state or
162                                  * NULL if there is no message */
163         int percentage;         /* Percentage indicating completeness 0-100 or
164                                  * -1 if there is no progress percentage to
165                                  * report */
166
167         /* Reserved "padding" to avoid future breaks in ABI compatibility */
168         void *reserved1;
169         void *reserved2;
170 } GnomeVFSModuleCallbackStatusMessageIn;
171
172 typedef struct {
173         int dummy; /* empty structs not allowed */
174
175         /* Reserved "padding" to avoid future breaks in ABI compatibility */
176         void *reserved1;
177         void *reserved2;
178 } GnomeVFSModuleCallbackStatusMessageOut;
179
180 G_END_DECLS
181
182 #endif /* GNOME_VFS_STANDARD_CALLBACKS_H */