1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright (C) 2007 Novell, Inc. 4 */ 5 6 #ifndef __SOUP_AUTH_DOMAIN_H__ 7 #define __SOUP_AUTH_DOMAIN_H__ 1 8 9 #include <libsoup/soup-types.h> 10 11 G_BEGIN_DECLS 12 13 #define SOUP_TYPE_AUTH_DOMAIN (soup_auth_domain_get_type ()) 14 #define SOUP_AUTH_DOMAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH_DOMAIN, SoupAuthDomain)) 15 #define SOUP_AUTH_DOMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH_DOMAIN, SoupAuthDomainClass)) 16 #define SOUP_IS_AUTH_DOMAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_AUTH_DOMAIN)) 17 #define SOUP_IS_AUTH_DOMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_AUTH_DOMAIN)) 18 #define SOUP_AUTH_DOMAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH_DOMAIN, SoupAuthDomainClass)) 19 20 struct _SoupAuthDomain { 21 GObject parent; 22 23 }; 24 25 typedef struct { 26 GObjectClass parent_class; 27 28 char * (*accepts) (SoupAuthDomain *domain, 29 SoupMessage *msg, 30 const char *header); 31 char * (*challenge) (SoupAuthDomain *domain, 32 SoupMessage *msg); 33 gboolean (*check_password) (SoupAuthDomain *domain, 34 SoupMessage *msg, 35 const char *username, 36 const char *password); 37 38 /* Padding for future expansion */ 39 void (*_libsoup_reserved2) (void); 40 void (*_libsoup_reserved3) (void); 41 void (*_libsoup_reserved4) (void); 42 } SoupAuthDomainClass; 43 44 #define SOUP_AUTH_DOMAIN_REALM "realm" 45 #define SOUP_AUTH_DOMAIN_PROXY "proxy" 46 #define SOUP_AUTH_DOMAIN_ADD_PATH "add-path" 47 #define SOUP_AUTH_DOMAIN_REMOVE_PATH "remove-path" 48 #define SOUP_AUTH_DOMAIN_FILTER "filter" 49 #define SOUP_AUTH_DOMAIN_FILTER_DATA "filter-data" 50 #define SOUP_AUTH_DOMAIN_GENERIC_AUTH_CALLBACK "generic-auth-callback" 51 #define SOUP_AUTH_DOMAIN_GENERIC_AUTH_DATA "generic-auth-data" 52 53 typedef gboolean (*SoupAuthDomainFilter) (SoupAuthDomain *domain, 54 SoupMessage *msg, 55 gpointer user_data); 56 57 typedef gboolean (*SoupAuthDomainGenericAuthCallback) (SoupAuthDomain *domain, 58 SoupMessage *msg, 59 const char *username, 60 gpointer user_data); 61 62 SOUP_AVAILABLE_IN_2_4 63 GType soup_auth_domain_get_type (void); 64 65 SOUP_AVAILABLE_IN_2_4 66 void soup_auth_domain_add_path (SoupAuthDomain *domain, 67 const char *path); 68 SOUP_AVAILABLE_IN_2_4 69 void soup_auth_domain_remove_path (SoupAuthDomain *domain, 70 const char *path); 71 72 SOUP_AVAILABLE_IN_2_4 73 void soup_auth_domain_set_filter (SoupAuthDomain *domain, 74 SoupAuthDomainFilter filter, 75 gpointer filter_data, 76 GDestroyNotify dnotify); 77 78 SOUP_AVAILABLE_IN_2_4 79 const char *soup_auth_domain_get_realm (SoupAuthDomain *domain); 80 81 SOUP_AVAILABLE_IN_2_4 82 void soup_auth_domain_set_generic_auth_callback (SoupAuthDomain *domain, 83 SoupAuthDomainGenericAuthCallback auth_callback, 84 gpointer auth_data, 85 GDestroyNotify dnotify); 86 SOUP_AVAILABLE_IN_2_4 87 gboolean soup_auth_domain_check_password (SoupAuthDomain *domain, 88 SoupMessage *msg, 89 const char *username, 90 const char *password); 91 92 SOUP_AVAILABLE_IN_2_4 93 gboolean soup_auth_domain_covers (SoupAuthDomain *domain, 94 SoupMessage *msg); 95 SOUP_AVAILABLE_IN_2_4 96 char *soup_auth_domain_accepts (SoupAuthDomain *domain, 97 SoupMessage *msg); 98 SOUP_AVAILABLE_IN_2_4 99 void soup_auth_domain_challenge (SoupAuthDomain *domain, 100 SoupMessage *msg); 101 102 /* protected */ 103 SOUP_AVAILABLE_IN_2_4 104 gboolean soup_auth_domain_try_generic_auth_callback (SoupAuthDomain *domain, 105 SoupMessage *msg, 106 const char *username); 107 108 G_END_DECLS 109 110 #endif /* __SOUP_AUTH_DOMAIN_H__ */ 111