Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
cache.h
Go to the documentation of this file.
1#ifndef __CACHE_H__
2#define __CACHE_H__
3
4#ifdef __cplusplus
5extern "C" {
6#endif /* __cplusplus */
7
8
9#include "chain.h"
10#include "url.h"
11
12/*
13 * Cache Op codes
14 */
15#define CA_Send (0) /* Normal update */
16#define CA_Close (1) /* Successful operation close */
17#define CA_Abort (2) /* Operation abort */
18
19/*
20 * Flag Defines
21 */
22#define CA_GotHeader 0x1 /* True after header is completely got */
23#define CA_GotContentType 0x2 /* True after Content-Type is known */
24#define CA_GotLength 0x4 /* True if Content-Length is known */
25#define CA_InProgress 0x8 /* True if we are getting data */
26#define CA_Redirect 0x10 /* Data actually points to a redirect */
27#define CA_ForceRedirect 0x20 /* Unconditional redirect */
28#define CA_TempRedirect 0x40 /* Temporary redirect */
29#define CA_NotFound 0x80 /* True if remote server didn't find the URL */
30#define CA_Aborted 0x100 /* Aborted before getting full data */
31#define CA_MsgErased 0x200 /* Used to erase the bw's status bar */
32#define CA_RedirectLoop 0x400 /* Redirect loop */
33#define CA_InternalUrl 0x800 /* URL content is generated by dillo */
34#define CA_HugeFile 0x1000 /* URL content is too big */
35#define CA_IsEmpty 0x2000 /* True until a byte of content arrives */
36#define CA_KeepAlive 0x4000
37
39
43typedef void (*CA_Callback_t)(int Op, CacheClient_t *Client);
44
58
59/*
60 * Function prototypes
61 */
62void a_Cache_init(void);
63int a_Cache_open_url(void *Web, CA_Callback_t Call, void *CbData);
64int a_Cache_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize);
65void a_Cache_unref_buf(const DilloUrl *Url);
66const char *a_Cache_get_content_type(const DilloUrl *url);
67const char *a_Cache_set_content_type(const DilloUrl *url, const char *ctype,
68 const char *from);
71bool_t a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size,
72 const DilloUrl *Url);
75void a_Cache_freeall(void);
77void a_Cache_stop_client(int Key);
78
79
80#ifdef __cplusplus
81}
82#endif /* __cplusplus */
83#endif /* __CACHE_H__ */
84
int a_Cache_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize)
Get the pointer to the URL document, and its size, from the cache entry.
Definition cache.c:552
CacheClient_t * a_Cache_client_get_if_unique(int Key)
Last Client for this entry?
Definition cache.c:1399
uint_t a_Cache_get_flags_with_redirection(const DilloUrl *url)
Get cache entry status (following redirections).
Definition cache.c:415
void(* CA_Callback_t)(int Op, CacheClient_t *Client)
Callback type for cache clients.
Definition cache.h:43
const char * a_Cache_set_content_type(const DilloUrl *url, const char *ctype, const char *from)
Change Content-Type for cache entry found by url.
Definition cache.c:492
void a_Cache_unref_buf(const DilloUrl *Url)
Unreference the data buffer when no longer using it.
Definition cache.c:571
const char * a_Cache_get_content_type(const DilloUrl *url)
Get current Content-Type for cache entry found by URL.
Definition cache.c:472
void a_Cache_entry_remove_by_url(DilloUrl *url)
Wrapper for capi.
Definition cache.c:357
bool_t a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, const DilloUrl *Url)
Receive new data, update the reception buffer (for next read), update the cache, and service the clie...
Definition cache.c:897
int a_Cache_download_enabled(const DilloUrl *url)
Check whether a URL scheme is downloadable.
Definition cache.c:1093
int a_Cache_open_url(void *Web, CA_Callback_t Call, void *CbData)
Try finding the url in the cache.
Definition cache.c:376
void a_Cache_init(void)
Initialize cache data.
Definition cache.c:118
void a_Cache_freeall(void)
Memory deallocator (only called at exit time)
Definition cache.c:1448
uint_t a_Cache_get_flags(const DilloUrl *url)
Get cache entry status.
Definition cache.c:406
void a_Cache_stop_client(int Key)
Remove a client from the client queue TODO: notify the dicache and upper layers.
Definition cache.c:1419
unsigned int uint_t
Definition d_size.h:20
unsigned char bool_t
Definition d_size.h:21
Data structure for cache clients.
Definition cache.h:48
CA_Callback_t Callback
Client function.
Definition cache.h:54
const DilloUrl * Url
Pointer to a cache entry Url.
Definition cache.h:50
int Key
Primary Key for this client.
Definition cache.h:49
int Version
Dicache version of this Url (0 if not used)
Definition cache.h:51
void * CbData
Client function data.
Definition cache.h:55
uint_t BufSize
Valid size of cache-data.
Definition cache.h:53
void * Buf
Pointer to cache-data.
Definition cache.h:52
void * Web
Pointer to the Web structure of our client.
Definition cache.h:56
Definition url.h:88
Parse and normalize all URL's inside Dillo.