opkg.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* opkg.h - the opkg package management system
  2. Thomas Wood <thomas@openedhand.com>
  3. Copyright (C) 2008 OpenMoko Inc
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation; either version 2, or (at
  7. your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. */
  13. #ifndef OPKG_H
  14. #define OPKG_H
  15. #include "pkg.h"
  16. #include "opkg_message.h"
  17. typedef struct _opkg_progress_data_t opkg_progress_data_t;
  18. typedef void (*opkg_progress_callback_t) (const opkg_progress_data_t * progress,
  19. void *user_data);
  20. typedef void (*opkg_package_callback_t) (pkg_t * pkg, void *user_data);
  21. enum _opkg_action_t {
  22. OPKG_INSTALL,
  23. OPKG_REMOVE,
  24. OPKG_DOWNLOAD
  25. };
  26. struct _opkg_progress_data_t {
  27. int percentage;
  28. int action;
  29. pkg_t *pkg;
  30. };
  31. int opkg_new(void);
  32. void opkg_free(void);
  33. int opkg_re_read_config_files(void);
  34. void opkg_get_option(char *option, void **value);
  35. void opkg_set_option(char *option, void *value);
  36. int opkg_install_package(const char *package_name,
  37. opkg_progress_callback_t callback, void *user_data);
  38. int opkg_remove_package(const char *package_name,
  39. opkg_progress_callback_t callback, void *user_data);
  40. int opkg_upgrade_package(const char *package_name,
  41. opkg_progress_callback_t callback, void *user_data);
  42. int opkg_upgrade_all(opkg_progress_callback_t callback, void *user_data);
  43. int opkg_update_package_lists(opkg_progress_callback_t callback,
  44. void *user_data);
  45. int opkg_list_packages(opkg_package_callback_t callback, void *user_data);
  46. int opkg_list_upgradable_packages(opkg_package_callback_t callback,
  47. void *user_data);
  48. pkg_t *opkg_find_package(const char *name, const char *version,
  49. const char *architecture, const char *repository);
  50. int opkg_repository_accessibility_check(void);
  51. #endif /* OPKG_H */