1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * Copyright (C) 2008 Red Hat, Inc. |
4 | */ |
5 | |
6 | #ifndef __SOUP_COOKIE_JAR_H__ |
7 | #define __SOUP_COOKIE_JAR_H__ 1 |
8 | |
9 | #include <libsoup/soup-types.h> |
10 | |
11 | G_BEGIN_DECLS |
12 | |
13 | #define SOUP_TYPE_COOKIE_JAR (soup_cookie_jar_get_type ()) |
14 | #define SOUP_COOKIE_JAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_COOKIE_JAR, SoupCookieJar)) |
15 | #define SOUP_COOKIE_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_COOKIE_JAR, SoupCookieJarClass)) |
16 | #define SOUP_IS_COOKIE_JAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_COOKIE_JAR)) |
17 | #define SOUP_IS_COOKIE_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_COOKIE_JAR)) |
18 | #define SOUP_COOKIE_JAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_COOKIE_JAR, SoupCookieJarClass)) |
19 | |
20 | struct _SoupCookieJar { |
21 | GObject parent; |
22 | |
23 | }; |
24 | |
25 | typedef struct { |
26 | GObjectClass parent_class; |
27 | |
28 | void (*save) (SoupCookieJar *jar); |
29 | gboolean (*is_persistent) (SoupCookieJar *jar); |
30 | |
31 | /* signals */ |
32 | void (*changed) (SoupCookieJar *jar, |
33 | SoupCookie *old_cookie, |
34 | SoupCookie *new_cookie); |
35 | |
36 | /* Padding for future expansion */ |
37 | void (*_libsoup_reserved1) (void); |
38 | void (*_libsoup_reserved2) (void); |
39 | } SoupCookieJarClass; |
40 | |
41 | #define SOUP_COOKIE_JAR_READ_ONLY "read-only" |
42 | #define SOUP_COOKIE_JAR_ACCEPT_POLICY "accept-policy" |
43 | |
44 | typedef enum { |
45 | SOUP_COOKIE_JAR_ACCEPT_ALWAYS, |
46 | SOUP_COOKIE_JAR_ACCEPT_NEVER, |
47 | SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY |
48 | } SoupCookieJarAcceptPolicy; |
49 | |
50 | SOUP_AVAILABLE_IN_2_24 |
51 | GType soup_cookie_jar_get_type (void); |
52 | SOUP_AVAILABLE_IN_2_24 |
53 | SoupCookieJar * soup_cookie_jar_new (void); |
54 | SOUP_AVAILABLE_IN_2_24 |
55 | char * soup_cookie_jar_get_cookies (SoupCookieJar *jar, |
56 | SoupURI *uri, |
57 | gboolean for_http); |
58 | SOUP_AVAILABLE_IN_2_40 |
59 | GSList * soup_cookie_jar_get_cookie_list (SoupCookieJar *jar, |
60 | SoupURI *uri, |
61 | gboolean for_http); |
62 | SOUP_AVAILABLE_IN_2_24 |
63 | void soup_cookie_jar_set_cookie (SoupCookieJar *jar, |
64 | SoupURI *uri, |
65 | const char *cookie); |
66 | SOUP_AVAILABLE_IN_2_30 |
67 | void soup_cookie_jar_set_cookie_with_first_party (SoupCookieJar *jar, |
68 | SoupURI *uri, |
69 | SoupURI *first_party, |
70 | const char *cookie); |
71 | SOUP_AVAILABLE_IN_2_26 |
72 | void soup_cookie_jar_add_cookie (SoupCookieJar *jar, |
73 | SoupCookie *cookie); |
74 | SOUP_AVAILABLE_IN_2_40 |
75 | void soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar *jar, |
76 | SoupURI *first_party, |
77 | SoupCookie *cookie); |
78 | SOUP_AVAILABLE_IN_2_26 |
79 | void soup_cookie_jar_delete_cookie (SoupCookieJar *jar, |
80 | SoupCookie *cookie); |
81 | SOUP_AVAILABLE_IN_2_26 |
82 | GSList * soup_cookie_jar_all_cookies (SoupCookieJar *jar); |
83 | SOUP_AVAILABLE_IN_2_30 |
84 | void soup_cookie_jar_set_accept_policy (SoupCookieJar *jar, |
85 | SoupCookieJarAcceptPolicy policy); |
86 | SOUP_AVAILABLE_IN_2_30 |
87 | SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy (SoupCookieJar *jar); |
88 | SOUP_AVAILABLE_IN_2_40 |
89 | gboolean soup_cookie_jar_is_persistent (SoupCookieJar *jar); |
90 | |
91 | #ifndef SOUP_DISABLE_DEPRECATED |
92 | SOUP_AVAILABLE_IN_2_24 |
93 | SOUP_DEPRECATED_IN_2_26 |
94 | void soup_cookie_jar_save (SoupCookieJar *jar); |
95 | #endif |
96 | |
97 | G_END_DECLS |
98 | |
99 | #endif /* __SOUP_COOKIE_JAR_H__ */ |
100 | |