Go to the documentation of this file.00001 #ifndef HEADER_CURL_TOOL_METALINK_H
00002 #define HEADER_CURL_TOOL_METALINK_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "tool_setup.h"
00025
00026 struct GlobalConfig;
00027 struct OperationConfig;
00028
00029
00030 typedef int (* Curl_digest_init_func)(void *context);
00031
00032 typedef void (* Curl_digest_update_func)(void *context,
00033 const unsigned char *data,
00034 unsigned int len);
00035 typedef void (* Curl_digest_final_func)(unsigned char *result, void *context);
00036
00037 typedef struct {
00038 Curl_digest_init_func digest_init;
00039 Curl_digest_update_func digest_update;
00040 Curl_digest_final_func digest_final;
00041 unsigned int digest_ctxtsize;
00042 unsigned int digest_resultlen;
00043 } digest_params;
00044
00045 typedef struct {
00046 const digest_params *digest_hash;
00047 void *digest_hashctx;
00048 } digest_context;
00049
00050 digest_context * Curl_digest_init(const digest_params *dparams);
00051 int Curl_digest_update(digest_context *context,
00052 const unsigned char *data,
00053 unsigned int len);
00054 int Curl_digest_final(digest_context *context, unsigned char *result);
00055
00056 typedef struct {
00057 const char *hash_name;
00058 const digest_params *dparams;
00059 } metalink_digest_def;
00060
00061 typedef struct {
00062 const char *alias_name;
00063 const metalink_digest_def *digest_def;
00064 } metalink_digest_alias;
00065
00066 typedef struct metalink_checksum {
00067 const metalink_digest_def *digest_def;
00068
00069 unsigned char *digest;
00070 } metalink_checksum;
00071
00072 typedef struct metalink_resource {
00073 struct metalink_resource *next;
00074 char *url;
00075 } metalink_resource;
00076
00077 typedef struct metalinkfile {
00078 struct metalinkfile *next;
00079 char *filename;
00080 metalink_checksum *checksum;
00081 metalink_resource *resource;
00082 } metalinkfile;
00083
00084 #ifdef USE_METALINK
00085
00086
00087
00088
00089 #define CURL_REQ_LIBMETALINK_MAJOR 0
00090 #define CURL_REQ_LIBMETALINK_MINOR 1
00091 #define CURL_REQ_LIBMETALINK_PATCH 0
00092
00093 #define CURL_REQ_LIBMETALINK_VERS ((CURL_REQ_LIBMETALINK_MAJOR * 10000) + \
00094 (CURL_REQ_LIBMETALINK_MINOR * 100) + \
00095 CURL_REQ_LIBMETALINK_PATCH)
00096
00097 extern const digest_params MD5_DIGEST_PARAMS[1];
00098 extern const digest_params SHA1_DIGEST_PARAMS[1];
00099 extern const digest_params SHA256_DIGEST_PARAMS[1];
00100
00101 #include <metalink/metalink.h>
00102
00103
00104
00105
00106 int count_next_metalink_resource(metalinkfile *mlfile);
00107 void clean_metalink(struct OperationConfig *config);
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
00120 const char *metalink_url);
00121
00122
00123
00124
00125 size_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,
00126 void *userdata);
00127
00128
00129
00130
00131
00132 int check_metalink_content_type(const char *content_type);
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 int metalink_check_hash(struct GlobalConfig *config,
00149 metalinkfile *mlfile,
00150 const char *filename);
00151
00152
00153
00154
00155 void metalink_cleanup(void);
00156
00157 #else
00158
00159 #define count_next_metalink_resource(x) 0
00160 #define clean_metalink(x) (void)x
00161
00162
00163 #define metalink_cleanup() Curl_nop_stmt
00164
00165 #endif
00166
00167 #endif