File indexing completed on 2026-04-17 08:35:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef _THRIFT_TRANSPORT_TPIPE_H_
0021 #define _THRIFT_TRANSPORT_TPIPE_H_ 1
0022
0023 #include <thrift/transport/TTransport.h>
0024 #include <thrift/transport/TVirtualTransport.h>
0025 #ifndef _WIN32
0026 #include <thrift/transport/TSocket.h>
0027 #endif
0028 #ifdef _WIN32
0029 #include <thrift/windows/Sync.h>
0030 #endif
0031 #include <thrift/TNonCopyable.h>
0032 #ifdef _WIN32
0033 #include <thrift/windows/Sync.h>
0034 #endif
0035
0036 namespace apache {
0037 namespace thrift {
0038 namespace transport {
0039
0040
0041
0042
0043
0044
0045
0046 #ifdef _WIN32
0047 class TPipeImpl;
0048
0049 class TPipe : public TVirtualTransport<TPipe> {
0050 public:
0051
0052 TPipe(std::shared_ptr<TConfiguration> config = nullptr);
0053
0054 explicit TPipe(HANDLE Pipe, std::shared_ptr<TConfiguration> config = nullptr);
0055 explicit TPipe(TAutoHandle& Pipe, std::shared_ptr<TConfiguration> config = nullptr);
0056
0057 explicit TPipe(const char* pipename, std::shared_ptr<TConfiguration> config = nullptr);
0058 explicit TPipe(const std::string& pipename, std::shared_ptr<TConfiguration> config = nullptr);
0059
0060 TPipe(HANDLE PipeRd, HANDLE PipeWrt, std::shared_ptr<TConfiguration> config = nullptr);
0061
0062
0063 virtual ~TPipe();
0064
0065
0066 bool isOpen() const override;
0067
0068
0069 bool peek() override;
0070
0071
0072 void open() override;
0073
0074
0075 void close() override;
0076
0077
0078 virtual uint32_t read(uint8_t* buf, uint32_t len);
0079
0080
0081 virtual void write(const uint8_t* buf, uint32_t len);
0082
0083
0084 std::string getPipename();
0085 void setPipename(const std::string& pipename);
0086 HANDLE getPipeHandle();
0087 void setPipeHandle(HANDLE pipehandle);
0088 HANDLE getWrtPipeHandle();
0089 void setWrtPipeHandle(HANDLE pipehandle);
0090 long getConnTimeout();
0091 void setConnTimeout(long seconds);
0092
0093
0094
0095 HANDLE getNativeWaitHandle();
0096
0097 private:
0098 std::shared_ptr<TPipeImpl> impl_;
0099
0100 std::string pipename_;
0101
0102 long TimeoutSeconds_;
0103 bool isAnonymous_;
0104 };
0105
0106 #else
0107 typedef TSocket TPipe;
0108 #endif
0109 }
0110 }
0111 }
0112
0113 #endif