![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
A network destination transport using UDP with automatic fragmentation. More...
#include <dfx-core/transports/destinations/UdpDestination.hpp>
Public Member Functions | |
| UdpDestination (Endpoint endpoint, nlohmann::json config) | |
| Constructs a UdpDestination. | |
| void | start (FdWatch::Poller &poller) override |
| Initializes the UDP socket and enables PMTUD. | |
| void | stop () noexcept override |
| Closes the socket and releases resources. | |
| bool | deliver (MessagePtr message) override |
| Delivers a message over the network. | |
| Public Member Functions inherited from dfx::Core::DestinationTransport | |
| DestinationTransport (Endpoint endpoint, nlohmann::json config) | |
| Constructs a DestinationTransport with the Role::Destination role. | |
| virtual int64_t | pendingMessageCount () const noexcept |
| Return the number of pending message in this transport or -1 if unknown. | |
| Public Member Functions inherited from dfx::Core::Transport | |
| Transport (Role role, Endpoint endpoint, nlohmann::json config) | |
| Constructs a transport instance. | |
| DFX_DISABLE_COPY_AND_MOVE (Transport) | |
| Transport is not copiable nor movable. | |
| virtual | ~Transport ()=default |
| Virtual destructor ensuring proper cleanup of derived transports. | |
| template<DerivedFromTransport T> | |
| bool | is () const noexcept |
| Check whether this transport is of a given derived type. | |
| template<DerivedFromTransport T> | |
| T & | as () noexcept |
| Cast this transport to a derived type (unchecked). | |
| template<DerivedFromTransport T> | |
| T const & | as () const noexcept |
| Cast this transport to a derived type (unchecked). | |
| Role | role () const noexcept |
| Returns the Role (Source or Destination) of this transport. | |
| bool | isSource () const noexcept |
| Returns true if this transport is a source. | |
| bool | isDestination () const noexcept |
| Returns true if this transport is a destination. | |
| Endpoint const & | endpoint () const noexcept |
| Gets the endpoint descriptor associated with this transport. | |
| Channel * | channel () const noexcept |
| Gets the channel which this transport is attached to if any. | |
| Port * | port () const noexcept |
| Gets the port associated with this transport. | |
| NodePtr | node () const noexcept |
| Gets the node associated with this transport. | |
| nlohmann::json const & | config () const noexcept |
| Gets the JSON configuration used to initialize this transport. | |
Static Public Attributes | |
| static constexpr auto | defaultMtuNetworkOverhead = 64 |
| Prepares the UDP socket and performs initial MTU discovery. | |
Additional Inherited Members | |
| Public Types inherited from dfx::Core::Transport | |
| enum class | Role { Source , Destination } |
| Defines the operational role of a transport relative to a channel. More... | |
| Protected Attributes inherited from dfx::Core::Transport | |
| Role const | _role |
| Endpoint | _endpoint |
| nlohmann::json | _config |
A network destination transport using UDP with automatic fragmentation.
UdpDestination implements a robust "Reliable-ish" UDP transport. Because UDP does not support large payloads natively without kernel fragmentation, this class utilizes the Framer to split messages into MTU-sized frames.
IP_PMTUDISC_DO to prevent kernel-level fragmentation.EMSGSIZE errors.sendmmsg and iovec to transmit multiple frames with minimal system call overhead.| dfx::Core::UdpDestination::UdpDestination | ( | Endpoint | endpoint, |
| nlohmann::json | config ) |
Constructs a UdpDestination.
| endpoint | The UDP endpoint (e.g., udp://127.0.0.1:5000). |
| config | Transport-specific JSON configuration. |
|
overridevirtual |
Delivers a message over the network.
This method performs the following:
message into a binary buffer using Packer.MessageID.mmsghdr.sendmmsg.EMSGSIZE is caught, it triggers MTU re-discovery, reframes the remaining data with the new smaller size, and retries.| message | The message to transmit. |
true if all fragments were successfully sent; false on fatal pipe errors. Implements dfx::Core::DestinationTransport.
|
overridevirtual |
Initializes the UDP socket and enables PMTUD.
Sets IP_MTU_DISCOVER to IP_PMTUDISC_DO. Fetches the initial interface MTU.
| poller | The poller instance. |
Implements dfx::Core::Transport.
|
overridevirtualnoexcept |
Closes the socket and releases resources.
Implements dfx::Core::Transport.
|
staticconstexpr |
Prepares the UDP socket and performs initial MTU discovery.