1 /* Declarations for metalink.c. 2 Copyright (C) 2015, 2018-2021 Free Software Foundation, Inc. 3 4 This file is part of GNU Wget. 5 6 GNU Wget is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3 of the License, or 9 (at your option) any later version. 10 11 GNU Wget is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Wget. If not, see <http://www.gnu.org/licenses/>. 18 19 Additional permission under GNU GPL version 3 section 7 20 21 If you modify this program, or any covered work, by linking or 22 combining it with the OpenSSL project's OpenSSL library (or a 23 modified version of that library), containing parts covered by the 24 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation 25 grants you additional permission to convey the resulting work. 26 Corresponding Source for a non-source form of such a combination 27 shall include the source code for the parts of OpenSSL used as well 28 as that of the covered work. */ 29 #if ! defined METALINK_H && defined HAVE_METALINK 30 #define METALINK_H 31 32 #include <metalink/metalink_types.h> 33 #include "dirname.h" 34 #include "wget.h" 35 36 #ifdef HAVE_SSL 37 # define RES_TYPE_SUPPORTED(x)\ 38 ((!x) || !strcmp (x, "http") || !strcmp (x, "https") || !strcmp (x, "ftp") || !strcmp (x, "ftps")) 39 #else 40 # define RES_TYPE_SUPPORTED(x)\ 41 ((!x) || !strcmp (x, "ftp") || !strcmp (x, "http")) 42 #endif 43 44 #define DEFAULT_PRI 999999 45 #define VALID_PRI_RANGE(x) ((x) > 0 && (x) < 1000000) 46 47 uerr_t retrieve_from_metalink (const metalink_t *metalink); 48 49 int metalink_res_cmp (const void *res1, const void *res2); 50 int metalink_meta_cmp (const void* meta1, const void* meta2); 51 52 int metalink_check_safe_path (const char *path); 53 54 void replace_metalink_basename (char **name, char *ref); 55 char *get_metalink_basename (char *name); 56 void append_suffix_number (char **str, const char *sep, wgint num); 57 void clean_metalink_string (char **str); 58 void dequote_metalink_string (char **str); 59 void badhash_suffix (char *name); 60 void badhash_or_remove (char *name); 61 uerr_t fetch_metalink_file (const char *url_str, 62 bool resume, bool metalink_http, 63 const char *filename, char **destname); 64 65 bool find_key_value (const char *start, 66 const char *end, 67 const char *key, 68 char **value); 69 bool has_key (const char *start, const char *end, const char *key); 70 const char *find_key_values (const char *start, 71 const char *end, 72 char **key, 73 char **value); 74 75 #endif /* METALINK_H */ 76