您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

46 行
1.4KB

  1. /*
  2. * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MK_TCP_PRIVATE_H
  11. #define MK_TCP_PRIVATE_H
  12. #include "mk_tcp.h"
  13. #include "Network/TcpClient.h"
  14. #include "Network/Session.h"
  15. class TcpClientForC : public toolkit::TcpClient {
  16. public:
  17. using Ptr = std::shared_ptr<TcpClientForC>;
  18. TcpClientForC(mk_tcp_client_events *events) ;
  19. ~TcpClientForC() override ;
  20. void onRecv(const toolkit::Buffer::Ptr &pBuf) override;
  21. void onErr(const toolkit::SockException &ex) override;
  22. void onManager() override;
  23. void onConnect(const toolkit::SockException &ex) override;
  24. void setClient(mk_tcp_client client);
  25. void *_user_data;
  26. private:
  27. mk_tcp_client_events _events;
  28. mk_tcp_client _client;
  29. };
  30. class SessionForC : public toolkit::Session {
  31. public:
  32. SessionForC(const toolkit::Socket::Ptr &pSock) ;
  33. ~SessionForC() override = default;
  34. void onRecv(const toolkit::Buffer::Ptr &buffer) override ;
  35. void onError(const toolkit::SockException &err) override;
  36. void onManager() override;
  37. void *_user_data;
  38. uint16_t _local_port;
  39. };
  40. #endif //MK_TCP_PRIVATE_H