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
11G_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
20struct _SoupCookieJar {
21 GObject parent;
22
23};
24
25typedef 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
44typedef enum {
45 SOUP_COOKIE_JAR_ACCEPT_ALWAYS,
46 SOUP_COOKIE_JAR_ACCEPT_NEVER,
47 SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
48} SoupCookieJarAcceptPolicy;
49
50SOUP_AVAILABLE_IN_2_24
51GType soup_cookie_jar_get_type (void);
52SOUP_AVAILABLE_IN_2_24
53SoupCookieJar * soup_cookie_jar_new (void);
54SOUP_AVAILABLE_IN_2_24
55char * soup_cookie_jar_get_cookies (SoupCookieJar *jar,
56 SoupURI *uri,
57 gboolean for_http);
58SOUP_AVAILABLE_IN_2_40
59GSList * soup_cookie_jar_get_cookie_list (SoupCookieJar *jar,
60 SoupURI *uri,
61 gboolean for_http);
62SOUP_AVAILABLE_IN_2_24
63void soup_cookie_jar_set_cookie (SoupCookieJar *jar,
64 SoupURI *uri,
65 const char *cookie);
66SOUP_AVAILABLE_IN_2_30
67void soup_cookie_jar_set_cookie_with_first_party (SoupCookieJar *jar,
68 SoupURI *uri,
69 SoupURI *first_party,
70 const char *cookie);
71SOUP_AVAILABLE_IN_2_26
72void soup_cookie_jar_add_cookie (SoupCookieJar *jar,
73 SoupCookie *cookie);
74SOUP_AVAILABLE_IN_2_40
75void soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar *jar,
76 SoupURI *first_party,
77 SoupCookie *cookie);
78SOUP_AVAILABLE_IN_2_26
79void soup_cookie_jar_delete_cookie (SoupCookieJar *jar,
80 SoupCookie *cookie);
81SOUP_AVAILABLE_IN_2_26
82GSList * soup_cookie_jar_all_cookies (SoupCookieJar *jar);
83SOUP_AVAILABLE_IN_2_30
84void soup_cookie_jar_set_accept_policy (SoupCookieJar *jar,
85 SoupCookieJarAcceptPolicy policy);
86SOUP_AVAILABLE_IN_2_30
87SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy (SoupCookieJar *jar);
88SOUP_AVAILABLE_IN_2_40
89gboolean soup_cookie_jar_is_persistent (SoupCookieJar *jar);
90
91#ifndef SOUP_DISABLE_DEPRECATED
92SOUP_AVAILABLE_IN_2_24
93SOUP_DEPRECATED_IN_2_26
94void soup_cookie_jar_save (SoupCookieJar *jar);
95#endif
96
97G_END_DECLS
98
99#endif /* __SOUP_COOKIE_JAR_H__ */
100