summaryrefslogtreecommitdiff
path: root/libsoup/soup-cookie-jar.h
blob: d3ee4f23d39a3f6a84c474b7dc18c7cee9558a4f (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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * Copyright (C) 2008 Red Hat, Inc.
 */

#ifndef __SOUP_COOKIE_JAR_H__
#define __SOUP_COOKIE_JAR_H__ 1

#include <libsoup/soup-types.h>

G_BEGIN_DECLS

#define SOUP_TYPE_COOKIE_JAR            (soup_cookie_jar_get_type ())
#define SOUP_COOKIE_JAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_COOKIE_JAR, SoupCookieJar))
#define SOUP_COOKIE_JAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_COOKIE_JAR, SoupCookieJarClass))
#define SOUP_IS_COOKIE_JAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_COOKIE_JAR))
#define SOUP_IS_COOKIE_JAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_COOKIE_JAR))
#define SOUP_COOKIE_JAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_COOKIE_JAR, SoupCookieJarClass))

struct _SoupCookieJar {
	GObject parent;

};

typedef struct {
	GObjectClass parent_class;

	void     (*save)          (SoupCookieJar *jar);
	gboolean (*is_persistent) (SoupCookieJar *jar);

	/* signals */
	void (*changed) (SoupCookieJar *jar,
			 SoupCookie    *old_cookie,
			 SoupCookie    *new_cookie);

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

#define SOUP_COOKIE_JAR_READ_ONLY "read-only"
#define SOUP_COOKIE_JAR_ACCEPT_POLICY "accept-policy"

typedef enum {
	SOUP_COOKIE_JAR_ACCEPT_ALWAYS,
	SOUP_COOKIE_JAR_ACCEPT_NEVER,
	SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
} SoupCookieJarAcceptPolicy;

SOUP_AVAILABLE_IN_2_24
GType                     soup_cookie_jar_get_type                    (void);
SOUP_AVAILABLE_IN_2_24
SoupCookieJar *           soup_cookie_jar_new                         (void);
SOUP_AVAILABLE_IN_2_24
char          *           soup_cookie_jar_get_cookies                 (SoupCookieJar             *jar,
								       SoupURI                   *uri,
								       gboolean                   for_http);
SOUP_AVAILABLE_IN_2_40
GSList        *           soup_cookie_jar_get_cookie_list             (SoupCookieJar             *jar,
								       SoupURI                   *uri,
								       gboolean                   for_http);
SOUP_AVAILABLE_IN_2_24
void                      soup_cookie_jar_set_cookie                  (SoupCookieJar             *jar,
								       SoupURI                   *uri,
								       const char                *cookie);
SOUP_AVAILABLE_IN_2_30
void                      soup_cookie_jar_set_cookie_with_first_party (SoupCookieJar             *jar,
								       SoupURI                   *uri,
								       SoupURI                   *first_party,
								       const char                *cookie);
SOUP_AVAILABLE_IN_2_26
void                      soup_cookie_jar_add_cookie                  (SoupCookieJar             *jar,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_2_40
void                      soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar             *jar,
								       SoupURI                   *first_party,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_2_68
void                      soup_cookie_jar_add_cookie_full             (SoupCookieJar             *jar,
                                                                       SoupCookie                *cookie,
								       SoupURI                   *uri,
								       SoupURI                   *first_party);
SOUP_AVAILABLE_IN_2_26
void                      soup_cookie_jar_delete_cookie               (SoupCookieJar             *jar,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_2_26
GSList        *           soup_cookie_jar_all_cookies                 (SoupCookieJar             *jar);
SOUP_AVAILABLE_IN_2_30
void                      soup_cookie_jar_set_accept_policy           (SoupCookieJar             *jar,
								       SoupCookieJarAcceptPolicy  policy);
SOUP_AVAILABLE_IN_2_30
SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy           (SoupCookieJar             *jar);
SOUP_AVAILABLE_IN_2_40
gboolean                  soup_cookie_jar_is_persistent               (SoupCookieJar             *jar);

#ifndef SOUP_DISABLE_DEPRECATED
SOUP_AVAILABLE_IN_2_24
SOUP_DEPRECATED_IN_2_26
void                      soup_cookie_jar_save                        (SoupCookieJar             *jar);
#endif

G_END_DECLS

#endif /* __SOUP_COOKIE_JAR_H__ */