00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __copier_h__
00034 #define __copier_h__
00035
00043 struct _RDD_COPIER;
00044 struct _RDD_COPY_OPS;
00045
00046 typedef struct _RDD_COPIER {
00047 struct _RDD_COPY_OPS *ops;
00048 void *state;
00049 } RDD_COPIER;
00050
00051 typedef struct _RDD_COPIER_RETURN {
00052 rdd_count_t nbyte;
00053 rdd_count_t nlost;
00054 rdd_count_t nread_err;
00055 rdd_count_t nsubst;
00056 } RDD_COPIER_RETURN;
00057
00058 typedef int (*rdd_copy_exec_fun)(RDD_COPIER *c,
00059 RDD_READER *reader,
00060 RDD_FILTERSET *fset,
00061 RDD_COPIER_RETURN *ret);
00062
00063 typedef int (*rdd_copy_free_fun)(RDD_COPIER *c);
00064
00068 typedef struct _RDD_COPY_OPS {
00069 rdd_copy_exec_fun exec;
00070 rdd_copy_free_fun free;
00071 } RDD_COPY_OPS;
00072
00075 typedef void (*rdd_readerrhandler_t)(rdd_count_t offset, unsigned nbyte,
00076 void *env);
00079 typedef void (*rdd_substhandler_t)(rdd_count_t offset, unsigned nbyte,
00080 void *env);
00083 typedef int (*rdd_proghandler_t)(rdd_count_t ncopied, rdd_count_t nsubstituted, void *env);
00084
00087 typedef struct _RDD_SIMPLE_PARAMS {
00088 rdd_proghandler_t progressfun;
00089 void *progressenv;
00090 } RDD_SIMPLE_PARAMS;
00091
00094 typedef struct _RDD_ROBUST_PARAMS {
00095 unsigned minblocklen;
00096 unsigned maxblocklen;
00097 unsigned nretry;
00098 unsigned maxsubst;
00099 rdd_readerrhandler_t readerrfun;
00100 void *readerrenv;
00101 rdd_substhandler_t substfun;
00102 void *substenv;
00103 rdd_proghandler_t progressfun;
00104 void *progressenv;
00105 } RDD_ROBUST_PARAMS;
00106
00107
00108
00124 int rdd_new_copier(RDD_COPIER **c, RDD_COPY_OPS *ops, unsigned statesize);
00125
00140 int rdd_new_simple_copier(RDD_COPIER **c, RDD_SIMPLE_PARAMS *params);
00141
00164 int rdd_new_robust_copier(RDD_COPIER **c,
00165 rdd_count_t offset, rdd_count_t count,
00166 RDD_ROBUST_PARAMS *params);
00167
00168
00169
00170
00185 int rdd_copy_exec(RDD_COPIER *c, RDD_READER *r, RDD_FILTERSET *fset,
00186 RDD_COPIER_RETURN *ret);
00187
00192 int rdd_copy_free(RDD_COPIER *c);
00193
00194 #endif