tdlight/td/mtproto/PingConnection.h
Arseny Smirnov be006f6cb4 mtproto::Ping two variants with mtproto_api::ping and mtproto_api::req_pq
GitOrigin-RevId: 196d7af132a791615c867cbdbfa23a2fa48327e9
2019-05-06 18:59:49 +02:00

45 lines
1.4 KiB
C++

//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2019
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/mtproto/AuthKey.h"
#include "td/mtproto/AuthData.h"
#include "td/mtproto/NoCryptoStorer.h"
#include "td/mtproto/PacketInfo.h"
#include "td/mtproto/PacketStorer.h"
#include "td/mtproto/RawConnection.h"
#include "td/mtproto/utils.h"
#include "td/mtproto/mtproto_api.h"
#include "td/utils/buffer.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/Random.h"
#include "td/utils/Status.h"
#include "td/utils/Time.h"
#include "td/utils/UInt.h"
namespace td {
namespace mtproto {
class PingConnection {
public:
virtual ~PingConnection() = default;
virtual PollableFdInfo &get_poll_info() = 0;
virtual unique_ptr<RawConnection> move_as_raw_connection() = 0;
virtual Status flush() = 0;
virtual bool was_pong() const = 0;
virtual double rtt() const = 0;
static unique_ptr<PingConnection> create_req_pq(unique_ptr<RawConnection> raw_connection, size_t ping_count);
static unique_ptr<PingConnection> create_ping_pong(unique_ptr<RawConnection> raw_connection,
unique_ptr<AuthData> auth_data);
};
} // namespace mtproto
} // namespace td