1 #ifndef CRYPTOPP_WINPIPES_H 2 #define CRYPTOPP_WINPIPES_H 4 #ifdef WINDOWS_PIPES_AVAILABLE 17 WindowsHandle(HANDLE h = INVALID_HANDLE_VALUE,
bool own=
false);
18 WindowsHandle(
const WindowsHandle &h) : m_h(h.m_h), m_own(false) {}
19 virtual ~WindowsHandle();
21 bool GetOwnership()
const {
return m_own;}
22 void SetOwnership(
bool own) {m_own = own;}
24 operator HANDLE()
const {
return m_h;}
25 HANDLE GetHandle()
const {
return m_h;}
26 bool HandleValid()
const;
27 void AttachHandle(HANDLE h,
bool own=
false);
28 HANDLE DetachHandle();
32 virtual void HandleChanged() {}
45 Err(HANDLE h,
const std::string& operation,
int error);
46 HANDLE GetHandle()
const {
return m_h;}
53 virtual HANDLE GetHandle()
const =0;
54 virtual void HandleError(
const char *operation)
const;
55 void CheckAndHandleError(
const char *operation, BOOL result)
const 56 {assert(result==TRUE || result==FALSE);
if (!result) HandleError(operation);}
63 WindowsPipeReceiver();
65 bool MustWaitForResult() {
return true;}
66 bool Receive(byte* buf,
size_t bufLen);
67 unsigned int GetReceiveResult();
68 bool EofReceived()
const {
return m_eofReceived;}
70 HANDLE GetHandle()
const {
return m_event;}
71 unsigned int GetMaxWaitObjectCount()
const {
return 1;}
75 WindowsHandle m_event;
76 OVERLAPPED m_overlapped;
83 class WindowsPipeSender :
public WindowsPipe,
public NetworkSender 88 bool MustWaitForResult() {
return true;}
89 void Send(
const byte* buf,
size_t bufLen);
90 unsigned int GetSendResult();
91 bool MustWaitForEof() {
return false; }
94 HANDLE GetHandle()
const {
return m_event;}
95 unsigned int GetMaxWaitObjectCount()
const {
return 1;}
99 WindowsHandle m_event;
100 OVERLAPPED m_overlapped;
101 bool m_resultPending;
106 class WindowsPipeSource :
public WindowsHandle,
public NetworkSource,
public WindowsPipeReceiver
109 WindowsPipeSource(HANDLE h=INVALID_HANDLE_VALUE,
bool pumpAll=
false,
BufferedTransformation *attachment=NULL)
120 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
125 class WindowsPipeSink :
public WindowsHandle,
public NetworkSink,
public WindowsPipeSender
128 WindowsPipeSink(HANDLE h=INVALID_HANDLE_VALUE,
unsigned int maxBufferSize=0,
unsigned int autoFlushBound=16*1024)
129 : WindowsHandle(h),
NetworkSink(maxBufferSize, autoFlushBound) {}
135 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
141 #endif // WINDOWS_PIPES_AVAILABLE
container of wait objects
The operating system reported an error.
Abstract base classes that provide a uniform interface to this library.
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
Retrieves waitable objects.
unsigned int GetMaxWaitObjectCount() const
Retrieves the maximum number of waitable objects.
Classes for an unlimited queue to store bytes.
unsigned int GetMaxWaitObjectCount() const
Retrieves the maximum number of waitable objects.
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
Retrieves waitable objects.
Crypto++ library namespace.