tcp_forward.h 783 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "net/tcp2tcp.h"
  3. #include "util/map.hpp"
  4. namespace ylib
  5. {
  6. namespace network
  7. {
  8. namespace tcp
  9. {
  10. class forward
  11. {
  12. public:
  13. struct Packages : public std::vector<ylib::buffer>
  14. {
  15. };
  16. public:
  17. forward();
  18. ~forward();
  19. bool start(const std::string& listen_address, ushort listen_port);
  20. void stop();
  21. void setAP(const ylib::AddressPort& remote) { m_remote = remote; }
  22. void setMaxConntionCount(uint32 max) { m_max_connection_count = max; }
  23. uint64 connectionCount();
  24. void disIpAddress(const std::string& ipaddress);
  25. private:
  26. ylib::AddressPort m_remote;
  27. network::tcp::tcp2tcp m_t2t;
  28. uint32 m_max_connection_count = 0;
  29. // 待发送
  30. ylib::map<uint64, Packages*> m_wait_send_data;
  31. };
  32. }
  33. }
  34. }