Bug 1004: NEWS and AUTHORS
[elinks/kon.git] / src / cookies / cookies.h
blob4a7dfa48323d9b846e70df994712b61dfbaffdaa
1 #ifndef EL__COOKIES_COOKIES_H
2 #define EL__COOKIES_COOKIES_H
4 #include "main/module.h"
5 #include "main/object.h"
6 #include "protocol/uri.h"
7 #include "util/string.h"
8 #include "util/time.h"
10 struct listbox_item;
11 struct terminal;
13 enum cookies_accept {
14 COOKIES_ACCEPT_NONE,
15 COOKIES_ACCEPT_ASK,
16 COOKIES_ACCEPT_ALL
19 struct cookie_server {
20 OBJECT_HEAD(struct cookie_server);
22 struct listbox_item *box_item;
23 unsigned char host[1]; /* Must be at end of struct. */
26 struct cookie {
27 OBJECT_HEAD(struct cookie);
29 unsigned char *name, *value;
30 unsigned char *path, *domain;
32 struct cookie_server *server; /* The host the cookie originated from */
33 time_t expires; /* Expiration time. Zero means undefined */
34 int secure; /* Did it have 'secure' attribute */
36 struct listbox_item *box_item;
39 struct cookie_server *get_cookie_server(unsigned char *host, int hostlen);
40 struct cookie *init_cookie(unsigned char *name, unsigned char *value,
41 unsigned char *path, unsigned char *domain,
42 struct cookie_server *server);
43 void accept_cookie(struct cookie *);
44 void done_cookie(struct cookie *);
45 void delete_cookie(struct cookie *);
46 void set_cookie(struct uri *, unsigned char *);
47 void load_cookies(void);
48 void save_cookies(struct terminal *);
49 void set_cookies_dirty(void);
51 /* Note that the returned value points to a static structure and thus the
52 * string will be overwritten at the next call time. The string source
53 * itself is dynamically allocated, though. */
54 struct string *send_cookies(struct uri *uri);
56 extern struct module cookies_module;
58 #endif