1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * Copyright 2007, 2008 Red Hat, Inc. |
4 | */ |
5 | |
6 | #ifndef __SOUP_COOKIE_H__ |
7 | #define __SOUP_COOKIE_H__ 1 |
8 | |
9 | #include <libsoup/soup-types.h> |
10 | |
11 | G_BEGIN_DECLS |
12 | |
13 | struct _SoupCookie { |
14 | char *name; |
15 | char *value; |
16 | char *domain; |
17 | char *path; |
18 | SoupDate *expires; |
19 | gboolean secure; |
20 | gboolean http_only; |
21 | }; |
22 | |
23 | SOUP_AVAILABLE_IN_2_24 |
24 | GType soup_cookie_get_type (void); |
25 | #define SOUP_TYPE_COOKIE (soup_cookie_get_type()) |
26 | |
27 | #define SOUP_COOKIE_MAX_AGE_ONE_HOUR (60 * 60) |
28 | #define SOUP_COOKIE_MAX_AGE_ONE_DAY (SOUP_COOKIE_MAX_AGE_ONE_HOUR * 24) |
29 | #define SOUP_COOKIE_MAX_AGE_ONE_WEEK (SOUP_COOKIE_MAX_AGE_ONE_DAY * 7) |
30 | #define SOUP_COOKIE_MAX_AGE_ONE_YEAR (SOUP_COOKIE_MAX_AGE_ONE_DAY * 365.2422) |
31 | |
32 | SOUP_AVAILABLE_IN_2_24 |
33 | SoupCookie *soup_cookie_new (const char *name, |
34 | const char *value, |
35 | const char *domain, |
36 | const char *path, |
37 | int max_age); |
38 | SOUP_AVAILABLE_IN_2_24 |
39 | SoupCookie *soup_cookie_parse (const char *, |
40 | SoupURI *origin); |
41 | SOUP_AVAILABLE_IN_2_24 |
42 | SoupCookie *soup_cookie_copy (SoupCookie *cookie); |
43 | |
44 | SOUP_AVAILABLE_IN_2_32 |
45 | const char *soup_cookie_get_name (SoupCookie *cookie); |
46 | SOUP_AVAILABLE_IN_2_24 |
47 | void soup_cookie_set_name (SoupCookie *cookie, |
48 | const char *name); |
49 | SOUP_AVAILABLE_IN_2_32 |
50 | const char *soup_cookie_get_value (SoupCookie *cookie); |
51 | SOUP_AVAILABLE_IN_2_24 |
52 | void soup_cookie_set_value (SoupCookie *cookie, |
53 | const char *value); |
54 | SOUP_AVAILABLE_IN_2_32 |
55 | const char *soup_cookie_get_domain (SoupCookie *cookie); |
56 | SOUP_AVAILABLE_IN_2_24 |
57 | void soup_cookie_set_domain (SoupCookie *cookie, |
58 | const char *domain); |
59 | SOUP_AVAILABLE_IN_2_32 |
60 | const char *soup_cookie_get_path (SoupCookie *cookie); |
61 | SOUP_AVAILABLE_IN_2_24 |
62 | void soup_cookie_set_path (SoupCookie *cookie, |
63 | const char *path); |
64 | SOUP_AVAILABLE_IN_2_24 |
65 | void soup_cookie_set_max_age (SoupCookie *cookie, |
66 | int max_age); |
67 | SOUP_AVAILABLE_IN_2_32 |
68 | SoupDate *soup_cookie_get_expires (SoupCookie *cookie); |
69 | SOUP_AVAILABLE_IN_2_24 |
70 | void soup_cookie_set_expires (SoupCookie *cookie, |
71 | SoupDate *expires); |
72 | SOUP_AVAILABLE_IN_2_32 |
73 | gboolean soup_cookie_get_secure (SoupCookie *cookie); |
74 | SOUP_AVAILABLE_IN_2_24 |
75 | void soup_cookie_set_secure (SoupCookie *cookie, |
76 | gboolean secure); |
77 | SOUP_AVAILABLE_IN_2_32 |
78 | gboolean soup_cookie_get_http_only (SoupCookie *cookie); |
79 | SOUP_AVAILABLE_IN_2_24 |
80 | void soup_cookie_set_http_only (SoupCookie *cookie, |
81 | gboolean http_only); |
82 | |
83 | SOUP_AVAILABLE_IN_2_24 |
84 | char * (SoupCookie *cookie); |
85 | SOUP_AVAILABLE_IN_2_24 |
86 | char * (SoupCookie *cookie); |
87 | |
88 | SOUP_AVAILABLE_IN_2_24 |
89 | gboolean soup_cookie_applies_to_uri (SoupCookie *cookie, |
90 | SoupURI *uri); |
91 | SOUP_AVAILABLE_IN_2_24 |
92 | gboolean soup_cookie_equal (SoupCookie *cookie1, |
93 | SoupCookie *cookie2); |
94 | |
95 | SOUP_AVAILABLE_IN_2_24 |
96 | void soup_cookie_free (SoupCookie *cookie); |
97 | |
98 | SOUP_AVAILABLE_IN_2_24 |
99 | GSList *soup_cookies_from_response (SoupMessage *msg); |
100 | SOUP_AVAILABLE_IN_2_24 |
101 | GSList *soup_cookies_from_request (SoupMessage *msg); |
102 | |
103 | SOUP_AVAILABLE_IN_2_24 |
104 | void soup_cookies_to_response (GSList *cookies, |
105 | SoupMessage *msg); |
106 | SOUP_AVAILABLE_IN_2_24 |
107 | void soup_cookies_to_request (GSList *cookies, |
108 | SoupMessage *msg); |
109 | |
110 | SOUP_AVAILABLE_IN_2_24 |
111 | void soup_cookies_free (GSList *cookies); |
112 | |
113 | SOUP_AVAILABLE_IN_2_24 |
114 | char * (GSList *cookies); |
115 | |
116 | SOUP_AVAILABLE_IN_2_30 |
117 | gboolean soup_cookie_domain_matches (SoupCookie *cookie, |
118 | const char *host); |
119 | |
120 | G_END_DECLS |
121 | |
122 | #endif /* __SOUP_COOKIE_H__ */ |
123 | |