Added some RFC2109 support
[platform/upstream/curl.git] / lib / cookie.h
1 #ifndef __COOKIE_H
2 #define __COOKIE_H
3
4 #include <stdio.h>
5 #ifdef WIN32
6 #include <time.h>
7 #else
8 #include <sys/time.h>
9 #endif
10
11 #include <curl/curl.h>
12
13 struct Cookie {
14   struct Cookie *next; /* next in the chain */
15   char *name;        /* <this> = value */
16   char *value;       /* name = <this> */
17   char *path;         /* path = <this> */
18   char *domain;      /* domain = <this> */
19   time_t expires;    /* expires = <this> */
20   char *expirestr;   /* the plain text version */
21   
22   /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
23   char *version;     /* Version = <value> */
24   char *maxage;      /* Max-Age = <value> */
25   
26   bool secure;       /* whether the 'secure' keyword was used */
27 };
28
29 struct CookieInfo {
30    /* linked list of cookies we know of */
31    struct Cookie *cookies;
32
33    char *filename; /* file we read from/write to */
34 };
35
36 /* This is the maximum line length we accept for a cookie line */
37 #define MAX_COOKIE_LINE 2048
38 #define MAX_COOKIE_LINE_TXT "2047"
39
40 /* This is the maximum length of a cookie name we deal with: */
41 #define MAX_NAME 256
42 #define MAX_NAME_TXT "255"
43
44 struct Cookie *cookie_add(struct CookieInfo *, bool, char *);
45 struct CookieInfo *cookie_init(char *);
46 struct Cookie *cookie_getlist(struct CookieInfo *, char *, char *, bool);
47 void cookie_freelist(struct Cookie *);
48 void cookie_cleanup(struct CookieInfo *);
49
50 #endif