00001
00002
00003
00004
00005 #ifndef __COOKIE_H
00006 #define __COOKIE_H
00007
00008 #include <stdio.h>
00009 #if defined(WIN32)
00010 #include <time.h>
00011 #else
00012 #ifdef HAVE_SYS_TIME_H
00013 #include <sys/time.h>
00014 #endif
00015 #endif
00016
00017 #include <curl/curl.h>
00018
00019 struct Cookie {
00020 struct Cookie *next;
00021 char *name;
00022 char *value;
00023 char *path;
00024 char *domain;
00025 curl_off_t expires;
00026 char *expirestr;
00027 bool tailmatch;
00028
00029
00030 char *version;
00031 char *maxage;
00032
00033 bool secure;
00034 bool livecookie;
00035 };
00036
00037 struct CookieInfo {
00038
00039 struct Cookie *cookies;
00040
00041 char *filename;
00042 bool running;
00043 long numcookies;
00044 bool newsession;
00045 };
00046
00047 #define MAX_COOKIE_LINE 5000
00048 #define MAX_COOKIE_LINE_TXT "4999"
00049
00050 #define MAX_NAME 1024
00051 #define MAX_NAME_TXT "1023"
00052
00053 struct SessionHandle;
00054
00055 struct Cookie *Curl_cookie_add(struct SessionHandle *data,
00056 struct CookieInfo *, bool header, char *line,
00057 char *domain, char *path);
00058
00059 struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
00060 char *, struct CookieInfo *, bool);
00061 struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
00062 void Curl_cookie_freelist(struct Cookie *);
00063 void Curl_cookie_clearall(struct CookieInfo *cookies);
00064 void Curl_cookie_clearsess(struct CookieInfo *cookies);
00065 void Curl_cookie_cleanup(struct CookieInfo *);
00066 int Curl_cookie_output(struct CookieInfo *, char *);
00067
00068 #if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
00069 #define Curl_cookie_list(x) NULL
00070 #define Curl_cookie_loadfiles(x) do { } while (0)
00071 #else
00072 struct curl_slist *Curl_cookie_list(struct SessionHandle *data);
00073 void Curl_cookie_loadfiles(struct SessionHandle *data);
00074 #endif
00075
00076 #endif