Package io.aeron.driver.media
Class UdpChannel
java.lang.Object
io.aeron.driver.media.UdpChannel
The media configuration for Aeron UDP channels as an instantiation of the socket addresses for a
ChannelUri.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe offset from the beginning of a payload where the reserved value begins. -
Method Summary
Modifier and TypeMethodDescriptionThe canonical form for the channel.static Stringcanonicalise(String localParamValue, InetSocketAddress localData, String remoteParamValue, InetSocketAddress remoteData) Return a string which is a canonical form of the channel suitable for use as a file or directory name and also as a method of hashing, etc.intOffset to store the channel receive timestamp in a user message.intOffset to store the channel send timestamp in a user message.Get theChannelUrifor this channel.The channel's control mode.Used for debugging to get a human-readable description of the channel.static InetSocketAddressdestinationAddress(ChannelUri uri, NameResolver nameResolver) Get the endpoint destination address from the URI.booleanChannels are considered equal if thecanonicalForm()is equal.groupTag()Group tag specified for this channel or null if not specified.booleanDoes the channel have an explicit control address as used with multi-destination-cast or not?booleanDoes the channel have an explicit endpoint address?booleanDoes the channel have group semantics (multicast or MDC).inthashCode()The hash code for thecanonicalForm().booleanHas this channel got a multicast TTL value set so thatmulticastTtl()is valid.booleanhasTag()Has the URI a tag to indicate entity relationships and iftag()is valid.booleanCheck if channel receive timestamps should be recorded.booleanCheck if channel send timestamps should be recorded.booleanDoes the channel have dynamic control mode specified.booleanDoes the channel have manual control mode specified.booleanIs the channel UDP multicast.static booleanCheck if the address pointed to by the endpoint is multicast.static booleanisMulticastEndpoint(String endpoint) Check if the endpoint is multicast.booleanIs the channel configured as multi-destination.booleanDoes the channel have response control mode specified.Local control address and port.Local data address and port.Local interface to be used by the channel.booleanmatchesTag(UdpChannel udpChannel, InetSocketAddress localAddress, InetSocketAddress remoteAddress) Does this channel have a tag match to another channel having INADDR_ANY endpoints.intMulticast TTL value.The length of the initial nak delay to be used by the LossDetector on this channel.Original URI of the channel URI.static UdpChannelParse channel URI and create aUdpChannelusing the default name resolver.static UdpChannelparse(String channelUriString, NameResolver nameResolver) Parse channel URI and create aUdpChannel.static UdpChannelparse(String channelUriString, NameResolver nameResolver, boolean isDestination) Parse channel URI and create aUdpChannel.static intparseBufferLength(ChannelUri channelUri, String paramName) Parse a buffer length for a given URI paramName with a format specified bySystemUtil.parseSize(String, String), clamping the range to 0 <= x <= Integer.MAX_VALUE.static ControlModeparseControlMode(ChannelUri channelUri) Parse the control mode from the channel URI.static LongparseOptionalDurationNs(ChannelUri channelUri, String paramName) Parses out a duration from a channel URI and caters for unit suffix information.Get theProtocolFamilyfor this channel.intGet the receiver window length used as the initial window length for congestion control.intreceiverWindowLengthOrDefault(int defaultValue) Get the receiver window length used as the initial window length for congestion control.Remote control address information.Remote data address and port.static InetSocketAddressresolve(String endpoint, String uriParamName, boolean isReResolution, NameResolver nameResolver) Resolve and endpoint into aInetSocketAddress.intGet the socket receive buffer length.intsocketRcvbufLengthOrDefault(int defaultValue) Get the socket receive buffer length.intGet the socket send buffer length.intsocketSndbufLengthOrDefault(int defaultValue) Get the socket send buffer length.longtag()Get the tag value on the channel which is only valid ifhasTag()is true.toString()ThecanonicalForm()for the channel.
-
Field Details
-
RESERVED_VALUE_MESSAGE_OFFSET
public static final int RESERVED_VALUE_MESSAGE_OFFSETThe offset from the beginning of a payload where the reserved value begins.- See Also:
-
-
Method Details
-
parse
Parse channel URI and create aUdpChannelusing the default name resolver.- Parameters:
channelUriString- to parse.- Returns:
- a new
UdpChannelas the result of parsing. - Throws:
InvalidChannelException- if an error occurs.
-
parse
Parse channel URI and create aUdpChannel.- Parameters:
channelUriString- to parse.nameResolver- to use for resolving names.- Returns:
- a new
UdpChannelas the result of parsing. - Throws:
InvalidChannelException- if an error occurs.
-
parse
public static UdpChannel parse(String channelUriString, NameResolver nameResolver, boolean isDestination) Parse channel URI and create aUdpChannel.- Parameters:
channelUriString- to parse.nameResolver- to use for resolving names.isDestination- to identify if it is a destination within a channel.- Returns:
- a new
UdpChannelas the result of parsing. - Throws:
InvalidChannelException- if an error occurs.
-
parseBufferLength
Parse a buffer length for a given URI paramName with a format specified bySystemUtil.parseSize(String, String), clamping the range to 0 <= x <= Integer.MAX_VALUE.- Parameters:
channelUri- to get the value from.paramName- key for the parameter.- Returns:
- value as an integer.
- See Also:
-
parseControlMode
Parse the control mode from the channel URI. If the value is null or unknown thenControlMode.NONEwill be used.- Parameters:
channelUri- to parse the control mode from.- Returns:
- an enum value representing the control mode.
-
parseOptionalDurationNs
Parses out a duration from a channel URI and caters for unit suffix information.- Parameters:
channelUri- to read the value fromparamName- specific field to access in the URI- Returns:
- duration in nanoseconds, null if not present
-
canonicalise
public static String canonicalise(String localParamValue, InetSocketAddress localData, String remoteParamValue, InetSocketAddress remoteData) Return a string which is a canonical form of the channel suitable for use as a file or directory name and also as a method of hashing, etc.The general format is: UDP-interface:localPort-remoteAddress:remotePort
- Parameters:
localParamValue- interface or MDC control param value or null for not set.localData- address/interface for the channel.remoteParamValue- endpoint param value or null if not set.remoteData- address for the channel.- Returns:
- canonical representation as a string.
-
remoteData
Remote data address and port.- Returns:
- remote data address and port.
-
localData
Local data address and port.- Returns:
- local data address port.
-
remoteControl
Remote control address information.- Returns:
- remote control address information.
-
localControl
Local control address and port.- Returns:
- local control address and port.
-
channelUri
Get theChannelUrifor this channel.- Returns:
- the
ChannelUrifor this channel.
-
hasMulticastTtl
public boolean hasMulticastTtl()Has this channel got a multicast TTL value set so thatmulticastTtl()is valid.- Returns:
- true if this channel is a multicast TTL set otherwise false.
-
multicastTtl
public int multicastTtl()Multicast TTL value.- Returns:
- multicast TTL value.
-
canonicalForm
The canonical form for the channel.- Returns:
- canonical form for channel.
- See Also:
-
toString
ThecanonicalForm()for the channel.- Overrides:
toStringin classObject- Returns:
- the
canonicalForm()for the channel.
-
isMulticast
public boolean isMulticast()Is the channel UDP multicast.- Returns:
- true if the channel is UDP multicast.
-
localInterface
Local interface to be used by the channel.- Returns:
NetworkInterfacefor the local interface used by the channel.
-
originalUriString
Original URI of the channel URI.- Returns:
- the original uri string from the client.
-
protocolFamily
Get theProtocolFamilyfor this channel.- Returns:
- the
ProtocolFamilyfor this channel.
-
tag
public long tag()Get the tag value on the channel which is only valid ifhasTag()is true.- Returns:
- the tag value on the channel.
-
controlMode
The channel's control mode.- Returns:
- the control mode for the channel.
-
isManualControlMode
public boolean isManualControlMode()Does the channel have manual control mode specified.- Returns:
- does channel have manual control mode specified.
-
isDynamicControlMode
public boolean isDynamicControlMode()Does the channel have dynamic control mode specified.- Returns:
- does channel have dynamic control mode specified.
-
isResponseControlMode
public boolean isResponseControlMode()Does the channel have response control mode specified.- Returns:
- does the channel have response control mode specified.
-
hasExplicitEndpoint
public boolean hasExplicitEndpoint()Does the channel have an explicit endpoint address?- Returns:
- does channel have an explicit endpoint address or not?
-
hasExplicitControl
public boolean hasExplicitControl()Does the channel have an explicit control address as used with multi-destination-cast or not?- Returns:
- does channel have an explicit control address or not?
-
hasTag
public boolean hasTag()Has the URI a tag to indicate entity relationships and iftag()is valid.- Returns:
- true if the channel has a tag.
-
isMultiDestination
public boolean isMultiDestination()Is the channel configured as multi-destination.- Returns:
- true if the channel configured as multi-destination.
-
hasGroupSemantics
public boolean hasGroupSemantics()Does the channel have group semantics (multicast or MDC).- Returns:
- true if the channel has group semantics.
-
socketRcvbufLength
public int socketRcvbufLength()Get the socket receive buffer length.- Returns:
- socket receive buffer length or 0 if not specified.
-
socketRcvbufLengthOrDefault
public int socketRcvbufLengthOrDefault(int defaultValue) Get the socket receive buffer length.- Parameters:
defaultValue- to be used if the UdpChannel's value is 0 (unspecified).- Returns:
- socket receive buffer length or 0 if not specified.
-
socketSndbufLength
public int socketSndbufLength()Get the socket send buffer length.- Returns:
- socket send buffer length or 0 if not specified.
-
socketSndbufLengthOrDefault
public int socketSndbufLengthOrDefault(int defaultValue) Get the socket send buffer length.- Parameters:
defaultValue- to be used if the UdpChannel's value is 0 (unspecified).- Returns:
- socket send buffer length or defaultValue if not specified.
-
receiverWindowLength
public int receiverWindowLength()Get the receiver window length used as the initial window length for congestion control.- Returns:
- receiver window length or 0 if not specified.
-
receiverWindowLengthOrDefault
public int receiverWindowLengthOrDefault(int defaultValue) Get the receiver window length used as the initial window length for congestion control.- Parameters:
defaultValue- to be used if the UdpChannel's value is 0 (unspecified).- Returns:
- receiver window length or defaultValue if not specified.
-
nakDelayNs
The length of the initial nak delay to be used by the LossDetector on this channel.- Returns:
- delay in nanoseconds or null if the value is not set.
-
matchesTag
public boolean matchesTag(UdpChannel udpChannel, InetSocketAddress localAddress, InetSocketAddress remoteAddress) Does this channel have a tag match to another channel having INADDR_ANY endpoints.- Parameters:
udpChannel- to match against.localAddress- local address override to use for this channel.remoteAddress- remote address override to use for this channel.- Returns:
- true if there is a match otherwise false.
-
description
Used for debugging to get a human-readable description of the channel.- Returns:
- a human-readable description of the channel.
-
equals
Channels are considered equal if thecanonicalForm()is equal.- Overrides:
equalsin classObject- Parameters:
o- object to be compared with.- Returns:
- true if the
canonicalForm()is equal, otherwise false.
-
hashCode
public int hashCode()The hash code for thecanonicalForm().- Overrides:
hashCodein classObject- Returns:
- the hash code for the
canonicalForm().
-
destinationAddress
Get the endpoint destination address from the URI.- Parameters:
uri- to check.nameResolver- to use for resolution.- Returns:
- endpoint address for URI.
-
isMulticastDestinationAddress
Check if the address pointed to by the endpoint is multicast.- Parameters:
uri- to check.- Returns:
trueif the destination uses multicast address.- Since:
- 1.44.0
-
isMulticastEndpoint
Check if the endpoint is multicast.- Parameters:
endpoint- to check.- Returns:
trueif the destination uses multicast address.- Since:
- 1.47.0
-
resolve
public static InetSocketAddress resolve(String endpoint, String uriParamName, boolean isReResolution, NameResolver nameResolver) Resolve and endpoint into aInetSocketAddress.- Parameters:
endpoint- to resolve.uriParamName- for the resolution.isReResolution- for the resolution.nameResolver- to be used for hostname.- Returns:
- address for endpoint.
-
channelReceiveTimestampOffset
public int channelReceiveTimestampOffset()Offset to store the channel receive timestamp in a user message.- Returns:
- offset of channel receive timestamps.
-
isChannelReceiveTimestampEnabled
public boolean isChannelReceiveTimestampEnabled()Check if channel receive timestamps should be recorded.- Returns:
- true if channel receive timestamps should be collected false otherwise.
-
isChannelSendTimestampEnabled
public boolean isChannelSendTimestampEnabled()Check if channel send timestamps should be recorded.- Returns:
- true if channel send timestamps should be collected false otherwise.
-
channelSendTimestampOffset
public int channelSendTimestampOffset()Offset to store the channel send timestamp in a user message.- Returns:
- offset of channel send timestamps.
-
groupTag
Group tag specified for this channel or null if not specified.- Returns:
- group tag for the channel
-