dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::service::platform::connection Class Reference

macOS: a client's connection to a service - a launchd mach service, or a listener below it - over XPC More...

#include <dx_service_transport.h>

Inheritance diagram for dx::service::platform::connection:
Collaboration diagram for dx::service::platform::connection:

Public Member Functions

 connection(const connection &)= delete
 connection(const connection &)= delete
 connection(const std::string& id)
 connection(const std::string& id)
void free() noexcept override
size_t ioctl(uint32_t ioctl, const void* tx, size_t tx_size, void* rx, size_t rx_size)
 one round trip: the request's data out, the reply's in - its size answered, its result thrown
size_t ioctl(uint32_t ioctl, const void* tx, size_t tx_size, void* rx, size_t rx_size)
 one round trip: the request's data out, the reply's in - its size answered, its result thrown
 operator const os_event() const noexcept
 operator os_event() noexcept
 operator ::HANDLE() const noexcept
void run()
 the service's first answer: the status follows
void run()
 the read thread started, its first connection tried: a round trip goes where it succeeded
void send(const std::vector<uint8_t>& message)
 ~connection()
 ~connection() override

Public Attributes

listen<std::function<void()>> broadcast
 the service's signal: whatever of it is mirrored reads itself back
promoted<os_result> status{driver_not_connected}
 ok while the service answers

Protected Member Functions

const message* receive(std::stop_token& stop_token) noexcept
 the next message whole, its sizes checked - none where the pipe ended, stops or carried no message
std::optional<::DWORD> wait(::OVERLAPPED& overlapped, std::stop_token& stop_token) noexcept
 an overlapped operation's end, waited for against the stop token: its size, or none where it failed or stops

Static Protected Member Functions

static std::string name(const std::string& id)

Protected Attributes

::HANDLE handle{invalid_t}
::HANDLE process{::GetCurrentProcess()}

Detailed Description

macOS: a client's connection to a service - a launchd mach service, or a listener below it - over XPC

Windows: a client's connection to a service's named pipe.

A round trip is one message and its reply; the service's broadcast is a message of its own, whose listeners run on a queue of the connection's own: a round trip never waits on the queue its reply arrives on. The connection follows the service: a service that ended (XPC_ERROR_CONNECTION_INTERRUPTED) is asked again at once - launchd starts it on demand - and status turns ok when it answers.

Its read thread connects - again whenever the service went: the service signals its pipe's shared event for every instance it listens with - and hands a reply to the round trip waiting for it. The status and the service's broadcast reach their listeners on the thread pool, never on the read thread: a listener's round trip waits for its reply there. A round trip is one at a time; the connection's end wakes it.

Constructor & Destructor Documentation

◆ connection() [1/4]

dx::service::platform::connection::connection(const std::string& id)
inline

◆ connection() [2/4]

dx::service::platform::connection::connection(const connection&)
delete

◆ ~connection() [1/2]

dx::service::platform::connection::~connection()
inline

◆ connection() [3/4]

dx::service::platform::connection::connection(const std::string& id)
inline

◆ connection() [4/4]

dx::service::platform::connection::connection(const connection&)
delete

◆ ~connection() [2/2]

dx::service::platform::connection::~connection()
inlineoverride
Here is the call graph for this function:

Member Function Documentation

◆ free()

void dx::service::platform::connection::free()
inlineoverridevirtualnoexcept

Reimplemented from dx::resource< invalid_t >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ioctl() [1/2]

size_t dx::service::platform::connection::ioctl(uint32_t ioctl, const void* tx, size_t tx_size, void* rx, size_t rx_size)
inline

one round trip: the request's data out, the reply's in - its size answered, its result thrown

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ioctl() [2/2]

size_t dx::service::platform::connection::ioctl(uint32_t ioctl, const void* tx, size_t tx_size, void* rx, size_t rx_size)
inline

one round trip: the request's data out, the reply's in - its size answered, its result thrown

Here is the call graph for this function:

◆ name()

std::string dx::service::platform::pipe::name(const std::string& id)
inlinestaticprotectedinherited
Here is the call graph for this function:

◆ operator const os_event()

template<::HANDLE invalid_t= INVALID_HANDLE_VALUE>
dx::resource<invalid_t>::operator const os_event() const
inlinenoexceptinherited

◆ operator os_event()

template<::HANDLE invalid_t= INVALID_HANDLE_VALUE>
dx::resource<invalid_t>::operator os_event()
inlinenoexceptinherited

◆ operator ::HANDLE()

template<::HANDLE invalid_t= INVALID_HANDLE_VALUE>
dx::resource<invalid_t>::operator ::HANDLE() const
inlinenoexceptinherited
Here is the caller graph for this function:

◆ receive()

const message* dx::service::platform::pipe::receive(std::stop_token& stop_token)
inlineprotectednoexceptinherited

the next message whole, its sizes checked - none where the pipe ended, stops or carried no message

Here is the call graph for this function:

◆ run() [1/2]

void dx::service::platform::connection::run()
inline

the service's first answer: the status follows

Here is the caller graph for this function:

◆ run() [2/2]

void dx::service::platform::connection::run()
inline

the read thread started, its first connection tried: a round trip goes where it succeeded

Here is the call graph for this function:

◆ send()

void dx::service::platform::pipe::send(const std::vector<uint8_t>& message)
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait()

std::optional<::DWORD> dx::service::platform::pipe::wait(::OVERLAPPED& overlapped, std::stop_token& stop_token)
inlineprotectednoexceptinherited

an overlapped operation's end, waited for against the stop token: its size, or none where it failed or stops

Here is the caller graph for this function:

Member Data Documentation

◆ broadcast

listen<std::function<void()>> dx::service::platform::connection::broadcast

the service's signal: whatever of it is mirrored reads itself back

◆ handle

template<::HANDLE invalid_t= INVALID_HANDLE_VALUE>
::HANDLE dx::resource<invalid_t>::handle{invalid_t}
protectedinherited

◆ process

template<::HANDLE invalid_t= INVALID_HANDLE_VALUE>
::HANDLE dx::resource<invalid_t>::process{::GetCurrentProcess()}
protectedinherited

◆ status

promoted<os_result> dx::service::platform::connection::status{driver_not_connected}

ok while the service answers


The documentation for this class was generated from the following files: