2 Copyright (C) 2010 ProFUSION embedded systems
3 Copyright (C) 2010 Samsung Electronics
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
23 * @brief The Ewk cookies API.
38 * @brief Describes properties of an HTTP cookie.
45 /// the "domain" attribute, or else the hostname that the cookie came from
47 /// the "path" attribute, or @c 0
49 /// the cookie expiration time, or @c 0 for a session cookie
51 /// @c EINA_TRUE if the cookie should only be tranferred over SSL
53 /// @c EINA_TRUE if the cookie should not be exposed to scripts
56 /// Creates a type name for the _Ewk_Cookie.
57 typedef struct _Ewk_Cookie Ewk_Cookie;
60 * \enum _Ewk_Cookie_Policy
62 * @brief Contains a policy for the cookies.
64 enum _Ewk_Cookie_Policy {
65 /// Rejects all cookies.
66 EWK_COOKIE_JAR_ACCEPT_NEVER,
67 /// Accepts every cookie sent from any page.
68 EWK_COOKIE_JAR_ACCEPT_ALWAYS,
69 /// Accepts cookies only from the main page.
70 EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
72 /// Creates a type name for the _Ewk_Cookie_Policy.
73 typedef enum _Ewk_Cookie_Policy Ewk_Cookie_Policy;
75 /************************** Exported functions ***********************/
78 * Sets the path where the cookies are going to be stored.
80 * @param filename path to the cookies.txt file, use @c 0 for keep
81 * cookies just in memory.
83 * @return @c EINA_FALSE if it wasn't possible to create the cookie jar,
84 * @c EINA_TRUE otherwise.
86 EAPI Eina_Bool ewk_cookies_file_set(const char *filename);
89 * Clears all the cookies from the cookie jar.
91 EAPI void ewk_cookies_clear(void);
94 * Returns a list of cookies in the cookie jar.
96 * @return an @c Eina_List with all the cookies in the cookie jar
98 EAPI Eina_List* ewk_cookies_get_all(void);
101 * Deletes a cookie from the cookie jar.
103 * Note that the fields name, value, domain and path are used to match this
104 * cookie in the cookie jar.
106 * @param cookie an @c Ewk_Cookie that has the info relative to that cookie
108 EAPI void ewk_cookies_cookie_del(Ewk_Cookie *cookie);
111 * Frees the memory used by a cookie.
113 * @param cookie the Ewk_Cookie struct that will be freed
115 EAPI void ewk_cookies_cookie_free(Ewk_Cookie *cookie);
118 * Sets accept policy for the cookies.
120 * @param p the acceptance policy
122 * @see Ewk_Cookie_Policy
124 EAPI void ewk_cookies_policy_set(Ewk_Cookie_Policy p);
127 * Gets the acceptance policy used in the current cookie jar.
129 * @return the current acceptance policy
130 * @see Ewk_Cookie_Policy
132 EAPI Ewk_Cookie_Policy ewk_cookies_policy_get(void);
137 #endif // ewk_cookies_h