1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2010 Red Hat, Inc.
4  */
5 
6 #ifndef __SOUP_CONNECTION_AUTH_H__
7 #define __SOUP_CONNECTION_AUTH_H__ 1
8 
9 #include <libsoup/soup-auth.h>
10 
11 G_BEGIN_DECLS
12 
13 #define SOUP_TYPE_CONNECTION_AUTH            (soup_connection_auth_get_type ())
14 #define SOUP_CONNECTION_AUTH(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), SOUP_TYPE_CONNECTION_AUTH, SoupConnectionAuth))
15 #define SOUP_CONNECTION_AUTH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_CONNECTION_AUTH, SoupConnectionAuthClass))
16 #define SOUP_IS_CONNECTION_AUTH(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOUP_TYPE_CONNECTION_AUTH))
17 #define SOUP_IS_CONNECTION_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_CONNECTION_AUTH))
18 #define SOUP_CONNECTION_AUTH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_CONNECTION_AUTH, SoupConnectionAuthClass))
19 
20 typedef struct SoupConnectionAuthPrivate SoupConnectionAuthPrivate;
21 
22 typedef struct {
23 	SoupAuth parent;
24 
25 	SoupConnectionAuthPrivate *priv;
26 } SoupConnectionAuth;
27 
28 typedef struct {
29 	SoupAuthClass parent_class;
30 
31 	gpointer  (*create_connection_state)      (SoupConnectionAuth *auth);
32 	void      (*free_connection_state)        (SoupConnectionAuth *auth,
33 						   gpointer            conn);
34 
35 	gboolean  (*update_connection)            (SoupConnectionAuth *auth,
36 						   SoupMessage        *msg,
37 						   const char         *auth_header,
38 						   gpointer            conn);
39 	char     *(*get_connection_authorization) (SoupConnectionAuth *auth,
40 						   SoupMessage        *msg,
41 						   gpointer            conn);
42 	gboolean  (*is_connection_ready)          (SoupConnectionAuth *auth,
43 						   SoupMessage        *msg,
44 						   gpointer            conn);
45 } SoupConnectionAuthClass;
46 
47 GType soup_connection_auth_get_type (void);
48 
49 SOUP_AVAILABLE_IN_2_58
50 gpointer	soup_connection_auth_get_connection_state_for_message
51 						(SoupConnectionAuth *auth,
52 						 SoupMessage *message);
53 G_END_DECLS
54 
55 #endif /* __SOUP_CONNECTION_AUTH_H__ */
56