ZIF Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy |
#define ZIF_DOWNLOAD_ERROR struct ZifDownload; struct ZifDownloadClass; enum ZifDownloadError; GQuark zif_download_error_quark (void
); ZifDownload * zif_download_new (void
); gboolean zif_download_set_proxy (ZifDownload *download
,const gchar *http_proxy
,GError **error
); gboolean zif_download_file (ZifDownload *download
,const gchar *uri
,const gchar *filename
,ZifState *state
,GError **error
); gboolean zif_download_file_full (ZifDownload *download
,const gchar *uri
,const gchar *filename
,guint64 size
,const gchar *content_types
,GChecksumType checksum_type
,const gchar *checksum
,ZifState *state
,GError **error
); gboolean zif_download_location_add_uri (ZifDownload *download
,const gchar *uri
,GError **error
); gboolean zif_download_location_add_array (ZifDownload *download
,GPtrArray *array
,GError **error
); gboolean zif_download_location_remove_uri (ZifDownload *download
,const gchar *uri
,GError **error
); gboolean zif_download_location (ZifDownload *download
,const gchar *location
,const gchar *filename
,ZifState *state
,GError **error
); gboolean zif_download_location_full (ZifDownload *download
,const gchar *location
,const gchar *filename
,guint64 size
,const gchar *content_types
,GChecksumType checksum_type
,const gchar *checksum
,ZifState *state
,GError **error
); guint zif_download_location_get_size (ZifDownload *download
); void zif_download_location_clear (ZifDownload *download
);
This object is a simple wrapper around libsoup that handles mirrorlists, timeouts and retries.
struct ZifDownloadClass { GObjectClass parent_class; /* Padding for future expansion */ void (*_zif_reserved1) (void); void (*_zif_reserved2) (void); void (*_zif_reserved3) (void); void (*_zif_reserved4) (void); };
typedef enum { ZIF_DOWNLOAD_ERROR_FAILED, ZIF_DOWNLOAD_ERROR_PERMISSION_DENIED, ZIF_DOWNLOAD_ERROR_CANCELLED, ZIF_DOWNLOAD_ERROR_NO_SPACE, ZIF_DOWNLOAD_ERROR_WRONG_STATUS, ZIF_DOWNLOAD_ERROR_WRONG_CONTENT_TYPE, ZIF_DOWNLOAD_ERROR_WRONG_SIZE, ZIF_DOWNLOAD_ERROR_WRONG_CHECKSUM, ZIF_DOWNLOAD_ERROR_NO_LOCATIONS, ZIF_DOWNLOAD_ERROR_LAST } ZifDownloadError;
GQuark zif_download_error_quark (void
);
Returns : |
An error quark. |
Since 0.1.0
ZifDownload * zif_download_new (void
);
Returns : |
A new download instance. |
Since 0.1.0
gboolean zif_download_set_proxy (ZifDownload *download
,const gchar *http_proxy
,GError **error
);
Sets the proxy used for downloading files.
Do not use this method any more. Instead use: zif_config_set_string(config, "http_proxy", "value", error)
|
A ZifDownload |
|
HTTP proxy, e.g. "http://10.0.0.1:8080" |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.0
gboolean zif_download_file (ZifDownload *download
,const gchar *uri
,const gchar *filename
,ZifState *state
,GError **error
);
Downloads a file either from a remote site, or copying the file from the local filesystem.
This function will return with an error if the downloaded file has zero size.
|
A ZifDownload |
|
A full remote URI |
|
A local filename to save to |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.0
gboolean zif_download_file_full (ZifDownload *download
,const gchar *uri
,const gchar *filename
,guint64 size
,const gchar *content_types
,GChecksumType checksum_type
,const gchar *checksum
,ZifState *state
,GError **error
);
Downloads a file either from a remote site, or copying the file from the local filesystem, and then verifying it against what we are expecting.
|
A ZifDownload |
|
A full remote URI. |
|
Local filename to save to |
|
Expected size in bytes, or 0 |
|
Comma delimited expected content types of the file, or NULL
|
|
Checksum type, e.g. G_CHECKSUM_SHA256 , or 0 |
|
Expected checksum of the file, or NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.2.1
gboolean zif_download_location_add_uri (ZifDownload *download
,const gchar *uri
,GError **error
);
Adds a URI to be used when using zif_download_location_full()
.
|
A ZifDownload |
|
Full mirror URI, e.g. "http://dave.com/pub/" |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.3
gboolean zif_download_location_add_array (ZifDownload *download
,GPtrArray *array
,GError **error
);
Adds an array of URIs to be used when using zif_download_location_full()
.
|
A ZifDownload |
|
Array of URI strings to add |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.3
gboolean zif_download_location_remove_uri (ZifDownload *download
,const gchar *uri
,GError **error
);
Removes a URI from the pool used to download files.
|
A ZifDownload |
|
URI to remove |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.3
gboolean zif_download_location (ZifDownload *download
,const gchar *location
,const gchar *filename
,ZifState *state
,GError **error
);
Downloads a file using a pool of download servers.
|
A ZifDownload |
|
Location to add on to the end of the pool URIs |
|
Local filename to save to |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.3
gboolean zif_download_location_full (ZifDownload *download
,const gchar *location
,const gchar *filename
,guint64 size
,const gchar *content_types
,GChecksumType checksum_type
,const gchar *checksum
,ZifState *state
,GError **error
);
Downloads a file using a pool of download servers, and then verifying it against what we are expecting.
|
A ZifDownload |
|
Location to add on to the end of the pool URIs |
|
Local filename to save to |
|
Expected size in bytes, or 0 |
|
Comma delimited expected content types of the file, or NULL
|
|
Checksum type, e.g. G_CHECKSUM_SHA256 , or 0 |
|
Expected checksum of the file, or NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.3
guint zif_download_location_get_size (ZifDownload *download
);
Gets the number of active mirrors we can use.
|
A ZifDownload |
Returns : |
A number or active URIs |
Since 0.1.3
void zif_download_location_clear (ZifDownload *download
);
Clears the list of active mirrors.
|
A ZifDownload |
Since 0.1.3