summaryrefslogtreecommitdiff
path: root/src/proxy/store.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/proxy/store.h')
-rw-r--r--src/proxy/store.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/proxy/store.h b/src/proxy/store.h
new file mode 100644
index 0000000..805bc20
--- /dev/null
+++ b/src/proxy/store.h
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------ */
+/*
+HTTrack Website Copier, Offline Browser for Windows and Unix
+Copyright (C) Xavier Roche and other contributors
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Please visit our Website: http://www.httrack.com
+*/
+
+/* ------------------------------------------------------------ */
+/* File: Cache manager for ProxyTrack */
+/* Author: Xavier Roche */
+/* ------------------------------------------------------------ */
+
+#ifndef WEBHTTRACK_PROXYTRACK_STORE
+#define WEBHTTRACK_PROXYTRACK_STORE
+
+/* Proxy */
+
+typedef struct _PT_Index _PT_Index;
+typedef struct _PT_Indexes _PT_Indexes;
+
+typedef struct _PT_Index *PT_Index;
+typedef struct _PT_Indexes *PT_Indexes;
+
+typedef struct _PT_Cache _PT_Cache;
+typedef struct _PT_Cache *PT_Cache;
+
+typedef struct _PT_CacheItem _PT_CacheItem;
+typedef struct _PT_CacheItem *PT_CacheItem;
+
+typedef struct _PT_Element {
+ int indexId; // index identifier, if suitable (!= -1)
+ //
+ int statuscode; // status-code, -1=erreur, 200=OK,201=..etc (cf RFC1945)
+ char* adr; // adresse du bloc de mémoire, NULL=vide
+ char* headers; // adresse des en têtes si présents
+ unsigned long int size; // taille fichier
+ char msg[1024]; // error message ("\0"=undefined)
+ char contenttype[64]; // content-type ("text/html" par exemple)
+ char charset[64]; // charset ("iso-8859-1" par exemple)
+ char* location; // on copie dedans éventuellement la véritable 'location'
+ char lastmodified[64]; // Last-Modified
+ char etag[64]; // Etag
+ char cdispo[256]; // Content-Disposition coupé
+} _PT_Element;
+typedef struct _PT_Element *PT_Element;
+
+typedef enum PT_Fetch_Flags {
+ FETCH_HEADERS, // fetch headers
+ FETCH_BODY // fetch body
+} PT_Fetch_Flags;
+
+/* Locking */
+#ifdef _WIN32
+typedef void* PT_Mutex;
+#else
+typedef pthread_mutex_t PT_Mutex;
+#endif
+
+void MutexInit(PT_Mutex *pMutex);
+void MutexLock(PT_Mutex *pMutex);
+void MutexUnlock(PT_Mutex *pMutex);
+void MutexFree(PT_Mutex *pMutex);
+
+/* Indexes */
+PT_Indexes PT_New(void);
+void PT_Delete(PT_Indexes index);
+PT_Element PT_ReadIndex(PT_Indexes indexes, const char* url, int flags);
+int PT_LookupIndex(PT_Indexes indexes, const char* url);
+int PT_AddIndex(PT_Indexes index, const char *path);
+int PT_RemoveIndex(PT_Indexes index, int indexId);
+int PT_IndexMerge(PT_Indexes indexes, PT_Index *pindex);
+PT_Index PT_GetIndex(PT_Indexes indexes, int indexId);
+
+/* Indexes list */
+PT_Element PT_Index_HTML_BuildRootInfo(PT_Indexes indexes);
+char ** PT_Enumerate(PT_Indexes indexes, const char *url, int subtree);
+void PT_Enumerate_Delete(char ***plist);
+
+/* Index */
+PT_Index PT_LoadCache(const char *filename);
+void PT_Index_Delete(PT_Index *pindex);
+PT_Element PT_ReadCache(PT_Index index, const char* url, int flags);
+int PT_LookupCache(PT_Index index, const char* url);
+time_t PT_Index_Timestamp(PT_Index index);
+
+/* Elements*/
+PT_Element PT_ElementNew(void);
+void PT_Element_Delete(PT_Element *pentry);
+
+#endif