• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY
49 } SoupCookieJarAcceptPolicy;
50 
51 SOUP_AVAILABLE_IN_2_24
52 GType                     soup_cookie_jar_get_type                    (void);
53 SOUP_AVAILABLE_IN_2_24
54 SoupCookieJar *           soup_cookie_jar_new                         (void);
55 SOUP_AVAILABLE_IN_2_24
56 char          *           soup_cookie_jar_get_cookies                 (SoupCookieJar             *jar,
57 								       SoupURI                   *uri,
58 								       gboolean                   for_http);
59 SOUP_AVAILABLE_IN_2_40
60 GSList        *           soup_cookie_jar_get_cookie_list             (SoupCookieJar             *jar,
61 								       SoupURI                   *uri,
62 								       gboolean                   for_http);
63 SOUP_AVAILABLE_IN_2_70
64 GSList        *           soup_cookie_jar_get_cookie_list_with_same_site_info (
65 	                                                               SoupCookieJar             *jar,
66 	                                                               SoupURI                   *uri,
67 								       SoupURI                   *top_level,
68 								       SoupURI                   *site_for_cookies,
69 								       gboolean                   for_http,
70 								       gboolean                   is_safe_method,
71 								       gboolean                   is_top_level_navigation);
72 SOUP_AVAILABLE_IN_2_24
73 void                      soup_cookie_jar_set_cookie                  (SoupCookieJar             *jar,
74 								       SoupURI                   *uri,
75 								       const char                *cookie);
76 SOUP_AVAILABLE_IN_2_30
77 void                      soup_cookie_jar_set_cookie_with_first_party (SoupCookieJar             *jar,
78 								       SoupURI                   *uri,
79 								       SoupURI                   *first_party,
80 								       const char                *cookie);
81 SOUP_AVAILABLE_IN_2_26
82 void                      soup_cookie_jar_add_cookie                  (SoupCookieJar             *jar,
83 								       SoupCookie                *cookie);
84 SOUP_AVAILABLE_IN_2_40
85 void                      soup_cookie_jar_add_cookie_with_first_party (SoupCookieJar             *jar,
86 								       SoupURI                   *first_party,
87 								       SoupCookie                *cookie);
88 SOUP_AVAILABLE_IN_2_68
89 void                      soup_cookie_jar_add_cookie_full             (SoupCookieJar             *jar,
90                                                                        SoupCookie                *cookie,
91 								       SoupURI                   *uri,
92 								       SoupURI                   *first_party);
93 SOUP_AVAILABLE_IN_2_26
94 void                      soup_cookie_jar_delete_cookie               (SoupCookieJar             *jar,
95 								       SoupCookie                *cookie);
96 SOUP_AVAILABLE_IN_2_26
97 GSList        *           soup_cookie_jar_all_cookies                 (SoupCookieJar             *jar);
98 SOUP_AVAILABLE_IN_2_30
99 void                      soup_cookie_jar_set_accept_policy           (SoupCookieJar             *jar,
100 								       SoupCookieJarAcceptPolicy  policy);
101 SOUP_AVAILABLE_IN_2_30
102 SoupCookieJarAcceptPolicy soup_cookie_jar_get_accept_policy           (SoupCookieJar             *jar);
103 SOUP_AVAILABLE_IN_2_40
104 gboolean                  soup_cookie_jar_is_persistent               (SoupCookieJar             *jar);
105 
106 #ifndef SOUP_DISABLE_DEPRECATED
107 SOUP_AVAILABLE_IN_2_24
108 SOUP_DEPRECATED_IN_2_26
109 void                      soup_cookie_jar_save                        (SoupCookieJar             *jar);
110 #endif
111 
112 G_END_DECLS
113 
114 #endif /* __SOUP_COOKIE_JAR_H__ */
115