Package org.openhab.core.net
Interface NetworkAddressService
- All Known Implementing Classes:
NetUtil
@NonNullByDefault
public interface NetworkAddressService
Interface that provides access to configured network addresses
- Author:
- Stefan Triller - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aNetworkAddressChangeListener
that is notified about changes.@Nullable String
Returns the user configured broadcast address, or the broadcast address of the user configured primary IPv4 if not provided@Nullable String
Returns the user configured primary IPv4 address of the systemboolean
Use IPv6.boolean
Use only one address per interface and family (IPv4 and IPv6).void
Removes aNetworkAddressChangeListener
so that it is no longer notified about changes.
-
Method Details
-
getPrimaryIpv4HostAddress
@Nullable String getPrimaryIpv4HostAddress()Returns the user configured primary IPv4 address of the system- Returns:
- IPv4 address as a String in format xxx.xxx.xxx.xxx or
null
if there is no interface or an error occurred
-
getConfiguredBroadcastAddress
@Nullable String getConfiguredBroadcastAddress()Returns the user configured broadcast address, or the broadcast address of the user configured primary IPv4 if not provided- Returns:
- IPv4 broadcast address as a String in format xxx.xxx.xxx or
null
if no broadcast address is found or an error occurred
-
isUseOnlyOneAddress
boolean isUseOnlyOneAddress()Use only one address per interface and family (IPv4 and IPv6). If set listeners should bind only to one address per interface and family.- Returns:
- use only one address per interface and family
-
isUseIPv6
boolean isUseIPv6()Use IPv6. If not set, IPv6 addresses should be completely ignored by listeners.- Returns:
- use IPv6
-
addNetworkAddressChangeListener
Adds aNetworkAddressChangeListener
that is notified about changes.- Parameters:
listener
- The listener
-
removeNetworkAddressChangeListener
Removes aNetworkAddressChangeListener
so that it is no longer notified about changes.- Parameters:
listener
- The listener
-