#include <OnixS/CME/MDH/testing/MulticastSender.h>
Public Member Functions | |
| MulticastTarget (NetFeedType::Enum target, const FeedSettings &feedSettings=generateFeedSettings(), Messaging::TimeSpan arbitrageDelay=Messaging::TimeSpan{}, ReplayDelayer &delayPolicy=CombinedReplayDelayer::service(), const MulticastTargetOptions &options=MulticastTargetOptions{}) | |
| ~MulticastTarget () | |
| Threading::Event | send (const void *data, size_t dataSize) |
| Threading::Event | send (ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> | |
| Threading::Event | send (const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> | |
| Threading::Event | send (Collection &&spans) |
| template<size_t N> | |
| Threading::Event | send (const ByteSpan(&spans)[N]) |
| void | sendA (const void *data, size_t dataSize) |
| void | sendA (ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> | |
| void | sendA (const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> | |
| void | sendA (Collection &&spans) |
| template<size_t N> | |
| void | sendA (const ByteSpan(&spans)[N]) |
| void | sendB (const void *data, size_t dataSize) |
| void | sendB (ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> | |
| void | sendB (const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> | |
| void | sendB (Collection &&spans) |
| template<size_t N> | |
| void | sendB (const ByteSpan(&spans)[N]) |
| void | sendPrimary (const void *data, size_t dataSize) |
| void | sendPrimary (ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> | |
| void | sendPrimary (const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> | |
| void | sendPrimary (Collection &&spans) |
| template<size_t N> | |
| void | sendPrimary (const ByteSpan(&spans)[N]) |
| void | sendSecondary (const void *data, size_t dataSize) |
| void | sendSecondary (ByteSpan span) |
| template<class Span, EnableIfByteSpan< Span > = 0> | |
| void | sendSecondary (const Span spans[], size_t spansCount) |
| template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0> | |
| void | sendSecondary (Collection &&spans) |
| template<size_t N> | |
| void | sendSecondary (const ByteSpan(&spans)[N]) |
| NetFeedRole::Enum | primaryFeed () const noexcept |
| NetFeedRole::Enum | secondaryFeed () const noexcept |
| bool | hasSecondary () const noexcept |
| MulticastTarget (const MulticastTarget &)=delete | |
| MulticastTarget & | operator= (const MulticastTarget &)=delete |
Static Public Attributes | |
| static constexpr PacketSize | DefaultMaxPacketSize = 1420 |
| static constexpr size_t | MaxSpansCount = 16 |
Definition at line 80 of file MulticastSender.h.
|
explicit |
Initializes the target for one network feed type.
| target | Feed type whose multicast connection settings are used. |
| feedSettings | Feed settings containing the target's layout, endpoints, network interfaces, and packet size limit. |
| arbitrageDelay | Delay applied before sending to the secondary feed when both feeds are configured. |
| delayPolicy | Policy used to implement an asynchronous secondary-feed delay. The referenced object must outlive this multicast target. |
| options | Multicast socket options applied to each configured feed. |
| 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. |
| ~MulticastTarget | ( | ) |
Leaves joined multicast groups and releases owned multicast clients.
|
delete |
|
noexcept |
Indicates whether the configured layout has a secondary feed.
|
delete |
|
noexcept |
Returns the feed role used as the primary feed.
|
noexcept |
Returns the feed role used as the secondary feed.
| Threading::Event send | ( | ByteSpan | span | ) |
Sends a byte view as a datagram to the configured multicast feeds.
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().
| span | Read-only view of the datagram payload. |
| std::runtime_error | If span is nonempty with null data, the payload exceeds this target's packet size limit, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
|
inline |
Sends a contiguous collection of byte views as one datagram.
The collection must expose data() returning exactly ByteSpan* or const ByteSpan* and size() returning a non-boolean integral type. The collection and its referenced bytes are consumed or copied before this method returns and need not remain valid while the returned event is pending. The supplied bytes are concatenated without constructing a packet header.
| Collection | Contiguous collection of ByteSpan objects. |
| 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. |
| 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, 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 202 of file MulticastSender.h.
|
inline |
Sends a fixed-size sequence of byte views as one datagram to the configured feeds.
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
| spans | Views concatenated into the datagram. |
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
Definition at line 218 of file MulticastSender.h.
|
inline |
Sends multiple byte views as one datagram to the configured multicast feeds.
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().
| Span | Byte view type; constrained to ByteSpan. |
| spans | Views concatenated into the datagram. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
| 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, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
Definition at line 175 of file MulticastSender.h.
| Threading::Event send | ( | const void * | data, |
| size_t | dataSize ) |
Sends a datagram to the primary feed and sends to the secondary feed when it is configured.
When the secondary feed is sent asynchronously, the returned future becomes ready after the queued secondary send completes. Otherwise, the returned future is already ready after this method returns. 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().
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, the asynchronous secondary-send queue is saturated, or a synchronous UDP send fails. |
| void sendA | ( | ByteSpan | span | ) |
Sends a byte view as a datagram to feed A when feed A is configured.
| span | Read-only view of the datagram payload. Its storage must remain valid for the duration of this call. |
| std::runtime_error | If span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails. |
|
inline |
Sends a contiguous collection of byte views as one datagram to feed A.
| Collection | Contiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type. |
| spans | Collection whose size, span descriptors, and referenced bytes must remain valid and unchanged for this call. A null data pointer is permitted for size zero. The bytes are concatenated without constructing a packet header. |
| 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, or the UDP send fails. |
| Any | exception thrown by the collection's size() or data() accessor. |
Definition at line 269 of file MulticastSender.h.
|
inline |
Sends a fixed-size sequence of byte views as one datagram to feed A.
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size, or if the UDP send fails. |
Definition at line 283 of file MulticastSender.h.
|
inline |
Sends multiple byte views as one datagram to feed A when configured.
| Span | Byte view type; constrained to ByteSpan. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
| 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, or if the UDP send fails. |
Definition at line 252 of file MulticastSender.h.
| void sendA | ( | const void * | data, |
| size_t | dataSize ) |
Sends a datagram to feed A when feed A is configured.
UDP transmission is synchronous, so a send failure is thrown directly.
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails. |
| void sendB | ( | ByteSpan | span | ) |
Sends a byte view as a datagram to feed B when feed B is configured.
| span | Read-only view of the datagram payload. Its storage must remain valid for the duration of this call. |
| std::runtime_error | If span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails. |
|
inline |
Sends a contiguous collection of byte views as one datagram to feed B.
| Collection | Contiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type. |
| spans | Collection whose size, span descriptors, and referenced bytes must remain valid and unchanged for this call. A null data pointer is permitted for size zero. The bytes are concatenated without constructing a packet header. |
| 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, or the UDP send fails. |
| Any | exception thrown by the collection's size() or data() accessor. |
Definition at line 334 of file MulticastSender.h.
|
inline |
Sends a fixed-size sequence of byte views as one datagram to feed B.
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size, or if the UDP send fails. |
Definition at line 348 of file MulticastSender.h.
|
inline |
Sends multiple byte views as one datagram to feed B when configured.
| Span | Byte view type; constrained to ByteSpan. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
| 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, or if the UDP send fails. |
Definition at line 317 of file MulticastSender.h.
| void sendB | ( | const void * | data, |
| size_t | dataSize ) |
Sends a datagram to feed B when feed B is configured.
UDP transmission is synchronous, so a send failure is thrown directly.
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails. |
| void sendPrimary | ( | ByteSpan | span | ) |
Sends a byte view as a datagram to the primary feed.
| span | Read-only view of the datagram payload. Its storage must remain valid for the duration of this call. |
| std::runtime_error | If span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails. |
|
inline |
Sends a contiguous collection of byte views as one datagram to the primary feed.
| Collection | Contiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type. |
| spans | Collection whose size, span descriptors, and referenced bytes must remain valid and unchanged for this call. A null data pointer is permitted for size zero. The bytes are concatenated without constructing a packet header. |
| 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, or the UDP send fails. |
| Any | exception thrown by the collection's size() or data() accessor. |
Definition at line 399 of file MulticastSender.h.
|
inline |
Sends a fixed-size sequence of byte views as one datagram to the primary feed.
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size, or if the UDP send fails. |
Definition at line 413 of file MulticastSender.h.
|
inline |
Sends multiple byte views as one datagram to the primary feed.
| Span | Byte view type; constrained to ByteSpan. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
| 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, or if the UDP send fails. |
Definition at line 382 of file MulticastSender.h.
| void sendPrimary | ( | const void * | data, |
| size_t | dataSize ) |
Sends a datagram to the primary feed.
UDP transmission is synchronous, so a send failure is thrown directly.
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails. |
| void sendSecondary | ( | ByteSpan | span | ) |
Sends a byte view immediately to the secondary feed when it is configured.
| span | Read-only view of the datagram payload. Its storage must remain valid for the duration of this call. |
| std::runtime_error | If span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails. |
|
inline |
Sends a contiguous collection of byte views as one datagram to the secondary feed.
| Collection | Contiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type. |
| spans | Collection whose size, span descriptors, and referenced bytes must remain valid and unchanged for this call. A null data pointer is permitted for size zero. The bytes are concatenated without constructing a packet header. |
| 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, or the UDP send fails. |
| Any | exception thrown by the collection's size() or data() accessor. |
Definition at line 464 of file MulticastSender.h.
|
inline |
Sends a fixed-size sequence of byte views as one datagram to the secondary feed.
| N | Number of views. Compilation fails when N exceeds MaxSpansCount. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| std::runtime_error | If a nonempty span has null data, the sum of all span sizes exceeds the configured packet size, or if the UDP send fails. |
Definition at line 478 of file MulticastSender.h.
|
inline |
Sends multiple byte views as one datagram to the secondary feed when configured.
| Span | Byte view type; constrained to ByteSpan. |
| spans | Views concatenated into the datagram. Their storage must remain valid for the duration of this call. |
| spansCount | Number of views in spans; must not exceed MaxSpansCount. |
| 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, or if the UDP send fails. |
Definition at line 447 of file MulticastSender.h.
| void sendSecondary | ( | const void * | data, |
| size_t | dataSize ) |
Sends a datagram immediately to the secondary feed when it is configured.
UDP transmission is synchronous, so a send failure is thrown directly.
| data | Pointer to the datagram payload. |
| dataSize | Payload size in bytes. |
| std::runtime_error | If data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails. |
|
staticconstexpr |
Packet-size value matching the default feed settings.
Definition at line 86 of file MulticastSender.h.
|
staticconstexpr |
Maximum number of byte spans accepted by a gather send.
Definition at line 89 of file MulticastSender.h.