1 | #ifndef HEADER_CURL_PROGRESS_H |
2 | #define |
3 | /*************************************************************************** |
4 | * _ _ ____ _ |
5 | * Project ___| | | | _ \| | |
6 | * / __| | | | |_) | | |
7 | * | (__| |_| | _ <| |___ |
8 | * \___|\___/|_| \_\_____| |
9 | * |
10 | * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. |
11 | * |
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 https://curl.se/docs/copyright.html. |
15 | * |
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. |
19 | * |
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
21 | * KIND, either express or implied. |
22 | * |
23 | * SPDX-License-Identifier: curl |
24 | * |
25 | ***************************************************************************/ |
26 | |
27 | #include "timeval.h" |
28 | |
29 | |
30 | typedef enum { |
31 | TIMER_NONE, |
32 | TIMER_STARTOP, |
33 | TIMER_STARTSINGLE, |
34 | TIMER_NAMELOOKUP, |
35 | TIMER_CONNECT, |
36 | TIMER_APPCONNECT, |
37 | TIMER_PRETRANSFER, |
38 | TIMER_STARTTRANSFER, |
39 | TIMER_POSTRANSFER, |
40 | TIMER_STARTACCEPT, |
41 | TIMER_REDIRECT, |
42 | TIMER_LAST /* must be last */ |
43 | } timerid; |
44 | |
45 | int Curl_pgrsDone(struct Curl_easy *data); |
46 | void (struct Curl_easy *data); |
47 | void (struct Curl_easy *data, curl_off_t size); |
48 | void (struct Curl_easy *data, curl_off_t size); |
49 | |
50 | /* It is fine to not check the return code if 'size' is set to 0 */ |
51 | CURLcode (struct Curl_easy *data, curl_off_t size); |
52 | |
53 | void (struct Curl_easy *data, curl_off_t size); |
54 | void Curl_ratelimit(struct Curl_easy *data, struct curltime now); |
55 | int Curl_pgrsUpdate(struct Curl_easy *data); |
56 | void Curl_pgrsResetTransferSizes(struct Curl_easy *data); |
57 | struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer); |
58 | timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize, |
59 | curl_off_t startsize, |
60 | curl_off_t limit, |
61 | struct curltime start, |
62 | struct curltime now); |
63 | /** |
64 | * Update progress timer with the elapsed time from its start to `timestamp`. |
65 | * This allows updating timers later and is used by happy eyeballing, where |
66 | * we only want to record the winner's times. |
67 | */ |
68 | void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer, |
69 | struct curltime timestamp); |
70 | |
71 | #define PGRS_HIDE (1<<4) |
72 | #define PGRS_UL_SIZE_KNOWN (1<<5) |
73 | #define PGRS_DL_SIZE_KNOWN (1<<6) |
74 | #define (1<<7) /* set when the headers have been written */ |
75 | |
76 | #endif /* HEADER_CURL_PROGRESS_H */ |
77 | |