iconv: Bail out of the loop when an illegal sequence of bytes occurs.
[elinks/elinks-j605.git] / src / cookies / cookies.h
bloba2f6695ea63680f918655650a2b6fc93d4063f8e
1 #ifndef EL__COOKIES_COOKIES_H
2 #define EL__COOKIES_COOKIES_H
4 /* ELinks cookies file format:
5 * NAME\tVALUE\tSERVER\tPATH\tDOMAIN\tEXPIRES\tSECURE\n
7 * \t is a tabulator
8 * \n is a newline
9 * EXPIRES is the number of seconds since 1970-01-01 00:00:00 UTC.
10 * SECURE is 0 for http and 1 for https.
13 #include "main/module.h"
14 #include "main/object.h"
15 #include "protocol/uri.h"
16 #include "util/string.h"
17 #include "util/time.h"
19 struct listbox_item;
20 struct terminal;
22 enum cookies_accept {
23 COOKIES_ACCEPT_NONE,
24 COOKIES_ACCEPT_ASK,
25 COOKIES_ACCEPT_ALL
28 struct cookie_server {
29 OBJECT_HEAD(struct cookie_server);
31 struct listbox_item *box_item;
32 unsigned char host[1]; /* Must be at end of struct. */
35 struct cookie {
36 OBJECT_HEAD(struct cookie);
38 unsigned char *name, *value;
39 unsigned char *path, *domain;
41 struct cookie_server *server; /* The host the cookie originated from */
42 time_t expires; /* Expiration time. Zero means undefined */
43 int secure; /* Did it have 'secure' attribute */
45 struct listbox_item *box_item;
48 struct cookie_server *get_cookie_server(unsigned char *host, int hostlen);
49 struct cookie *init_cookie(unsigned char *name, unsigned char *value,
50 unsigned char *path, unsigned char *domain,
51 struct cookie_server *server);
52 void accept_cookie(struct cookie *);
53 void done_cookie(struct cookie *);
54 void delete_cookie(struct cookie *);
55 void set_cookie(struct uri *, unsigned char *);
56 void load_cookies(void);
57 void save_cookies(struct terminal *);
58 void set_cookies_dirty(void);
60 /* Note that the returned value points to a static structure and thus the
61 * string will be overwritten at the next call time. The string source
62 * itself is dynamically allocated, though. */
63 struct string *send_cookies(struct uri *uri);
65 extern struct module cookies_module;
67 #endif