#include <OnixS/CME/MDH/testing/MulticastSender.h>
|
| | MulticastSender (const FeedSettings &feedSettings=generateFeedSettings(), Messaging::TimeSpan arbitrageDelay=Messaging::TimeSpan{}, ReplayDelayer &delayPolicy=CombinedReplayDelayer::service(), const MulticastTargetOptions &options=MulticastTargetOptions{}) |
| | ~MulticastSender () |
| Threading::Event | send (NetFeedType::Enum target, const void *data, size_t dataSize) |
| Threading::Event | send (NetFeedType::Enum target, ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> |
| Threading::Event | send (NetFeedType::Enum target, const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> |
| Threading::Event | send (NetFeedType::Enum target, Collection &&spans) |
| template<size_t N> |
| Threading::Event | send (NetFeedType::Enum target, const ByteSpan(&spans)[N]) |
| MulticastTargetPtr & | getTarget (NetFeedType::Enum target) |
| | MulticastSender (const MulticastSender &)=delete |
| MulticastSender & | operator= (const MulticastSender &)=delete |
Definition at line 531 of file MulticastSender.h.
◆ MulticastSender() [1/2]
Initializes multicast targets from the feed settings.
- Parameters
-
| feedSettings | Feed settings that define packet size limits and multicast connection settings for each supported network feed type. |
| arbitrageDelay | Delay applied by targets before sending to secondary feeds when both feeds are configured. |
| delayPolicy | Policy used to implement secondary feed delays. |
| options | Multicast socket options applied to every configured target. |
- Exceptions
-
| std::runtime_error | If a target layout is unsupported, or an effective endpoint does not contain a valid IPv4 multicast group, port, and explicit network interface. |
| std::invalid_argument | If a positive TTL is not authorized through ONIXS_CMEMDH_ALLOW_MULTICAST_EGRESS, or an outgoing destination outside 239.0.0.0/8 is not authorized through ONIXS_CMEMDH_ALLOW_ANY_MULTICAST_DESTINATION. |
| Any | exception thrown while creating or joining a multicast client. |
◆ ~MulticastSender()
Releases all configured multicast targets.
◆ MulticastSender() [2/2]
| MulticastSender |
( |
const MulticastSender & | | ) |
|
|
delete |
◆ constructTarget()
Constructs a multicast target for the requested network feed type.
- Parameters
-
| target | Network feed type for which to construct a multicast target. |
| feedSettings | Feed settings containing the requested target's multicast connection settings and packet size limit. |
| arbitrageDelay | Delay applied before sending to the secondary feed when both feeds are configured. |
| delayPolicy | Policy used to implement the secondary feed delay. |
| options | Multicast socket options applied to the constructed target. |
- Returns
- Newly constructed multicast target, or an empty pointer if neither connection for the requested feed type contains a group or port.
- Exceptions
-
| std::runtime_error | If target or its layout is unsupported, or an effective endpoint does not contain a valid IPv4 multicast group, port, and explicit network interface. |
| std::invalid_argument | If a positive TTL is not authorized through ONIXS_CMEMDH_ALLOW_MULTICAST_EGRESS, or an outgoing destination outside 239.0.0.0/8 is not authorized through ONIXS_CMEMDH_ALLOW_ANY_MULTICAST_DESTINATION. |
| Any | exception thrown while creating or joining a multicast client. |
◆ getTarget()
Returns the multicast target configured for the requested network feed type.
- Parameters
-
| target | Network feed type whose multicast target is requested. |
- Returns
- Mutable pointer reference to the configured multicast target.
- Exceptions
-
| std::runtime_error | If target is not configured. |
◆ operator=()
◆ send() [1/5]
Sends a byte view as a datagram to the requested network feed type.
The referenced bytes are consumed or copied before this method returns, so the view's storage does not need to remain valid while the returned event is pending. A synchronous UDP send failure is thrown directly. An asynchronous secondary-send failure is stored in the returned event and rethrown by Threading::Event::get().
- Parameters
-
| target | Network feed type that receives the datagram. |
| span | Read-only view of the datagram payload. |
- Returns
- Completion event for the asynchronous part of the send operation.
- Exceptions
-
| std::runtime_error | If span is nonempty with null data, the payload exceeds the configured packet size limit, target is not configured, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
◆ send() [2/5]
Sends a contiguous collection of byte views to a network feed type.
The collection must expose data() returning exactly ByteSpan* or const ByteSpan* and size() returning a non-boolean integral type. Its referenced bytes are consumed or copied before this method returns and need not remain valid while the returned event is pending. The bytes are concatenated without constructing a packet header.
- Template Parameters
-
| Collection | Contiguous collection of ByteSpan objects. |
- Parameters
-
| target | Network feed type that receives the datagram. |
| spans | Collection whose size and storage must remain unchanged for the duration of this call. A nonzero size must describe that many valid, contiguous ByteSpan objects; a null data pointer is permitted for size zero. |
- Returns
- Completion event for the asynchronous part of the send operation.
- Exceptions
-
| std::runtime_error | If the collection reports a negative size, has null descriptor storage for a nonzero size, contains a nonempty span with null data, has more than MaxSpansCount spans, the aggregate payload exceeds the configured packet size, target is not configured, the asynchronous queue is saturated, or a synchronous UDP send fails. |
| Any | exception thrown by the collection's size() or data() accessor. |
Definition at line 670 of file MulticastSender.h.
◆ send() [3/5]
Sends a fixed-size sequence of byte views as one datagram to a network feed type.
- Template Parameters
-
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
- Parameters
-
| target | Network feed type that receives the datagram. |
| spans | Views concatenated into the datagram. |
- Returns
- Completion event for the asynchronous part of the send operation.
- Exceptions
-
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size limit, target is not configured, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
Definition at line 688 of file MulticastSender.h.
◆ send() [4/5]
template<class Span, EnableIfByteSpan< Span > = 0>
Sends multiple byte views as one datagram to the requested network feed type.
The referenced bytes are consumed or copied before this method returns, so their storage does not need to remain valid while the returned event is pending. A synchronous UDP send failure is thrown directly. An asynchronous secondary-send failure is stored in the returned event and rethrown by Threading::Event::get().
- Template Parameters
-
| Span | Byte view type; constrained to ByteSpan. |
- Parameters
-
| target | Network feed type that receives the datagram. |
| spans | Views concatenated into the datagram. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
- Returns
- Completion event for the asynchronous part of the send operation.
- Exceptions
-
| std::runtime_error | If spansCount is nonzero and spans is null, if a nonempty span has null data, if spansCount is greater than MaxSpansCount, if the sum of all span sizes exceeds the configured packet size limit, target is not configured, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
Definition at line 643 of file MulticastSender.h.
◆ send() [5/5]
Sends a datagram to the requested network feed type.
A synchronous UDP send failure is thrown directly. An asynchronous secondary-send failure is stored in the returned event and rethrown by Threading::Event::get().
- Parameters
-
| target | Network feed type that receives the datagram. |
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
- Returns
- Completion event for the asynchronous part of the send operation.
- Exceptions
-
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds the configured packet size limit, target is not configured, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |