52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
// #pragma once
|
|
// #include "abstract_coder.hpp"
|
|
// #include "coroutine.hpp"
|
|
// #include "fd_event.hpp"
|
|
// #include "reactor.hpp"
|
|
// #include "tcp_buffer.hpp"
|
|
// #include "tcp_client.hpp"
|
|
// #include "tinypb_data.hpp"
|
|
// #include <memory>
|
|
// #include <unordered_map>
|
|
|
|
// namespace tinyrpc {
|
|
// class TcpServer;
|
|
// class TcpConnection {
|
|
// public:
|
|
// enum class State{
|
|
// Disconnected,
|
|
// Connected
|
|
// };
|
|
// enum class Type{
|
|
// Server,
|
|
// Client
|
|
// };
|
|
|
|
// public:
|
|
// TcpConnection(int fd, Reactor& reactor, TcpServer& ser, Type type = Type::Server);
|
|
// TcpConnection(int fd, Reactor& reactor, TcpClient& cli, Type type = Type::Client);
|
|
// void clearClient();
|
|
// void mainLoopFun();
|
|
// State getState() {return m_state;}
|
|
// bool getResPackageData(const std::string& msg_req, std::shared_ptr<AbstractData>& pb_struct);
|
|
// ~TcpConnection();
|
|
|
|
// private:
|
|
// void input();
|
|
// void output();
|
|
// void process();
|
|
|
|
// private:
|
|
// FdEvent *m_fdEvent;
|
|
// Coroutine m_mainCoroutine;
|
|
// State m_state{State::Connected};
|
|
// TcpBuffer m_writeBuffer{};
|
|
// TcpBuffer m_readBuffer{};
|
|
// Reactor& m_reactor;
|
|
// TcpServer& m_server;
|
|
// // TcpClient& m_server;
|
|
// Type m_connectType{};
|
|
// std::unordered_map<std::string, std::shared_ptr<AbstractData>> m_respond_datas;
|
|
// };
|
|
|
|
// }
|