Class used to test the raw asynchronous socket API.
More...
|
| void | SetUp () override |
| | Sets up the test fixture.
|
| |
| struct | __attribute__ ((packed)) Packet |
| | Raw packet.
|
| |
|
| static void | onCompletion (const std::error_code &ec, size_t size) |
| | report a completion to the waiting test.
|
| |
| static void | onReadCompletion (const std::error_code &ec, const char *data, size_t size, bool more) |
| | report a read completion to the waiting test.
|
| |
| static void | onRead (const std::error_code &ec, const char *data, size_t size, bool more) |
| | handler resubmitting a read from within itself.
|
| |
| static void | onWrite (const std::error_code &ec, size_t size) |
| | handler resubmitting a write from within itself.
|
| |
| static void | onWriteAndClose (const std::error_code &ec, size_t size) |
| | handler closing the socket from within itself.
|
| |
| static void | onReportMulti (const std::error_code &ec, const char *data, size_t size, bool more) |
| | report a multishot completion to the waiting test.
|
| |
| static bool | wait (int expected) |
| | wait for the expected number of completions.
|
| |
| static void | onReportWait (const std::error_code &ec, bool more) |
| | report a wait completion to the test thread.
|
| |
|
| static Mutex | _mut |
| | mutex.
|
| |
| static Condition | _cond |
| | condition variable.
|
| |
| static std::error_code | _code |
| | error reported by the last completion.
|
| |
| static int | _completions = 0 |
| | number of completions reported.
|
| |
| static size_t | _transferred = 0 |
| | number of bytes reported by the last completion.
|
| |
| static Packet | _packet |
| | packet.
|
| |
| static char | _buf [2048] = {} |
| | read buffer.
|
| |
| static const std::string | _interface = "lo" |
| | interface.
|
| |
| static Raw::AsyncSocket * | _current = nullptr |
| | socket used by the resubmitting handler.
|
| |
| static bool | _more = false |
| | last reported multishot state.
|
| |
| static int | _rearms = 0 |
| | number of resubmissions left to perform from a handler.
|
| |
| static const std::chrono::milliseconds | _timeout {1000} |
| | timeout.
|
| |
Class used to test the raw asynchronous socket API.
◆ __attribute__()
| struct RawAsyncSocket::__attribute__ |
( |
(packed) | | ) |
|
|
inlineprotected |
◆ onCompletion()
| static void RawAsyncSocket::onCompletion |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
report a completion to the waiting test.
- Parameters
-
| ec | error reported by the socket. |
| size | number of bytes transferred. |
◆ onRead()
| static void RawAsyncSocket::onRead |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
handler resubmitting a read from within itself.
◆ onReadCompletion()
| static void RawAsyncSocket::onReadCompletion |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a read completion to the waiting test.
- Parameters
-
| ec | error reported by the socket. |
| data | buffer holding the data received. |
| size | number of bytes read. |
| more | true if the read stays armed. |
◆ onReportMulti()
| static void RawAsyncSocket::onReportMulti |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a multishot completion to the waiting test.
- Parameters
-
| ec | error reported by the socket. |
| data | buffer holding the data received. |
| size | number of bytes read. |
| more | true if the read stays armed. |
◆ onReportWait()
| static void RawAsyncSocket::onReportWait |
( |
const std::error_code & | ec, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a wait completion to the test thread.
- Parameters
-
| ec | error reported by the socket. |
| more | true if the wait stays armed. |
◆ onWrite()
| static void RawAsyncSocket::onWrite |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
handler resubmitting a write from within itself.
◆ onWriteAndClose()
| static void RawAsyncSocket::onWriteAndClose |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
handler closing the socket from within itself.
◆ SetUp()
| void RawAsyncSocket::SetUp |
( |
| ) |
|
|
inlineoverrideprotected |
Sets up the test fixture.
◆ SetUpTestCase()
| static void RawAsyncSocket::SetUpTestCase |
( |
| ) |
|
|
inlinestatic |
◆ wait()
| static bool RawAsyncSocket::wait |
( |
int | expected | ) |
|
|
inlinestaticprotected |
wait for the expected number of completions.
- Parameters
-
| expected | number of completions to wait for. |
- Returns
- true on success, false on timeout.
◆ _buf
| char RawAsyncSocket::_buf = {} |
|
staticprotected |
◆ _code
| std::error_code RawAsyncSocket::_code |
|
staticprotected |
error reported by the last completion.
◆ _completions
| int RawAsyncSocket::_completions = 0 |
|
staticprotected |
number of completions reported.
◆ _cond
◆ _current
| Raw::AsyncSocket * RawAsyncSocket::_current = nullptr |
|
staticprotected |
socket used by the resubmitting handler.
◆ _interface
| const std::string RawAsyncSocket::_interface = "lo" |
|
staticprotected |
◆ _more
| bool RawAsyncSocket::_more = false |
|
staticprotected |
last reported multishot state.
◆ _mut
| Mutex RawAsyncSocket::_mut |
|
staticprotected |
◆ _packet
| RawAsyncSocket::Packet RawAsyncSocket::_packet |
|
staticprotected |
◆ _rearms
| int RawAsyncSocket::_rearms = 0 |
|
staticprotected |
number of resubmissions left to perform from a handler.
◆ _timeout
| const std::chrono::milliseconds RawAsyncSocket::_timeout {1000} |
|
staticprotected |
◆ _transferred
| size_t RawAsyncSocket::_transferred = 0 |
|
staticprotected |
number of bytes reported by the last completion.
The documentation for this class was generated from the following file: