XBPS Library API  0.19
The X Binary Package System
xbps_api_impl.h
1 /*-
2  * Copyright (c) 2010-2012 Juan Romero Pardines.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *-
25  */
26 
27 #ifndef _XBPS_API_IMPL_H_
28 #define _XBPS_API_IMPL_H_
29 
30 #include <assert.h>
31 #include <xbps_api.h>
32 /*
33  * By default all public functions have default visibility, unless
34  * visibility has been detected by configure and the HIDDEN definition
35  * is used.
36  */
37 #if HAVE_VISIBILITY
38 #define HIDDEN __attribute__ ((visibility("hidden")))
39 #else
40 #define HIDDEN
41 #endif
42 
43 #include "queue.h"
44 #include "fetch.h"
45 
46 #define ARCHIVE_READ_BLOCKSIZE 10240
47 
48 #define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
49  ARCHIVE_EXTRACT_SECURE_SYMLINKS
50 #define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
51  ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_UNLINK | \
52  EXTRACT_FLAGS
53 
54 #ifndef __UNCONST
55 #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
56 #endif
57 
58 __BEGIN_DECLS
59 
60 /**
61  * @private
62  * From lib/external/dewey.c
63  */
64 int HIDDEN dewey_match(const char *, const char *);
65 
66 /**
67  * @private
68  * From lib/pkgdb.c
69  */
70 int HIDDEN xbps_pkgdb_init(struct xbps_handle *);
71 void HIDDEN xbps_pkgdb_release(struct xbps_handle *);
72 
73 /**
74  * @private
75  * From lib/plist.c
76  */
77 bool HIDDEN xbps_add_obj_to_dict(prop_dictionary_t,
78  prop_object_t, const char *);
79 bool HIDDEN xbps_add_obj_to_array(prop_array_t, prop_object_t);
80 
81 int HIDDEN xbps_array_replace_dict_by_name(prop_array_t,
82  prop_dictionary_t,
83  const char *);
84 int HIDDEN xbps_array_replace_dict_by_pattern(prop_array_t,
85  prop_dictionary_t,
86  const char *);
87 
88 /**
89  * @private
90  * From lib/plist_remove.c
91  */
92 bool HIDDEN xbps_remove_pkg_from_array_by_name(prop_array_t, const char *);
93 bool HIDDEN xbps_remove_pkg_from_array_by_pattern(prop_array_t, const char *);
94 bool HIDDEN xbps_remove_pkg_from_array_by_pkgver(prop_array_t, const char *);
95 bool HIDDEN xbps_remove_pkgname_from_array(prop_array_t, const char *);
96 bool HIDDEN xbps_remove_string_from_array(prop_array_t, const char *);
97 
98 /**
99  * @private
100  * From lib/util.c
101  */
102 char HIDDEN *xbps_repository_pkg_path(struct xbps_handle *, prop_dictionary_t);
103 
104 /**
105  * @private
106  * From lib/rpool.c
107  */
108 int HIDDEN xbps_rpool_init(struct xbps_handle *);
109 void HIDDEN xbps_rpool_release(struct xbps_handle *);
110 
111 /**
112  * @private
113  * From lib/download.c
114  */
115 void HIDDEN xbps_fetch_set_cache_connection(int, int);
116 void HIDDEN xbps_fetch_unset_cache_connection(void);
117 
118 /**
119  * @private
120  * From lib/package_config_files.c
121  */
122 int HIDDEN xbps_entry_is_a_conf_file(prop_dictionary_t, const char *);
123 int HIDDEN xbps_entry_install_conf_file(struct xbps_handle *,
124  prop_dictionary_t,
125  struct archive_entry *,
126  const char *,
127  const char *,
128  const char *);
129 /**
130  * @private
131  * From lib/plist_archive_entry.c
132  */
133 prop_dictionary_t HIDDEN
134  xbps_dictionary_from_archive_entry(struct archive *,
135  struct archive_entry *);
136 
137 /**
138  * @private
139  * From lib/rpool_pkgdeps.c
140  */
141 int HIDDEN xbps_repository_find_deps(struct xbps_handle *,
142  prop_array_t,
143  prop_dictionary_t);
144 
145 /**
146  * @private
147  * From lib/plist_find.c
148  */
149 prop_dictionary_t HIDDEN xbps_find_pkg_in_array(prop_array_t, const char *);
150 prop_dictionary_t HIDDEN
151  xbps_find_virtualpkg_in_array(struct xbps_handle *, prop_array_t,
152  const char *);
153 
154 /**
155  * @private
156  * From lib/transaction_sortdeps.c
157  */
158 int HIDDEN xbps_transaction_sort(struct xbps_handle *);
159 
160 /**
161  * @private
162  * From lib/transaction_dictionary.c
163  */
164 int HIDDEN xbps_transaction_init(struct xbps_handle *);
165 
166 /**
167  * @private
168  * From lib/rindex_sync.c
169  */
170 char HIDDEN *xbps_get_remote_repo_string(const char *);
171 int HIDDEN xbps_rindex_sync(struct xbps_handle *, const char *, const char *);
172 
173 /**
174  * @private
175  * From lib/util_hash.c
176  */
177 int HIDDEN xbps_file_hash_check_dictionary(struct xbps_handle *,
178  prop_dictionary_t d,
179  const char *,
180  const char *);
181 
182 /**
183  * @private
184  * From lib/external/fexec.c
185  */
186 int HIDDEN xbps_file_exec(struct xbps_handle *, const char *, ...);
187 
188 /**
189  * @private
190  * From lib/cb_util.c
191  */
192 void HIDDEN xbps_set_cb_fetch(struct xbps_handle *, off_t, off_t, off_t,
193  const char *, bool, bool, bool);
194 void HIDDEN xbps_set_cb_state(struct xbps_handle *, xbps_state_t, int,
195  const char *, const char *, const char *, ...);
196 
197 /**
198  * @private
199  * From lib/package_unpack.c
200  */
201 int HIDDEN xbps_unpack_binary_pkg(struct xbps_handle *, prop_dictionary_t);
202 
203 int HIDDEN xbps_transaction_package_replace(struct xbps_handle *);
204 
205 /**
206  * @private
207  * From lib/package_conflicts.c
208  */
209 void HIDDEN xbps_pkg_find_conflicts(struct xbps_handle *,
210  prop_array_t,
211  prop_dictionary_t);
212 /**
213  * @private
214  * From lib/rindex_get.c
215  */
216 const char HIDDEN *vpkg_user_conf(struct xbps_handle *, const char *, bool);
217 
218 __END_DECLS
219 
220 #endif /* !_XBPS_API_IMPL_H_ */