be4c31b9d66eff40e96058051a3596e37e95ab1e
[oweals/opkg-lede.git] / libopkg / libopkg.h
1 /* opkglib.h - the itsy package management system
2
3    Florian Boor <florian.boor@kernelconcepts.de>
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2, or (at
8    your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 */
15
16 #ifndef OPKGLIB_H
17 #define OPKGLIB_H
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23
24 #ifdef OPKG_LIB
25
26 #include "opkg_conf.h"
27 #include "opkg_message.h"
28 #include "opkg_state.h"
29
30 #include "args.h"
31 #include "pkg.h"
32
33 typedef int (*opkg_message_callback)(opkg_conf_t *conf, message_level_t level, 
34         char *msg);
35 typedef int (*opkg_list_callback)(char *name, char *desc, char *version, 
36         pkg_state_status_t status, void *userdata);
37 typedef int (*opkg_status_callback)(char *name, int istatus, char *desc,
38         void *userdata);
39 typedef char* (*opkg_response_callback)(char *question);
40 typedef void (*opkg_download_progress_callback)(int percent, char *url);
41 typedef void (*opkg_state_changed_callback)(opkg_state_t state, const char *data);
42 typedef void (*opkg_progress_callback)(int complete, int total, void *userdata);
43
44 extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
45 extern int opkg_init (opkg_message_callback mcall, 
46                       opkg_response_callback rcall,
47                                           args_t * args);
48
49 extern int opkg_deinit (args_t *args);
50 extern int opkg_packages_list(args_t *args, 
51                               const char *packages, 
52                               opkg_list_callback cblist,
53                               void *userdata);
54 extern int opkg_packages_status(args_t *args, 
55                                 const char *packages, 
56                                 opkg_status_callback cbstatus,
57                                                                 void *userdata);
58 extern int opkg_packages_info(args_t *args,
59                               const char *packages,
60                               opkg_status_callback cbstatus,
61                               void *userdata);
62 extern int opkg_packages_install(args_t *args, const char *name);
63 extern int opkg_packages_remove(args_t *args, const char *name, int purge);
64 extern int opkg_lists_update(args_t *args);
65 extern int opkg_packages_upgrade(args_t *args);
66 extern int opkg_packages_download(args_t *args, const char *name);
67 extern int opkg_package_files(args_t *args,
68                               const char *name,
69                                                           opkg_list_callback cblist,
70                                                           void *userdata);
71 extern int opkg_file_search(args_t *args,
72                             const char *file,
73                                                         opkg_list_callback cblist,
74                                                         void *userdata);
75 extern int opkg_package_whatdepends(args_t *args, const char *file);
76 extern int opkg_package_whatrecommends(args_t *args, const char *file);
77 extern int opkg_package_whatprovides(args_t *args, const char *file);
78 extern int opkg_package_whatconflicts(args_t *args, const char *file);
79 extern int opkg_package_whatreplaces(args_t *args, const char *file);
80
81 extern opkg_message_callback opkg_cb_message; /* opkglib.c */
82 extern opkg_response_callback opkg_cb_response;
83 extern opkg_status_callback opkg_cb_status;
84 extern opkg_list_callback opkg_cb_list;
85 extern opkg_download_progress_callback opkg_cb_download_progress; /* opkg_download.c */
86 extern opkg_state_changed_callback opkg_cb_state_changed; /* opkg_state.c */
87
88 extern void push_error_list(struct errlist **errors,char * msg);
89 extern void reverse_error_list(struct errlist **errors);
90 extern void free_error_list();
91
92 #endif
93
94
95 #endif