ELinks 0.18.0
cache.c File Reference
#include <string.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "cache/cache.h"
#include "cache/dialogs.h"
#include "config/options.h"
#include "main/main.h"
#include "main/object.h"
#include "network/connection.h"
#include "protocol/protocol.h"
#include "protocol/proxy.h"
#include "protocol/uri.h"
#include "util/base64.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
#include "util/time.h"
Include dependency graph for cache.c:

Macros

#define dump_frags(entry, comment)
#define CACHE_PAD(x)
#define FRAGSIZE(x)

Functions

static void truncate_entry (struct cache_entry *cached, off_t offset, int final)
unsigned longlong get_cache_size (void)
int get_cache_entry_count (void)
int get_cache_entry_used_count (void)
int get_cache_entry_loading_count (void)
struct cache_entryfind_in_cache (struct uri *uri)
struct cache_entryget_cache_entry (struct uri *uri)
static int cache_entry_has_expired (struct cache_entry *cached)
struct cache_entryget_validated_cache_entry (struct uri *uri, cache_mode_T cache_mode)
int cache_entry_is_valid (struct cache_entry *cached)
struct cache_entryfollow_cached_redirects (struct cache_entry *cached)
struct cache_entryget_redirected_cache_entry (struct uri *uri)
static void enlarge_entry (struct cache_entry *cached, off_t size)
static struct fragmentfrag_alloc (size_t size)
static struct fragmentfrag_realloc (struct fragment *f, size_t size)
static void frag_free (struct fragment *f)
static void remove_overlaps (struct cache_entry *cached, struct fragment *f, int *trunc)
int add_fragment (struct cache_entry *cached, off_t offset, const char *data, ssize_t length)
struct fragmentget_cache_fragment (struct cache_entry *cached)
static void delete_fragment (struct cache_entry *cached, struct fragment *f)
void free_entry_to (struct cache_entry *cached, off_t offset)
void delete_entry_content (struct cache_entry *cached)
static void done_cache_entry (struct cache_entry *cached)
void delete_cache_entry (struct cache_entry *cached)
void normalize_cache_entry (struct cache_entry *cached, off_t truncate_length)
struct uriredirect_cache (struct cache_entry *cached, const char *location, int get, int incomplete)
void garbage_collection (int whole)
int validate_cache_integrity (struct cache_entry *cached, const char *integrity)

Variables

static struct cache_entry list cache_entries = { D_LIST_HEAD_EL(cache_entries) }
static unsigned longlong cache_size
static int id_counter = 1

Macro Definition Documentation

◆ CACHE_PAD

#define CACHE_PAD ( x)
Value:
(((x) | 0x3fff) + 1)

◆ dump_frags

#define dump_frags ( entry,
comment )

◆ FRAGSIZE

#define FRAGSIZE ( x)
Value:
(sizeof(struct fragment) + (x) - 1)
Definition cache.h:81

Function Documentation

◆ add_fragment()

int add_fragment ( struct cache_entry * cached,
off_t offset,
const char * data,
ssize_t length )

◆ cache_entry_has_expired()

int cache_entry_has_expired ( struct cache_entry * cached)
static

◆ cache_entry_is_valid()

int cache_entry_is_valid ( struct cache_entry * cached)

◆ delete_cache_entry()

void delete_cache_entry ( struct cache_entry * cached)

◆ delete_entry_content()

void delete_entry_content ( struct cache_entry * cached)

◆ delete_fragment()

void delete_fragment ( struct cache_entry * cached,
struct fragment * f )
static

◆ done_cache_entry()

void done_cache_entry ( struct cache_entry * cached)
static

◆ enlarge_entry()

void enlarge_entry ( struct cache_entry * cached,
off_t size )
inlinestatic

◆ find_in_cache()

struct cache_entry * find_in_cache ( struct uri * uri)

◆ follow_cached_redirects()

struct cache_entry * follow_cached_redirects ( struct cache_entry * cached)

◆ frag_alloc()

struct fragment * frag_alloc ( size_t size)
static

◆ frag_free()

void frag_free ( struct fragment * f)
static

◆ frag_realloc()

struct fragment * frag_realloc ( struct fragment * f,
size_t size )
static

◆ free_entry_to()

void free_entry_to ( struct cache_entry * cached,
off_t offset )

◆ garbage_collection()

void garbage_collection ( int whole)

◆ get_cache_entry()

struct cache_entry * get_cache_entry ( struct uri * uri)

◆ get_cache_entry_count()

int get_cache_entry_count ( void )

◆ get_cache_entry_loading_count()

int get_cache_entry_loading_count ( void )

◆ get_cache_entry_used_count()

int get_cache_entry_used_count ( void )

◆ get_cache_fragment()

struct fragment * get_cache_fragment ( struct cache_entry * cached)

◆ get_cache_size()

unsigned longlong get_cache_size ( void )

◆ get_redirected_cache_entry()

struct cache_entry * get_redirected_cache_entry ( struct uri * uri)

◆ get_validated_cache_entry()

struct cache_entry * get_validated_cache_entry ( struct uri * uri,
cache_mode_T cache_mode )

◆ normalize_cache_entry()

void normalize_cache_entry ( struct cache_entry * cached,
off_t truncate_length )

◆ redirect_cache()

struct uri * redirect_cache ( struct cache_entry * cached,
const char * location,
int get,
int incomplete )

◆ remove_overlaps()

void remove_overlaps ( struct cache_entry * cached,
struct fragment * f,
int * trunc )
static

◆ truncate_entry()

void truncate_entry ( struct cache_entry * cached,
off_t offset,
int final )
static

◆ validate_cache_integrity()

int validate_cache_integrity ( struct cache_entry * cached,
const char * integrity )

Variable Documentation

◆ cache_entries

struct cache_entry list cache_entries = { D_LIST_HEAD_EL(cache_entries) }
static

◆ cache_size

unsigned longlong cache_size
static

◆ id_counter

int id_counter = 1
static