Remove build warning
[platform/upstream/libsoup.git] / libsoup / soup-auth.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2001-2003, Ximian, Inc.
4  */
5
6 #ifndef SOUP_AUTH_H
7 #define SOUP_AUTH_H 1
8
9 #include <libsoup/soup-types.h>
10 #include <libsoup/soup-headers.h>
11
12 G_BEGIN_DECLS
13
14 #define SOUP_TYPE_AUTH            (soup_auth_get_type ())
15 #define SOUP_AUTH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH, SoupAuth))
16 #define SOUP_AUTH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH, SoupAuthClass))
17 #define SOUP_IS_AUTH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_AUTH))
18 #define SOUP_IS_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_AUTH))
19 #define SOUP_AUTH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH, SoupAuthClass))
20
21 struct _SoupAuth {
22         GObject parent;
23
24         char *realm;
25 };
26
27 typedef struct {
28         GObjectClass parent_class;
29
30         const char  *scheme_name;
31         guint        strength;
32
33         gboolean     (*update)               (SoupAuth      *auth,
34                                               SoupMessage   *msg,
35                                               GHashTable    *auth_header);
36
37         GSList *     (*get_protection_space) (SoupAuth      *auth,
38                                               SoupURI       *source_uri);
39
40         void         (*authenticate)         (SoupAuth      *auth,
41                                               const char    *username,
42                                               const char    *password);
43         gboolean     (*is_authenticated)     (SoupAuth      *auth);
44
45         char *       (*get_authorization)    (SoupAuth      *auth,
46                                               SoupMessage   *msg);
47
48         gboolean     (*is_ready)             (SoupAuth      *auth,
49                                               SoupMessage   *msg);
50
51         /* Padding for future expansion */
52         void (*_libsoup_reserved2) (void);
53         void (*_libsoup_reserved3) (void);
54         void (*_libsoup_reserved4) (void);
55 } SoupAuthClass;
56
57 #define SOUP_AUTH_SCHEME_NAME      "scheme-name"
58 #define SOUP_AUTH_REALM            "realm"
59 #define SOUP_AUTH_HOST             "host"
60 #define SOUP_AUTH_IS_FOR_PROXY     "is-for-proxy"
61 #define SOUP_AUTH_IS_AUTHENTICATED "is-authenticated"
62
63 GType       soup_auth_get_type              (void);
64
65 SoupAuth   *soup_auth_new                   (GType          type,
66                                              SoupMessage   *msg,
67                                              const char    *auth_header);
68 gboolean    soup_auth_update                (SoupAuth      *auth,
69                                              SoupMessage   *msg,
70                                              const char    *auth_header);
71
72 gboolean    soup_auth_is_for_proxy          (SoupAuth      *auth);
73 const char *soup_auth_get_scheme_name       (SoupAuth      *auth);
74 const char *soup_auth_get_host              (SoupAuth      *auth);
75 const char *soup_auth_get_realm             (SoupAuth      *auth);
76 char       *soup_auth_get_info              (SoupAuth      *auth);
77
78 void        soup_auth_authenticate          (SoupAuth      *auth,
79                                              const char    *username,
80                                              const char    *password);
81 gboolean    soup_auth_is_authenticated      (SoupAuth      *auth);
82 SOUP_AVAILABLE_IN_2_42
83 gboolean    soup_auth_is_ready              (SoupAuth      *auth,
84                                              SoupMessage   *msg);
85
86 char       *soup_auth_get_authorization     (SoupAuth      *auth, 
87                                              SoupMessage   *msg);
88
89 GSList     *soup_auth_get_protection_space  (SoupAuth      *auth,
90                                              SoupURI       *source_uri);
91 void        soup_auth_free_protection_space (SoupAuth      *auth,
92                                              GSList        *space);
93
94 /* The actual auth types, which can be added/removed as features */
95
96 #define SOUP_TYPE_AUTH_BASIC  (soup_auth_basic_get_type ())
97 GType soup_auth_basic_get_type  (void);
98 #define SOUP_TYPE_AUTH_DIGEST (soup_auth_digest_get_type ())
99 GType soup_auth_digest_get_type (void);
100 #define SOUP_TYPE_AUTH_NTLM   (soup_auth_ntlm_get_type ())
101 GType soup_auth_ntlm_get_type   (void);
102
103 /* Deprecated SoupPasswordManager-related APIs: all are now no-ops */
104 SOUP_AVAILABLE_IN_2_28
105 SOUP_DEPRECATED_IN_2_28
106 GSList     *soup_auth_get_saved_users    (SoupAuth   *auth);
107 SOUP_AVAILABLE_IN_2_28
108 SOUP_DEPRECATED_IN_2_28
109 const char *soup_auth_get_saved_password (SoupAuth   *auth,
110                                           const char *user);
111 SOUP_AVAILABLE_IN_2_28
112 SOUP_DEPRECATED_IN_2_28
113 void        soup_auth_save_password      (SoupAuth   *auth,
114                                           const char *username,
115                                           const char *password);
116 SOUP_AVAILABLE_IN_2_28
117 SOUP_DEPRECATED_IN_2_28
118 void        soup_auth_has_saved_password (SoupAuth   *auth,
119                                           const char *username,
120                                           const char *password);
121
122 G_END_DECLS
123
124 #endif /* SOUP_AUTH_H */