]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/cpp/src/thrift/transport/TPipe.h
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 #ifndef _THRIFT_TRANSPORT_TPIPE_H_
21 #define _THRIFT_TRANSPORT_TPIPE_H_ 1
23 #include <thrift/transport/TTransport.h>
24 #include <thrift/transport/TVirtualTransport.h>
26 #include <thrift/transport/TSocket.h>
29 #include <thrift/windows/Sync.h>
31 #include <boost/noncopyable.hpp>
33 #include <thrift/windows/Sync.h>
41 * Windows Pipes implementation of the TTransport interface.
42 * Don't destroy a TPipe at global scope, as that will cause a thread join
43 * during DLLMain. That also means that client objects using TPipe shouldn't be at global
49 class TPipe
: public TVirtualTransport
<TPipe
> {
51 // Constructs a new pipe object.
53 // Named pipe constructors -
54 explicit TPipe(HANDLE Pipe
); // HANDLE is a void*
55 explicit TPipe(TAutoHandle
& Pipe
); // this ctor will clear out / move from Pipe
56 // need a const char * overload so string literals don't go to the HANDLE overload
57 explicit TPipe(const char* pipename
);
58 explicit TPipe(const std::string
& pipename
);
60 TPipe(HANDLE PipeRd
, HANDLE PipeWrt
);
62 // Destroys the pipe object, closing it if necessary.
65 // Returns whether the pipe is open & valid.
66 bool isOpen() const override
;
68 // Checks whether more data is available in the pipe.
71 // Creates and opens the named/anonymous pipe.
74 // Shuts down communications on the pipe.
75 void close() override
;
77 // Reads from the pipe.
78 virtual uint32_t read(uint8_t* buf
, uint32_t len
);
80 // Writes to the pipe.
81 virtual void write(const uint8_t* buf
, uint32_t len
);
84 std::string
getPipename();
85 void setPipename(const std::string
& pipename
);
86 HANDLE
getPipeHandle(); // doubles as the read handle for anon pipe
87 void setPipeHandle(HANDLE pipehandle
);
88 HANDLE
getWrtPipeHandle();
89 void setWrtPipeHandle(HANDLE pipehandle
);
90 long getConnTimeout();
91 void setConnTimeout(long seconds
);
93 // this function is intended to be used in generic / template situations,
94 // so its name needs to be the same as TPipeServer's
95 HANDLE
getNativeWaitHandle();
98 std::shared_ptr
<TPipeImpl
> impl_
;
100 std::string pipename_
;
102 long TimeoutSeconds_
;
107 typedef TSocket TPipe
;
111 } // apache::thrift::transport
113 #endif // #ifndef _THRIFT_TRANSPORT_TPIPE_H_