Merge commit 'grg' into HEAD
[project/opkg-lede.git] / libopkg / opkg_conf.h
1 /* opkg_conf.h - the opkg 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 extern opkg_conf_t *conf;
23
24 #include "hash_table.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
36 /* In case the config file defines no dest */
37 #define OPKG_CONF_DEFAULT_DEST_NAME "root"
38 #define OPKG_CONF_DEFAULT_DEST_ROOT_DIR "/"
39
40 #define OPKG_CONF_DEFAULT_HASH_LEN 1024
41
42 struct opkg_conf
43 {
44 pkg_src_list_t pkg_src_list;
45 pkg_dest_list_t pkg_dest_list;
46 nv_pair_list_t arch_list;
47
48 int restrict_to_default_dest;
49 pkg_dest_t *default_dest;
50
51 char *tmp_dir;
52 char *lists_dir;
53
54 uint pfm; /* package field mask */
55
56 /* options */
57 int autoremove;
58 int force_depends;
59 int force_defaults;
60 int force_maintainer;
61 int force_overwrite;
62 int force_downgrade;
63 int force_reinstall;
64 int force_space;
65 int force_removal_of_dependent_packages;
66 int force_removal_of_essential_packages;
67 int check_signature;
68 int nodeps; /* do not follow dependences */
69 char *offline_root;
70 int query_all;
71 int verbosity;
72 int noaction;
73 char *cache;
74
75 #ifdef HAVE_SSLCURL
76 /* some options could be used by
77 * wget if curl support isn't builtin
78 * If someone want to try...
79 */
80 char *ssl_engine;
81 char *ssl_cert;
82 char *ssl_cert_type;
83 char *ssl_key;
84 char *ssl_key_type;
85 char *ssl_key_passwd;
86 char *ssl_ca_file;
87 char *ssl_ca_path;
88 int ssl_dont_verify_peer;
89 #endif
90 #ifdef HAVE_PATHFINDER
91 int check_x509_path;
92 #endif
93
94 /* proxy options */
95 char *http_proxy;
96 char *ftp_proxy;
97 char *no_proxy;
98 char *proxy_user;
99 char *proxy_passwd;
100
101 char *signature_ca_file;
102 char *signature_ca_path;
103
104 hash_table_t pkg_hash;
105 hash_table_t file_hash;
106 hash_table_t obs_file_hash;
107 };
108
109 enum opkg_option_type {
110 OPKG_OPT_TYPE_BOOL,
111 OPKG_OPT_TYPE_INT,
112 OPKG_OPT_TYPE_STRING
113 };
114 typedef enum opkg_option_type opkg_option_type_t;
115
116 typedef struct opkg_option opkg_option_t;
117 struct opkg_option {
118 const char *name;
119 const opkg_option_type_t type;
120 void * const value;
121 };
122
123 int opkg_conf_init(const args_t *args);
124 void opkg_conf_deinit(void);
125
126 int opkg_conf_write_status_files(void);
127 char *root_filename_alloc(char *filename);
128
129 #endif