98b3fe1ddff19a17a8a552a8433dc58c67479e7b
[oweals/opkg-lede.git] / libopkg / opkg_conf.h
1 /* opkg_conf.h - the itsy package management system
2
3    Carl D. Worth
4
5    Copyright (C) 2001 University of Southern California
6
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2, or (at
10    your option) any later version.
11
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 */
17
18 #ifndef OPKG_CONF_H
19 #define OPKG_CONF_H
20
21 typedef struct opkg_conf opkg_conf_t;
22
23 #include "hash_table.h"
24 #include "opkg.h"
25 #include "args.h"
26 #include "pkg.h"
27 #include "pkg_hash.h"
28 #include "pkg_src_list.h"
29 #include "pkg_dest_list.h"
30 #include "nv_pair_list.h"
31
32 #define OPKG_CONF_DEFAULT_TMP_DIR_BASE "/tmp"
33 #define OPKG_CONF_TMP_DIR_SUFFIX "opkg-XXXXXX"
34 #define OPKG_CONF_LISTS_DIR  OPKG_STATE_DIR_PREFIX "/lists"
35 #define OPKG_CONF_PENDING_DIR OPKG_STATE_DIR_PREFIX "/pending"
36
37 /* In case the config file defines no dest */
38 #define OPKG_CONF_DEFAULT_DEST_NAME "root"
39 #define OPKG_CONF_DEFAULT_DEST_ROOT_DIR "/"
40
41 #define OPKG_CONF_DEFAULT_HASH_LEN 1024
42
43 struct opkg_conf
44 {
45      pkg_src_list_t pkg_src_list;
46      pkg_dest_list_t pkg_dest_list;
47      nv_pair_list_t arch_list;
48
49      int restrict_to_default_dest;
50      pkg_dest_t *default_dest;
51
52      char *tmp_dir;
53      const char *lists_dir;
54      const char *pending_dir;
55
56      /* options */
57      int autoremove;
58      int force_depends;
59      int force_defaults;
60      int force_overwrite;
61      int force_downgrade;
62      int force_reinstall;
63      int force_space;
64      int force_removal_of_dependent_packages;
65      int force_removal_of_essential_packages;
66      int nodeps; /* do not follow dependences */
67      int verbose_wget;
68      int multiple_providers;
69      char *offline_root;
70      char *offline_root_pre_script_cmd;
71      char *offline_root_post_script_cmd;
72      int query_all;
73      int verbosity;
74      int noaction;
75
76      /* proxy options */
77      char *http_proxy;
78      char *ftp_proxy;
79      char *no_proxy;
80      char *proxy_user;
81      char *proxy_passwd;
82
83      hash_table_t pkg_hash;
84      hash_table_t file_hash;
85      hash_table_t obs_file_hash;
86 };
87
88 enum opkg_option_type {
89      OPKG_OPT_TYPE_BOOL,
90      OPKG_OPT_TYPE_INT,
91      OPKG_OPT_TYPE_STRING
92 };
93 typedef enum opkg_option_type opkg_option_type_t;
94
95 typedef struct opkg_option opkg_option_t;
96 struct opkg_option {
97      const char *name;
98      const opkg_option_type_t type;
99      const void *value;
100 };
101
102 int opkg_conf_init(opkg_conf_t *conf, const args_t *args);
103 void opkg_conf_deinit(opkg_conf_t *conf);
104
105 int opkg_conf_write_status_files(opkg_conf_t *conf);
106 char *root_filename_alloc(opkg_conf_t *conf, char *filename);
107
108 #endif