libgpac
Documentation of the core library of GPAC
DownloaderCache

HTTP Downloader Cache. More...

+ Collaboration diagram for DownloaderCache:

Functions

void gf_cache_delete_entry (const DownloadedCacheEntry entry)
 
const char * gf_cache_get_etag_on_server (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_set_etag_on_disk (const DownloadedCacheEntry entry, const char *eTag)
 
GF_Err gf_cache_set_etag_on_server (const DownloadedCacheEntry entry, const char *eTag)
 
const char * gf_cache_get_mime_type (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_set_mime_type (const DownloadedCacheEntry entry, const char *mime_type)
 
const char * gf_cache_get_url (const DownloadedCacheEntry entry)
 
Bool gf_cache_can_be_cached (const DownloadedCacheEntry entry)
 
const char * gf_cache_get_last_modified_on_server (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_set_last_modified_on_disk (const DownloadedCacheEntry entry, const char *newLastModified)
 
GF_Err gf_cache_set_last_modified_on_server (const DownloadedCacheEntry entry, const char *newLastModified)
 
const char * gf_cache_get_cache_filename (const DownloadedCacheEntry entry)
 
u32 gf_cache_get_cache_filesize (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_set_content_length (const DownloadedCacheEntry entry, u32 length)
 
u32 gf_cache_get_content_length (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_get_http_headers (const DownloadedCacheEntry entry, const char **etag, const char **last_modif)
 
u64 gf_cache_get_size (const char *directory)
 
u64 gf_cache_cleanup (const char *directory, u32 max_size)
 
void gf_cache_entry_set_delete_files_when_deleted (const DownloadedCacheEntry entry)
 
Bool gf_cache_entry_is_delete_files_when_deleted (const DownloadedCacheEntry entry)
 
u32 gf_cache_get_sessions_count_for_cache_entry (const DownloadedCacheEntry entry)
 
u64 gf_cache_get_start_range (const DownloadedCacheEntry entry)
 
u64 gf_cache_get_end_range (const DownloadedCacheEntry entry)
 
Bool gf_cache_are_headers_processed (const DownloadedCacheEntry entry)
 
GF_Err gf_cache_set_headers_processed (const DownloadedCacheEntry entry)
 

Detailed Description

This section documents the file HTTP caching tools the GPAC framework.

Function Documentation

◆ gf_cache_delete_entry()

void gf_cache_delete_entry ( const DownloadedCacheEntry  entry)

Free The DownloadedCacheEntry handle

Parameters
entryThe entry to delete

Cache should have been close before, abornormal situation

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_etag_on_server()

const char* gf_cache_get_etag_on_server ( const DownloadedCacheEntry  entry)

Get the ETag associated with this cache entry if any

Parameters
entryThe entry
Returns
The ETag if any was defined, NULL otherwise
+ Here is the caller graph for this function:

◆ gf_cache_set_etag_on_disk()

GF_Err gf_cache_set_etag_on_disk ( const DownloadedCacheEntry  entry,
const char *  eTag 
)

Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.

Parameters
entryThe entry
eTagThe eTag to set
Returns
GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_etag_on_server()

GF_Err gf_cache_set_etag_on_server ( const DownloadedCacheEntry  entry,
const char *  eTag 
)

Set the eTag in the cache. Data is duplicated, so original string can be freed by caller.

Parameters
entryThe entry
eTagThe eTag to set
Returns
GF_OK if entry and eTag are valid, GF_BAD_PARAM otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_mime_type()

const char* gf_cache_get_mime_type ( const DownloadedCacheEntry  entry)

Get the Mime-Type associated with this cache entry.

Parameters
entryThe entry
Returns
The Mime-Type (never NULL if entry is valid)
+ Here is the caller graph for this function:

◆ gf_cache_set_mime_type()

GF_Err gf_cache_set_mime_type ( const DownloadedCacheEntry  entry,
const char *  mime_type 
)

Set the Mime-Type in the cache. Data is duplicated, so original string can be freed by caller.

Parameters
entryThe entry
mime_typeThe mime-type to set
Returns
GF_OK if entry and mime-type are valid, GF_BAD_PARAM otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_url()

const char* gf_cache_get_url ( const DownloadedCacheEntry  entry)

Get the URL associated with this cache entry.

Parameters
entryThe entry
Returns
The Hash key (never NULL if entry is valid)
+ Here is the caller graph for this function:

◆ gf_cache_can_be_cached()

Bool gf_cache_can_be_cached ( const DownloadedCacheEntry  entry)

Tells whether a cache entry should be cached safely (no

Parameters
entryThe entry
Returns
1 if entry should be cached

◆ gf_cache_get_last_modified_on_server()

const char* gf_cache_get_last_modified_on_server ( const DownloadedCacheEntry  entry)

Get the Last-Modified information associated with this cache entry.

Parameters
entryThe entry
Returns
The Last-Modified header (can be NULL)
+ Here is the caller graph for this function:

◆ gf_cache_set_last_modified_on_disk()

GF_Err gf_cache_set_last_modified_on_disk ( const DownloadedCacheEntry  entry,
const char *  newLastModified 
)

Set the Last-Modified header for this cache entry

Parameters
entryThe entry
newLastModifiedThe new value to set, will be duplicated
Returns
GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_last_modified_on_server()

GF_Err gf_cache_set_last_modified_on_server ( const DownloadedCacheEntry  entry,
const char *  newLastModified 
)

Set the Last-Modified header for this cache entry

Parameters
entryThe entry
newLastModifiedThe new value to set, will be duplicated
Returns
GF_OK if everything went alright, GF_BAD_PARAM if entry is NULL
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_cache_filename()

const char* gf_cache_get_cache_filename ( const DownloadedCacheEntry  entry)

Get the file name of cache associated with this cache entry.

Parameters
entryThe entry
Returns
The Cache file (never NULL if entry is valid)
+ Here is the caller graph for this function:

◆ gf_cache_get_cache_filesize()

u32 gf_cache_get_cache_filesize ( const DownloadedCacheEntry  entry)

Get the real file size of the cache entry

Parameters
entryThe entry
Returns
the file size
+ Here is the caller graph for this function:

◆ gf_cache_set_content_length()

GF_Err gf_cache_set_content_length ( const DownloadedCacheEntry  entry,
u32  length 
)

Set content length of resource

Parameters
entryThe entry
lengthsize of the content in bytes
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_cache_get_content_length()

u32 gf_cache_get_content_length ( const DownloadedCacheEntry  entry)

Get content length of resource

Parameters
entryThe entry
Returns
size of the content in bytes
+ Here is the caller graph for this function:

◆ gf_cache_get_http_headers()

GF_Err gf_cache_get_http_headers ( const DownloadedCacheEntry  entry,
const char **  etag,
const char **  last_modif 
)

Get directives headers associated with the cache

Parameters
entryThe entry of cache to use
etagset to etag value or NULL if no cache
last_modifset to last modif value or NULL if no cache
Returns
GF_OK if everything went fine, GF_BAD_PARAM if parameters are wrong
+ Here is the caller graph for this function:

◆ gf_cache_get_size()

u64 gf_cache_get_size ( const char *  directory)

Computes the size of the cache elements in directory

Parameters
directorycontaining cache files
Returns
size in bytes

◆ gf_cache_cleanup()

u64 gf_cache_cleanup ( const char *  directory,
u32  max_size 
)

Delete all cached files in given directory starting with startpattern

Parameters
directoryto clean up
max_sizemax size to achieve
Returns
total number of bytes in cache after cleanup
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_entry_set_delete_files_when_deleted()

void gf_cache_entry_set_delete_files_when_deleted ( const DownloadedCacheEntry  entry)

Mark associated files as "to be deleted" when the cache entry is removed

Parameters
entryThe entry
+ Here is the caller graph for this function:

◆ gf_cache_entry_is_delete_files_when_deleted()

Bool gf_cache_entry_is_delete_files_when_deleted ( const DownloadedCacheEntry  entry)

Check if associated files is marked as "to be deleted" when the cache entry is removed

Parameters
entryThe entry
Returns
GF_TRUE if cache entry is flaged as "to be deleted"
+ Here is the caller graph for this function:

◆ gf_cache_get_sessions_count_for_cache_entry()

u32 gf_cache_get_sessions_count_for_cache_entry ( const DownloadedCacheEntry  entry)

Get the number of sessions for a cache entry

Parameters
entryThe entry
Returns
the number of sessions using this cache entry
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_start_range()

u64 gf_cache_get_start_range ( const DownloadedCacheEntry  entry)

Get the start range of a cache entry

Parameters
entryThe entry
Returns
the start range in bytes
+ Here is the caller graph for this function:

◆ gf_cache_get_end_range()

u64 gf_cache_get_end_range ( const DownloadedCacheEntry  entry)

Get the end range of a cache entry

Parameters
entryThe entry
Returns
the end range in bytes
+ Here is the caller graph for this function:

◆ gf_cache_are_headers_processed()

Bool gf_cache_are_headers_processed ( const DownloadedCacheEntry  entry)

Check if the entry is marked as "headers processed" (reply headers have been parsed)

Parameters
entryThe entry
Returns
GF_TRUE if the entry is marked
+ Here is the caller graph for this function:

◆ gf_cache_set_headers_processed()

GF_Err gf_cache_set_headers_processed ( const DownloadedCacheEntry  entry)

Mark the entry as "headers processed"

Parameters
entryThe entry
Returns
error if any
+ Here is the caller graph for this function: