Class used to test the unix asynchronous stream socket API.
More...
|
| void | SetUp () override |
| | Sets up the test fixture.
|
| |
| void | TearDown () override |
| | Tears down the test fixture.
|
| |
|
| static void | TearDownTestSuite () |
| | Tears down the test suite.
|
| |
| static UnixStream::AsyncSocket & | peer () |
| | get the socket accepted by the echo server.
|
| |
| static void | onEchoRead (const std::error_code &ec, const char *data, size_t size, bool more) |
| | receive the data to send back.
|
| |
| static void | onEchoWrite (const std::error_code &ec, size_t size) |
| | send back the data received by the echo server.
|
| |
| static void | onEchoAccept (UnixStream::Socket &&sock, const std::error_code &ec, bool more) |
| | adopt the socket accepted by the echo server.
|
| |
| static void | onWrite (const std::error_code &ec, size_t size) |
| | handler resubmitting a write from within itself.
|
| |
| static void | onConnect (const std::error_code &ec) |
| | handler retrying the connection 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 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 | onReportWait (const std::error_code &ec, bool more) |
| | report a wait completion to the test thread.
|
| |
|
| UnixStream::AsyncAcceptor | _server |
| | echo server.
|
| |
|
| 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 bool | _more = false |
| | last reported multishot state.
|
| |
| static char | _echobuf [1024] = {} |
| | buffer used by the echo server.
|
| |
| static UnixStream::AsyncSocket * | _current = nullptr |
| | socket used by the resubmitting handler.
|
| |
| static int | _rearms = 0 |
| | number of resubmissions left to perform from the read handler.
|
| |
| static const std::string | _serverpath = "/tmp/unixasyncserver_test.sock" |
| | path.
|
| |
| static const std::string | _clientpath = "/tmp/unixasyncclient_test.sock" |
| |
| static const std::string | _stallpath = "/tmp/unixasyncstall_test.sock" |
| |
| static const std::chrono::milliseconds | _timeout {1000} |
| | timeout.
|
| |
Class used to test the unix asynchronous stream socket API.
◆ onConnect()
| static void UnixAsyncStreamSocket::onConnect |
( |
const std::error_code & | ec | ) |
|
|
inlinestaticprotected |
handler retrying the connection from within itself.
- Parameters
-
| ec | error reported by the socket. |
◆ onEchoAccept()
| static void UnixAsyncStreamSocket::onEchoAccept |
( |
UnixStream::Socket && | sock, |
|
|
const std::error_code & | ec, |
|
|
bool | more ) |
|
inlinestaticprotected |
adopt the socket accepted by the echo server.
- Parameters
-
| sock | accepted socket. |
| ec | error reported by the acceptor. |
| more | true if the acceptation stays armed. |
◆ onEchoRead()
| static void UnixAsyncStreamSocket::onEchoRead |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
receive the data to send back.
- 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. |
◆ onEchoWrite()
| static void UnixAsyncStreamSocket::onEchoWrite |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
send back the data received by the echo server.
- Parameters
-
| ec | error reported by the socket. |
| size | number of bytes written. |
◆ onRead()
| static void UnixAsyncStreamSocket::onRead |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
bool | more ) |
|
inlinestaticprotected |
handler resubmitting a read from within itself.
- 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 UnixAsyncStreamSocket::onReportMulti |
( |
const std::error_code & | ec, |
|
|
const char * | data, |
|
|
size_t | size, |
|
|
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. |
| more | true if the read stays armed. |
◆ onReportWait()
| static void UnixAsyncStreamSocket::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 UnixAsyncStreamSocket::onWrite |
( |
const std::error_code & | ec, |
|
|
size_t | size ) |
|
inlinestaticprotected |
handler resubmitting a write from within itself.
- Parameters
-
| ec | error reported by the socket. |
| size | number of bytes written. |
◆ peer()
| static UnixStream::AsyncSocket & UnixAsyncStreamSocket::peer |
( |
| ) |
|
|
inlinestaticprotected |
get the socket accepted by the echo server.
- Returns
- the socket accepted by the echo server.
◆ SetUp()
| void UnixAsyncStreamSocket::SetUp |
( |
| ) |
|
|
inlineoverrideprotected |
Sets up the test fixture.
◆ TearDown()
| void UnixAsyncStreamSocket::TearDown |
( |
| ) |
|
|
inlineoverrideprotected |
Tears down the test fixture.
◆ TearDownTestSuite()
| static void UnixAsyncStreamSocket::TearDownTestSuite |
( |
| ) |
|
|
inlinestaticprotected |
Tears down the test suite.
◆ _buf
| char UnixAsyncStreamSocket::_buf = {} |
|
staticprotected |
◆ _clientpath
| const std::string UnixAsyncStreamSocket::_clientpath = "/tmp/unixasyncclient_test.sock" |
|
staticprotected |
◆ _code
| std::error_code UnixAsyncStreamSocket::_code |
|
staticprotected |
◆ _completions
| int UnixAsyncStreamSocket::_completions = 0 |
|
staticprotected |
number of completions reported.
◆ _cond
◆ _current
| UnixStream::AsyncSocket * UnixAsyncStreamSocket::_current = nullptr |
|
staticprotected |
socket used by the resubmitting handler.
◆ _echobuf
| char UnixAsyncStreamSocket::_echobuf = {} |
|
staticprotected |
buffer used by the echo server.
◆ _more
| bool UnixAsyncStreamSocket::_more = false |
|
staticprotected |
last reported multishot state.
◆ _mut
| Mutex UnixAsyncStreamSocket::_mut |
|
staticprotected |
◆ _rearms
| int UnixAsyncStreamSocket::_rearms = 0 |
|
staticprotected |
number of resubmissions left to perform from the read handler.
◆ _server
| UnixStream::AsyncAcceptor UnixAsyncStreamSocket::_server |
|
protected |
◆ _serverpath
| const std::string UnixAsyncStreamSocket::_serverpath = "/tmp/unixasyncserver_test.sock" |
|
staticprotected |
◆ _stallpath
| const std::string UnixAsyncStreamSocket::_stallpath = "/tmp/unixasyncstall_test.sock" |
|
staticprotected |
◆ _timeout
| const std::chrono::milliseconds UnixAsyncStreamSocket::_timeout {1000} |
|
staticprotected |
◆ _transferred
| size_t UnixAsyncStreamSocket::_transferred = 0 |
|
staticprotected |
number of bytes reported by the last completion.
The documentation for this class was generated from the following file: