libgpac
Documentation of the core library of GPAC
downloader.c File Reference
#include <gpac/tools.h>
#include <gpac/download.h>
#include <gpac/network.h>
#include <gpac/token.h>
#include <gpac/thread.h>
#include <gpac/list.h>
#include <gpac/base_coding.h>
#include <gpac/cache.h>
#include <gpac/filters.h>
#include <gpac/revision.h>
#include <gpac/crypt.h>
+ Include dependency graph for downloader.c:

Data Structures

struct  GF_HTTPHeader
 
struct  GF_PartialDownload
 
struct  GF_SessTask
 
struct  __gf_download_session
 
struct  __gf_download_manager
 

Macros

#define SIZE_IN_STREAM   ( 2 << 29 )
 
#define SESSION_RETRY_COUNT   10
 
#define SESSION_RETRY_SSL   8
 
#define GF_DOWNLOAD_AGENT_NAME   "GPAC/"GPAC_VERSION "-rev" GPAC_GIT_REVISION
 
#define GF_DOWNLOAD_BUFFER_SIZE   50000
 
#define GF_DOWNLOAD_BUFFER_SIZE_LIMIT_RATE   GF_DOWNLOAD_BUFFER_SIZE/20
 
#define GF_NETIO_SESSION_NO_STORE   (1<<30)
 
#define SET_LAST_ERR(_e)   sess->last_error = _e;
 
#define PUSH_HDR(_name, _value)
 

Enumerations

enum  { GF_DOWNLOAD_SESSION_USE_SSL = 1<<10 , GF_DOWNLOAD_SESSION_THREAD_DEAD = 1<<11 , GF_DOWNLOAD_SESSION_SSL_FORCED = 1<<12 }
 
enum  REQUEST_TYPE { GET = 0 , HEAD = 1 , OTHER = 2 }
 
enum  HTTPCloseType { HTTP_NO_CLOSE =0 , HTTP_CLOSE , HTTP_RESET_CONN }
 

Functions

static void gf_dm_data_received (GF_DownloadSession *sess, u8 *payload, u32 payload_size, Bool store_in_init, u32 *rewrite_size, u8 *original_payload)
 
static GF_Err gf_dm_read_data (GF_DownloadSession *sess, char *data, u32 data_size, u32 *out_read)
 
static void gf_dm_connect (GF_DownloadSession *sess)
 
GF_Err gf_dm_sess_send (GF_DownloadSession *sess, u8 *data, u32 size)
 
GF_Err gf_dm_sess_flush_async (GF_DownloadSession *sess, Bool no_select)
 
void gf_dm_sess_set_header_ex (GF_DownloadSession *sess, const char *name, const char *value, Bool allow_overwrite)
 
static GF_Err dm_sess_write (GF_DownloadSession *sess, const u8 *buffer, u32 size)
 
static void dm_sess_sk_del (GF_DownloadSession *sess)
 
static void sess_connection_closed (GF_DownloadSession *sess)
 
GF_Err gf_cache_write_to_cache (const DownloadedCacheEntry entry, const GF_DownloadSession *sess, const char *data, const u32 size, GF_Mutex *mx)
 
GF_Err gf_cache_close_write_cache (const DownloadedCacheEntry entry, const GF_DownloadSession *sess, Bool success)
 Close the write file pointer of cache This function also flushes all buffers, so cache will always be consistent after. More...
 
GF_Err gf_cache_open_write_cache (const DownloadedCacheEntry entry, const GF_DownloadSession *sess)
 Open the write file pointer of cache This function prepares calls for gf_cache_write_to_cache. More...
 
void gf_cache_set_end_range (DownloadedCacheEntry entry, u64 range_end)
 
Bool gf_cache_is_in_progress (const DownloadedCacheEntry entry)
 
static GF_Err gf_user_credentials_save_digest (GF_DownloadManager *dm, GF_UserCredentials *creds, const char *password, Bool store_info)
 Saves the digest for authentication of password and username. More...
 
GF_UserCredentials * gf_user_credentials_find_for_site (GF_DownloadManager *dm, const char *server_name, const char *user_name)
 
static void on_user_pass (void *udta, const char *user, const char *pass, Bool store_info)
 
static GF_Err gf_user_credentials_ask_password (GF_DownloadManager *dm, GF_UserCredentials *creds, Bool secure)
 Asks the user for credentials for given site. More...
 
GF_UserCredentials * gf_user_credentials_register (GF_DownloadManager *dm, Bool secure, const char *server_name, const char *username, const char *password, Bool valid)
 
static Bool gf_dm_is_local (GF_DownloadManager *dm, const char *url)
 
Bool gf_dm_can_handle_url (const char *url)
 
DownloadedCacheEntry gf_dm_find_cached_entry_by_url (GF_DownloadSession *sess)
 
DownloadedCacheEntry gf_cache_create_entry (const char *cache_directory, const char *url, u64 start_range, u64 end_range, Bool mem_storage, GF_Mutex *mx)
 
s32 gf_cache_remove_session_from_cache_entry (DownloadedCacheEntry entry, GF_DownloadSession *sess)
 
Bool gf_cache_set_mime (const DownloadedCacheEntry entry, const char *mime)
 
Bool gf_cache_set_range (const DownloadedCacheEntry entry, u64 size, u64 start_range, u64 end_range)
 
Bool gf_cache_set_content (const DownloadedCacheEntry entry, GF_Blob *blob, Bool copy, GF_Mutex *mx)
 
Bool gf_cache_set_headers (const DownloadedCacheEntry entry, const char *headers)
 
void gf_cache_set_downtime (const DownloadedCacheEntry entry, u32 download_time_ms)
 
void gf_cache_set_max_age (const DownloadedCacheEntry entry, u32 max_age, Bool must_revalidate)
 
static void gf_dm_remove_cache_entry_from_session (GF_DownloadSession *sess)
 
s32 gf_cache_add_session_to_cache_entry (DownloadedCacheEntry entry, GF_DownloadSession *sess)
 
Bool gf_cache_entry_persistent (const DownloadedCacheEntry entry)
 
void gf_cache_entry_set_persistent (const DownloadedCacheEntry entry)
 
static void gf_dm_sess_notify_state (GF_DownloadSession *sess, GF_NetIOStatus dnload_status, GF_Err error)
 
Bool gf_cache_entry_can_reuse (const DownloadedCacheEntry entry, Bool skip_revalidate)
 
Bool gf_cache_entry_is_shared (const DownloadedCacheEntry entry)
 
FILE * gf_cache_open_read (const DownloadedCacheEntry entry)
 
Bool gf_cache_is_mem (const DownloadedCacheEntry entry)
 
static void gf_dm_configure_cache (GF_DownloadSession *sess)
 
void gf_dm_delete_cached_file_entry (const GF_DownloadManager *dm, const char *url)
 
GF_EXPORT void gf_dm_delete_cached_file_entry_session (const GF_DownloadSession *sess, const char *url, Bool force)
 
void gf_dm_sess_set_header (GF_DownloadSession *sess, const char *name, const char *value)
 
GF_Err gf_dm_sess_send_reply (GF_DownloadSession *sess, u32 reply_code, const char *response_body, u32 body_len, Bool no_body)
 
void gf_dm_sess_clear_headers (GF_DownloadSession *sess)
 
static void gf_dm_disconnect (GF_DownloadSession *sess, HTTPCloseType close_type)
 
GF_EXPORT void gf_dm_sess_del (GF_DownloadSession *sess)
 
void http_do_requests (GF_DownloadSession *sess)
 
static void gf_dm_sess_user_io (GF_DownloadSession *sess, GF_NETIO_Parameter *par)
 
GF_EXPORT GF_Err gf_dm_sess_last_error (GF_DownloadSession *sess)
 
GF_EXPORT void gf_dm_url_info_init (GF_URL_Info *info)
 
GF_EXPORT void gf_dm_url_info_del (GF_URL_Info *info)
 
static s32 gf_dm_parse_protocol (const char *url, GF_URL_Info *info)
 
GF_EXPORT GF_Err gf_dm_get_url_info (const char *url, GF_URL_Info *info, const char *baseURL)
 
char * gf_cache_get_forced_headers (const DownloadedCacheEntry entry)
 
u32 gf_cache_get_downtime (const DownloadedCacheEntry entry)
 
u32 gf_cache_is_done (const DownloadedCacheEntry entry)
 
Bool gf_cache_is_deleted (const DownloadedCacheEntry entry)
 
static void gf_dm_sess_reload_cached_headers (GF_DownloadSession *sess)
 
GF_EXPORT GF_Err gf_dm_sess_setup_from_url (GF_DownloadSession *sess, const char *url, Bool allow_direct_reuse)
 
Bool gf_dm_session_do_task (GF_DownloadSession *sess)
 
Bool gf_dm_session_task (GF_FilterSession *fsess, void *callback, u32 *reschedule_ms)
 
static u32 gf_dm_session_thread (void *par)
 
static GF_DownloadSession * gf_dm_sess_new_internal (GF_DownloadManager *dm, const char *url, u32 dl_flags, gf_dm_user_io user_io, void *usr_cbk, GF_Socket *server, GF_Err *e)
 
GF_EXPORT GF_DownloadSession * gf_dm_sess_new_server (GF_DownloadManager *dm, GF_Socket *server, void *ssl_sock_ctx, gf_dm_user_io user_io, void *usr_cbk, Bool async, GF_Err *e)
 
GF_DownloadSession * gf_dm_sess_new_subsession (GF_DownloadSession *sess, u32 stream_id, void *usr_cbk, GF_Err *e)
 
u32 gf_dm_sess_subsession_count (GF_DownloadSession *sess)
 
void gf_dm_sess_server_reset (GF_DownloadSession *sess)
 
GF_EXPORT GF_DownloadSession * gf_dm_sess_new_simple (GF_DownloadManager *dm, const char *url, u32 dl_flags, gf_dm_user_io user_io, void *usr_cbk, GF_Err *e)
 
GF_EXPORT GF_DownloadSession * gf_dm_sess_new (GF_DownloadManager *dm, const char *url, u32 dl_flags, gf_dm_user_io user_io, void *usr_cbk, GF_Err *e)
 
DownloadedCacheEntry gf_dm_refresh_cache_entry (GF_DownloadSession *sess)
 
GF_EXPORT const char * gf_dm_sess_mime_type (GF_DownloadSession *sess)
 
GF_EXPORT GF_Err gf_dm_sess_set_range (GF_DownloadSession *sess, u64 start_range, u64 end_range, Bool discontinue_cache)
 
GF_EXPORT GF_Err gf_dm_sess_process (GF_DownloadSession *sess)
 
GF_EXPORT GF_Err gf_dm_sess_process_headers (GF_DownloadSession *sess)
 
GF_EXPORT GF_DownloadManager * gf_dm_new (GF_FilterSession *fsess)
 
GF_EXPORT void gf_dm_set_auth_callback (GF_DownloadManager *dm, gf_dm_get_usr_pass get_user_password, void *usr_cbk)
 
GF_EXPORT void gf_dm_del (GF_DownloadManager *dm)
 
static void gf_icy_skip_data (GF_DownloadSession *sess, const char *data, u32 nbBytes)
 
static char * gf_dm_get_chunk_data (GF_DownloadSession *sess, Bool first_chunk_in_payload, char *body_start, u32 *payload_size, u32 *header_size)
 
static void dm_sess_update_download_rate (GF_DownloadSession *sess)
 
static Bool dm_exceeds_cap_rate (GF_DownloadManager *dm, GF_DownloadSession *for_sess)
 
static void gf_dm_sess_estimate_chunk_rate (GF_DownloadSession *sess, u32 nb_bytes)
 
const u8gf_cache_get_content (const DownloadedCacheEntry entry, u32 *size, u32 *max_valid_size, Bool *was_modified)
 
void gf_cache_release_content (const DownloadedCacheEntry entry)
 
GF_EXPORT GF_Err gf_dm_sess_fetch_data (GF_DownloadSession *sess, char *buffer, u32 buffer_size, u32 *read_size)
 
GF_EXPORT GF_Err gf_dm_sess_get_stats (GF_DownloadSession *sess, const char **server, const char **path, u64 *total_size, u64 *bytes_done, u32 *bytes_per_sec, GF_NetIOStatus *net_status)
 
GF_EXPORT u64 gf_dm_sess_get_utc_start (GF_DownloadSession *sess)
 
GF_EXPORT const char * gf_dm_sess_get_cache_name (GF_DownloadSession *sess)
 
GF_EXPORT void gf_dm_sess_abort (GF_DownloadSession *sess)
 
static GF_Err http_send_headers (GF_DownloadSession *sess)
 
static GF_Err http_parse_remaining_body (GF_DownloadSession *sess)
 
static void notify_error_body (GF_DownloadSession *sess, char *sHTTP, s32 bytesRead, s32 BodyStart)
 
static u32 http_parse_method (const char *comp)
 
static GF_Err wait_for_header_and_parse (GF_DownloadSession *sess)
 
GF_EXPORT void gf_dm_sess_set_max_rate (GF_DownloadSession *sess, u32 max_rate)
 
GF_EXPORT u32 gf_dm_sess_get_max_rate (GF_DownloadSession *sess)
 
GF_EXPORT Bool gf_dm_sess_is_regulated (GF_DownloadSession *sess)
 
static void wget_NetIO (void *cbk, GF_NETIO_Parameter *param)
 
GF_EXPORT GF_Err gf_dm_wget (const char *url, const char *filename, u64 start_range, u64 end_range, char **redirected_url)
 
GF_EXPORT GF_Err gf_dm_wget_with_cache (GF_DownloadManager *dm, const char *url, const char *filename, u64 start_range, u64 end_range, char **redirected_url)
 
GF_EXPORT const char * gf_dm_sess_get_resource_name (GF_DownloadSession *dnload)
 
GF_EXPORT void gf_dm_set_data_rate (GF_DownloadManager *dm, u32 rate_in_bits_per_sec)
 
GF_EXPORT u32 gf_dm_get_data_rate (GF_DownloadManager *dm)
 
GF_EXPORT u32 gf_dm_get_global_rate (GF_DownloadManager *dm)
 
Bool gf_dm_sess_is_h2 (GF_DownloadSession *sess)
 
u32 gf_dm_sess_get_resource_size (GF_DownloadSession *sess)
 
GF_EXPORT const char * gf_dm_sess_get_header (GF_DownloadSession *sess, const char *name)
 
GF_EXPORT GF_Err gf_dm_sess_enum_headers (GF_DownloadSession *sess, u32 *idx, const char **hdr_name, const char **hdr_val)
 
GF_EXPORT GF_Err gf_dm_sess_get_header_sizes_and_times (GF_DownloadSession *sess, u32 *req_hdr_size, u32 *rsp_hdr_size, u32 *connect_time, u32 *reply_time, u32 *download_time)
 
GF_EXPORT void gf_dm_sess_force_memory_mode (GF_DownloadSession *sess, u32 force_keep)
 
GF_EXPORT GF_Err gf_dm_set_localcache_provider (GF_DownloadManager *dm, Bool(*local_cache_url_provider_cbk)(void *udta, char *url, Bool is_cache_destroy), void *lc_udta)
 
GF_EXPORT DownloadedCacheEntry gf_dm_add_cache_entry (GF_DownloadManager *dm, const char *szURL, GF_Blob *blob, u64 start_range, u64 end_range, const char *mime, Bool clone_memory, u32 download_time_ms)
 
GF_EXPORT GF_Err gf_dm_force_headers (GF_DownloadManager *dm, const DownloadedCacheEntry entry, const char *headers)
 
u32 gf_dm_sess_async_pending (GF_DownloadSession *sess)
 
void gf_dm_sess_flush_h2 (GF_DownloadSession *sess)
 
GF_Socket * gf_dm_sess_get_socket (GF_DownloadSession *sess)
 
void gf_dm_sess_set_sock_group (GF_DownloadSession *sess, GF_SockGroup *sg)
 
void gf_dm_sess_detach_async (GF_DownloadSession *sess)
 
void gf_dm_sess_set_timeout (GF_DownloadSession *sess, u32 timeout)
 
void gf_dm_sess_set_netcap_id (GF_DownloadSession *sess, const char *netcap_id)
 

Data Structure Documentation

◆ GF_HTTPHeader

struct GF_HTTPHeader

the structure used to store an HTTP header

Data Fields
char * name
char * value

◆ GF_PartialDownload

struct GF_PartialDownload

This structure handles partial downloads

Data Fields
char * url
u64 startOffset
u64 endOffset
char * filename

◆ GF_SessTask

struct GF_SessTask
+ Collaboration diagram for GF_SessTask:
Data Fields
struct __gf_download_session * sess

Macro Definition Documentation

◆ SIZE_IN_STREAM

#define SIZE_IN_STREAM   ( 2 << 29 )

◆ SESSION_RETRY_COUNT

#define SESSION_RETRY_COUNT   10

◆ SESSION_RETRY_SSL

#define SESSION_RETRY_SSL   8

◆ GF_DOWNLOAD_AGENT_NAME

#define GF_DOWNLOAD_AGENT_NAME   "GPAC/"GPAC_VERSION "-rev" GPAC_GIT_REVISION

◆ GF_DOWNLOAD_BUFFER_SIZE

#define GF_DOWNLOAD_BUFFER_SIZE   50000

◆ GF_DOWNLOAD_BUFFER_SIZE_LIMIT_RATE

#define GF_DOWNLOAD_BUFFER_SIZE_LIMIT_RATE   GF_DOWNLOAD_BUFFER_SIZE/20

◆ GF_NETIO_SESSION_NO_STORE

#define GF_NETIO_SESSION_NO_STORE   (1<<30)

◆ SET_LAST_ERR

#define SET_LAST_ERR (   _e)    sess->last_error = _e;

◆ PUSH_HDR

#define PUSH_HDR (   _name,
  _value 
)
Value:
{\
GF_SAFEALLOC(hdr, GF_HTTPHeader)\
hdr->name = gf_strdup(_name);\
hdr->value = gf_strdup(_value);\
gf_list_add(sess->headers, hdr);\
}
Definition: downloader.c:152
char * gf_strdup(const char *str)
Definition: alloc.c:168

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GF_DOWNLOAD_SESSION_USE_SSL 
GF_DOWNLOAD_SESSION_THREAD_DEAD 
GF_DOWNLOAD_SESSION_SSL_FORCED 

◆ REQUEST_TYPE

Enumerator
GET 
HEAD 
OTHER 

◆ HTTPCloseType

Enumerator
HTTP_NO_CLOSE 
HTTP_CLOSE 
HTTP_RESET_CONN 

Function Documentation

◆ gf_dm_data_received()

static void gf_dm_data_received ( GF_DownloadSession *  sess,
u8 payload,
u32  payload_size,
Bool  store_in_init,
u32 rewrite_size,
u8 original_payload 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_read_data()

static GF_Err gf_dm_read_data ( GF_DownloadSession *  sess,
char *  data,
u32  data_size,
u32 out_read 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_connect()

static void gf_dm_connect ( GF_DownloadSession *  sess)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_send()

GF_Err gf_dm_sess_send ( GF_DownloadSession *  sess,
u8 data,
u32  size 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_flush_async()

GF_Err gf_dm_sess_flush_async ( GF_DownloadSession *  sess,
Bool  no_select 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_header_ex()

void gf_dm_sess_set_header_ex ( GF_DownloadSession *  sess,
const char *  name,
const char *  value,
Bool  allow_overwrite 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dm_sess_write()

static GF_Err dm_sess_write ( GF_DownloadSession *  sess,
const u8 buffer,
u32  size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dm_sess_sk_del()

static void dm_sess_sk_del ( GF_DownloadSession *  sess)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sess_connection_closed()

static void sess_connection_closed ( GF_DownloadSession *  sess)
static
+ Here is the caller graph for this function:

◆ gf_cache_write_to_cache()

GF_Err gf_cache_write_to_cache ( const DownloadedCacheEntry  entry,
const GF_DownloadSession *  sess,
const char *  data,
const u32  size,
GF_Mutex *  mx 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_close_write_cache()

GF_Err gf_cache_close_write_cache ( const DownloadedCacheEntry  entry,
const GF_DownloadSession *  sess,
Bool  success 
)
Parameters
entryThe entry to use
sessThe download session
success1 if cache write is success, false otherwise
Returns
GF_OK is everything went fine, GF_BAD_PARAM if entry is NULL, GF_IO_ERR if a failure occurs
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_open_write_cache()

GF_Err gf_cache_open_write_cache ( const DownloadedCacheEntry  entry,
const GF_DownloadSession *  sess 
)
Parameters
entryThe entry to use
sessThe download session
Returns
GF_OK is everything went fine, GF_BAD_PARAM if entry is NULL, GF_IO_ERR if a failure occurs
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_end_range()

void gf_cache_set_end_range ( DownloadedCacheEntry  entry,
u64  range_end 
)
+ Here is the caller graph for this function:

◆ gf_cache_is_in_progress()

Bool gf_cache_is_in_progress ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_user_credentials_save_digest()

static GF_Err gf_user_credentials_save_digest ( GF_DownloadManager *  dm,
GF_UserCredentials *  creds,
const char *  password,
Bool  store_info 
)
static
Parameters
dmThe download manager
credsThe credentials to fill
Returns
GF_OK if info has been filled, GF_BAD_PARAM if creds == NULL or dm == NULL, GF_AUTHENTICATION_FAILURE if user did not filled the info.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_user_credentials_find_for_site()

GF_UserCredentials* gf_user_credentials_find_for_site ( GF_DownloadManager *  dm,
const char *  server_name,
const char *  user_name 
)

Find a User's credentials for a given site

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

◆ on_user_pass()

static void on_user_pass ( void *  udta,
const char *  user,
const char *  pass,
Bool  store_info 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_user_credentials_ask_password()

static GF_Err gf_user_credentials_ask_password ( GF_DownloadManager *  dm,
GF_UserCredentials *  creds,
Bool  secure 
)
static
Parameters
dmThe download manager
credsThe credentials to fill
Returns
GF_OK if info has been filled, GF_BAD_PARAM if creds == NULL or dm == NULL, GF_AUTHENTICATION_FAILURE if user did not filled the info.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_user_credentials_register()

GF_UserCredentials* gf_user_credentials_register ( GF_DownloadManager *  dm,
Bool  secure,
const char *  server_name,
const char *  username,
const char *  password,
Bool  valid 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_is_local()

static Bool gf_dm_is_local ( GF_DownloadManager *  dm,
const char *  url 
)
static
+ Here is the caller graph for this function:

◆ gf_dm_can_handle_url()

Bool gf_dm_can_handle_url ( const char *  url)
+ Here is the caller graph for this function:

◆ gf_dm_find_cached_entry_by_url()

DownloadedCacheEntry gf_dm_find_cached_entry_by_url ( GF_DownloadSession *  sess)

Finds an existing entry in the cache for a given URL

Parameters
sessThe session configured with the URL
Returns
NULL if none found, the DownloadedCacheEntry otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_create_entry()

DownloadedCacheEntry gf_cache_create_entry ( const char *  cache_directory,
const char *  url,
u64  start_range,
u64  end_range,
Bool  mem_storage,
GF_Mutex *  mx 
)

Creates a new cache entry

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

◆ gf_cache_remove_session_from_cache_entry()

s32 gf_cache_remove_session_from_cache_entry ( DownloadedCacheEntry  entry,
GF_DownloadSession *  sess 
)

Removes a session for a DownloadedCacheEntry

Parameters
entryThe entry
sessThe session to remove
Returns
the number of sessions left in the cached entry, -1 if one of the parameters is wrong
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_mime()

Bool gf_cache_set_mime ( const DownloadedCacheEntry  entry,
const char *  mime 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_range()

Bool gf_cache_set_range ( const DownloadedCacheEntry  entry,
u64  size,
u64  start_range,
u64  end_range 
)
+ Here is the caller graph for this function:

◆ gf_cache_set_content()

Bool gf_cache_set_content ( const DownloadedCacheEntry  entry,
GF_Blob blob,
Bool  copy,
GF_Mutex *  mx 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_headers()

Bool gf_cache_set_headers ( const DownloadedCacheEntry  entry,
const char *  headers 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_set_downtime()

void gf_cache_set_downtime ( const DownloadedCacheEntry  entry,
u32  download_time_ms 
)
+ Here is the caller graph for this function:

◆ gf_cache_set_max_age()

void gf_cache_set_max_age ( const DownloadedCacheEntry  entry,
u32  max_age,
Bool  must_revalidate 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_remove_cache_entry_from_session()

static void gf_dm_remove_cache_entry_from_session ( GF_DownloadSession *  sess)
static

Removes a cache entry from cache and performs a cleanup if possible. If the cache entry is marked for deletion and has no sessions associated with it, it will be removed (so some modules using a streaming like cache will still work).

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

◆ gf_cache_add_session_to_cache_entry()

s32 gf_cache_add_session_to_cache_entry ( DownloadedCacheEntry  entry,
GF_DownloadSession *  sess 
)

Adds a session to a DownloadedCacheEntry. implemented in cache.c

Parameters
entryThe entry
sessThe session to add
Returns
the number of sessions in the cached entry, -1 if one of the parameters is wrong
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_entry_persistent()

Bool gf_cache_entry_persistent ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_cache_entry_set_persistent()

void gf_cache_entry_set_persistent ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_dm_sess_notify_state()

static void gf_dm_sess_notify_state ( GF_DownloadSession *  sess,
GF_NetIOStatus  dnload_status,
GF_Err  error 
)
static
+ Here is the caller graph for this function:

◆ gf_cache_entry_can_reuse()

Bool gf_cache_entry_can_reuse ( const DownloadedCacheEntry  entry,
Bool  skip_revalidate 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_entry_is_shared()

Bool gf_cache_entry_is_shared ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_cache_open_read()

FILE* gf_cache_open_read ( const DownloadedCacheEntry  entry)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_is_mem()

Bool gf_cache_is_mem ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_dm_configure_cache()

static void gf_dm_configure_cache ( GF_DownloadSession *  sess)
static

indicate we can destroy file upon destruction, except if disabled at session level

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

◆ gf_dm_delete_cached_file_entry()

void gf_dm_delete_cached_file_entry ( const GF_DownloadManager *  dm,
const char *  url 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_delete_cached_file_entry_session()

GF_EXPORT void gf_dm_delete_cached_file_entry_session ( const GF_DownloadSession *  sess,
const char *  url,
Bool  force 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_header()

void gf_dm_sess_set_header ( GF_DownloadSession *  sess,
const char *  name,
const char *  value 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_send_reply()

GF_Err gf_dm_sess_send_reply ( GF_DownloadSession *  sess,
u32  reply_code,
const char *  response_body,
u32  body_len,
Bool  no_body 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_clear_headers()

void gf_dm_sess_clear_headers ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_disconnect()

static void gf_dm_disconnect ( GF_DownloadSession *  sess,
HTTPCloseType  close_type 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_del()

GF_EXPORT void gf_dm_sess_del ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ http_do_requests()

void http_do_requests ( GF_DownloadSession *  sess)

Default performing behavior

Parameters
sessThe session
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_user_io()

static void gf_dm_sess_user_io ( GF_DownloadSession *  sess,
GF_NETIO_Parameter *  par 
)
static
+ Here is the caller graph for this function:

◆ gf_dm_sess_last_error()

GF_EXPORT GF_Err gf_dm_sess_last_error ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_url_info_init()

GF_EXPORT void gf_dm_url_info_init ( GF_URL_Info *  info)
+ Here is the caller graph for this function:

◆ gf_dm_url_info_del()

GF_EXPORT void gf_dm_url_info_del ( GF_URL_Info *  info)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_parse_protocol()

static s32 gf_dm_parse_protocol ( const char *  url,
GF_URL_Info *  info 
)
static
Parameters
urlThe url to parse for protocol
infoThe info to fill
Returns
Returns the offset in url of the protocol found -1 if not found
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_get_url_info()

GF_EXPORT GF_Err gf_dm_get_url_info ( const char *  url,
GF_URL_Info *  info,
const char *  baseURL 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_forced_headers()

char* gf_cache_get_forced_headers ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_cache_get_downtime()

u32 gf_cache_get_downtime ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_cache_is_done()

u32 gf_cache_is_done ( const DownloadedCacheEntry  entry)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_is_deleted()

Bool gf_cache_is_deleted ( const DownloadedCacheEntry  entry)
+ Here is the caller graph for this function:

◆ gf_dm_sess_reload_cached_headers()

static void gf_dm_sess_reload_cached_headers ( GF_DownloadSession *  sess)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_setup_from_url()

GF_EXPORT GF_Err gf_dm_sess_setup_from_url ( GF_DownloadSession *  sess,
const char *  url,
Bool  allow_direct_reuse 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_session_do_task()

Bool gf_dm_session_do_task ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_session_task()

Bool gf_dm_session_task ( GF_FilterSession *  fsess,
void *  callback,
u32 reschedule_ms 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_session_thread()

static u32 gf_dm_session_thread ( void *  par)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_new_internal()

static GF_DownloadSession* gf_dm_sess_new_internal ( GF_DownloadManager *  dm,
const char *  url,
u32  dl_flags,
gf_dm_user_io  user_io,
void *  usr_cbk,
GF_Socket *  server,
GF_Err e 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_new_server()

GF_EXPORT GF_DownloadSession* gf_dm_sess_new_server ( GF_DownloadManager *  dm,
GF_Socket *  server,
void *  ssl_sock_ctx,
gf_dm_user_io  user_io,
void *  usr_cbk,
Bool  async,
GF_Err e 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_new_subsession()

GF_DownloadSession* gf_dm_sess_new_subsession ( GF_DownloadSession *  sess,
u32  stream_id,
void *  usr_cbk,
GF_Err e 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_subsession_count()

u32 gf_dm_sess_subsession_count ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_server_reset()

void gf_dm_sess_server_reset ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_new_simple()

GF_EXPORT GF_DownloadSession* gf_dm_sess_new_simple ( GF_DownloadManager *  dm,
const char *  url,
u32  dl_flags,
gf_dm_user_io  user_io,
void *  usr_cbk,
GF_Err e 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_new()

GF_EXPORT GF_DownloadSession* gf_dm_sess_new ( GF_DownloadManager *  dm,
const char *  url,
u32  dl_flags,
gf_dm_user_io  user_io,
void *  usr_cbk,
GF_Err e 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_refresh_cache_entry()

DownloadedCacheEntry gf_dm_refresh_cache_entry ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_mime_type()

GF_EXPORT const char* gf_dm_sess_mime_type ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_range()

GF_EXPORT GF_Err gf_dm_sess_set_range ( GF_DownloadSession *  sess,
u64  start_range,
u64  end_range,
Bool  discontinue_cache 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_process()

GF_EXPORT GF_Err gf_dm_sess_process ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_process_headers()

GF_EXPORT GF_Err gf_dm_sess_process_headers ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_new()

GF_EXPORT GF_DownloadManager* gf_dm_new ( GF_FilterSession *  fsess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_set_auth_callback()

GF_EXPORT void gf_dm_set_auth_callback ( GF_DownloadManager *  dm,
gf_dm_get_usr_pass  get_user_password,
void *  usr_cbk 
)
+ Here is the caller graph for this function:

◆ gf_dm_del()

GF_EXPORT void gf_dm_del ( GF_DownloadManager *  dm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_icy_skip_data()

static void gf_icy_skip_data ( GF_DownloadSession *  sess,
const char *  data,
u32  nbBytes 
)
static

Skip ICY metadata from SHOUTCAST or ICECAST streams. Data will be skipped and parsed and sent as a GF_NETIO_Parameter to the user_io, so modules interrested by those streams may use the data

Parameters
sessThe GF_DownloadSession
datalast data received
nbBytesThe number of bytes contained into data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_get_chunk_data()

static char* gf_dm_get_chunk_data ( GF_DownloadSession *  sess,
Bool  first_chunk_in_payload,
char *  body_start,
u32 payload_size,
u32 header_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dm_sess_update_download_rate()

static void dm_sess_update_download_rate ( GF_DownloadSession *  sess)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dm_exceeds_cap_rate()

static Bool dm_exceeds_cap_rate ( GF_DownloadManager *  dm,
GF_DownloadSession *  for_sess 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_estimate_chunk_rate()

static void gf_dm_sess_estimate_chunk_rate ( GF_DownloadSession *  sess,
u32  nb_bytes 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_get_content()

const u8* gf_cache_get_content ( const DownloadedCacheEntry  entry,
u32 size,
u32 max_valid_size,
Bool was_modified 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_cache_release_content()

void gf_cache_release_content ( const DownloadedCacheEntry  entry)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_fetch_data()

GF_EXPORT GF_Err gf_dm_sess_fetch_data ( GF_DownloadSession *  sess,
char *  buffer,
u32  buffer_size,
u32 read_size 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_stats()

GF_EXPORT GF_Err gf_dm_sess_get_stats ( GF_DownloadSession *  sess,
const char **  server,
const char **  path,
u64 total_size,
u64 bytes_done,
u32 bytes_per_sec,
GF_NetIOStatus *  net_status 
)
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_utc_start()

GF_EXPORT u64 gf_dm_sess_get_utc_start ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_cache_name()

GF_EXPORT const char* gf_dm_sess_get_cache_name ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_abort()

GF_EXPORT void gf_dm_sess_abort ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ http_send_headers()

static GF_Err http_send_headers ( GF_DownloadSession *  sess)
static

Sends the HTTP headers

Parameters
sessThe GF_DownloadSession
sHTTPbuffer containing the request
Returns
GF_OK if everything went fine, the error otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ http_parse_remaining_body()

static GF_Err http_parse_remaining_body ( GF_DownloadSession *  sess)
static

Parse the remaining part of body

Parameters
sessThe session
sHTTPthe data buffer
Returns
The error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notify_error_body()

static void notify_error_body ( GF_DownloadSession *  sess,
char *  sHTTP,
s32  bytesRead,
s32  BodyStart 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ http_parse_method()

static u32 http_parse_method ( const char *  comp)
static
+ Here is the caller graph for this function:

◆ wait_for_header_and_parse()

static GF_Err wait_for_header_and_parse ( GF_DownloadSession *  sess)
static

Waits for the response HEADERS, parse the information... and so on

Parameters
sessThe session
sHTTPthe data buffer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_max_rate()

GF_EXPORT void gf_dm_sess_set_max_rate ( GF_DownloadSession *  sess,
u32  max_rate 
)

◆ gf_dm_sess_get_max_rate()

GF_EXPORT u32 gf_dm_sess_get_max_rate ( GF_DownloadSession *  sess)

◆ gf_dm_sess_is_regulated()

GF_EXPORT Bool gf_dm_sess_is_regulated ( GF_DownloadSession *  sess)

◆ wget_NetIO()

static void wget_NetIO ( void *  cbk,
GF_NETIO_Parameter *  param 
)
static

NET IO for MPD, we don't need this anymore since mime-type can be given by session

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

◆ gf_dm_wget()

GF_EXPORT GF_Err gf_dm_wget ( const char *  url,
const char *  filename,
u64  start_range,
u64  end_range,
char **  redirected_url 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_wget_with_cache()

GF_EXPORT GF_Err gf_dm_wget_with_cache ( GF_DownloadManager *  dm,
const char *  url,
const char *  filename,
u64  start_range,
u64  end_range,
char **  redirected_url 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_resource_name()

GF_EXPORT const char* gf_dm_sess_get_resource_name ( GF_DownloadSession *  dnload)
+ Here is the caller graph for this function:

◆ gf_dm_set_data_rate()

GF_EXPORT void gf_dm_set_data_rate ( GF_DownloadManager *  dm,
u32  rate_in_bits_per_sec 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_get_data_rate()

GF_EXPORT u32 gf_dm_get_data_rate ( GF_DownloadManager *  dm)
+ Here is the caller graph for this function:

◆ gf_dm_get_global_rate()

GF_EXPORT u32 gf_dm_get_global_rate ( GF_DownloadManager *  dm)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_is_h2()

Bool gf_dm_sess_is_h2 ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_resource_size()

u32 gf_dm_sess_get_resource_size ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_header()

GF_EXPORT const char* gf_dm_sess_get_header ( GF_DownloadSession *  sess,
const char *  name 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_enum_headers()

GF_EXPORT GF_Err gf_dm_sess_enum_headers ( GF_DownloadSession *  sess,
u32 idx,
const char **  hdr_name,
const char **  hdr_val 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_header_sizes_and_times()

GF_EXPORT GF_Err gf_dm_sess_get_header_sizes_and_times ( GF_DownloadSession *  sess,
u32 req_hdr_size,
u32 rsp_hdr_size,
u32 connect_time,
u32 reply_time,
u32 download_time 
)
+ Here is the caller graph for this function:

◆ gf_dm_sess_force_memory_mode()

GF_EXPORT void gf_dm_sess_force_memory_mode ( GF_DownloadSession *  sess,
u32  force_keep 
)
+ Here is the caller graph for this function:

◆ gf_dm_set_localcache_provider()

GF_EXPORT GF_Err gf_dm_set_localcache_provider ( GF_DownloadManager *  dm,
Bool(*)(void *udta, char *url, Bool is_cache_destroy)  local_cache_url_provider_cbk,
void *  lc_udta 
)
+ Here is the caller graph for this function:

◆ gf_dm_add_cache_entry()

GF_EXPORT DownloadedCacheEntry gf_dm_add_cache_entry ( GF_DownloadManager *  dm,
const char *  szURL,
GF_Blob blob,
u64  start_range,
u64  end_range,
const char *  mime,
Bool  clone_memory,
u32  download_time_ms 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_force_headers()

GF_EXPORT GF_Err gf_dm_force_headers ( GF_DownloadManager *  dm,
const DownloadedCacheEntry  entry,
const char *  headers 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_async_pending()

u32 gf_dm_sess_async_pending ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_sess_flush_h2()

void gf_dm_sess_flush_h2 ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_get_socket()

GF_Socket* gf_dm_sess_get_socket ( GF_DownloadSession *  sess)
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_sock_group()

void gf_dm_sess_set_sock_group ( GF_DownloadSession *  sess,
GF_SockGroup *  sg 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_detach_async()

void gf_dm_sess_detach_async ( GF_DownloadSession *  sess)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_timeout()

void gf_dm_sess_set_timeout ( GF_DownloadSession *  sess,
u32  timeout 
)
+ Here is the caller graph for this function:

◆ gf_dm_sess_set_netcap_id()

void gf_dm_sess_set_netcap_id ( GF_DownloadSession *  sess,
const char *  netcap_id 
)
+ Here is the caller graph for this function: