opkg: add extra data to libopkg progress callbacks
[oweals/opkg-lede.git] / libopkg / opkg.h
index 4dda6c7271e7f4288800091e1aab6cb0c49e9d60..1295f51920212d9ccf78f7f0cea02ace4aeade3a 100644 (file)
 
 typedef struct _opkg_t opkg_t;
 typedef struct _opkg_package_t opkg_package_t;
+typedef struct _opkg_progress_data_t opkg_progress_data_t;
 
-typedef void (*opkg_progress_callback_t) (opkg_t *opkg, int percentage, void *user_data);
+typedef void (*opkg_progress_callback_t) (opkg_t *opkg, const opkg_progress_data_t *progress, void *user_data);
 typedef void (*opkg_package_callback_t) (opkg_t *opkg, opkg_package_t *package, void *user_data);
 
+enum _opkg_action_t
+{
+  OPKG_INSTALL,
+  OPKG_REMOVE,
+  OPKG_DOWNLOAD
+};
 
 struct _opkg_package_t
 {
@@ -33,6 +40,13 @@ struct _opkg_package_t
   int installed;
 };
 
+struct _opkg_progress_data_t
+{
+  int percentage;
+  int action;
+  opkg_package_t *package;
+};
+
 opkg_package_t* opkg_package_new ();
 opkg_package_t* opkg_package_new_with_values (const char *name, const char *version, const char *arch, const char *desc, const char *tags, int installed);
 void opkg_package_free (opkg_package_t *package);