[Draft V.0.8, 2004-01-27 Florian Boor ] IPKG library interface description * Global functions * int ipkg_init (ipkg_message_callback mcall, ipkg_response_callback rcall, args_t *args) Initialises ipkg library and defines callbacks to use for data transfer to client application. It is used to intialise a local set of args to default values. For definition of callback routines see below. The messages callback is used for all messages from ipkg, the type of the messages is passed to the callback as well as current configuration settings and message text. All questions that need to be answered by the user are passed to the response callback. Returns 0 on success. int ipkg_deinit (args_t *args) Finalizes usage of ipkg library and frees storage allocated my argument data type. Returns 0 on success. * Configuration interface * ipkg_options_t ipkg_conf_get_options () This parses local configuration files and sets up a complete option struct * Package handling functions * int ipkg_packages_list(args_t *args, const char *packages, ipkg_list_callback cblist, void *userdata) List packages that matches given pattern. If string for given packages is emty, all packages are listed. ipkg_list_callback cblist is called seperately for every matching package name providing full package name, short description and version information. "userdata" is a pointer that is passed to callback function. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_packages_status(args_t *args, const char *packages, ipkg_status_callback cbstatus, void *userdata) This function extracts detailed status information from package status database about the status of all packages that match the string given by the "packages" parameter. The full package name and status information text is returned by calling the ipkg_status_callback parameter cbstatus. int ipkg_packages_info(args_t *args, const char *packages, ipkg_status_callback cbstatus, void *userdata) This function extracts detailed information of all packages that match the string given by the "packages" parameter. The full package name and status information text is returned by calling the ipkg_status_callback parameter cbstatus. int ipkg_packages_install(args_t *args, const char *name) Installs a package given by the "name" parameter. In contrast to the functions described before the parameter needs to match the package name exactly. All messages are returned to the defined ipkg_message_callback including a set of configuration parameters and an according message priority. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_packages_remove(args_t *args, const char *name, int purge) Removes a package given by the "name" parameter. The parameter needs to match the package name exactly like for package install. The boolean parameter "purge" tells ipkg library wether to use normal package remove function or purge function that removes all data provided by the package including data that was changed since installation of the package. All messages are returned to the defined ipkg_message_callback. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_lists_update(args_t *args) Updates package lists from confgured feeds. All messages are returned to the defined ipkg_message_callback. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_packages_upgrade(args_t *args) Updates all installed package to the last known state. All messages are returned to the defined ipkg_message_callback. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_packages_download(args_t *args, const char *name) Downloads a package given by the "name" parameter to the current working directory. This parameter needs to match the package name exactly. All messages are returned to the defined ipkg_message_callback including a set of configuration parameters and an according message priority. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_package_files(args_t *args, const char *name, ipkg_list_callback cblist, void *userdata) Lists all files that are provided by the package given by the "name" parameter. The parameter cblist is used for returning the names of files. Returns 0 if operation is executed without error, an error code otherwise. int ipkg_file_search(args_t *args, const char *file, ipkg_list_callback cblist, void *userdata) This function searches the ipkg database for a package containing the file given by parameter "file". If found the name of the package is returned via list callback cblist in this order: PACKAGE_NAME, PATH_TO_FILE. All additional messages are reported through th ipkg_message_callback. Query calls: int ipkg_package_whatdepends(args_t *args, const char *file) int ipkg_package_whatrecommends(args_t *args, const char *file) int ipkg_package_whatprovides(args_t *args, const char *file) int ipkg_package_whatconflicts(args_t *args, const char *file) int ipkg_package_whatreplaces(args_t *args, const char *file) Callback function types: typedef int (*ipkg_message_callback)(ipkg_conf_t *conf, message_level_t level, char *msg); typedef int (*ipkg_list_callback)(char *name, char *desc, char *version, void *userdata); typedef int (*ipkg_status_callback)(char *name, int istatus, char *desc, void *userdata); typedef char* (*ipkg_response_callback)(char *question);