1 #ifndef CRYPTOPP_WINPIPES_H
2 #define CRYPTOPP_WINPIPES_H
6 #ifdef WINDOWS_PIPES_AVAILABLE
12 NAMESPACE_BEGIN(CryptoPP)
18 WindowsHandle(HANDLE h = INVALID_HANDLE_VALUE,
bool own=
false);
19 WindowsHandle(
const WindowsHandle &h) : m_h(h.m_h), m_own(
false) {}
20 virtual ~WindowsHandle();
22 bool GetOwnership()
const {
return m_own;}
23 void SetOwnership(
bool own) {m_own = own;}
25 operator HANDLE() {
return m_h;}
26 HANDLE GetHandle()
const {
return m_h;}
27 bool HandleValid()
const;
28 void AttachHandle(HANDLE h,
bool own=
false);
29 HANDLE DetachHandle();
33 virtual void HandleChanged() {}
46 Err(HANDLE h,
const std::string& operation,
int error);
47 HANDLE GetHandle()
const {
return m_h;}
54 virtual HANDLE GetHandle()
const =0;
55 virtual void HandleError(
const char *operation)
const;
56 void CheckAndHandleError(
const char *operation, BOOL result)
const
57 {assert(result==TRUE || result==FALSE);
if (!result) HandleError(operation);}
66 bool MustWaitForResult() {
return true;}
67 bool Receive(byte* buf,
size_t bufLen);
68 unsigned int GetReceiveResult();
69 bool EofReceived()
const {
return m_eofReceived;}
76 OVERLAPPED m_overlapped;
88 bool MustWaitForResult() {
return true;}
89 void Send(
const byte* buf,
size_t bufLen);
90 unsigned int GetSendResult();
91 bool MustWaitForEof() {
return false; }
99 OVERLAPPED m_overlapped;
100 bool m_resultPending;
119 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
127 WindowsPipeSink(HANDLE h=INVALID_HANDLE_VALUE,
unsigned int maxBufferSize=0,
unsigned int autoFlushBound=16*1024)
134 HANDLE GetHandle()
const {
return WindowsHandle::GetHandle();}
container of wait objects
error reported by the operating system
unsigned int GetMaxWaitObjectCount() const
maximum number of wait objects that this object can return
unsigned int GetMaxWaitObjectCount() const
maximum number of wait objects that this object can return
pipe-based implementation of NetworkReceiver
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
put wait objects into container
unsigned int GetMaxWaitObjectCount() const
maximum number of wait objects that this object can return
pipe-based implementation of NetworkSender
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
put wait objects into container
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
put wait objects into container
bool Receive(byte *buf, size_t bufLen)
receive data from network source, returns whether result is immediately available ...
void GetWaitObjects(WaitObjectContainer &container, CallStack const &callStack)
put wait objects into container
unsigned int GetMaxWaitObjectCount() const
maximum number of wait objects that this object can return