dload.h 2.06 KB
Newer Older
Dan McGee's avatar
Dan McGee committed
1
2
3
/*
 *  dload.h
 *
Allan McRae's avatar
Allan McRae committed
4
 *  Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
5
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
Dan McGee's avatar
Dan McGee committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 *  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/>.
 */
20
21
#ifndef ALPM_DLOAD_H
#define ALPM_DLOAD_H
Dan McGee's avatar
Dan McGee committed
22
23
24
25

#include "alpm_list.h"
#include "alpm.h"

26
struct dload_payload {
27
	alpm_handle_t *handle;
28
	const char *tempfile_openmode;
29
	char *remote_name;
30
31
	char *tempfile_name;
	char *destfile_name;
32
	char *content_disp_name;
33
34
35
36
37
	/* 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"
	 */
38
	char *fileurl;
39
	char *filepath; /* download URL path */
40
41
	alpm_list_t *servers;
	long respcode;
42
43
	off_t initial_size;
	off_t max_size;
44
	off_t prevprogress;
45
46
	int force;
	int allow_resume;
47
	int random_partfile;
48
	int errors_ok;
49
	int unlink_on_fail;
50
	int trust_remote_name;
51
52
	int download_signature; /* specifies if an accompanion *.sig file need to be downloaded*/
	int signature_optional; /* *.sig file is optional */
53
#ifdef HAVE_LIBCURL
54
	CURL *curl;
55
56
	char error_buffer[CURL_ERROR_SIZE];
	FILE *localf; /* temp download file */
57
	int signature; /* specifies if this payload is for a signature file */
58
#endif
59
60
};

61
void _alpm_dload_payload_reset(struct dload_payload *payload);
62

63
int _alpm_download(alpm_handle_t *handle,
64
65
66
		alpm_list_t *payloads /* struct dload_payload */,
		const char *localpath);

67
#endif /* ALPM_DLOAD_H */