Class used to test the icmp asynchronous datagram socket API.
More...
|
| void | SetUp () override |
| | Sets up the test fixture.
|
| |
|
| static void | onReport (const std::error_code &ec, size_t size) |
| | report a completion to the test thread.
|
| |
| static void | onReportRead (const std::error_code &ec, const char *data, size_t size, bool more) |
| | report a read completion to the test thread.
|
| |
| static void | onReportFrom (const std::error_code &ec, const char *data, size_t size, const Icmp::Endpoint &from, bool more) |
| | report a read completion and the endpoint it came from to the test thread.
|
| |
| 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 bool | wait (int expected) |
| | wait for the expected number of completions.
|
| |
| static void | onReportMulti (const std::error_code &ec, const char *data, size_t size, const Icmp::Endpoint &from, bool more) |
| | report a multishot completion to the test thread.
|
| |
| static void | onReportWait (const std::error_code &ec, bool more) |
| | report a wait completion to the test thread.
|
| |
|
| static Mutex | _mut |
| | condition mutex.
|
| |
| static Condition | _cond |
| | condition variable.
|
| |
| static std::error_code | _code |
| | last reported error.
|
| |
| static int | _completions = 0 |
| | number of completions reported.
|
| |
| static size_t | _transferred = 0 |
| | number of bytes reported by the last completion.
|
| |
| static char | _buf [1024] = {} |
| | read buffer.
|
| |
| static Icmp::Endpoint | _from |
| | endpoint the last datagram was received from.
|
| |
| static bool | _more = false |
| | last reported multishot state.
|
| |
| static char | _data [sizeof(struct icmphdr)] = {} |
| | echo request sent by the tests.
|
| |
| static const std::string | _host = "127.0.0.1" |
| | host.
|
| |
| static Icmp::AsyncSocket * | _current = nullptr |
| | socket used by the resubmitting handler.
|
| |
| 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 icmp asynchronous datagram socket API.
◆ onRead()
| static void IcmpAsyncSocket::onRead |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
handler resubmitting a read from within itself.
◆ onReport()
| static void IcmpAsyncSocket::onReport |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
report a completion to the test thread.
- Parameters
-
| ec | error reported by the socket. |
| size | number of bytes transferred. |
◆ onReportFrom()
| static void IcmpAsyncSocket::onReportFrom |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
const Icmp::Endpoint & | from, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a read completion and the endpoint it came from to the test thread.
- Parameters
-
| ec | error reported by the socket. |
| data | buffer holding the data received. |
| size | number of bytes read. |
| from | endpoint the datagram was received from. |
| more | true if the read stays armed. |
◆ onReportMulti()
| static void IcmpAsyncSocket::onReportMulti |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
const Icmp::Endpoint & | from, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a multishot completion to the test thread.
- Parameters
-
| ec | error reported by the socket. |
| data | buffer holding the data received. |
| size | number of bytes read. |
| from | endpoint the datagram was received from. |
| more | true if the read stays armed. |
◆ onReportRead()
| static void IcmpAsyncSocket::onReportRead |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
report a read completion to the test thread.
- 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 IcmpAsyncSocket::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 IcmpAsyncSocket::onWrite |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
handler resubmitting a write from within itself.
◆ onWriteAndClose()
| static void IcmpAsyncSocket::onWriteAndClose |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
handler closing the socket from within itself.
◆ SetUp()
| void IcmpAsyncSocket::SetUp |
( |
| ) |
|
|
inlineoverrideprotected |
Sets up the test fixture.
◆ SetUpTestCase()
| static void IcmpAsyncSocket::SetUpTestCase |
( |
| ) |
|
|
inlinestatic |
◆ wait()
| static bool IcmpAsyncSocket::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 IcmpAsyncSocket::_buf = {} |
|
staticprotected |
◆ _code
| std::error_code IcmpAsyncSocket::_code |
|
staticprotected |
◆ _completions
| int IcmpAsyncSocket::_completions = 0 |
|
staticprotected |
number of completions reported.
◆ _cond
◆ _current
| Icmp::AsyncSocket * IcmpAsyncSocket::_current = nullptr |
|
staticprotected |
socket used by the resubmitting handler.
◆ _data
| char IcmpAsyncSocket::_data = {} |
|
staticprotected |
echo request sent by the tests.
◆ _from
| Icmp::Endpoint IcmpAsyncSocket::_from |
|
staticprotected |
endpoint the last datagram was received from.
◆ _host
| const std::string IcmpAsyncSocket::_host = "127.0.0.1" |
|
staticprotected |
◆ _more
| bool IcmpAsyncSocket::_more = false |
|
staticprotected |
last reported multishot state.
◆ _mut
| Mutex IcmpAsyncSocket::_mut |
|
staticprotected |
◆ _rearms
| int IcmpAsyncSocket::_rearms = 0 |
|
staticprotected |
number of resubmissions left to perform from a handler.
◆ _timeout
| const std::chrono::milliseconds IcmpAsyncSocket::_timeout {1000} |
|
staticprotected |
◆ _transferred
| size_t IcmpAsyncSocket::_transferred = 0 |
|
staticprotected |
number of bytes reported by the last completion.
The documentation for this class was generated from the following file: