src/libpakfire/archive.c \
src/libpakfire/db.c \
src/libpakfire/dist.c \
+ src/libpakfire/downloader.c \
src/libpakfire/errno.c \
src/libpakfire/execute.c \
src/libpakfire/file.c \
src/libpakfire/include/pakfire/constants.h \
src/libpakfire/include/pakfire/db.h \
src/libpakfire/include/pakfire/dist.h \
+ src/libpakfire/include/pakfire/downloader.h \
src/libpakfire/include/pakfire/errno.h \
src/libpakfire/include/pakfire/execute.h \
src/libpakfire/include/pakfire/file.h \
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2021 Pakfire development team #
+# #
+# 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 3 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/>. #
+# #
+#############################################################################*/
+
+#include <errno.h>
+#include <stdlib.h>
+
+#include <pakfire/downloader.h>
+#include <pakfire/pakfire.h>
+#include <pakfire/types.h>
+
+struct pakfire_downloader {
+ Pakfire pakfire;
+ int nrefs;
+};
+
+static void pakfire_downloader_free(struct pakfire_downloader* downloader) {
+ pakfire_unref(downloader->pakfire);
+ free(downloader);
+}
+
+int pakfire_downloader_create(struct pakfire_downloader** downloader, Pakfire pakfire) {
+ struct pakfire_downloader* d = calloc(1, sizeof(*d));
+ if (!d)
+ return ENOMEM;
+
+ // Store reference to Pakfire
+ d->pakfire = pakfire_ref(pakfire);
+
+ // Initialize reference counting
+ d->nrefs = 1;
+
+ *downloader = d;
+
+ return 0;
+}
+
+struct pakfire_downloader* pakfire_downloader_ref(struct pakfire_downloader* downloader) {
+ ++downloader->nrefs;
+
+ return downloader;
+}
+
+struct pakfire_downloader* pakfire_downloader_unref(struct pakfire_downloader* downloader) {
+ if (--downloader->nrefs > 0)
+ return downloader;
+
+ pakfire_downloader_free(downloader);
+ return NULL;
+}
+
+int pakfire_downloader_add(struct pakfire_downloader* downloader, const char* url) {
+ return 0;
+}
+
+int pakfire_downloader_run(struct pakfire_downloader* downloader) {
+ return 0;
+}
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2021 Pakfire development team #
+# #
+# 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 3 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/>. #
+# #
+#############################################################################*/
+
+#ifndef PAKFIRE_DOWNLOADER_H
+#define PAKFIRE_DOWNLOADER_H
+
+#ifdef PAKFIRE_PRIVATE
+
+#include <pakfire/types.h>
+
+struct pakfire_downloader;
+
+int pakfire_downloader_create(struct pakfire_downloader** downloader, Pakfire pakfire);
+
+struct pakfire_downloader* pakfire_downloader_ref(struct pakfire_downloader* downloader);
+struct pakfire_downloader* pakfire_downloader_unref(struct pakfire_downloader* downloader);
+
+int pakfire_downloader_add(struct pakfire_downloader* downloader, const char* url);
+
+int pakfire_downloader_run(struct pakfire_downloader* downloader);
+
+#endif
+
+#endif /* PAKFIRE_DOWNLOADER_H */