1 #ifndef CRYPTOPP_WINPIPES_H 2 #define CRYPTOPP_WINPIPES_H 6 #if !defined(NO_OS_DEPENDENCE) && defined(WINDOWS_PIPES_AVAILABLE) 19 virtual ~WindowsHandle();
21 WindowsHandle(HANDLE
h = INVALID_HANDLE_VALUE,
bool own=
false);
22 WindowsHandle(
const WindowsHandle &
h) : m_h(h.m_h), m_own(false) {}
24 bool GetOwnership()
const {
return m_own;}
25 void SetOwnership(
bool own) {m_own = own;}
27 operator HANDLE()
const {
return m_h;}
28 HANDLE GetHandle()
const {
return m_h;}
29 bool HandleValid()
const;
30 void AttachHandle(HANDLE
h,
bool own=
false);
31 HANDLE DetachHandle();
35 virtual void HandleChanged() {}
48 Err(HANDLE
h,
const std::string& operation,
int error);
49 HANDLE GetHandle()
const {
return m_h;}
56 virtual HANDLE GetHandle()
const =0;
57 virtual void HandleError(
const char *operation)
const;
58 void CheckAndHandleError(
const char *operation, BOOL result)
const 63 class WindowsPipeReceiver :
public WindowsPipe,
public NetworkReceiver
66 WindowsPipeReceiver();
68 bool MustWaitForResult() {
return true;}
69 bool Receive(
byte* buf,
size_t bufLen);
70 unsigned int GetReceiveResult();
71 bool EofReceived()
const {
return m_eofReceived;}
73 HANDLE GetHandle()
const {
return m_event;}
74 unsigned int GetMaxWaitObjectCount()
const {
return 1;}
78 WindowsHandle m_event;
79 OVERLAPPED m_overlapped;
86 class WindowsPipeSender :
public WindowsPipe,
public NetworkSender
91 bool MustWaitForResult() {
return true;}
92 void Send(
const byte* buf,
size_t bufLen);
93 unsigned int GetSendResult();
94 bool MustWaitForEof() {
return false; }
97 HANDLE GetHandle()
const {
return m_event;}
98 unsigned int GetMaxWaitObjectCount()
const {
return 1;}
102 WindowsHandle m_event;
103 OVERLAPPED m_overlapped;
105 bool m_resultPending;
109 class WindowsPipeSource :
public WindowsHandle,
public NetworkSource,
public WindowsPipeReceiver
113 : WindowsHandle(
h), NetworkSource(attachment)
119 using NetworkSource::GetMaxWaitObjectCount;
120 using NetworkSource::GetWaitObjects;
123 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
124 NetworkReceiver & AccessReceiver() {
return *
this;}
128 class WindowsPipeSink :
public WindowsHandle,
public NetworkSink,
public WindowsPipeSender
131 WindowsPipeSink(HANDLE
h=INVALID_HANDLE_VALUE,
unsigned int maxBufferSize=0,
unsigned int autoFlushBound=16*1024)
132 : WindowsHandle(
h), NetworkSink(maxBufferSize, autoFlushBound) {}
134 using NetworkSink::GetMaxWaitObjectCount;
135 using NetworkSink::GetWaitObjects;
138 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
139 NetworkSender & AccessSender() {
return *
this;}
144 #endif // WINDOWS_PIPES_AVAILABLE bool error(const char *fmt, const Args &...args)
The operating system reported an error.
#define NAMESPACE_BEGIN(x)
Abstract base classes that provide a uniform interface to this library.
Library configuration file.
void HandleError(const leveldb::Status &status)
Handle database error by throwing dbwrapper_error exception.
Classes for an unlimited queue to store bytes.