cmake/Utilities/cmcurl/lib/progress.h

78 lines
2.9 KiB
C
Raw Normal View History

2015-04-27 22:25:09 +02:00
#ifndef HEADER_CURL_PROGRESS_H
#define HEADER_CURL_PROGRESS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
2023-07-02 19:51:09 +02:00
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
2021-09-14 00:13:48 +02:00
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
2022-11-16 20:14:03 +01:00
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "timeval.h"
typedef enum {
TIMER_NONE,
2015-04-27 22:25:09 +02:00
TIMER_STARTOP,
2024-04-14 22:45:38 +02:00
TIMER_STARTSINGLE, /* start of transfer, might get queued */
TIMER_POSTQUEUE, /* start, immediately after dequeue */
TIMER_NAMELOOKUP,
TIMER_CONNECT,
2015-04-27 22:25:09 +02:00
TIMER_APPCONNECT,
TIMER_PRETRANSFER,
TIMER_STARTTRANSFER,
TIMER_POSTRANSFER,
2015-04-27 22:25:09 +02:00
TIMER_STARTACCEPT,
TIMER_REDIRECT,
TIMER_LAST /* must be last */
} timerid;
2021-09-14 00:13:48 +02:00
int Curl_pgrsDone(struct Curl_easy *data);
2016-09-11 17:22:32 +02:00
void Curl_pgrsStartNow(struct Curl_easy *data);
void Curl_pgrsSetDownloadSize(struct Curl_easy *data, curl_off_t size);
void Curl_pgrsSetUploadSize(struct Curl_easy *data, curl_off_t size);
2023-12-07 09:12:54 +01:00
/* It is fine to not check the return code if 'size' is set to 0 */
CURLcode Curl_pgrsSetDownloadCounter(struct Curl_easy *data, curl_off_t size);
2016-09-11 17:22:32 +02:00
void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size);
2018-08-09 18:06:22 +02:00
void Curl_ratelimit(struct Curl_easy *data, struct curltime now);
2021-09-14 00:13:48 +02:00
int Curl_pgrsUpdate(struct Curl_easy *data);
2024-11-11 15:18:55 +01:00
void Curl_pgrsUpdate_nometer(struct Curl_easy *data);
2018-01-26 17:06:56 +01:00
void Curl_pgrsResetTransferSizes(struct Curl_easy *data);
2021-09-14 00:13:48 +02:00
struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer);
2024-11-11 15:18:55 +01:00
timediff_t Curl_pgrsLimitWaitTime(struct pgrs_dir *d,
curl_off_t speed_limit,
2018-08-09 18:06:22 +02:00
struct curltime now);
2023-07-02 19:51:09 +02:00
/**
* Update progress timer with the elapsed time from its start to `timestamp`.
* This allows updating timers later and is used by happy eyeballing, where
* we only want to record the winner's times.
*/
void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
struct curltime timestamp);
#define PGRS_HIDE (1<<4)
#define PGRS_UL_SIZE_KNOWN (1<<5)
#define PGRS_DL_SIZE_KNOWN (1<<6)
#define PGRS_HEADERS_OUT (1<<7) /* set when the headers have been written */
2015-04-27 22:25:09 +02:00
#endif /* HEADER_CURL_PROGRESS_H */