4 author: José Bollo <jose.bollo@iot.bzh>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
20 #include <libxml/tree.h>
24 /**************************************************************/
25 /* from wgtpkg-base64 */
27 extern char *base64encw(const char *buffer, int length, int width);
28 extern char *base64enc(const char *buffer, int length);
29 extern int base64dec(const char *buffer, char **output);
30 extern int base64eq(const char *buf1, const char *buf2);
32 /**************************************************************/
33 /* from wgtpkg-certs */
35 extern void clear_certificates();
36 extern int add_certificate_b64(const char *b64);
38 /**************************************************************/
39 /* from wgtpkg-digsig */
41 /* verify the digital signature in file */
42 extern int verify_digsig(struct filedesc *fdesc);
44 /* create a digital signature */
45 extern int create_digsig(int index, const char *key, const char **certs);
47 /* check the signatures of the current directory */
48 extern int check_all_signatures();
50 /**************************************************************/
51 /* from wgtpkg-files */
62 flag_author_signature = 4,
63 flag_distributor_signature = 8,
75 extern void file_reset();
76 extern void file_clear_flags();
77 extern unsigned int file_count();
78 extern struct filedesc *file_of_index(unsigned int index);
79 extern struct filedesc *file_of_name(const char *name);
80 extern struct filedesc *file_add_directory(const char *name);
81 extern struct filedesc *file_add_file(const char *name);
82 extern int fill_files();
84 extern unsigned int signature_count();
85 extern struct filedesc *signature_of_index(unsigned int index);
86 extern struct filedesc *create_signature(unsigned int number);
87 extern struct filedesc *get_signature(unsigned int number);
89 extern int file_set_prop(struct filedesc *file, const char *name, const char *value);
90 extern const char *file_get_prop(struct filedesc *file, const char *name);
92 /**************************************************************/
93 /* from wgtpkg-permission */
95 extern int is_standard_permission(const char *name);
96 extern void reset_permissions();
97 extern void crop_permissions(unsigned level);
98 extern void grant_permission_list(const char *list);
99 extern int permission_exists(const char *name);
100 extern int request_permission(const char *name);
101 extern const char *first_usable_permission();
102 extern const char *next_usable_permission();
104 /**************************************************************/
105 /* from wgtpkg-workdir */
107 extern char workdir[PATH_MAX];
108 extern int workdirfd;
109 extern void remove_workdir();
110 extern int set_workdir(const char *name, int create);
111 extern int make_workdir_base(const char *root, const char *prefix, int reuse);
112 extern int make_workdir(int reuse);
113 extern int move_workdir(const char *dest, int parents, int force);
115 /**************************************************************/
116 /* from wgtpkg-xmlsec */
118 extern int xmlsec_init();
119 extern void xmlsec_shutdown();
120 extern int xmlsec_verify(xmlNodePtr node);
121 extern xmlDocPtr xmlsec_create(int index, const char *key, const char **certs);
123 /**************************************************************/
124 /* from wgtpkg-zip */
126 /* read (extract) 'zipfile' in current directory */
127 extern int zread(const char *zipfile, unsigned long long maxsize);
129 /* write (pack) content of the current directory in 'zipfile' */
130 extern int zwrite(const char *zipfile);