winss
|
The pipe instance which is shared between client and server. More...
#include <pipe_instance.hpp>
Public Member Functions | |
PipeInstance () | |
Creates a new pipe instance. More... | |
PipeInstance (const PipeInstance &)=delete | |
No copy. More... | |
PipeInstance (PipeInstance &&instance) | |
Create a new pipe instance from another. More... | |
virtual bool | IsPendingIO () const |
Gets if there is pending IO operations. More... | |
virtual bool | IsConnected () const |
Gets if the instance is connected. More... | |
virtual bool | IsClosing () const |
Gets if the instance is closing. More... | |
virtual winss::HandleWrapper | GetHandle () const |
Gets the event handle for the instance. More... | |
virtual bool | SetConnected () |
Sets the instance to connected state. More... | |
virtual OverlappedResult | GetOverlappedResult () |
Gets the last overlapped result of the instance. More... | |
virtual bool | CreateNamedPipe (const winss::PipeName &pipe_name) |
Creates the Windows named pipe server. More... | |
virtual bool | CreateFile (const winss::PipeName &pipe_name) |
Creates a Windows named pipe client. More... | |
virtual void | Closing () |
Marks the pipe instance as closing and triggers the event. More... | |
virtual void | DisconnectNamedPipe () |
DIsconnect the client from the pipe server. More... | |
virtual bool | Close () |
Close the pipe connection. More... | |
PipeInstance & | operator= (const PipeInstance &)=delete |
No copy. More... | |
PipeInstance & | operator= (PipeInstance &&instance) |
Move a pipe instance to this instance. More... | |
virtual | ~PipeInstance () |
Default destructor. More... | |
Static Public Attributes | |
static const DWORD | kBufferSize = 4096 |
The pipe buffer. More... | |
static const DWORD | kTimeout = 5000 |
The pipe timeout. More... | |
Protected Member Functions | |
bool | CheckError () |
Checks if error is a real error or pending IO operation. More... | |
Protected Attributes | |
OVERLAPPED | overlapped |
The overlapped structure. More... | |
HANDLE | handle = nullptr |
The event handle. More... | |
bool | connected = false |
Flags if the instance is connected. More... | |
bool | pending_io = false |
Flagged if IO event is pending. More... | |
bool | close = false |
Flagged if instance is closing. More... | |
std::vector< char > | buffer |
The instance byte buffer. More... | |
DWORD | bytes = 0 |
The bytes read or written. More... | |
The pipe instance which is shared between client and server.
winss::PipeInstance::PipeInstance | ( | ) |
Creates a new pipe instance.
References buffer, kBufferSize, overlapped, and WINDOWS.
|
delete |
No copy.
winss::PipeInstance::PipeInstance | ( | winss::PipeInstance && | instance | ) |
Create a new pipe instance from another.
instance | The pipe instance to move from. |
References buffer, bytes, close, connected, handle, kBufferSize, overlapped, and pending_io.
|
virtual |
Default destructor.
References Close().
|
protected |
Checks if error is a real error or pending IO operation.
References close, handle, overlapped, pending_io, and WINDOWS.
Referenced by winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), and winss::OutboundPipeInstance::Write().
|
virtual |
Close the pipe connection.
References buffer, bytes, close, connected, handle, overlapped, pending_io, and WINDOWS.
Referenced by ~PipeInstance().
|
virtual |
Marks the pipe instance as closing and triggers the event.
The client should close the pipe in the event handler.
References close, handle, overlapped, and WINDOWS.
|
virtual |
Creates a Windows named pipe client.
pipe_name | The name of the pipe. |
References winss::PipeName::Get(), handle, and WINDOWS.
|
virtual |
Creates the Windows named pipe server.
pipe_name | The name of the pipe. |
References winss::PipeName::Get(), handle, kBufferSize, kTimeout, overlapped, pending_io, and WINDOWS.
|
virtual |
|
virtual |
Gets the event handle for the instance.
References overlapped.
|
virtual |
Gets the last overlapped result of the instance.
References bytes, close, winss::CONTINUE, handle, overlapped, pending_io, winss::REMOVE, winss::SKIP, and WINDOWS.
|
virtual |
Gets if the instance is closing.
References close.
|
virtual |
|
virtual |
Gets if there is pending IO operations.
References pending_io.
|
delete |
No copy.
Referenced by winss::OutboundPipeInstance::operator=(), and winss::InboundPipeInstance::operator=().
winss::PipeInstance & winss::PipeInstance::operator= | ( | winss::PipeInstance && | instance | ) |
Move a pipe instance to this instance.
instance | The pipe instance to move from. |
References buffer, bytes, close, connected, handle, overlapped, and pending_io.
|
virtual |
|
protected |
The instance byte buffer.
Referenced by Close(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), and winss::InboundPipeInstance::SwapBuffer().
|
protected |
The bytes read or written.
Referenced by Close(), winss::InboundPipeInstance::FinishRead(), GetOverlappedResult(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), winss::InboundPipeInstance::SwapBuffer(), and winss::OutboundPipeInstance::Write().
|
protected |
Flagged if instance is closing.
Referenced by CheckError(), Close(), Closing(), GetOverlappedResult(), IsClosing(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), and winss::InboundPipeInstance::Read().
|
protected |
Flags if the instance is connected.
Referenced by Close(), DisconnectNamedPipe(), winss::InboundPipeInstance::FinishRead(), winss::OutboundPipeInstance::FinishWrite(), IsConnected(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Queue(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), SetConnected(), winss::InboundPipeInstance::SwapBuffer(), and winss::OutboundPipeInstance::Write().
|
protected |
The event handle.
Referenced by CheckError(), Close(), Closing(), CreateFile(), CreateNamedPipe(), DisconnectNamedPipe(), GetOverlappedResult(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), SetConnected(), and winss::OutboundPipeInstance::Write().
|
static |
The pipe buffer.
Referenced by CreateNamedPipe(), PipeInstance(), winss::OutboundPipeInstance::Queue(), and winss::InboundPipeInstance::SwapBuffer().
|
static |
The pipe timeout.
Referenced by CreateNamedPipe().
|
protected |
The overlapped structure.
Referenced by CheckError(), Close(), Closing(), CreateNamedPipe(), GetHandle(), GetOverlappedResult(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), and winss::OutboundPipeInstance::Write().
|
protected |
Flagged if IO event is pending.
Referenced by CheckError(), Close(), CreateNamedPipe(), winss::InboundPipeInstance::FinishRead(), GetOverlappedResult(), IsPendingIO(), operator=(), PipeInstance(), winss::OutboundPipeInstance::Read(), winss::InboundPipeInstance::Read(), and winss::OutboundPipeInstance::Write().