-
- All Implemented Interfaces:
-
org.ice4j.ice.harvest.CandidateHarvester
public class TcpHarvester extends AbstractTcpListener implements CandidateHarvester
An implementation of AbstractTcpListener which acts as a CandidateHarvester. Sessions are accepted if their ufrag matches a Component registered with this harvester, and the known addresses of AbstractTcpListener are added as local host candidates (with type "tcp" and tcptype "passive") when harvesting.
-
-
Field Summary
Fields Modifier and Type Field Description private HarvestStatisticsharvestStatistics
-
Constructor Summary
Constructors Constructor Description TcpHarvester(int port)Initializes a new TcpHarvester, which is to listen on port number port on all IP addresses on all available interfaces. TcpHarvester(int port, boolean ssltcp)Initializes a new TcpHarvester, which is to listen on port number port on all IP addresses on all available interfaces. TcpHarvester(int port, List<NetworkInterface> interfaces, boolean ssltcp)Initializes a new TcpHarvester, which is to listen on port number port on all the IP addresses on the specified NetworkInterfaces. TcpHarvester(List<TransportAddress> transportAddresses)Initializes a new TcpHarvester, which is to listen on the specified list of TransportAddresses. TcpHarvester(List<TransportAddress> transportAddresses, boolean ssltcp)Initializes a new TcpHarvester, which is to listen on the specified list of TransportAddresses.
-
Method Summary
Modifier and Type Method Description HarvestStatisticsgetHarvestStatistics()Returns the statistics describing how well the various harvests of this harvester went. voidaddMappedAddress(InetAddress publicAddress, InetAddress localAddress)Adds a mapping between publicAddress and localAddress. voidaddMappedPort(int port)Adds port as an additional port. Collection<LocalCandidate>harvest(Component component)Gathers all candidate addresses of the type that this CandidateHarvester supports. booleanisHostHarvester()Returns true if this CandidateHarvester is to be considered a harvester for host candidates. -
-
Constructor Detail
-
TcpHarvester
TcpHarvester(int port)
Initializes a new TcpHarvester, which is to listen on port number port on all IP addresses on all available interfaces.- Parameters:
port- the port to listen on.
-
TcpHarvester
TcpHarvester(int port, boolean ssltcp)
Initializes a new TcpHarvester, which is to listen on port number port on all IP addresses on all available interfaces.- Parameters:
port- the port to listen on.ssltcp- true to use ssltcp; otherwise, false
-
TcpHarvester
TcpHarvester(int port, List<NetworkInterface> interfaces, boolean ssltcp)
Initializes a new TcpHarvester, which is to listen on port number port on all the IP addresses on the specified NetworkInterfaces.- Parameters:
port- the port to listen on.interfaces- the interfaces to listen on.ssltcp- true to use ssltcp; otherwise, false
-
TcpHarvester
TcpHarvester(List<TransportAddress> transportAddresses)
Initializes a new TcpHarvester, which is to listen on the specified list of TransportAddresses.- Parameters:
transportAddresses- the transport addresses to listen on.
-
TcpHarvester
TcpHarvester(List<TransportAddress> transportAddresses, boolean ssltcp)
Initializes a new TcpHarvester, which is to listen on the specified list of TransportAddresses.- Parameters:
transportAddresses- the transport addresses to listen on.ssltcp- true to use ssltcp; otherwise, false
-
-
Method Detail
-
getHarvestStatistics
HarvestStatistics getHarvestStatistics()
Returns the statistics describing how well the various harvests of this harvester went.
-
addMappedAddress
void addMappedAddress(InetAddress publicAddress, InetAddress localAddress)
Adds a mapping between publicAddress and localAddress. This means that on harvest, along with any host candidates that have publicAddress, a server reflexive candidate will be added (with the same port as the host candidate).
- Parameters:
publicAddress- the public address.localAddress- the local address.
-
addMappedPort
void addMappedPort(int port)
Adds port as an additional port. When harvesting, additional server reflexive candidates will be added with this port.
- Parameters:
port- the port to add.
-
harvest
Collection<LocalCandidate> harvest(Component component)
Gathers all candidate addresses of the type that this CandidateHarvester supports. The gathered candidate addresses are to be added by this CandidateHarvester to the specified Component using Component#addLocalCandidate(LocalCandidate) as soon as they are discovered. Saves a (weak) reference to Component, so that it can be notified if/when a socket for one of it LocalCandidates is accepted.
The method does not perform any network operations and should return quickly.
-
isHostHarvester
boolean isHostHarvester()
Returns true if this CandidateHarvester is to be considered a harvester for host candidates. Such a harvester should 1. Create local candidates of type HOST_CANDIDATE. 2. Not depend on other local candidates, already harvested for the component for which it is called. 3. Not perform blocking operations while harvesting.
-
-
-
-