sdc_proxy.h 921 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __SDC_PROXY_H__
  2. #define __SDC_PROXY_H__
  3. #include <string>
  4. namespace HWYolov3App
  5. {
  6. class HttpProxy
  7. {
  8. public:
  9. enum {
  10. IPROXY_ERROR = -1,
  11. IPROXY_OK = 0,
  12. };
  13. virtual ~HttpProxy(void);
  14. int32_t CreateSocket(void);
  15. void CloseSocket(void);
  16. int32_t Connect(const std::string &ip, uint16_t port);
  17. int32_t SendRequest(const uint8_t msg[], int32_t msglen);
  18. int32_t RecvResponse(uint8_t msg[], int32_t size, int32_t &msglen);
  19. protected:
  20. HttpProxy(void);
  21. private:
  22. HttpProxy(const HttpProxy&);
  23. HttpProxy& operator=(const HttpProxy&);
  24. HttpProxy(const HttpProxy&&);
  25. HttpProxy& operator=(const HttpProxy&&);
  26. int32_t m_sock;
  27. // nginx监听的域套接字/tmp/http_proxy_connect.socket
  28. static constexpr const char *HTTP_PROXY_SOCK = "/tmp/http_proxy_connect.socket";
  29. };
  30. }
  31. #endif /* __SDC_PROXY_H__ */