summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/network/soup/cache/webkit/soup-cache.h
blob: a926f98d84fe066899ef750ef1687cc49349f1d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * soup-cache.h:
 *
 * Copyright (C) 2009, 2010 Igalia, S.L.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef WEBKIT_SOUP_CACHE_H
#define WEBKIT_SOUP_CACHE_H 1

#ifdef G_OS_WIN32
    #ifdef BUILDING_WEBKIT
        #define WEBKIT_API __declspec(dllexport)
    #else
        #define WEBKIT_API __declspec(dllimport)
    #endif
    #define WEBKIT_OBSOLETE_API WEBKIT_API
#else
    #define WEBKIT_API __attribute__((visibility("default")))
    #define WEBKIT_OBSOLETE_API WEBKIT_API __attribute__((deprecated))
#endif

#include <libsoup/soup-types.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define WEBKIT_TYPE_SOUP_CACHE            (webkit_soup_cache_get_type ())
#define WEBKIT_SOUP_CACHE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_SOUP_CACHE, WebKitSoupCache))
#define WEBKIT_SOUP_CACHE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_SOUP_CACHE, WebKitSoupCacheClass))
#define WEBKIT_IS_SOUP_CACHE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_SOUP_CACHE))
#define WEBKIT_IS_SOUP_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), WEBKIT_TYPE_SOUP_CACHE))
#define WEBKIT_SOUP_CACHE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_SOUP_CACHE, WebKitSoupCacheClass))

typedef struct _WebKitSoupCache WebKitSoupCache;
typedef struct _WebKitSoupCachePrivate WebKitSoupCachePrivate;

typedef enum {
	WEBKIT_SOUP_CACHE_CACHEABLE = (1 << 0),
	WEBKIT_SOUP_CACHE_UNCACHEABLE = (1 << 1),
	WEBKIT_SOUP_CACHE_INVALIDATES = (1 << 2),
	WEBKIT_SOUP_CACHE_VALIDATES = (1 << 3)
} WebKitSoupCacheability;

typedef enum {
	WEBKIT_SOUP_CACHE_RESPONSE_FRESH,
	WEBKIT_SOUP_CACHE_RESPONSE_NEEDS_VALIDATION,
	WEBKIT_SOUP_CACHE_RESPONSE_STALE
} WebKitSoupCacheResponse;

typedef enum {
	WEBKIT_SOUP_CACHE_SINGLE_USER,
	WEBKIT_SOUP_CACHE_SHARED
} WebKitSoupCacheType;

struct _WebKitSoupCache {
	GObject parent_instance;

	WebKitSoupCachePrivate *priv;
};

typedef struct {
	GObjectClass parent_class;

	/* methods */
	WebKitSoupCacheability (*get_cacheability)(WebKitSoupCache *cache, SoupMessage *msg);

	/* Padding for future expansion */
	void (*_libsoup_reserved1)(void);
	void (*_libsoup_reserved2)(void);
	void (*_libsoup_reserved3)(void);
} WebKitSoupCacheClass;

WEBKIT_API GType             webkit_soup_cache_get_type (void);
WEBKIT_API WebKitSoupCache  *webkit_soup_cache_new (const char  *cache_dir,
						    WebKitSoupCacheType cache_type);
WEBKIT_API void              webkit_soup_cache_flush (WebKitSoupCache   *cache);
WEBKIT_API void              webkit_soup_cache_clear (WebKitSoupCache   *cache);

WEBKIT_API void              webkit_soup_cache_dump (WebKitSoupCache *cache);
WEBKIT_API void              webkit_soup_cache_load (WebKitSoupCache *cache);

WEBKIT_API void              webkit_soup_cache_set_max_size (WebKitSoupCache *cache,
							     guint max_size);
WEBKIT_API guint             webkit_soup_cache_get_max_size (WebKitSoupCache *cache);

G_END_DECLS


#endif /* WEBKIT_SOUP_CACHE_H */