Print error messages instead of returning error codes.
[oweals/opkg-lede.git] / libopkg / opkg.h
index 7444faf917bd533a80e4b4acce7e7ddb69c6f35c..b39f7fbe32b1beb5c0ecd82bfb37d1d927c2bcaf 100644 (file)
 #ifndef OPKG_H
 #define OPKG_H
 
-typedef struct _opkg_package_t opkg_package_t;
+#include "pkg.h"
+#include "opkg_message.h"
+
 typedef struct _opkg_progress_data_t opkg_progress_data_t;
 
 typedef void (*opkg_progress_callback_t) (const opkg_progress_data_t *progress, void *user_data);
-typedef void (*opkg_package_callback_t) (opkg_package_t *package, void *user_data);
+typedef void (*opkg_package_callback_t) (pkg_t *pkg, void *user_data);
 
 enum _opkg_action_t
 {
@@ -31,43 +33,13 @@ enum _opkg_action_t
   OPKG_DOWNLOAD
 };
 
-enum _opkg_error_code_t
-{
-  OPKG_NO_ERROR,
-  OPKG_UNKNOWN_ERROR,
-  OPKG_DOWNLOAD_FAILED,
-  OPKG_DEPENDENCIES_FAILED,
-  OPKG_PACKAGE_ALREADY_INSTALLED,
-  OPKG_PACKAGE_NOT_AVAILABLE,
-  OPKG_PACKAGE_NOT_FOUND,
-  OPKG_PACKAGE_NOT_INSTALLED,
-  OPKG_GPG_ERROR,
-  OPKG_MD5_ERROR,
-  OPKG_SHA256_ERROR
-};
-
-struct _opkg_package_t
-{
-  char *name;
-  char *version;
-  char *architecture;
-  char *repository;
-  char *description;
-  char *tags;
-  int size;
-  int installed;
-};
-
 struct _opkg_progress_data_t
 {
   int percentage;
   int action;
-  opkg_package_t *package;
+  pkg_t *pkg;
 };
 
-opkg_package_t* opkg_package_new ();
-void opkg_package_free (opkg_package_t *package);
-
 int opkg_new (void);
 void opkg_free (void);
 int opkg_re_read_config_files (void);
@@ -82,7 +54,7 @@ int opkg_update_package_lists (opkg_progress_callback_t callback, void *user_dat
 
 int opkg_list_packages (opkg_package_callback_t callback, void *user_data);
 int opkg_list_upgradable_packages (opkg_package_callback_t callback, void *user_data);
-opkg_package_t* opkg_find_package (const char *name, const char *version, const char *architecture, const char *repository);
+pkg_t* opkg_find_package (const char *name, const char *version, const char *architecture, const char *repository);
 
 int opkg_repository_accessibility_check(void);