summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
authorSebastian Nowicki <sebnow@gmail.com>2009-04-04 10:17:30 +0200
committerDan McGee <dan@archlinux.org>2009-07-23 04:27:46 +0200
commit30c4d53ce5c16cbbb17a88fe1ad14faf53d91999 (patch)
treeb2f41fd8fc49733f6487c3a4ecf7dbc919fdde43 /lib/libalpm/alpm.h
parent1d19f0896ccc1560a7e2f5b93cfe095b4aefe84a (diff)
downloadpacman-30c4d53ce5c16cbbb17a88fe1ad14faf53d91999.tar.gz
pacman-30c4d53ce5c16cbbb17a88fe1ad14faf53d91999.tar.xz
Add a fetch callback to allow front-end download support
This allows a frontend to define its own download algorithm so that the libfetch dependency can be omitted without using an external process. The callback will be used when if it is defined, otherwise the old behavior applies. Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> [Dan: minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/alpm.h')
-rw-r--r--lib/libalpm/alpm.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 5285ac39..ce8c6919 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -83,6 +83,17 @@ int alpm_logaction(char *fmt, ...);
typedef void (*alpm_cb_download)(const char *filename,
off_t xfered, off_t total);
typedef void (*alpm_cb_totaldl)(off_t total);
+/** A callback for downloading files
+ * @param url the URL of the file to be downloaded
+ * @param localpath the directory to which the file should be downloaded
+ * @param mtimeold the modification time of the file previously downloaded
+ * @param mtimenew the modification time of the newly downloaded file.
+ * This should be set by the callback.
+ * @return 0 on success, 1 if the modification times are identical, -1 on
+ * error.
+ */
+typedef int (*alpm_cb_fetch)(const char *url, const char *localpath,
+ time_t mtimeold, time_t *mtimenew);
/*
* Options
@@ -94,6 +105,9 @@ void alpm_option_set_logcb(alpm_cb_log cb);
alpm_cb_download alpm_option_get_dlcb();
void alpm_option_set_dlcb(alpm_cb_download cb);
+alpm_cb_fetch alpm_option_get_fetchcb();
+void alpm_option_set_fetchcb(alpm_cb_fetch cb);
+
alpm_cb_totaldl alpm_option_get_totaldlcb();
void alpm_option_set_totaldlcb(alpm_cb_totaldl cb);
@@ -137,9 +151,6 @@ void alpm_option_add_ignoregrp(const char *grp);
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps);
int alpm_option_remove_ignoregrp(const char *grp);
-const char *alpm_option_get_xfercommand();
-void alpm_option_set_xfercommand(const char *cmd);
-
unsigned short alpm_option_get_nopassiveftp();
void alpm_option_set_nopassiveftp(unsigned short nopasv);
void alpm_option_set_usedelta(unsigned short usedelta);