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

#include <OnixS/CME/MDH/testing/MulticastSender.h>

Public Member Functions

 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

Static Public Member Functions

static MulticastTargetPtr constructTarget (NetFeedType::Enum target, const FeedSettings &feedSettings, Messaging::TimeSpan arbitrageDelay=Messaging::TimeSpan{}, ReplayDelayer &delayPolicy=CombinedReplayDelayer::service(), const MulticastTargetOptions &options=MulticastTargetOptions{})

Detailed Description

Definition at line 531 of file MulticastSender.h.

Constructor & Destructor Documentation

◆ MulticastSender() [1/2]

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

Initializes multicast targets from the feed settings.

Parameters
feedSettingsFeed settings that define packet size limits and multicast connection settings for each supported network feed type.
arbitrageDelayDelay applied by targets before sending to secondary feeds when both feeds are configured.
delayPolicyPolicy used to implement secondary feed delays.
optionsMulticast socket options applied to every configured target.
Exceptions
std::runtime_errorIf a target 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.

◆ ~MulticastSender()

Releases all configured multicast targets.

◆ MulticastSender() [2/2]

MulticastSender ( const MulticastSender & )
delete

Member Function Documentation

◆ constructTarget()

MulticastTargetPtr constructTarget ( NetFeedType::Enum target,
const FeedSettings & feedSettings,
Messaging::TimeSpan arbitrageDelay = Messaging::TimeSpan{},
ReplayDelayer & delayPolicy = CombinedReplayDelayer::service(),
const MulticastTargetOptions & options = MulticastTargetOptions{} )
static

Constructs a multicast target for the requested network feed type.

Parameters
targetNetwork feed type for which to construct a multicast target.
feedSettingsFeed settings containing the requested target's multicast connection settings and packet size limit.
arbitrageDelayDelay applied before sending to the secondary feed when both feeds are configured.
delayPolicyPolicy used to implement the secondary feed delay.
optionsMulticast 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_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.

◆ getTarget()

MulticastTargetPtr & getTarget ( NetFeedType::Enum target)

Returns the multicast target configured for the requested network feed type.

Parameters
targetNetwork feed type whose multicast target is requested.
Returns
Mutable pointer reference to the configured multicast target.
Exceptions
std::runtime_errorIf target is not configured.

◆ operator=()

MulticastSender & operator= ( const MulticastSender & )
delete

◆ 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
targetNetwork feed type that receives the datagram.
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 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]

template<class Collection, details::EnableIfByteSpanCollection< Collection > = 0>
Threading::Event send ( NetFeedType::Enum target,
Collection && spans )
inline

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
CollectionContiguous collection of ByteSpan objects.
Parameters
targetNetwork feed type that receives the datagram.
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, target is not configured, the asynchronous queue is saturated, or a synchronous UDP send fails.
Anyexception thrown by the collection's size() or data() accessor.

Definition at line 670 of file MulticastSender.h.

◆ send() [3/5]

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

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

Template Parameters
NNumber of views. Compilation fails when N exceeds MaxSpansCount.
Parameters
targetNetwork feed type that receives the datagram.
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 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>
Threading::Event send ( NetFeedType::Enum target,
const Span spans[],
size_t spansCount )
inline

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
SpanByte view type; constrained to ByteSpan.
Parameters
targetNetwork feed type that receives the datagram.
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 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]

Threading::Event send ( NetFeedType::Enum target,
const void * data,
size_t dataSize )

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
targetNetwork feed type that receives the datagram.
dataPointer to the datagram payload.
dataSizePayload size in bytes.
Returns
Completion event for the asynchronous part of the send operation.
Exceptions
std::runtime_errorIf 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.