OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
MulticastTarget Class Reference

#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

Detailed Description

Definition at line 80 of file MulticastSender.h.

Constructor & Destructor Documentation

◆ MulticastTarget() [1/2]

MulticastTarget ( NetFeedType::Enum target,
const FeedSettings & feedSettings = generateFeedSettings(),
Messaging::TimeSpan arbitrageDelay = Messaging::TimeSpan{},
ReplayDelayer & delayPolicy = CombinedReplayDelayer::service(),
const MulticastTargetOptions & options = MulticastTargetOptions{} )
explicit

Initializes the target for one network feed type.

Parameters
targetFeed type whose multicast connection settings are used.
feedSettingsFeed settings containing the target's layout, endpoints, network interfaces, and packet size limit.
arbitrageDelayDelay applied before sending to the secondary feed when both feeds are configured.
delayPolicyPolicy used to implement an asynchronous secondary-feed delay. The referenced object must outlive this multicast target.
optionsMulticast socket options applied to each configured feed.
Note
A failover secondary is used only when both its group and port are configured; a partially configured optional secondary is ignored.
Exceptions
std::runtime_errorIf 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_argumentIf 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.
Anyexception thrown while creating or joining a multicast client.

◆ ~MulticastTarget()

Leaves joined multicast groups and releases owned multicast clients.

◆ MulticastTarget() [2/2]

MulticastTarget ( const MulticastTarget & )
delete

Member Function Documentation

◆ hasSecondary()

bool hasSecondary ( ) const
noexcept

Indicates whether the configured layout has a secondary feed.

◆ operator=()

MulticastTarget & operator= ( const MulticastTarget & )
delete

◆ primaryFeed()

NetFeedRole::Enum primaryFeed ( ) const
noexcept

Returns the feed role used as the primary feed.

◆ secondaryFeed()

NetFeedRole::Enum secondaryFeed ( ) const
noexcept

Returns the feed role used as the secondary feed.

◆ send() [1/5]

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().

Parameters
spanRead-only view of the datagram payload.
Returns
Completion event for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf 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.

◆ send() [2/5]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
Threading::Event send ( Collection && spans)
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.

Template Parameters
CollectionContiguous collection of ByteSpan objects.
Parameters
spansCollection 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_errorIf 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.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 202 of file MulticastSender.h.

◆ send() [3/5]

template<size_t N>
Threading::Event send ( const ByteSpan(&) spans[N])
inline

Sends a fixed-size sequence of byte views as one datagram to the configured feeds.

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
spansViews concatenated into the datagram.
Returns
Completion event for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf 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.

◆ send() [4/5]

template<class Span, EnableIfByteSpan< Span > = 0>
Threading::Event send ( const Span spans[],
size_t spansCount )
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().

Template Parameters
SpanByte view type; constrained to ByteSpan.
Parameters
spansViews concatenated into the datagram.
spansCountNumber of views in spans; must not exceed MaxSpansCount.
Returns
Completion event for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf 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.

◆ send() [5/5]

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().

Parameters
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Returns
Completion future for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf 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.

◆ sendA() [1/5]

void sendA ( ByteSpan span)

Sends a byte view as a datagram to feed A when feed A is configured.

Parameters
spanRead-only view of the datagram payload. Its storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendA() [2/5]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
void sendA ( Collection && spans)
inline

Sends a contiguous collection of byte views as one datagram to feed A.

Template Parameters
CollectionContiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type.
Parameters
spansCollection 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.
Exceptions
std::runtime_errorIf 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.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 269 of file MulticastSender.h.

◆ sendA() [3/5]

template<size_t N>
void sendA ( const ByteSpan(&) spans[N])
inline

Sends a fixed-size sequence of byte views as one datagram to feed A.

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf 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.

◆ sendA() [4/5]

template<class Span, EnableIfByteSpan< Span > = 0>
void sendA ( const Span spans[],
size_t spansCount )
inline

Sends multiple byte views as one datagram to feed A when configured.

Template Parameters
SpanByte view type; constrained to ByteSpan.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
spansCountNumber of views in spans; must not exceed MaxSpansCount.
Exceptions
std::runtime_errorIf 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.

◆ sendA() [5/5]

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.

Parameters
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Exceptions
std::runtime_errorIf data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendB() [1/5]

void sendB ( ByteSpan span)

Sends a byte view as a datagram to feed B when feed B is configured.

Parameters
spanRead-only view of the datagram payload. Its storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendB() [2/5]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
void sendB ( Collection && spans)
inline

Sends a contiguous collection of byte views as one datagram to feed B.

Template Parameters
CollectionContiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type.
Parameters
spansCollection 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.
Exceptions
std::runtime_errorIf 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.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 334 of file MulticastSender.h.

◆ sendB() [3/5]

template<size_t N>
void sendB ( const ByteSpan(&) spans[N])
inline

Sends a fixed-size sequence of byte views as one datagram to feed B.

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf 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.

◆ sendB() [4/5]

template<class Span, EnableIfByteSpan< Span > = 0>
void sendB ( const Span spans[],
size_t spansCount )
inline

Sends multiple byte views as one datagram to feed B when configured.

Template Parameters
SpanByte view type; constrained to ByteSpan.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
spansCountNumber of views in spans; must not exceed MaxSpansCount.
Exceptions
std::runtime_errorIf 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.

◆ sendB() [5/5]

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.

Parameters
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Exceptions
std::runtime_errorIf data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendPrimary() [1/5]

void sendPrimary ( ByteSpan span)

Sends a byte view as a datagram to the primary feed.

Parameters
spanRead-only view of the datagram payload. Its storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendPrimary() [2/5]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
void sendPrimary ( Collection && spans)
inline

Sends a contiguous collection of byte views as one datagram to the primary feed.

Template Parameters
CollectionContiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type.
Parameters
spansCollection 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.
Exceptions
std::runtime_errorIf 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.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 399 of file MulticastSender.h.

◆ sendPrimary() [3/5]

template<size_t N>
void sendPrimary ( const ByteSpan(&) spans[N])
inline

Sends a fixed-size sequence of byte views as one datagram to the primary feed.

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf 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.

◆ sendPrimary() [4/5]

template<class Span, EnableIfByteSpan< Span > = 0>
void sendPrimary ( const Span spans[],
size_t spansCount )
inline

Sends multiple byte views as one datagram to the primary feed.

Template Parameters
SpanByte view type; constrained to ByteSpan.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
spansCountNumber of views in spans; must not exceed MaxSpansCount.
Exceptions
std::runtime_errorIf 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.

◆ sendPrimary() [5/5]

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.

Parameters
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Exceptions
std::runtime_errorIf data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendSecondary() [1/5]

void sendSecondary ( ByteSpan span)

Sends a byte view immediately to the secondary feed when it is configured.

Parameters
spanRead-only view of the datagram payload. Its storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf span is nonempty with null data, the payload exceeds this target's packet size limit, or the UDP send fails.

◆ sendSecondary() [2/5]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
void sendSecondary ( Collection && spans)
inline

Sends a contiguous collection of byte views as one datagram to the secondary feed.

Template Parameters
CollectionContiguous collection whose data() result is exactly ByteSpan* or const ByteSpan* and whose size() result is a non-boolean integral type.
Parameters
spansCollection 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.
Exceptions
std::runtime_errorIf 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.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 464 of file MulticastSender.h.

◆ sendSecondary() [3/5]

template<size_t N>
void sendSecondary ( const ByteSpan(&) spans[N])
inline

Sends a fixed-size sequence of byte views as one datagram to the secondary feed.

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
Exceptions
std::runtime_errorIf 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.

◆ sendSecondary() [4/5]

template<class Span, EnableIfByteSpan< Span > = 0>
void sendSecondary ( const Span spans[],
size_t spansCount )
inline

Sends multiple byte views as one datagram to the secondary feed when configured.

Template Parameters
SpanByte view type; constrained to ByteSpan.
Parameters
spansViews concatenated into the datagram. Their storage must remain valid for the duration of this call.
spansCountNumber of views in spans; must not exceed MaxSpansCount.
Exceptions
std::runtime_errorIf 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.

◆ sendSecondary() [5/5]

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.

Parameters
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Exceptions
std::runtime_errorIf data is null for a nonzero dataSize, the payload exceeds this target's packet size limit, or the UDP send fails.

Member Data Documentation

◆ DefaultMaxPacketSize

PacketSize DefaultMaxPacketSize = 1420
staticconstexpr

Packet-size value matching the default feed settings.

Definition at line 86 of file MulticastSender.h.

◆ MaxSpansCount

size_t MaxSpansCount = 16
staticconstexpr

Maximum number of byte spans accepted by a gather send.

Definition at line 89 of file MulticastSender.h.