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 <stdarg.h>
25 #include <fnmatch.h>		/* FNM_CASEFOLD */
26 
27 #include "hash_table.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 #define OPKG_CONF_DEFAULT_CONF_FILE_DIR OPKGETCDIR"/opkg"
37 
38 /* In case the config file defines no dest */
39 #define OPKG_CONF_DEFAULT_DEST_NAME "root"
40 #define OPKG_CONF_DEFAULT_DEST_ROOT_DIR "/"
41 
42 #define OPKG_CONF_DEFAULT_HASH_LEN 1024
43 
44 struct opkg_conf {
45 	pkg_src_list_t pkg_src_list;
46 	pkg_src_list_t dist_src_list;
47 	pkg_dest_list_t pkg_dest_list;
48 	pkg_dest_list_t tmp_dest_list;
49 	nv_pair_list_t arch_list;
50 
51 	int restrict_to_default_dest;
52 	pkg_dest_t *default_dest;
53 	char *dest_str;
54 
55 	char *conf_file;
56 
57 	char *tmp_dir;
58 	char *lists_dir;
59 
60 	unsigned int pfm;	/* package field mask */
61 
62 	/* For libopkg users to capture messages. */
63 	void (*opkg_vmessage) (int, const char *fmt, va_list ap);
64 
65 	/* options */
66 	int autoremove;
67 	int force_depends;
68 	int force_defaults;
69 	int force_maintainer;
70 	int force_overwrite;
71 	int force_downgrade;
72 	int force_reinstall;
73 	int force_space;
74 	int force_removal_of_dependent_packages;
75 	int force_removal_of_essential_packages;
76 	int force_postinstall;
77 	int force_remove;
78 	int force_checksum;
79 	int check_signature;
80 	int force_signature;
81 	int no_check_certificate;
82 	int nodeps;		/* do not follow dependencies */
83 	int nocase;		/* perform case insensitive matching */
84 	char *offline_root;
85 	char *overlay_root;
86 	int query_all;
87 	int verbosity;
88 	int noaction;
89 	int size;
90 	int download_only;
91 	char *cache;
92 	char *chroot;
93 
94 	/* proxy options */
95 	char *http_proxy;
96 	char *http_timeout;
97 	char *ftp_proxy;
98 	char *no_proxy;
99 	char *proxy_user;
100 	char *proxy_passwd;
101 
102 	char *signature_ca_file;
103 	char *signature_ca_path;
104 
105 	hash_table_t pkg_hash;
106 	hash_table_t file_hash;
107 	hash_table_t obs_file_hash;
108 };
109 
110 enum opkg_option_type {
111 	OPKG_OPT_TYPE_BOOL,
112 	OPKG_OPT_TYPE_INT,
113 	OPKG_OPT_TYPE_STRING
114 };
115 typedef enum opkg_option_type opkg_option_type_t;
116 
117 typedef struct opkg_option opkg_option_t;
118 struct opkg_option {
119 	const char *name;
120 	const opkg_option_type_t type;
121 	void *const value;
122 };
123 
124 int opkg_conf_init(void);
125 int opkg_conf_load(void);
126 void opkg_conf_deinit(void);
127 
128 int opkg_conf_write_status_files(void);
129 char *root_filename_alloc(char *filename);
130 
131 #endif
132