- All Implemented Interfaces:
Comparable<Target>
address/prefix,
protocol, and optional port range.
Each Service may have multiple targets, but all targets will be
within its IPv4 destination and
IPv6 destination.
A ServiceSet goes beyond the single-destination limits of Service
and allows any arbitrary set of targets.
We choose the name "target" as it is the primary new concept and purpose of this API and is otherwise not used in standard firewalld service terminology.
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorsConstructorDescriptionTarget(InetAddressPrefix destination, IPortRange portRange) Creates a new target.Target(InetAddressPrefix destination, Protocol protocol) Creates a new target. -
Method Summary
Modifier and TypeMethodDescriptionCombines this target with the given target if possible.intOrdered by destination, portRange, protocol; those with port ranges before those that are protocol-only.booleanGets the destination network range for this target.Gets the optional port range for this target.Gets the protocol for this target.inthashCode()toString()
-
Constructor Details
-
Target
Creates a new target.- Parameters:
destination- The destination isnormalized
-
Target
Creates a new target.- Parameters:
destination- The destination isnormalized
-
-
Method Details
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
Ordered by destination, portRange, protocol; those with port ranges before those that are protocol-only.- Specified by:
compareToin interfaceComparable<Target>- See Also:
-
getDestination
Gets the destination network range for this target.- Returns:
- The
normalizeddestination
-
getProtocol
Gets the protocol for this target. -
getPortRange
Gets the optional port range for this target. -
coalesce
Combines this target with the given target if possible.If have the same destination, tries to combine by protocol and port range. If have the same protocol and port range, tries to combine by destination network prefixes.
When combining by protocol and port range, a target with no port range matches all ports on that protocol.
- Returns:
- The new target that represents the union of this and the other target or
nullwhen they cannot be combined.
-
