2018-12-31 20:04:05 +01:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// 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/telegram/net/NetQuery.h"
|
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
|
|
|
|
|
|
|
#include "td/utils/buffer.h"
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class NetActor : public NetQueryCallback {
|
|
|
|
public:
|
|
|
|
NetActor();
|
2021-11-08 12:19:57 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_parent(ActorShared<> parent);
|
2021-11-08 12:19:57 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_result(NetQueryPtr query) override;
|
2021-11-08 12:19:57 +01:00
|
|
|
|
|
|
|
virtual void on_result(BufferSlice packet) {
|
2018-12-31 20:04:05 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
2021-11-08 12:19:57 +01:00
|
|
|
|
|
|
|
virtual void on_error(Status status) {
|
2018-12-31 20:04:05 +01:00
|
|
|
UNREACHABLE();
|
|
|
|
}
|
2021-11-08 12:19:57 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
virtual void on_result_finish() {
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2021-11-08 13:20:38 +01:00
|
|
|
Td *td_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorShared<> parent_;
|
2021-11-08 13:20:38 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void send_query(NetQueryPtr query);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|