|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Synchronous UDP transport used by PROFINET DCE/RPC. More...
#include <rpcTransport.h>
Inheritance diagram for profinet::rpc::RpcTransport:
Collaboration diagram for profinet::rpc::RpcTransport:Public Member Functions | |
| RpcTransport (asio::io_context &ioContext) | |
| Create a transport using the supplied Asio execution context. | |
| void | Open (const std::string &address, std::uint16_t port, bool isListener=false) |
| Open the UDP socket and configure the remote endpoint. | |
| Bytes | Receive (std::chrono::milliseconds timeout, asio::ip::udp::endpoint &remoteEndpoint) |
| Wait for an incoming UDP datagram and capture the sender's endpoint. | |
| void | SendTo (const Bytes &data, const asio::ip::udp::endpoint &targetEndpoint) |
| Send a UDP datagram to a specific remote endpoint. | |
| Bytes | SendReceive (const Bytes &data, std::chrono::milliseconds timeout) override |
| Send a UDP datagram and wait for one response. | |
| void | Send (const Bytes &data) override |
| Send a UDP datagram without waiting for a response. | |
| void | Close () noexcept |
| Close the UDP socket. | |
| bool | IsOpen () const noexcept |
| Check whether the socket is open. | |
Public Member Functions inherited from profinet::rpc::IRpcTransport | |
| virtual | ~IRpcTransport ()=default |
Private Attributes | |
| asio::io_context & | ioContext |
| asio::ip::udp::socket | socket |
| asio::ip::udp::endpoint | endpoint |
Synchronous UDP transport used by PROFINET DCE/RPC.
Definition at line 17 of file rpcTransport.h.
|
explicit |
Create a transport using the supplied Asio execution context.
| ioContext | Asio execution context. |
Definition at line 22 of file rpcTransport.cpp.
|
noexcept |
|
noexcept |
Check whether the socket is open.
Definition at line 346 of file rpcTransport.cpp.
References socket.
| void profinet::rpc::RpcTransport::Open | ( | const std::string & | address, |
| std::uint16_t | port, | ||
| bool | isListener = false |
||
| ) |
Open the UDP socket and configure the remote endpoint.
| address | Remote IPv4 address. |
| port | Remote UDP port. |
| isListener | ... |
Definition at line 27 of file rpcTransport.cpp.
References endpoint, and socket.
Referenced by profinet::rpc::EpmLookup().
Here is the caller graph for this function:| Bytes profinet::rpc::RpcTransport::Receive | ( | std::chrono::milliseconds | timeout, |
| asio::ip::udp::endpoint & | remoteEndpoint | ||
| ) |
Wait for an incoming UDP datagram and capture the sender's endpoint.
| timeout | Maximum wait time. | |
| [out] | remoteEndpoint | Receives the endpoint details of the sender. |
Definition at line 105 of file rpcTransport.cpp.
References ioContext, profinet::RECEIVE_BUFFER_LENGTH, and socket.
|
overridevirtual |
Send a UDP datagram without waiting for a response.
| data | Datagram to send. |
Implements profinet::rpc::IRpcTransport.
Definition at line 310 of file rpcTransport.cpp.
|
overridevirtual |
Send a UDP datagram and wait for one response.
| data | Datagram to send. |
| timeout | Maximum response wait time. |
| std::system_error | on transport failure. |
| RPCTimeoutError | when the timeout expires. |
Implements profinet::rpc::IRpcTransport.
Definition at line 210 of file rpcTransport.cpp.
References endpoint, ioContext, profinet::RECEIVE_BUFFER_LENGTH, and socket.
Referenced by profinet::rpc::EpmLookup().
Here is the caller graph for this function:| void profinet::rpc::RpcTransport::SendTo | ( | const Bytes & | data, |
| const asio::ip::udp::endpoint & | targetEndpoint | ||
| ) |
Send a UDP datagram to a specific remote endpoint.
| data | Datagram to send. |
| targetEndpoint | Destination UDP endpoint. |
Definition at line 183 of file rpcTransport.cpp.
References socket.
|
private |
Definition at line 70 of file rpcTransport.h.
Referenced by Open(), Send(), and SendReceive().
|
private |
Definition at line 68 of file rpcTransport.h.
Referenced by Receive(), and SendReceive().
|
private |
Definition at line 69 of file rpcTransport.h.
Referenced by Close(), IsOpen(), Open(), Receive(), Send(), SendReceive(), and SendTo().