2008-01-22 21:36:11 -06:00
|
|
|
/*
|
|
|
|
* dload.h
|
|
|
|
*
|
2024-02-24 18:40:44 +10:00
|
|
|
* Copyright (c) 2006-2024 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
2009-07-01 02:08:33 -05:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2008-01-22 21:36:11 -06:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-09-03 22:14:49 -05:00
|
|
|
#ifndef ALPM_DLOAD_H
|
|
|
|
#define ALPM_DLOAD_H
|
2008-01-22 21:36:11 -06:00
|
|
|
|
|
|
|
#include "alpm_list.h"
|
|
|
|
#include "alpm.h"
|
|
|
|
|
2011-06-30 22:00:07 -04:00
|
|
|
struct dload_payload {
|
2011-06-28 14:04:00 +10:00
|
|
|
alpm_handle_t *handle;
|
2011-08-19 13:42:53 -04:00
|
|
|
const char *tempfile_openmode;
|
2011-09-28 02:56:36 -05:00
|
|
|
char *remote_name;
|
2011-08-19 11:56:37 -04:00
|
|
|
char *tempfile_name;
|
|
|
|
char *destfile_name;
|
2011-08-19 11:58:45 -04:00
|
|
|
char *content_disp_name;
|
2020-04-19 02:12:01 -07:00
|
|
|
/* client has to provide either
|
|
|
|
* 1) fileurl - full URL to the file
|
|
|
|
* 2) pair of (servers, filepath), in this case ALPM iterates over the
|
|
|
|
* server list and tries to download "$server/$filepath"
|
|
|
|
*/
|
2011-06-24 00:18:01 -04:00
|
|
|
char *fileurl;
|
2020-03-26 13:19:59 -07:00
|
|
|
char *filepath; /* download URL path */
|
2023-11-22 14:19:21 -08:00
|
|
|
alpm_list_t *cache_servers;
|
2014-01-02 12:37:08 -06:00
|
|
|
alpm_list_t *servers;
|
|
|
|
long respcode;
|
2011-08-24 19:48:03 -05:00
|
|
|
off_t initial_size;
|
|
|
|
off_t max_size;
|
2011-09-29 12:17:16 -04:00
|
|
|
off_t prevprogress;
|
2011-06-30 21:19:25 -04:00
|
|
|
int force;
|
|
|
|
int allow_resume;
|
2021-07-11 17:28:33 +01:00
|
|
|
int random_partfile;
|
2011-06-30 21:19:25 -04:00
|
|
|
int errors_ok;
|
2011-08-18 14:17:30 -04:00
|
|
|
int unlink_on_fail;
|
2013-09-05 16:08:23 +02:00
|
|
|
int trust_remote_name;
|
2020-05-12 15:26:38 -07:00
|
|
|
int download_signature; /* specifies if an accompanion *.sig file need to be downloaded*/
|
|
|
|
int signature_optional; /* *.sig file is optional */
|
2011-10-14 07:38:58 -05:00
|
|
|
#ifdef HAVE_LIBCURL
|
2020-03-09 15:23:12 -07:00
|
|
|
CURL *curl;
|
2020-04-13 21:48:55 -07:00
|
|
|
char error_buffer[CURL_ERROR_SIZE];
|
2020-05-12 15:26:38 -07:00
|
|
|
int signature; /* specifies if this payload is for a signature file */
|
2023-11-22 14:19:21 -08:00
|
|
|
int request_errors_ok; /* per-request errors-ok */
|
2011-10-14 07:38:58 -05:00
|
|
|
#endif
|
2023-09-17 18:47:10 +10:00
|
|
|
FILE *localf; /* temp download file */
|
2011-06-24 00:18:01 -04:00
|
|
|
};
|
|
|
|
|
2011-09-28 12:58:43 -05:00
|
|
|
void _alpm_dload_payload_reset(struct dload_payload *payload);
|
2011-06-24 00:18:01 -04:00
|
|
|
|
2020-04-20 01:42:53 -07:00
|
|
|
int _alpm_download(alpm_handle_t *handle,
|
2020-03-26 13:19:59 -07:00
|
|
|
alpm_list_t *payloads /* struct dload_payload */,
|
|
|
|
const char *localpath);
|
|
|
|
|
2016-09-03 22:14:49 -05:00
|
|
|
#endif /* ALPM_DLOAD_H */
|