2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2021-2022 Mnemosyne LLC.
|
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
|
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2021-10-16 13:20:04 +00:00
|
|
|
#include <cstdint>
|
2021-11-15 01:17:03 +00:00
|
|
|
#include <string_view>
|
2021-10-16 13:20:04 +00:00
|
|
|
|
2021-11-09 03:30:03 +00:00
|
|
|
#include "transmission.h"
|
2020-08-11 18:11:55 +00:00
|
|
|
|
2021-11-09 03:30:03 +00:00
|
|
|
struct evbuffer;
|
2009-10-23 03:41:36 +00:00
|
|
|
struct tr_address;
|
2011-07-10 15:24:51 +00:00
|
|
|
struct tr_web_task;
|
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
enum tr_web_close_mode
|
2010-03-06 15:05:05 +00:00
|
|
|
{
|
|
|
|
TR_WEB_CLOSE_WHEN_IDLE,
|
|
|
|
TR_WEB_CLOSE_NOW
|
2021-10-06 14:26:07 +00:00
|
|
|
};
|
2008-04-25 19:46:36 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_webClose(tr_session* session, tr_web_close_mode close_mode);
|
2010-03-06 15:05:05 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
using tr_web_done_func = void (*)(
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_session* session,
|
|
|
|
bool did_connect_flag,
|
|
|
|
bool timeout_flag,
|
|
|
|
long response_code,
|
2021-11-15 18:10:18 +00:00
|
|
|
std::string_view response,
|
2021-08-15 09:41:48 +00:00
|
|
|
void* user_data);
|
2008-04-25 04:26:04 +00:00
|
|
|
|
2021-11-15 01:17:03 +00:00
|
|
|
struct tr_web_task* tr_webRun(tr_session* session, std::string_view url, tr_web_done_func done_func, void* done_func_user_data);
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
struct tr_web_task* tr_webRunWithCookies(
|
|
|
|
tr_session* session,
|
2021-11-15 01:17:03 +00:00
|
|
|
std::string_view url,
|
|
|
|
std::string_view cookies,
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_web_done_func done_func,
|
2017-04-19 12:04:45 +00:00
|
|
|
void* done_func_user_data);
|
2013-04-13 20:25:28 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
struct tr_web_task* tr_webRunWebseed(
|
|
|
|
tr_torrent* tor,
|
2021-11-15 01:17:03 +00:00
|
|
|
std::string_view url,
|
|
|
|
std::string_view range,
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_web_done_func done_func,
|
|
|
|
void* done_func_user_data,
|
|
|
|
struct evbuffer* buffer);
|
2011-07-10 15:24:51 +00:00
|
|
|
|
2020-08-27 23:41:26 +00:00
|
|
|
long tr_webGetTaskResponseCode(struct tr_web_task* task);
|
|
|
|
|
|
|
|
char const* tr_webGetTaskRealUrl(struct tr_web_task* task);
|