ewk_cookies.h revision 81bc750723a18f21cd17d1b173cd2a4dda9cea6e
1/*
2    Copyright (C) 2010 ProFUSION embedded systems
3    Copyright (C) 2010 Samsung Electronics
4
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.
9
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.
14
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.
19*/
20
21/**
22 * @file    ewk_cookies.h
23 * @brief   The Ewk cookies API.
24 */
25
26#ifndef ewk_cookies_h
27#define ewk_cookies_h
28
29#include "ewk_eapi.h"
30#include <Eina.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * \struct  _Ewk_Cookie
38 *
39 * @brief   Describes properties of an HTTP cookie.
40 */
41struct _Ewk_Cookie {
42    /// the cookie name
43    char *name;
44    /// the cookie value
45    char *value;
46    /// the "domain" attribute, or else the hostname that the cookie came from
47    char *domain;
48    /// the "path" attribute, or @c 0
49    char *path;
50    /// the cookie expiration time, or @c 0 for a session cookie
51    time_t expires;
52    /// @c EINA_TRUE if the cookie should only be tranferred over SSL
53    Eina_Bool secure;
54    /// @c EINA_TRUE if the cookie should not be exposed to scripts
55    Eina_Bool http_only;
56};
57/// Creates a type name for the _Ewk_Cookie.
58typedef struct _Ewk_Cookie Ewk_Cookie;
59
60/**
61 * \enum    _Ewk_Cookie_Policy
62 *
63 * @brief   Contains a policy for the cookies.
64 */
65enum _Ewk_Cookie_Policy {
66    /// Rejects all cookies.
67    EWK_COOKIE_JAR_ACCEPT_NEVER,
68    /// Accepts every cookie sent from any page.
69    EWK_COOKIE_JAR_ACCEPT_ALWAYS,
70    /// Accepts cookies only from the main page.
71    EWK_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
72};
73/// Creates a type name for the _Ewk_Cookie_Policy.
74typedef enum _Ewk_Cookie_Policy Ewk_Cookie_Policy;
75
76/************************** Exported functions ***********************/
77
78EAPI Eina_Bool          ewk_cookies_file_set(const char *filename);
79EAPI void               ewk_cookies_clear();
80EAPI Eina_List*         ewk_cookies_get_all();
81EAPI void               ewk_cookies_cookie_del(Ewk_Cookie *cookie);
82EAPI void               ewk_cookies_cookie_free(Ewk_Cookie *cookie);
83EAPI void               ewk_cookies_policy_set(Ewk_Cookie_Policy p);
84EAPI Ewk_Cookie_Policy  ewk_cookies_policy_get();
85
86#ifdef __cplusplus
87}
88#endif
89#endif // ewk_cookies_h
90