|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Deterministic RPC transport used to test RPCCon without UDP. More...
Inheritance diagram for profinet::rpc::RpcTests::TestRpcTransport:
Collaboration diagram for profinet::rpc::RpcTests::TestRpcTransport:Public Types | |
| using | ResponseHandler = std::function< Bytes(const Bytes &)> |
Public Member Functions | |
| void | Open (const std::string &address, std::uint16_t port, bool isListener=false) override |
| Open the transport and configure the remote endpoint. | |
| Bytes | Receive (std::chrono::milliseconds, asio::ip::udp::endpoint &remoteEndpoint) override |
| Wait for an incoming byte array and capture the sender's endpoint. | |
| void | QueueIncomingDatagram (const Bytes &data) |
| Queues one incoming datagram for Receive(). | |
| void | SendTo (const Bytes &data, const asio::ip::udp::endpoint &targetEndpoint) override |
| Send a byte array of data to a specific remote Asio endpoint. | |
| Bytes | SendReceive (const Bytes &request, std::chrono::milliseconds) override |
| void | Send (const Bytes &request) override |
| void | Close () noexcept override |
| Close the transport. | |
Public Member Functions inherited from profinet::rpc::IRpcTransport | |
| virtual | ~IRpcTransport ()=default |
Public Attributes | |
| ResponseHandler | responseHandler |
| Optional callback used to generate a response from each request. | |
| std::deque< Bytes > | responses |
| Queued responses returned by SendReceive(). | |
| std::vector< Bytes > | receivedRequests |
| Requests passed to SendReceive(). | |
| std::vector< Bytes > | sentRequests |
| Requests passed to Send(). | |
| std::string | openedAddress |
| Address supplied to Open(). | |
| std::uint16_t | openedPort = 0 |
| Port supplied to Open(). | |
| bool | openedAsListener = false |
| Listener flag supplied to Open(). | |
| std::size_t | openCount = 0 |
| Number of times Open() was called. | |
| std::size_t | receiveCount = 0 |
| Number of times Receive() was called. | |
| std::size_t | sendToCount = 0 |
| Number of times SendTo() was called. | |
| std::size_t | closeCount = 0 |
| Number of times Close() was called. | |
| asio::ip::udp::endpoint | lastSendToEndpoint |
| Last endpoint supplied to SendTo(). | |
| asio::ip::udp::endpoint | receiveEndpoint |
| Last endpoint supplied by Receive(). | |
| Bytes | receiveData |
| Address supplied to Open(). | |
| std::deque< Bytes > | incomingDatagrams |
| Incoming datagrams returned by Receive() in FIFO order. | |
| std::exception_ptr | receiveException |
| Optional exception rethrown by Receive(). | |
| std::exception_ptr | sendException |
| Optional exception rethrown by Send(). | |
Deterministic RPC transport used to test RPCCon without UDP.
Definition at line 503 of file test_rpc.cpp.
| using profinet::rpc::RpcTests::TestRpcTransport::ResponseHandler = std::function<Bytes(const Bytes&)> |
Definition at line 506 of file test_rpc.cpp.
|
inlineoverridevirtualnoexcept |
Close the transport.
Implements profinet::rpc::IRpcTransport.
Definition at line 642 of file test_rpc.cpp.
References closeCount.
|
inlineoverridevirtual |
Open the transport and configure the remote endpoint.
| address | Remote IPv4 address. |
| port | Remote port. |
| isListener | Whether the transport is opened as a listener. |
Implements profinet::rpc::IRpcTransport.
Definition at line 564 of file test_rpc.cpp.
References openCount, openedAddress, openedAsListener, and openedPort.
|
inline |
Queues one incoming datagram for Receive().
| data | Datagram that will be returned by Receive(). |
Definition at line 597 of file test_rpc.cpp.
References incomingDatagrams.
Referenced by profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Wait for an incoming byte array and capture the sender's endpoint.
| timeout | Maximum wait time. |
| remoteEndpoint | Receives the endpoint details of the sender. |
Implements profinet::rpc::IRpcTransport.
Definition at line 577 of file test_rpc.cpp.
References incomingDatagrams, receiveCount, receiveData, receiveEndpoint, receiveException, and remoteEndpoint.
|
inlineoverridevirtual |
Implements profinet::rpc::IRpcTransport.
Definition at line 632 of file test_rpc.cpp.
References sendException, and sentRequests.
|
inlineoverridevirtual |
Implements profinet::rpc::IRpcTransport.
Definition at line 613 of file test_rpc.cpp.
References receivedRequests, responseHandler, and responses.
|
inlineoverridevirtual |
Send a byte array of data to a specific remote Asio endpoint.
| data | Datagram to send. |
| targetEndpoint | Destination UDP endpoint. |
Implements profinet::rpc::IRpcTransport.
Definition at line 606 of file test_rpc.cpp.
References lastSendToEndpoint, sendToCount, and sentRequests.
| std::size_t profinet::rpc::RpcTests::TestRpcTransport::closeCount = 0 |
Number of times Close() was called.
Definition at line 539 of file test_rpc.cpp.
Referenced by Close(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| std::deque<Bytes> profinet::rpc::RpcTests::TestRpcTransport::incomingDatagrams |
Incoming datagrams returned by Receive() in FIFO order.
Definition at line 551 of file test_rpc.cpp.
Referenced by QueueIncomingDatagram(), and Receive().
| asio::ip::udp::endpoint profinet::rpc::RpcTests::TestRpcTransport::lastSendToEndpoint |
Last endpoint supplied to SendTo().
Definition at line 542 of file test_rpc.cpp.
Referenced by SendTo(), and profinet::rpc::TEST_F().
| std::size_t profinet::rpc::RpcTests::TestRpcTransport::openCount = 0 |
Number of times Open() was called.
Definition at line 530 of file test_rpc.cpp.
Referenced by Open().
| std::string profinet::rpc::RpcTests::TestRpcTransport::openedAddress |
| bool profinet::rpc::RpcTests::TestRpcTransport::openedAsListener = false |
Listener flag supplied to Open().
Definition at line 527 of file test_rpc.cpp.
Referenced by Open().
| std::uint16_t profinet::rpc::RpcTests::TestRpcTransport::openedPort = 0 |
| std::size_t profinet::rpc::RpcTests::TestRpcTransport::receiveCount = 0 |
Number of times Receive() was called.
Definition at line 533 of file test_rpc.cpp.
Referenced by Receive(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| Bytes profinet::rpc::RpcTests::TestRpcTransport::receiveData |
Address supplied to Open().
Configured result returned by Receive().
Definition at line 548 of file test_rpc.cpp.
Referenced by Receive().
| std::vector<Bytes> profinet::rpc::RpcTests::TestRpcTransport::receivedRequests |
Requests passed to SendReceive().
Definition at line 515 of file test_rpc.cpp.
Referenced by SendReceive(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| asio::ip::udp::endpoint profinet::rpc::RpcTests::TestRpcTransport::receiveEndpoint |
Last endpoint supplied by Receive().
Definition at line 545 of file test_rpc.cpp.
Referenced by Receive(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| std::exception_ptr profinet::rpc::RpcTests::TestRpcTransport::receiveException |
Optional exception rethrown by Receive().
Definition at line 554 of file test_rpc.cpp.
Referenced by Receive(), and profinet::rpc::TEST_F().
| ResponseHandler profinet::rpc::RpcTests::TestRpcTransport::responseHandler |
Optional callback used to generate a response from each request.
Definition at line 509 of file test_rpc.cpp.
Referenced by SendReceive().
| std::deque<Bytes> profinet::rpc::RpcTests::TestRpcTransport::responses |
Queued responses returned by SendReceive().
Definition at line 512 of file test_rpc.cpp.
Referenced by SendReceive(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| std::exception_ptr profinet::rpc::RpcTests::TestRpcTransport::sendException |
Optional exception rethrown by Send().
Definition at line 557 of file test_rpc.cpp.
Referenced by Send(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().
| std::size_t profinet::rpc::RpcTests::TestRpcTransport::sendToCount = 0 |
Number of times SendTo() was called.
Definition at line 536 of file test_rpc.cpp.
Referenced by SendTo().
| std::vector<Bytes> profinet::rpc::RpcTests::TestRpcTransport::sentRequests |
Requests passed to Send().
Definition at line 518 of file test_rpc.cpp.
Referenced by Send(), SendTo(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), profinet::rpc::TEST_F(), and profinet::rpc::TEST_F().