add "realm" field to the struct. (SoupAuthClass) remove "get_realm"
[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
11 #define SOUP_TYPE_AUTH            (soup_auth_get_type ())
12 #define SOUP_AUTH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH, SoupAuth))
13 #define SOUP_AUTH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH, SoupAuthClass))
14 #define SOUP_IS_AUTH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_AUTH))
15 #define SOUP_IS_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_AUTH))
16 #define SOUP_AUTH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH, SoupAuthClass))
17
18 typedef struct {
19         GObject parent;
20
21         char *realm;
22 } SoupAuth;
23
24 typedef struct {
25         GObjectClass parent_class;
26
27         const char *scheme_name;
28
29         void         (*construct)            (SoupAuth      *auth,
30                                               GHashTable    *auth_params);
31
32         GSList *     (*get_protection_space) (SoupAuth      *auth,
33                                               const SoupUri *source_uri);
34
35         void         (*authenticate)         (SoupAuth      *auth,
36                                               const char    *username,
37                                               const char    *password);
38         gboolean     (*is_authenticated)     (SoupAuth      *auth);
39
40         char *       (*get_authorization)    (SoupAuth      *auth,
41                                               SoupMessage   *msg);
42 } SoupAuthClass;
43
44 GType       soup_auth_get_type              (void);
45
46
47 SoupAuth   *soup_auth_new_from_header_list  (const GSList  *vals);
48
49 const char *soup_auth_get_scheme_name       (SoupAuth      *auth);
50 const char *soup_auth_get_realm             (SoupAuth      *auth);
51 char       *soup_auth_get_info              (SoupAuth      *auth);
52
53 void        soup_auth_authenticate          (SoupAuth      *auth,
54                                              const char    *username,
55                                              const char    *password);
56 gboolean    soup_auth_is_authenticated      (SoupAuth      *auth);
57
58 char       *soup_auth_get_authorization     (SoupAuth      *auth, 
59                                              SoupMessage   *msg);
60
61 GSList     *soup_auth_get_protection_space  (SoupAuth      *auth,
62                                              const SoupUri *source_uri);
63 void        soup_auth_free_protection_space (SoupAuth      *auth,
64                                              GSList        *space);
65
66 #endif /* SOUP_AUTH_H */