1 #ifndef HEADER_CURL_TOOL_METALINK_H
2 #define HEADER_CURL_TOOL_METALINK_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
24 #include "tool_setup.h"
26 #include <metalink/metalink_parser.h>
28 #include "tool_cfgable.h"
31 struct metalinkfile *next;
32 metalink_file_t *file;
36 struct metalink *next;
40 struct metalinkfile *new_metalinkfile(metalink_file_t *metalinkfile);
42 struct metalink *new_metalink(metalink_t *metalink);
45 * Counts the resource in the metalinkfile.
47 int count_next_metalink_resource(struct metalinkfile *mlfile);
49 void clean_metalink(struct Configurable *config);
51 int parse_metalink(struct Configurable *config, const char *infile);
54 * Returns nonzero if content_type includes "application/metalink+xml"
55 * media-type. The check is done in case-insensitive manner.
57 int check_metalink_content_type(const char *content_type);
59 typedef void (* Curl_digest_init_func)(void *context);
60 typedef void (* Curl_digest_update_func)(void *context,
61 const unsigned char *data,
63 typedef void (* Curl_digest_final_func)(unsigned char *result, void *context);
66 Curl_digest_init_func digest_init; /* Initialize context procedure */
67 Curl_digest_update_func digest_update; /* Update context with data */
68 Curl_digest_final_func digest_final; /* Get final result procedure */
69 unsigned int digest_ctxtsize; /* Context structure size */
70 unsigned int digest_resultlen; /* Result length (bytes) */
74 const digest_params *digest_hash; /* Hash function definition */
75 void *digest_hashctx; /* Hash function context */
78 extern const digest_params MD5_DIGEST_PARAMS[1];
79 extern const digest_params SHA1_DIGEST_PARAMS[1];
80 extern const digest_params SHA256_DIGEST_PARAMS[1];
82 digest_context * Curl_digest_init(const digest_params *dparams);
83 int Curl_digest_update(digest_context *context,
84 const unsigned char *data,
86 int Curl_digest_final(digest_context *context, unsigned char *result);
89 const char *hash_name;
90 const digest_params *dparams;
91 } metalink_digest_def;
94 const char *alias_name;
95 const metalink_digest_def *digest_def;
96 } metalink_digest_alias;
99 * Check checksum of file denoted by filename.
101 * This function returns 1 if the checksum matches or one of the
102 * following integers:
105 * Checksum didn't match.
107 * Could not open file; or could not read data from file.
109 * No checksum in Metalink supported; or Metalink does not contain
112 int metalink_check_hash(struct Configurable *config,
113 struct metalinkfile *mlfile,
114 const char *filename);
116 #endif /* HEADER_CURL_TOOL_METALINK_H */