NetSurf
download.h
Go to the documentation of this file.
1/*
2 * Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file desktop/download.h
21 * \brief Core download context (interface)
22 */
23
24#ifndef NETSURF_DESKTOP_DOWNLOAD_H_
25#define NETSURF_DESKTOP_DOWNLOAD_H_
26
27#include "utils/errors.h"
28
29struct gui_window;
30struct llcache_handle;
31struct nsurl;
32
33/** Type of a download context */
35
36/**
37 * Create a download context
38 *
39 * \param llcache Low-level cache handle for download
40 * \param parent Parent window, for UI
41 * \return NSERROR_OK on success, appropriate error otherwise
42 *
43 * This must only be called by the core browser window fetch infrastructure.
44 * Ownership of the download context object created is passed to the frontend.
45 */
47 struct gui_window *parent);
48
49/**
50 * Destroy a download context
51 *
52 * \param ctx Context to destroy
53 *
54 * Called by the frontend when it has finished with a download context
55 */
57
58/**
59 * Abort a download fetch
60 *
61 * \param ctx Context to abort
62 *
63 * Called by the frontend to abort a download.
64 * The context must be destroyed independently.
65 */
67
68/**
69 * Retrieve the URL for a download
70 *
71 * The caller is borrowing the url reference from the underlying low
72 * level cache object. If it is used beyond the immediate scope of the
73 * caller an additional reference should be made.
74 *
75 * \param ctx Context to retrieve URL from
76 * \return URL object
77 */
79
80/**
81 * Retrieve the MIME type for a download
82 *
83 * \param ctx Context to retrieve MIME type from
84 * \return MIME type string
85 */
87
88/**
89 * Retrieve total byte length of download
90 *
91 * \param ctx Context to retrieve byte length from
92 * \return Total length, in bytes, or 0 if unknown
93 */
94unsigned long long int download_context_get_total_length(const download_context *ctx);
95
96/**
97 * Retrieve the filename for a download
98 *
99 * \param ctx Context to retrieve filename from
100 * \return Filename string
101 */
102const char *download_context_get_filename(const download_context *ctx);
103
104#endif
void download_context_destroy(download_context *ctx)
Destroy a download context.
Definition: download.c:270
struct nsurl * download_context_get_url(const download_context *ctx)
Retrieve the URL for a download.
Definition: download.c:291
const char * download_context_get_filename(const download_context *ctx)
Retrieve the filename for a download.
Definition: download.c:310
void download_context_abort(download_context *ctx)
Abort a download fetch.
Definition: download.c:285
nserror download_context_create(struct llcache_handle *llcache, struct gui_window *parent)
Create a download context.
Definition: download.c:248
const char * download_context_get_mime_type(const download_context *ctx)
Retrieve the MIME type for a download.
Definition: download.c:297
unsigned long long int download_context_get_total_length(const download_context *ctx)
Retrieve total byte length of download.
Definition: download.c:304
wimp_w parent
Definition: dialog.c:88
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
static struct llcache_s * llcache
low level cache state
Definition: llcache.c:267
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
A context for a download.
Definition: download.c:40
first entry in window list
Definition: gui.c:297
Handle to low-level cache object.
Definition: llcache.c:76