2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__COOKIES_COOKIES_H
|
|
|
|
#define EL__COOKIES_COOKIES_H
|
|
|
|
|
|
|
|
#include "main/module.h"
|
|
|
|
#include "main/object.h"
|
|
|
|
#include "protocol/uri.h"
|
|
|
|
#include "util/string.h"
|
|
|
|
#include "util/time.h"
|
|
|
|
|
|
|
|
struct listbox_item;
|
2006-12-09 11:27:40 -05:00
|
|
|
struct terminal;
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
enum cookies_accept {
|
|
|
|
COOKIES_ACCEPT_NONE,
|
|
|
|
COOKIES_ACCEPT_ASK,
|
|
|
|
COOKIES_ACCEPT_ALL
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cookie_server {
|
|
|
|
OBJECT_HEAD(struct cookie_server);
|
|
|
|
|
|
|
|
struct listbox_item *box_item;
|
|
|
|
unsigned char host[1]; /* Must be at end of struct. */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct cookie {
|
|
|
|
OBJECT_HEAD(struct cookie);
|
|
|
|
|
|
|
|
unsigned char *name, *value;
|
|
|
|
unsigned char *path, *domain;
|
|
|
|
|
|
|
|
struct cookie_server *server; /* The host the cookie originated from */
|
|
|
|
time_t expires; /* Expiration time. Zero means undefined */
|
|
|
|
int secure; /* Did it have 'secure' attribute */
|
|
|
|
|
|
|
|
struct listbox_item *box_item;
|
|
|
|
};
|
|
|
|
|
2006-05-27 17:56:42 -04:00
|
|
|
struct cookie_server *get_cookie_server(unsigned char *host, int hostlen);
|
2006-05-31 17:36:11 -04:00
|
|
|
struct cookie *init_cookie(unsigned char *name, unsigned char *value,
|
|
|
|
unsigned char *path, unsigned char *domain,
|
|
|
|
struct cookie_server *server);
|
2005-09-15 09:58:31 -04:00
|
|
|
void accept_cookie(struct cookie *);
|
|
|
|
void done_cookie(struct cookie *);
|
|
|
|
void delete_cookie(struct cookie *);
|
|
|
|
void set_cookie(struct uri *, unsigned char *);
|
|
|
|
void load_cookies(void);
|
2006-12-09 11:27:40 -05:00
|
|
|
void save_cookies(struct terminal *);
|
2006-12-09 09:24:24 -05:00
|
|
|
void set_cookies_dirty(void);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
/* Note that the returned value points to a static structure and thus the
|
|
|
|
* string will be overwritten at the next call time. The string source
|
|
|
|
* itself is dynamically allocated, though. */
|
|
|
|
struct string *send_cookies(struct uri *uri);
|
|
|
|
|
|
|
|
extern struct module cookies_module;
|
|
|
|
|
|
|
|
#endif
|