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

#pragma once

#include "soup-types.h"

G_BEGIN_DECLS

#define SOUP_TYPE_COOKIE_JAR            (soup_cookie_jar_get_type ())
SOUP_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SoupCookieJar, soup_cookie_jar, SOUP, COOKIE_JAR, GObject)

struct _SoupCookieJarClass {
	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 */
	gpointer padding[6];
};

typedef enum {
	SOUP_COOKIE_JAR_ACCEPT_ALWAYS,
	SOUP_COOKIE_JAR_ACCEPT_NEVER,
	SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY,
	SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY
} SoupCookieJarAcceptPolicy;

SOUP_AVAILABLE_IN_ALL
SoupCookieJar *           soup_cookie_jar_new                         (void);
SOUP_AVAILABLE_IN_ALL
char          *           soup_cookie_jar_get_cookies                 (SoupCookieJar             *jar,
								       GUri                      *uri,
								       gboolean                   for_http);
SOUP_AVAILABLE_IN_ALL
GSList        *           soup_cookie_jar_get_cookie_list             (SoupCookieJar             *jar,
								       GUri                      *uri,
								       gboolean                   for_http);
SOUP_AVAILABLE_IN_ALL
GSList        *           soup_cookie_jar_get_cookie_list_with_same_site_info (
	                                                               SoupCookieJar             *jar,
	                                                               GUri                      *uri,
								       GUri                      *top_level,
								       GUri                      *site_for_cookies,
								       gboolean                   for_http,
								       gboolean                   is_safe_method,
								       gboolean                   is_top_level_navigation);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_set_cookie                  (SoupCookieJar             *jar,
								       GUri                      *uri,
								       const char                *cookie);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_set_cookie_with_first_party (SoupCookieJar             *jar,
								       GUri                      *uri,
								       GUri                      *first_party,
								       const char                *cookie);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_add_cookie                  (SoupCookieJar             *jar,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar             *jar,
								       GUri                      *first_party,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_add_cookie_full             (SoupCookieJar             *jar,
                                                                       SoupCookie                *cookie,
								       GUri                      *uri,
								       GUri                      *first_party);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_delete_cookie               (SoupCookieJar             *jar,
								       SoupCookie                *cookie);
SOUP_AVAILABLE_IN_ALL
GSList        *           soup_cookie_jar_all_cookies                 (SoupCookieJar             *jar);
SOUP_AVAILABLE_IN_ALL
void                      soup_cookie_jar_set_accept_policy           (SoupCookieJar             *jar,
								       SoupCookieJarAcceptPolicy  policy);
SOUP_AVAILABLE_IN_ALL
SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy           (SoupCookieJar             *jar);
SOUP_AVAILABLE_IN_ALL
gboolean                  soup_cookie_jar_is_persistent               (SoupCookieJar             *jar);

G_END_DECLS