1 #ifndef EL__NETWORK_PROGRESS_H
2 #define EL__NETWORK_PROGRESS_H
4 #include "main/timer.h" /* timer_id_T */
7 #define CURRENT_SPD_SEC 50 /* number of seconds */
13 timeval_T estimated_time
;
15 int average_speed
; /* bytes/second */
16 int current_speed
; /* bytes/second */
20 off_t loaded
, last_loaded
;
23 /* This is offset where the download was resumed possibly */
24 /* progress->start == -1 means normal session, not download
29 /* This is absolute position in the stream
30 * (relative_position = pos - start) (maybe our fictional
31 * relative_position is equiv to loaded, but I'd rather not rely on it
34 /* If this is non-zero, it indicates that we should seek in the
35 * stream to the value inside before the next write (and zero this
36 * counter then, obviously). */
40 void (*timer_func
)(void *);
41 void *timer_func_data
;
43 int data_in_secs
[CURRENT_SPD_SEC
];
46 struct progress
*init_progress(off_t start
);
47 void done_progress(struct progress
*progress
);
48 void update_progress(struct progress
*progress
, off_t loaded
, off_t size
, off_t pos
);
49 void start_update_progress(struct progress
*progress
, void (*timer_func
)(void *), void *timer_func_data
);
51 int has_progress(struct progress
*progress
);